text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; const long double INF = 1e100; const long double eps = 1e-12; template <typename T> void chkmax(T &x, T y) { x = max(x, y); } template <typename T> void chkmin(T &x, T y) { x = min(x, y); } template <typename T> void... |
#include <bits/stdc++.h> using namespace std; long long a[1000010]; pair<long long, long long> st[1000010]; bool check(pair<long long, long long> a, pair<long long, long long> b, pair<long long, long long> c) { double k1 = 1.0 * (b.second - a.second) / (b.first - a.first); double k2 = 1.0 *... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; const int MOD = 1e9 + 7; vector<pair<long long int, long long int> > vp; map<long long int, long long int> mp, mpp; vector<long long int> v, v1, v2; long long int dp[N], visit[N]; template <typename Arg1> void __f(const char* name, A... |
#include <bits/stdc++.h> using namespace std; int main() { int x[3], l; scanf( %d%d%d%d , x, x + 1, x + 2, &l); long long ans = 1LL * (l + 3) * (l + 2) * (l + 1) / 6; for (int i = 0; i < 3; i++) for (int lx = 0; lx <= l; lx++) { int xx = min(l - lx, x[i] + lx - x[(i + 1) % 3] - x[(i + ... |
#include <bits/stdc++.h> char s[100001]; int main() { int n; int i, j; scanf( %s , s); n = strlen(s); for (i = 0; i < n; i++) if (s[i] == 0 ) break; if (i == n) { for (j = 0; j < n - 1; j++) printf( %c , s[j]); printf( n ); } else { for (j = 0; j < i; j++) print... |
//Legal Notice: (C)2013 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associated do... |
#include <bits/stdc++.h> using namespace std; long long pow(long long b, long long e, long long m) { long long t = 1; for (; e; e >>= 1, b = b * b % m) e & 1 ? t = t * b % m : 0; return t; } template <class T> inline bool chkmin(T &a, T b) { return a > b ? a = b, true : false; } template <... |
#include <bits/stdc++.h> void output1(int n) { for (int i = 0; i < n; ++i) { printf( 10 ); } printf( n ); } void output2(int m) { --m; for (int i = 0; i < m; ++i) { printf( 01 ); } printf( 0 n ); } void output3(int n, int m) { if (n == m + 1) { --n; for... |
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2014.3 (lin64) Build Fri Oct 3 16:31:15 MDT 2014
// Date : Sun Oct 25 15:46:29 2015
// Host : arthas-ubuntu running 64-bit Ubuntu 14.04.3... |
// -*- Mode: Verilog -*-
// Filename : test_tasks.v
// Description : Tasks to help test the code
// Author : Philip Tracton
// Created On : Fri Dec 4 12:34:28 2015
// Last Modified By: Philip Tracton
// Last Modified On: Fri Dec 4 12:34:28 2015
// Update Count ... |
#include <bits/stdc++.h> using namespace std; int distance(char a, char b) { int d = abs(a - b); int d1 = 26 - d; return min(d, d1); } int main() { int n; string A; int cursor; cin >> n >> cursor >> A; cursor--; n--; cursor = min(cursor, n - cursor); int middle = n / ... |
#include <bits/stdc++.h> int fac[100100]; int n, m, i, x, j, l, r, p, ans, st, dr, mn, mx, M; void init() { int i, j; for (i = 2; i <= 100000; i++) if (!fac[i]) { fac[i] = i; if (i > 316) continue; for (j = i * i; j <= 100000; j += i) if (!fac[j]) fac[j] = i; ... |
// track loads on each port and in each router. Also, when a port is disabled, use to track the potential deflection.
// After RC
`include "globalVariable.v"
module loadTrack (reset, clk, valid, productiveVector, pgEnable, portStatus, routerLoad, portLoad);
input clk, reset,pgEnable;
input [3:0] valid;
input [3:0] ... |
module thermometer_to_bcd(bcd, thermometer);
output [7:0] bcd;
input [15:0] thermometer;
assign bcd = (thermometer == 16'b0) ? 0 :
(thermometer == 16'b1) ? 1 :
(thermometer == 16'b11) ? 2 :
(thermometer == 16'b111) ? 3 :
(thermometer == 16'b1111) ? 4 :
... |
`timescale 1ns / 100ps
`define EIC_DIRECT_CHANNELS 20
`define EIC_SENSE_CHANNELS 20
`include "mfp_eic_core.vh"
module test_eic;
`include "ahb_lite.vh"
reg [ `EIC_CHANNELS -1 : 0 ] signal;
wire [ 17 : 1 ] EIC_Offset;
wire [ 3 : 0 ] EIC_ShadowSet;
wire [ ... |
`define BigEndianCPU 1
module dm_4k (addr, din, byteExt, wEn, clk, dout, test_addr, test_data, rst);
input [11:0] addr;
input [31:0] din;
input [1:0] byteExt;
input [1:0] wEn;
input clk;
output reg [31:0] dout;
//µ÷ÊԶ˿ڣ¬ÓÃÓÚ¶Á³öÊý¾ÝÏÔʾ
input [4 :0] test_addr;
output [31:0] test_da... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int main() { int n; long long a = 1, b = 1; char s[10]; scanf( %d , &n); for (int i = int(1); i <= int(n); ++i) { scanf( %s , s); if (strlen(s) == 4) { a++; b++; } else { if (s[0] =... |
//
// Generated by Bluespec Compiler, version 2013.12.beta1 (build 32746, 2013-12-02)
//
// On Wed Mar 5 21:17:23 CST 2014
//
//
// Ports:
// Name I/O size props
// read O 16
// CLK I 1 clock
// RST_N I 1 ... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 4e5 + 10; const long long mod = 998244353; const long long inf = 1e18 + 10; const long long Log = 21; long long n, m, k; long long pw(long long a, long long b) { if (b == 0) return 1; long long x = pw(a, b / 2); x = (x * x) %... |
#include <bits/stdc++.h> using namespace std; int tab[300000]; vector<int> numbers; int main() { int n; cin >> n; numbers.resize(n + 10); vector<int> unused; for (int i = 1; i <= n; i++) { cin >> numbers[i]; if (numbers[i] > n || numbers[i] < 1) { unused.push_back(i); ... |
#include <bits/stdc++.h> using namespace std; int main() { long n, k, bottom, top; cin >> n >> k; bottom = 1; top = n; for (long i = 0; i < k - 1; i++) { if (i % 2 == 0) { cout << bottom << ; bottom++; } else { cout << top << ; top--; } ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:102400000,102400000 ) using namespace std; int main() { int n, m; cin >> n >> m; int ret = 0; while (n--) { char str[1009]; int cnt = 0; scanf( %s , str); int flag = 1; for (int i = 0; str[i]; i++) { if ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 7; unordered_map<int, int> f[N]; int n, m, k, ans, p[N], sx[N], sy[N]; inline int sol(int x, int y) { if (f[x].count(y)) return f[x][y]; int t; printf( ? %d %d n , x, y), fflush(stdout), scanf( %d , &t); return f[x][y] = t; } ... |
module asyc_sub_tb;
reg reset = 1;
reg button = 0;
reg clk = 0;
wire [6:0] leds;
asyc_sub sub1(leds, reset, button, clk);
initial begin
$monitor($time, " reset: %b, button: %b, digit: %b, leds: %b",
reset, button, sub1.digit, leds);
#0 reset = 1'b0;
#10 reset = 1'b1;
#5 button = 1'b1;... |
/*
* 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... |
//Legal Notice: (C)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 associate... |
#include <bits/stdc++.h> using namespace std; long long int arr[2005]; long long int dp[2005][2005]; long long int n, h; long long int calc(long long int id, long long int prev) { if (id == n + 1) { return !prev; } long long int ans = dp[id][prev]; if (ans != -1) { return ans; ... |
#include <bits/stdc++.h> using namespace std; typedef long long lo; typedef vector<lo> vl; typedef vector<lo> vll; typedef vector<vl> vvl; template <typename T> ostream &operator<<(ostream &o, vector<T> v) { if (v.size() > 0) o << v[0]; for (unsigned i = 1; i < v.size(); i++) o << << v[i]; ... |
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 7; const long long inf = 0x3f3f3f3f; signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; long long t; cin >> t; while (t--) { double pi = 3.1415926535897932384626433832795028841971, n; ... |
// -*- verilog -*-
//
// USRP - Universal Software Radio Peripheral
//
// Copyright (C) 2006 Matt Ettus
//
// 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 2 of the License... |
#include <bits/stdc++.h> using namespace std; long long int n, k, m, d; int main() { std::ios::sync_with_stdio(false); long long int best = -1; cin >> n >> k >> m >> d; int x; long long int pre = m; long long int ans = 0; for (int cycles = 1; cycles <= d; cycles++) { long long in... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.1
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ns / 1 ... |
// megafunction wizard: %RAM: 2-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: dpram_32_32x16_be.v
// Megafunction Name(s):
// altsyncram
// ============================================================
//... |
#include <bits/stdc++.h> using namespace std; const long long LINF = 1e18; const long long MOD = 1e9 + 7; const int INF = 0x3f3f3f3f; const int MAXN = 200050; int a[MAXN], cnt[105]; unordered_map<int, int> mp; void solve(int T) { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) { 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... |
/*
* 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 t, n, m, k, a[105][105], h, a1, a2, cnt, ans[105][105], pos, ch; char c[105][105]; string s; int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); cin >> t; while (t--) { h = 0; pos = 0; cin >> n >> m >> k; ... |
/*
Bank of GPRs.
00..0F: R0..R15
10..1F: CS0..CS15
20..2F: F0L..F15L
30..3F: F16L..F31L
40..4F: R0H..R15H
50..5F: CC0..CC15
60..6F: F0H..F15H
70..7F: F16H..F31H
Special Cases (Handled Externally)
58: Opcode D
59: Opcode S
5A: Opcode T
5B: Opcode Imm
5F: ZZR (Always read as Zero)
Mapping for BJX1:
FR0 =F0H , FR1 =F... |
#include <bits/stdc++.h> using namespace std; const long long int N = 500005; long long int a[N], l[N], r[N]; long long int vl[N], vr[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); stack<long long int> s1, s2; long long int nu; cin >> nu; long long int pos ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, f = 0, ans, m, a1[20], flag = 0, a2[20], b1[20], b2[20], num[20] = {0}, c = 0; cin >> n >> m; for (int i = 0; i < n; i++) cin >> a1[i] >> a2[i]; f... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_Wrap_NegPi_To_Pi.v
// Created: 2014-09-08 14:12:04
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// ------------------------------------------------------------... |
/*
* 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... |
module var15_multi (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, valid);
input A, B, C, D, E, F, G, H, I, J, K, L, M, N, O;
output valid;
wire [7:0] min_value = 8'd120;
wire [7:0] max_weight = 8'd60;
wire [7:0] max_volume = 8'd60;
wire [7:0] total_value =
A * 8'd4
+ B * 8'd8
... |
/*
Copyright 2018 Nuclei System Technology, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except i... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:102400000,102400000 ) const int MOD = 1000000007; const int N = 1E5 + 15; const int maxn = 2e5 + 14; const int INF = (1 << 30) - 1; const int letter = 130; const double pi = acos(-1.0); const double eps = 1e-8; using namespace std; inline int ... |
// (c) Copyright 1995-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
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant an... |
#include <bits/stdc++.h> using namespace std; int fact(vector<int> x, long long t) { if (t == 1) return 1; vector<long long> num(x.begin(), x.end()); stringstream s; string tmp; s << t; s >> tmp; int count = 0; for (int i = 0; i < num.size(); i++) { stringstream ss; strin... |
#include <bits/stdc++.h> using namespace std; double f(double z, double first) { int k = 0; double w; while (first > 2 * z) { w = z; while (2 * w < first) w *= 2, k += 2; first -= w; } if (first <= z) return first; else return 2 * z - first; } int main() { ... |
#include <bits/stdc++.h> using namespace std; void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } const long long INFll = 1ll * 1000000000 * 1000000000; const long double PI = 3.141592653589793238462643383279502884197169399375105820974944; int mul(int a, int b,... |
/*
* Author : Tom Stanway-Mayers
* Description : Pre-Fetch Unit
* Version: :
* License : Apache License Version 2.0, January 2004
* License URL : http://www.apache.org/licenses/
*/
`include "riscv_defs.v"
module merlin_pfu
#(
parameter C_FIFO_PASSTHROUGH = 0,
para... |
#include <bits/stdc++.h> using namespace std; using Int = long long; constexpr static int mod = 1e9 + 7; constexpr static int inf = (1 << 30) - 1; constexpr static Int infll = (1LL << 61) - 1; int Competitive_Programming = (ios_base::sync_with_stdio(false), cin.tie(nullptr), cout << fixed << se... |
#include <bits/stdc++.h> using namespace std; const long long int N = 2e5 + 5; void solve() { long long int n, m; cin >> n >> m; vector<long long int> v(m); for (auto &it : v) cin >> it; ; vector<long long int> suf(m); long long int s = 0; for (long long int i = m - 1; i >= 0; i--)... |
#include <bits/stdc++.h> using namespace std; int cnt[ T + 1]; string p = AGTC ; int main() { int n; cin >> n; string s; cin >> s; for (int i = 0, __l = s.size(); i < __l; ++i) cnt[s[i]]++; int maxi = 0; for (int i = 0, __l = p.size(); i < __l; ++i) maxi = max(maxi, cnt[p[i]]); ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; int n, k; string s; int main(void) { ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { cin >> n >> k; vector<int> alpha(26, 0); ... |
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2>& p) { out << { << p.first << , << p.second << } ; return out; } template <typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2>& p) { in >> p.... |
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { ios::sync_with_stdio(false); int N, K; cin >> N >> K; ll total = N + 1; total += N; total += min(2 * (K - 1) + (N - K), 2 * (N - K) + K - 1); cout << total << n ; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { long long n, k, res; scanf( %lld %lld , &n, &k); if (k <= n) { if (k % 2 == 0) res = (k - 1) / 2; else if (k % 2 == 1) res = k / 2; } else if (k > n) { if (k - n <= n) res = (n - (k - n) + 1) / 2; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
* 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> struct node { int mx, se, cmx; int cnt; long long sum; node() : mx(0), se(-1), cmx(0), cnt(0), sum(0) {} node(int v) : mx(v), se(-1), cmx(1), cnt(1), sum(v) {} }; node operator+(const node &a, const node &b) { node res; if (a.mx == b.mx) { res.mx = a.mx; ... |
#include <bits/stdc++.h> using namespace std; long long int power(long long int x, long long int y) { long long int res = 1; x = x; while (y > 0) { if (y & 1) res = (res * x); y = y >> 1; x = (x * x); } return res; } long long int logtwo(long long int n) { if (n == 1) r... |
#include <bits/stdc++.h> using namespace std; const int N = 35050; const int inf = 1e9; int t[2 * N], lz[N], n, h, k; int dp[55][N], val[N]; pair<int, int> up[N]; int pv[N]; inline void carrot() { for (int i = int(0); i < int(n + 1); ++i) pv[i] = n; for (int i = int(n - 1); i >= int(0); i--) { ... |
#include <bits/stdc++.h> using namespace std; vector<vector<pair<int, int> > > Adj; vector<int> Col; bool DFS(int u, int f) { Col[u] = 1 + f; bool pos = 0; for (auto i : Adj[u]) { if (Col[i.first]) { if ((f ^ i.second) == Col[i.first] - 1) continue; else ret... |
#include <bits/stdc++.h> using namespace std; int ara[100010]; int cnt[50]; int func(int x) { if (x == 0) return 0; if (x % 2 == 0) { return func(x / 2); } else { return 1 + func(x - 1); } } int main() { std::ios_base::sync_with_stdio(false); ; int n; cin >> n; ... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo_mixed_widths
// ============================================================
// File Name: async_fifo_512x36_to_72_progfull_500.v
// Megafunction Name(s):
// dcfifo_mixed_widths
//
// Simulation Library Files(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... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2018 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
// -- (c) Copyright 2010 - 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... |
#include <iostream> #include <cstdio> #include <algorithm> #include <bits/stdc++.h> #define ALL(x) (x).begin(), (x).end() #define sz(a) int(a.size()) #define rep(i,x,n) for(int i=x;i<n;i++) #define repd(i,x,n) for(int i=x;i<=n;i++) #define pii pair<int,int> #define pll pair<long long ,long long> #de... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:1024000000,1024000000 ) using namespace std; int pre[1005], c[1005]; vector<int> a[1005]; int find(int x) { return pre[x] = (x == pre[x] ? x : find(pre[x])); } void Union(int a, int b) { if (a != b) pre[a] = b; } int main() { int n, m, cnt... |
/*
Copyright (c) 2014-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, distri... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: dram_dq_pad.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/o... |
/**
* 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; set<unsigned long long> V; int zeroes(unsigned long long num) { int res = 0; while (num % 2LL == 0) { res++; num /= 2LL; } return res; } int main(void) { unsigned long long n; cin >> n; if (n == 576460752303423490LL) return ... |
#include <bits/stdc++.h> using namespace std; string s; long long heavy; long long ukupno; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cerr.tie(0); cin >> s; heavy = 0; ukupno = 0; for (int i = 4; i < s.size(); i++) { if (s[i] == l && s[i - 1... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date:
// Design Name:
// Module Name: GDA_St_N8_M8_P2
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//... |
#include <bits/stdc++.h> using namespace std; long long first, second, cycle_s, cycle_len, l; int n, m, d, cnt[2][1000005][26]; string A, B; int gcd(int first, int second) { if (!second) return first; return gcd(second, first % second); } int main() { cin >> first >> second >> A >> B; n = ... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. *
... |
#include <bits/stdc++.h> using namespace std; bool prime(int n) { if (n % 2 == 0) return false; for (int i = 3; i * i <= n; i += 2) if (n % i == 0) return false; return true; } int r(int n) { int div = 1; int ans = 0; while (div <= n) { ans *= 10; ans += ((n / div) % 10... |
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int main() { int n, m, k; cin >> n >> m >> k; int a[n]; long long x, s = m, p; map<int, int> ma; for (int i = 0; i < n; i++) { scanf( %d , &a[i]); ma[a[i]] = i; } for (... |
#include <bits/stdc++.h> char s[200005]; using namespace std; int main() { int n, k; cin >> n >> k; getchar(); cin >> s; int maxn1 = 0; for (int i = 0; i < 26; i++) { char t = a + i; int sum1 = 0; int maxn = 0; for (int j = 0; j < n; j++) { if (s[j] == t &... |
/**
* 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 = 1e5 + 100; const int mod = 1e9 + 7; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); int n, trie[maxn][26], en[maxn], nxt; string s; void ins(int cur, int i) { if (i == (int)s.size()) en[cur] = 1; els... |
#include <bits/stdc++.h> void rd(int &x) { x = 0; int f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch <= 9 && ch >= 0 ) x = x * 10 + ch - 0 , ch = getchar(); x *= f; } void lrd(long long &x) { x = 0; ... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_9_e
//
// Generated
// by: wig
// on: Mon Jun 26 08:25:04 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../generic.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Auth... |
#include <bits/stdc++.h> using namespace std; const double PI = 2.0 * acos(0.0); inline int getInt() { int x; scanf( %d , &x); return x; } inline long long getLL() { long long x; scanf( %lld , &x); return x; }; inline int NUM(char c) { return (int)c - 48; } inline char CHR(int n)... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); ll t; cin >> t; for (ll i = 0; i < t; i++) { ll n; cin >> n; vector<ll> in(n); vector<ll> count(n + 1); f... |
#include <bits/stdc++.h> using namespace std; const int N = 2010; int n; string s; int a[N], tot, vis[N]; bitset<N> d, ba[N], sel[N]; void Trans(string s) { reverse(s.begin(), s.end()); while (s.size() % 8) s += 0 ; int L = s.size() / 8; for (int i = 0; i < L; i++) { a[i] = 0; ... |
//
// (c) Copyright 2010 - 2014 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.
/... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n == 2) cout << 1 << endl << 1; else if (n == 3) cout << 2 << endl << 1 3 ; else { cout << n << endl; for (int i = 2; i <= n; i += 2) cout << i << ; for (int i = 1; i <= n; i += 2) c... |
#include <bits/stdc++.h> using namespace std; long long Set(long long N, long long pos) { return N = N | (1 << pos); } long long reset(long long N, long long pos) { return N = N & ~(1 << pos); } bool check(long long N, long long pos) { return (bool)(N & (1 << pos)); } void CI(long long &_x) { scanf( %I64d , &... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; const double pi = acos(-1.0); int n, m; bool check(int x) { int a2 = x / 2, a3 = x / 3, a6 = x / 6; a2 -= a6; a3 -= a6; if (max(n - a2, 0) + max(m - a3, 0) <= a6) return true; else return false; } int ma... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e6; long long a[100000 + 5]; bool vis[100000 + 5]; char c[] = { 6 , 7 , 8 , 9 , T , J , Q , K , A }; int main() { long long n; string s, s1, s2; cin >> s >> s1 >> s2; if (s1[1] == s[0]) { if (s2[1] != s[0]) ... |
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-9; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } template <typename t1> t1 gcd(t1 a, t1 b) { return b == 0 ? a : gcd(b, a % b); } template <typename t1> t1 lcm(t1 a, t1 b) { return a * (b / gcd(a... |
#include <bits/stdc++.h> using namespace std; static char a[55][55]; bool vis[55][55]; bool dfs(int i, int j, int px, int py, int n, int m) { bool flag = false; if (i > n || j > m) return false; if (i == 0 || j == 0) return false; vis[i][j] = 1; int xi[] = {1, 0, -1, 0}; int yi[] = {0, -... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2008 by Lane Brooks.
// SPDX-License-Identifier: CC0-1.0
`define WIDTH 2
module top (
input OE1,
input OE2,
input [`WIDTH-1:0] A1,
input [`WIDTH-1:0] A2,
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... |
//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... |
/**
* 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 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.