text stringlengths 59 71.4k |
|---|
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009, 2010 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 distribut... |
// $Id: aeMB_core.v,v 1.9 2007/11/23 14:06:41 sybreon Exp $
//
// AEMB 32'bit RISC MICROPROCESSOR CORE
//
// Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <>
//
// This file is part of AEMB.
//
// AEMB is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License... |
/**
* 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 generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.4
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ns / 1... |
// megafunction wizard: %LPM_MULT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: lpm_mult
// ============================================================
// File Name: mult30_9.v
// Megafunction Name(s):
// lpm_mult
//
// Simulation Library Files(s):
// lpm
// ================================... |
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016-2020 NUDT, Inc. All rights reserved.
////////////////////////////////////////////////////////////////////////////////
//Vendor: NUDT
//Version: 0.1
//Filename: user_mux.v
//Target Device: Altera
//Dscription: ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; int cnt = 0, val; for (int k = 0; k < n; k++) { cin >> val; cnt += val; } if (n == 1 && val == 1) cout << YES ; else if (cnt == n - 1 && n != 1) cout << YES ; else cout <... |
//
// bsg_fifo_1r1w_pseudo_large
//
// MBT 3/11/15
//
// This fifo looks like a 1R1W fifo but actually is implemented
// with a 1RW FIFO for the bulk of its storage, and has a
// small 1R1W FIFO to help decouple reads and writes that may
// conflict. This FIFO is useful for cases where reads and writes
// each individu... |
/*
* 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; vector<vector<int>> tree; int res = 0; int dfs(int node, int parent) { int left = 2; for (int child : tree[node]) { if (child == parent) { continue; } int x = dfs(child, node); if (x == 1 && left > 0) { ++res; ... |
#include <bits/stdc++.h> const long long mod = 1e9 + 7; using namespace std; const long long N = 102; const long long M = 1e4 + 2; long long dp[N][M], c[N][N], cnt[N]; signed main() { long long n, i, j, k, l, ans = 0, type = 0; cin >> n; dp[0][0] = 1; c[0][0] = 1; for (i = 1; i <= n; i++... |
// nios_mem_if_ddr2_emif_0_s0_mm_interconnect_0_avalon_st_adapter.v
// This file was auto-generated from altera_avalon_st_adapter_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 nios_mem_if_ddr2_emif_0_s0_mm_interconnect_0_avalo... |
#include <bits/stdc++.h> using namespace std; int cnt, dfn[800005], ed[800005], tot, head[800005], tr[800005 * 4], sum[800005 * 4], fuckljx, n, m, vis[800005], de[800005]; char c[800005]; vector<char> mp[800005]; struct edge { int to, next; } data[800005 * 2]; struct hh { long long x, a, b, ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, x1, x2, s = 0, x, y1 = 0, y2 = 0, sm = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> x; for (int i = 0; i < x; i++) cout << 7 << ; cout << endl; } return 0; } |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sctag_deccdp.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/... |
// file: clk_wiz.v
//
// -----------------------------------------------------------------------------
// (c) Copyright 2008-2010 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 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> int main() { unsigned long long int n, sum = 0, sum1 = 0, i, MAX = 0, temp; scanf( %llu , &n); int a[n]; for (i = 0; i < n; ++i) { scanf( %llu , &a[i]); } for (i = 0; i < n; ++i) { sum = sum + a[i]; } for (i = 0; i < n; ++i) { if (a[i] > MAX) ... |
#include <bits/stdc++.h> using namespace std; int nr, N, K, ap[100009], last_N; pair<int, int> ans[10]; struct line { int a, b, c, init; }; vector<line> v; struct point { long long a, b, c, d; bool operator==(const point &other) const { return (1LL * a * other.b == 1LL * b * other.a && ... |
////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2013, University of British Columbia (UBC); All rights reserved. //
// //
// Redistribution and use in source and binary forms, w... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 10; const int mod = 20010905; const int inf = 0x3f3f3f3f; const long long linf = 0x3f3f3f3f3f3f3f3f; long long lowbit(long long x) { return x & (-x); } long long qpow(long long a, long long b, long long c) { long long res = 1; a ... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1000000000ll; const long long inf64 = inf * inf; const long long base = inf + 7; const double pi = acos(-1.0); long long Abs(long long x) { return (x >= 0 ? x : -x); } int n; string s; int par[62 * 62], size[62 * 62], in[62 * 62], out... |
#include <bits/stdc++.h> using namespace std; const int Win = 3, Loop = 2, Lose = 1; int n, dp[7001][3], ne[3], a[7001][3], k[3], sum[7001][3]; bool b[7001][3]; inline int max(int x, int y) { return x > y ? x : y; } void dfs(int x, int y) { if (b[x][y]) return; b[x][y] = 1; int t = ne[y]; fo... |
/**
* 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 sum = 0; bool ne = 0; for (int i = 0; i < 5; i++) { int x; cin >> x; sum += x; } if (sum % 5 != 0 or sum == 0) { cout << -1 ; } else cout << sum / 5; return 0; } |
/*
main function:
1)allocate cpuid for pkt by the key
2)round robin mode & port bind mode in this module
modify:
1)add in_fpgaac_cpuid_cs, module can work when this signal is valid 0:bit:round robin 1:port bind
tips: all fifo are showahead mode
*/
`timescale 1 ps / 1 ps
module DISPATHER_CPUID(
input clk... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; int cnt[maxn][26]; int dif[26]; int getAns() { int cc = 0; for (int i = 0; i < 26; ++i) if (dif[i]) { ++cc; } return cc; } int main() { string s; cin >> s; int len = s.length(); for (int... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int a, b, c, d, i, j, n, flag = 0; cin >> a >> b >> c >> d; n = max(max(a, b), max(c, d)); flag = 1; for (i = 0; i <= n; i++) { for (j = 0; j <= n; j++) { ... |
//-----------------------------------------------------------------------------
//
// (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
... |
// A Data Channel
`include "globalVariable.v"
module dataChannel (clk, reset, inPort, counterGolden, injectGrant,winningFlitPortTag, winningFlitValid, inRouterFlitLocal,inner_wire_in1, inner_wire_in2,swap1, swap2, inner_wire_out1, inner_wire_out2,outPort);
input clk, rese... |
#include <bits/stdc++.h> int main() { long n, a, b; scanf( %ld %ld %ld , &n, &a, &b); std::vector<long> v(n, 1); long current(1), sum(1); for (long p = 1; p < n; p++) { if (b > 0) { current = sum + 1; --b; } else if ((p > 1) && (a > 0)) { ++current, --a; }... |
#include <bits/stdc++.h> int main() { char a[100010]; scanf( %s , a); long long i = 0, x = 1; while (a[i] != 0 ) { if (a[i] == 0 ) { a[i] = 2 ; x = 0; break; } i++; } if (x) { a[0] = 2 ; } i = 0; while (a[i] != 0 ) { if (... |
/**
* 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, ans = 1; long long C(long long m, long long n) { long long p = 1; for (long long i = 1; i <= n; i++) p *= i; for (long long i = 1; i <= m; i++) p /= i; for (long long i = 1; i <= n - m; i++) p /= i; return p; } signed main() { ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; const long long INFLL = 1e18 + 1; const int MAX = 200001; const long long MOD = 1000000007; const int SZ = 300100; const double PI = 3.14159265358979323846264338327; long long inq(long long k, long long q, long long mod) { if (q == 0... |
#include <bits/stdc++.h> using namespace std; long long int power(long long int a, long long int n, long long int m); long long int power(long long int a, long long int n, long long int m) { if (n == 0) return 1; long long int x = power(a, n / 2, m); if (n % 2 != 0) return (((a * x) % m) * (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; const int NO_OF_ALPHABETS = 26; vector<int> degree(NO_OF_ALPHABETS, 0); vector<int> graph[NO_OF_ALPHABETS]; vector<int> component_no(NO_OF_ALPHABETS, 0); void dfs(int v, int parent_v, int c) { component_no[v] = c; for (int i = 0; i < graph[v].size(); i++... |
#include <bits/stdc++.h> using namespace std; long long a[1000006], s[1000006]; int main() { ios_base::sync_with_stdio(false); long long n, i, j, k; string st; cin >> st; long long ln = st.size(); stack<long long> stk; for (i = 0; i < ln; i++) { if (st[i] == ( ) { stk.pu... |
/**
* 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 i, n; string st; vector<string> v; map<string, int> mp; cin >> n; for (i = 0; i < n; i++) { cin >> st; if (mp[st] == 0) { v.push_back(st); } mp[st]++; } if (v.size() == 1) cout << v[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; template <typename T1, typename T2> bool Max(T1& a, T2 b) { return a < b ? a = b, 1 : 0; } template <typename T1, typename T2> bool Min(T1& a, T2 b) { return a > b ? a = b, 1 : 0; } const int N = 1000001; bool prime[N]; vector<long long> pri; v... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 08:58:49 03/06/2017
// Design Name: FULL_ADDER
// Module Name: D:/Projects/XilinxISE/HW1/Homework1/testFULL_ADDER.v
// Project Name: Homework1
// Target Device:
//... |
// ----------------------------------------------------------------------
// 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; map<pair<string, string>, int> m, m1; vector<pair<string, string> > ans; int main() { string s1, s2; int n, t, i, d, j; scanf( %d%d , &n, &d); for (i = 1; i <= n; i++) { cin >> s1 >> s2 >> t; for (j = 0; j < ans.size(); j++) if ((... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:26:11 07/23/2010
// Design Name:
// Module Name: dac_test
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:... |
#include <bits/stdc++.h> const int maxn(505); char ans[maxn]; int main() { int n; scanf( %d , &n); int nr(1), nc(1); ans[(n - 1) * 2] = 0 ; for (int i(0); i < n - 1; ++i) { printf( ? %d %d %d %d n , nr, nc + 1, n, n); fflush(stdout); char tmp[5]; scanf( %s , tmp); ... |
#include <bits/stdc++.h> using namespace std; int N, T, L, R, X, H; unordered_map<int, int> siz; unordered_map<int, pair<int, int> > par; pair<int, int> find(int now) { if (par.count(now)) { pair<int, int> a, b; a = par[now]; b = find(a.first); return {b.first, a.second ^ b.second}... |
/*
8 bit up-down counter.
Based on code from Mojo tutorial
https://embeddedmicro.com/tutorials/mojo/pulse-width-modulation
/\ /\
/ \ / \
/ \ / \
/ \/ \
the CRT_LEN determines the period of the resulting counter
26 results in ~1s period.
*/
module counter #(parameter CTR_LEN = ... |
#include <bits/stdc++.h> const int INF = 1e9 + 1; const int MOD = 1e9 + 7; using namespace std; void solve() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i += 1) cin >> a[i]; ; sort(a.begin(), a.end()); vector<int> ans; for (int i = 0; i < n; i += 1) { for (i... |
#include <bits/stdc++.h> using namespace std; struct nodo { int v, c, i, d; nodo() {} nodo(int V, int C, int I, int D) { v = V, c = C, i = I, d = D; } }; int ans[200055], I[200055]; int n, m; void solve(vector<vector<nodo> > v) { int d[m + 5]; memset(d, -1, sizeof(d)); queue<int> Q; ... |
#include <bits/stdc++.h> using namespace std; bool compare(pair<double, int> p1, pair<double, int> p2) { return p1.first > p2.first; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, t1, t2, k; cin >> n >> t1 >> t2 >> k; vector<pair<double, int>> participan... |
//======================================================================
//
// sha256.v
// --------
// Top level wrapper for the SHA-256 hash function providing
// a simple memory like interface with 32 bit data access.
//
//
// Author: Joachim Strombergson
// Copyright (c) 2013, 201, Secworks Sweden AB
// All rights r... |
#include <bits/stdc++.h> using namespace std; struct STree { vector<int> st; int n; STree(int n) : st(4 * n + 5, 0), n(n) {} void upd(int k, int s, int e, int p, int v) { if (s + 1 == e) { st[k] = v; return; } int m = (s + e) / 2; if (p < m) upd(2 * k,... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << 0 0 << endl; string left; cin >> left; int l = 0, r = 1e9; for (int i = 1; i < n; i++) { int mid = (l + r) / 2; cout << mid << 1 << endl; string s; cin >> s; if (s == le... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.2
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
mod... |
#include <bits/stdc++.h> using namespace std; long long power(long long a, long long b) { long long result = 1; while (b > 0) { if (b % 2 == 1) { result *= a; } a *= a; b /= 2; } return result; } long long gcd(long long x, long long y) { long long r; while... |
#include <bits/stdc++.h> using namespace std; double dot(complex<double> a, complex<double> b) { return real(conj(a) * b); } double calcspeed(complex<double> p1, complex<double> p2, complex<double> w, double vmax) { complex<double> r = p2 - p1; double k = dot(r, w) + sqrt(pow(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... |
//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; constexpr int inf = 1e9 + 7; constexpr long long md = 1e6; void solve(int testi) { int n; cin >> n; if (n == 0) { cout << 1 << n ; ; return; } vector<int> digits = {6, 8, 4, 2}; cout << digits[n % digits.size()] << n ; ... |
//////////////////////////////////////////////////////////////////
////
////
//// CRCAHB CORE BLOCK
////
////
////
//// This file is part of the APB to I2C project
////
//// http://www.opencores.org/cores/apbi2c/
////
////
////
//// Description
////
//// Implementation of APB IP core according to
////
... |
/*------------------------------------------------------------------------------
Purpose
Placement test environment with CPU core.
------------------------------------------------------------------------------*/
`include "tenv_test/tenv_test.v"
`include "tenv_link.v"
`include "tenv_4ssram_wishbone.v"
module test... |
`timescale 1ns / 1ps
module WhacAMole(BCD1, BCD0, mole_position, random, mallet_position, timesup, PRESS_VALID, reset, clk_1us);
input PRESS_VALID, reset, clk_1us;
input [3:0] random;
input [3:0] mallet_position;
input timesup;
output [3:0] BCD1, BCD0;
output [4:0] mole_position;
reg [4:0] mole_po... |
#include <bits/stdc++.h> const int inf = 0xfffffff; const long long INF = 1ll << 61; using namespace std; int n, s, k; int aa[100 + 55][100 + 55]; int ans; void init() { memset(aa, 0, sizeof(aa)); } bool input() { while (scanf( %d %d %d , &n, &s, &k) == 3) { for (int i = 0; i < n; i++) ... |
`timescale 1 ns / 1 ps
module sample_generator_v1_0_S_AXIS #
(
// Users to add parameters here
// User parameters ends
// Do not modify the parameters beyond this line
// AXI4Stream sink: Data Width
parameter integer C_S_AXIS_TDATA_WIDTH = 32
)
(
// Users to add ports here
// User ports ends
//... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100000 + 10; struct TreeNode { int L, R; pair<double, double> val; } tree[maxn << 2]; int a[maxn], b[maxn], n, q; void pushUp(int root) { tree[root].val.first = tree[root << 1].val.first * tree[root << 1 | 1].val.first; t... |
#include <bits/stdc++.h> using namespace std; vector<pair<string, long long> > Name(1010); long long n; vector<vector<pair<string, long long> > > a(1010); map<string, long long> already; map<string, long long>::iterator ii; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; l... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, a, b; cin >> n >> a >> b; long long ma, mi; ma = max(a, b); mi = min(a, b); long long seated = 0; for (long long i = (long long)(0); i < (long long)(n); i++) { char t; cin >> t; while (t == . and ... |
/*
* 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 oriArr[2000001] = {0}; int arr[2000001]; int main() { int oriCnt; cin >> oriCnt; int maxOri = 0; for (int i = 0; i < oriCnt; i++) { int tmp; cin >> tmp; oriArr[tmp] = 1; if (maxOri < tmp) maxOri = tmp; } arr[0] = 0... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2012-2012 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
... |
module axis_shifter_v2 #
(
parameter integer C_PIXEL_WIDTH = 8,
parameter integer C_IMG_WBITS = 12,
parameter integer C_IMG_HBITS = 12
)
(
input wire clk,
input wire resetn,
input wire fsync,
input wire lsync,
input wire [C_IMG_WBITS-1 : 0] col_idx,
input wire [C_IMG_WBITS-1 : 0] col_idx_next,
input wire col... |
/*
Copyright (c) 2015-2018 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 1986-1999, 2001-2013 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2013.4 (lin64) Build 353583 Mon Dec 9 17:26:26 MST 2013
// Date : Thu Mar 20 14:12:08 2014
// Host : macbook running 64-bit Arc... |
/*============================================================================
This Verilog source file is part of the Berkeley HardFloat IEEE Floating-Point
Arithmetic Package, Release 1, by John R. Hauser.
Copyright 2019 The Regents of the University of California. All rights
reserved.
Redistribution an... |
#include <bits/stdc++.h> using namespace std; const int N = 8e5 + 5; struct trie { int a[26]; vector<int> val[2]; } a[N]; int vis[N][2]; char ch[800005]; int cnt, n; void insert(char ch[], int op, int k) { int u = 0; int len = strlen(ch + 1); a[u].val[op].push_back(k); for (int i... |
#include <bits/stdc++.h> using namespace std; map<int, int> uf; map<int, vector<int> > contents; map<int, int> val; void make(int a) { if (uf.find(a) == uf.end()) { uf[a] = a; contents[a].push_back(a); val[a] = 0; } } int main() { cin.sync_with_stdio(0); cin.tie(0); i... |
//
// 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)
// ... |
#include <bits/stdc++.h> using namespace std; int Length[1001], n, x, a[1001], Concern, Pos, Ppl; vector<int> Queues, adj[1001], Ans; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; cin >> n >> x; for (int i = 1; i <= n; ++i) { cin >> a[i]; if (a[i]) adj[... |
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long n; cin >> n; int a[n], b[n]; for (int i = 0; i < n; i++) cin >> a[i]; string s; cin >> s; vector<pair<long long, pair<long long, long long>>> c(n); fo... |
// ====================================================================
// Bashkiria-2M FPGA REPLICA
//
// Copyright (C) 2010 Dmitry Tselikov
//
// This core is distributed under modified BSD license.
// For complete licensing information see LICENSE.TXT.
// ----------------------------------... |
// megafunction wizard: %RAM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: cyclone4gx_pmem.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ========================... |
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> inline void smin(T &a, const U &b) { if (a > b) a = b; } template <typename T, typename U> inline void smax(T &a, const U &b) { if (a < b) a = b; } template <class T> inline void gn(T &first) { char c, sg = 0; ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; void printV(vector<int> &S) { for (int s : S) { cout << s; } cout << endl; } void solve() { int x; cin >> x; string T; cin >> T; vector<int> S; for (int i = 0; i < (int)T.size(); i++) { ... |
#include <bits/stdc++.h> using namespace std; int n, tx, ty; vector<pair<int, int> > ar; int vis[100010]; bool check(int first, int second, int x1, int y1, int x2, int y2) { if ((1LL * x2 - 1LL * x1) * 1LL * (1LL * second - 1LL * y1) == (1LL * y2 - 1LL * y1) * 1LL * (1LL * first - 1LL * x1)) ... |
/*
* 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... |
/*
Copyright (c) 2014-2018 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... |
#include <bits/stdc++.h> using namespace std; int main() { int nb; scanf( %d , &nb); int arr[nb]; for (int i = 0; i < nb; i++) scanf( %d , arr + i); sort(arr, arr + nb); int occ[3] = {0}; for (int i = 0; i < nb; i++) { for (int j = 0; j < 3; j++) if (arr[i] == arr[j]) occ[j... |
/**
* 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 2017 Google Inc.
*
* 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... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, i, a, counter = 0, ar[100000]; map<char, int> mp; mp[ 6 ] = 1, mp[ 7 ] = 2, mp[ 8 ] = 3, mp[ 9 ] = 4, mp[ T ] = 5; mp[ J ] = 6, mp[ Q ] = 7, mp[ K ] = 8, mp[ A ] = 9; string str1, str2; char trump; cin >> trump; cin... |
#include <bits/stdc++.h> const int MAX_N = (int)5e5 + 4, MAX_M = (int)1e7 + 4; const double eps = 1e-6; const int mod = (int)1e9 + 7; using namespace std; int n; int a[MAX_N]; bool pr[MAX_M]; int lp[MAX_M], mu[MAX_M]; inline void sieve() { for (int i = 2; i < MAX_M; i++) { if (pr[i]) continu... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////
//
// This file is part of Descrypt Ztex Bruteforcer
// Copyright (C) 2014 Alexey Osipov <giftsungiv3n at gmail dot com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of ... |
#include <bits/stdc++.h> using namespace std; static long long mod = 998244353; long long pow(long long x, long long y) { x = x % mod; int res = 1; while (y > 0) { if (y & 1) { res = (res * x) % mod; } y = y >> 1; x = (x * x) % mod; } return res; } long long... |
#include <bits/stdc++.h> using namespace std; const signed long long int INF = 1e9; int main() { int n; cin >> n; vector<signed long long int> a(n); for (int i(0); i < n; i++) { scanf( %lld , &a[i]); } int s, f; scanf( %d %d , &s, &f); vector<signed long long int> d(n + 1); ... |
#include <bits/stdc++.h> using namespace std; namespace IO { template <typename t> inline void read(t& x) { x = 0; bool f = 1; char ch; for (ch = getchar(); ch < 0 || 9 < ch; ch = getchar()) if (ch == - ) f ^= 1; for (; 0 <= ch && ch <= 9 ; ch = getchar()) x = (x << 3) + ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; int t; cin >> t; while (t--) { int n; cin >> n; long long move = 0; for (int i = 1; i <= n / 2; ++i) { move += i * 1ll * i; } cout << move * 8 << endl; } return 0; } |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e3 + 13; const int INF = 1e6 + 7; int t[MAXN][MAXN]; int tab[MAXN * MAXN]; bool odw[MAXN * MAXN]; int wyn[MAXN * MAXN]; bool prze[MAXN * MAXN]; int xx[4] = {0, 0, -1, 1}; int yy[4] = {-1, 1, 0, 0}; vector<int> v[MAXN * MAXN]; int ch... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.