text stringlengths 59 71.4k |
|---|
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:00:03 05/22/2014
// Design Name:
// Module Name: cpu_top
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:31:47 10/30/2016
// Design Name: Main
// Module Name: /home/fede/DatosWindows/Facultad/Arquitectura de Computadoras/WorkspaceXilinxIse/UART/UART_Arquitectura/testM... |
#include <bits/stdc++.h> using namespace std; int cnt[2][2]; string s; int main() { ios_base::sync_with_stdio(0); cin >> s; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { cnt[i][j] = 0; } } for (int i = 0; i < s.length(); i++) { cnt[i & 1][s[i] - a ]++... |
#include <bits/stdc++.h> using namespace std; const int L = 1000000 + 10; int main() { int n; scanf( %d , &n); char s[n + 10]; scanf( %s , s); int next[n + 10]; next[0] = -1; int j = 0, k = -1; int maxn = 1; while (j < n) { if (k == -1 || s[j] == s[k]) { next[++j]... |
#include <bits/stdc++.h> using namespace std; inline void boost() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } const long long maxn = 2e6 + 123; const long long inf = 1e9 + 123; const long long linf = 1e18 + 123; const long long mod = 1e9 + 7; const double eps = 1e-9; const d... |
#include <bits/stdc++.h> using namespace std; void read(int &a) { a = 0; char c = getchar(); while (c < 0 || c > 9 ) { c = getchar(); } while (c >= 0 && c <= 9 ) { a = (a << 1) + (a << 3) + (c ^ 48); c = getchar(); } } const int Maxn = 200000; struct Segment { ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.4
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
m... |
/*------------------------------------------------------------------------------
* This code was generated by Spiral Multiplier Block Generator, www.spiral.net
* Copyright (c) 2006, Carnegie Mellon University
* All rights reserved.
* The code is distributed under a BSD style license
* (see http://www.opensource.or... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cin.ignore(); string arr; getline(cin, arr); int mx = 0; int cur = 0; for (int i = 0; i < n; i++) { if (arr[i] == ) { mx = max(mx, cur); cur = 0; continue; } if (i... |
#include <bits/stdc++.h> #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast , unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; const long long inf = numeric_limits<long long>::max() / 2; const long double eps = 1e-9; co... |
#include <bits/stdc++.h> using namespace std; int l[7]; int main() { scanf( %d%d%d , &l[3], &l[4], &l[5]); double a, A, ap, r, anw = 0; for (int n = 3; n <= 5; n++) { a = acos(-1) / n; A = 1.0 * n / 4 * l[n] * l[n] / tan(a); ap = A * 2 / n / l[n]; r = ap / cos(a); anw += ... |
#include <bits/stdc++.h> using namespace std; template <class T> inline T sqr(T x) { return x * x; } const double EPS = 1e-10; const int INF = 0x3fffffff; const long long LINF = INF * 1ll * INF; const double PI = acos(-1.0); using namespace std; int sign(double x) { return x > 0 ? 1 : -1; } in... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int TESTS = 1; while (TESTS--) { long long m = 1, ans = 1; long long n; cin >> n; while (ans < n) { m++; ans += 2; } cout << m... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:05:35 06/18/2015
// Design Name:
// Module Name: gainMult
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
/... |
#include <bits/stdc++.h> using namespace std; int main() { int x, ans, sum = 0; cin >> x; x = abs(x); for (int i = 0;; i++) { sum += i; if (sum >= x && (sum - x) % 2 == 0) { ans = i; break; } } cout << ans << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; if ((int)s.size() < 26) { cout << -1; return 0; } char cur = a ; bool fg = 0; for (int i = 0; i < (int)s.size(); i++) { if (s[i] <= cur) { if (cur == z ) { s[i] = cur; ... |
#include<bits/stdc++.h> #define fort(i,a,b) for(long long i=a;i<=b;i++) #define forn(i,a,b) for(long long i=a;i>=b;i--) #define rep(i,a,b) for(long long i=a;i<b;i++) #define x first #define y second #define pb push_back #define MP make_pair using namespace std; const long long N=2e5+5; long long s... |
// File : ../RTL/slaveController/sctxportarbiter.v
// Generated : 11/10/06 05:37:24
// From : ../RTL/slaveController/sctxportarbiter.asf
// By : FSM2VHDL ver. 5.0.0.9
//////////////////////////////////////////////////////////////////////
//// ... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n; cin >> n; vector<long long> a(n), t(n); vector<pair<long long, long long> > vp; for (int i = 0; i < n; i++) { cin >> a[i]; vp.push_back({a[i], i}); } for (int i = 0; i < n; i++) cin >> t[i]; long lo... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 06:51:17 11/29/2011
// Design Name: np_core
// Module Name: C:/Hari/Study/Masters_thesis/needtosee/altera_netfpga_08_08_11/Danai_proj/xilinx _test_localram/latest_cod... |
/*
Copyright 2010 David Fritz, Brian Gordon, Wira Mulia
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
(at your option) any later version.
... |
#include <bits/stdc++.h> int inp() { char c = getchar(); while (c < 0 || c > 9 ) c = getchar(); int sum = 0; while (c >= 0 && c <= 9 ) { sum = sum * 10 + c - 0 ; c = getchar(); } return sum; } int root[1000010]; struct President_Tree { int lc[10000000], rc[10000000... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; queue<int> v1; deque<int> v2; for (int i = 0; i < s.size(); i++) { if (s[i] == ( ) v1.push(i); else { v2.push_front(i); ... |
// Must synthesize into 3 * 8x2048 brams
module vram(input clk,
input [12:0] p1_addr,
input [7:0] p1_data,
input p1_we,
input [12:0] p2_addr,
output reg [7:0] p2_data);
reg [7:0] mem[0:(3*2048)-1];
always @(posedge clk)
begin
if (p1_we) begin
mem[... |
//------------------------------------------------------------------------------
// (c) Copyright 2013-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 propert... |
/*================================================
Thomas Gorham
ECE 441 Spring 2017
Project 2 - bcd_ctr
Description: This module implements a 3-digit
bcd counter with async reset and enable inputs.
It is intended to be controlled by a state machine
that manages inputs from the lfsr and pushbuttons
====================... |
/**
* 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... |
/*+--------------------------------------------------------------------------
Copyright (c) 2015, Microsoft Corporation
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 ... |
// O(q*log(q)) with pretty big constant factor #include<bits/stdc++.h> using namespace std; struct query { vector<int> nodes; }; // for a given path // active will find intersections not at it s lca // cnts with find intersections at it s lca const int maxn = 3e5 + 1; int n, m; vector<int>... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 5; long long n, k, z, a[N]; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long t; cin >> t; while (t--) { cin >> n >> k >> z; long long sum = 0; for (long long i = 1; i... |
// file: clk32to40_exdes.v
//
// (c) Copyright 2008 - 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 disc... |
#include <bits/stdc++.h> using namespace std; int countbit(int a) { int i = 0; while (a != 0) { if (a & 1) i++; a /= 2; } return i; } int dp[1100000] = {0}; int main() { int a[150]; int arr[150], arr1[150] = {0}; int n, m; cin >> n; for (int i = 0; i < n; i++) c... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 110; int N, A[Maxn]; map<int, int> K, dp; int SG(int x) { set<int> S; if (dp.count(x)) return dp[x]; if (x == 0) return 0; for (int i = 1; i <= 30; i++) { int y = (x >> i) | (x & ((1 << (i - 1)) - 1)); if (y != x) ... |
//======================================================================
//
// chacha_qr.v
// -----------
// Verilog 2001 implementation of the stream cipher ChaCha.
// This is the combinational QR logic as a separade module to allow
// us to build versions of the cipher with 1, 2, 4 and even 8
// parallel qr functions... |
/*
* 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... |
#include <bits/stdc++.h> using namespace std; int p[100100]; int main() { int n, a, b, t, cn = 1; cin >> n; for (int i = 0; i < n; i++) { cin >> a; p[i] = a; } sort(p, p + n); int ans = 0; vector<int> v; for (int i = 0; i < n; i++) { int j = 0; for (j = 0; j... |
/*
* PicoSoC - A simple example SoC using PicoRV32
*
* Copyright (C) 2017 Clifford Wolf <>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies... |
/*
* 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 I2CTest(CLCK, SCL, SDA);
//I2C
input CLCK;
input SCL;
inout SDA;
parameter slaveaddress = 7'b1110010;
//Sample registers to send to requesting device
reg[2:0] valuecnt = 3'b011; //Count of bytes to be sent, send read value twice
//Synch SCL edge to the CPLD clock
reg [2:0] SCLSynch = 3'b000;
... |
module displaydriver (
clk,
reset_,
digit_0,
digit_1,
digit_2,
digit_3,
segment_,
digit_enable_
);
input clk;
input reset_;
input [6:0] digit_0;
input [6:0] digit_1;
input [6:0] digit_2;
input [6:0] digit_3;
output [6:0] segment_;
output [3:0] digit_enable_;
// Theory of operation... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sparc_mul_top.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it and... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; ; vector<int> a(n); int m = 1000; for (__typeof(0) i = 0; i < n; i++) { cin >> a[i]; m = min(a[i], m); } int minc = 0; for (__typeof(0) i ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1000 * 1000 * 1000; const double EPS = 1e-9; const double PI = 2 * acos(0.); const int N = 10; const int dx[] = {-2, -1, 1, 2, 2, 1, -1, -2}; const int dy[] = {-1, -2, -2, -1, 1, 2, 2, 1}; char a[N][N]; bool r[N]; int main() { int ans... |
`define ADDER_WIDTH 028
`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 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(0), cin.tie(0), cout.tie(0); //freopen( input.txt , r ,stdin); //freopen( output.txt , w ,stdout); int T; cin>>T; for(int t=0;t<T;t++){ int n,k; cin>>n>>k; if(n==1&&k==1){cout<<0<<endl;continue;} ... |
/*
* 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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2020 by Anderson Ignacio da Silva.
// SPDX-License-Identifier: CC0-1.0
package test_pkg;
localparam [31:0] test_arr [4][4:0]
= '{
'{'h0000, 'h1000, ... |
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> inline void smin(T &a, U b) { if (a > b) a = b; } template <typename T, typename U> inline void smax(T &a, U b) { if (a < b) a = b; } template <typename T> inline void gn(T &first) { char c, sg = 0; while (... |
#include <bits/stdc++.h> using namespace std; template <typename T> ostream &operator<<(ostream &o, vector<T> &vec) { cout << [ ; for (int i = 0; i < ((int)(vec).size()); i++) { if (i) cout << , ; cout << vec[i]; } cout << ] ; return o; } template <typename T1, typename T2>... |
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associate... |
#include <bits/stdc++.h> using namespace std; long long n, m, q, t, c; string s; long long inv[200007]; long long p[200007]; long long f[200007]; long long nq[200007]; long long mq[200007]; long long res[200007]; long long dp[200007]; vector<long long> que[200007]; long long fpow(long long a, lo... |
#include <bits/stdc++.h> int ___read_tmp; using namespace std; int fwt[1010000]; int query(int sz) { int sum = 0; sz++; while (sz > 0) { sum += fwt[sz]; sz -= sz & (-sz); } return sum; } void upd(int id, int add) { id++; for (; id < 1010000; id += (id & (-id))) { ... |
#include <bits/stdc++.h> using namespace std; int n, k, ans = 1 << 30; int main() { scanf( %d%d , &n, &k); for (int i = 1; i <= k - 1; i++) if (n % i == 0) ans = min(ans, k * n / i + i); printf( %d n , ans); return 0; } |
#include <bits/stdc++.h> using namespace std; const int N = 300000; int x[N][2]; int ans[N]; bool hear[N]; vector<pair<int, int> > G[N]; int color[N]; void dfs1(int s) { color[s] = 1; for (int i = 0; i < (int)G[s].size(); i++) { int v = G[s][i].first; if (color[v] == 0) { if ... |
`timescale 1ns / 1ps
`default_nettype none
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 18:22:21 06/07/2015
// Design Name:
// Module Name: coreid
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
/... |
#include <bits/stdc++.h> using namespace std; long long n, in[5100], st[5100], f[5100], ans = 9999999999999; signed main() { cin >> n; for (long long i = 1; i <= n; i++) { cin >> in[i]; } memset(f, 0x7f, sizeof(f)); memcpy(st, in, sizeof(in)); sort(st + 1, st + n + 1); for (long ... |
module top_tb;
reg clk_i = 0;
reg rst_i = 1;
reg [4:0] rx_i_ctr = 0;
reg [19:0] rx_tmp = 20'b10100011101010010000;
reg tmp_rx_bit = 1;
wire clk_uart_rx, clk_uart_tx;
wire [7:0] led_o;
wire rs232_tx_o;
wire rs232_rx_i;
initial
begin
$dum... |
/**
* 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() { long long t; cin >> t; while (t--) { long long n; cin >> n; map<string, int> m; int ans = 0; vector<string> a, b; for (int i = 0; i < n; i++) { string s; cin >> s; if (m[s] != 0) ans++;... |
//
// Copyright 2011 Ettus Research LLC
//
// 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
// (at your option) any later version.
//
// This program is dis... |
/**
* 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; vector<vector<int>> compos; int complement_component(vector<vector<int>> &g) { int n = g.size(), ans = 0; set<int> S; for (int i = 0; i < n; ++i) S.insert(i); while (S.size()) { ++ans; int theCompo = 0; queue<int> q; q.push(*S.b... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company: TU Darmstadt
// Engineer: Mahdi Enan
//
// Create Date: 10:06:06 01/18/2017
// Design Name: retnuoCl
// Module Name: tb_retnuoCl.v
// Project Name: spongent
// Target Device:
// Tool versions:
/... |
/**
* 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 + 5; int n; long long r, a[(1LL << 20)], x, y; int main() { scanf( %d %I64d , &n, &r); long long sum = 0; double qpw = 1; for (int i = 1; i <= n; ++i) qpw *= 2; for (int i = 1; i <= qpw; ++i) { scanf( %I64d , &a[i]); ... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Wed Sep 20 21:08:01 2017
// Host : EffulgentTome running 64-bit major rele... |
`include "timescale.v"
module orpsoc_tb;
vlog_tb_utils vlog_tb_utils0();
////////////////////////////////////////////////////////////////////////
//
// JTAG VPI interface
//
////////////////////////////////////////////////////////////////////////
wire tms;
wire tck;
wire tdi;
... |
#include <bits/stdc++.h> using namespace std; const int N = 100000; const int inf = (int)1e9 + 1; const long long big = (long long)1e18 + 1; const int P = 239; const int MOD = (int)1e9 + 7; const int MOD1 = (int)1e9 + 9; const double eps = 1e-9; const double pi = atan2(0, -1); const int ABC = 26; ... |
module register_file (clk, we, dval, s1, s2, d, s1val, s2val, pc);
parameter NUM_REGISTERS = 32;
// input
input clk;
input we;
input [31:0] dval;
input [5:0] s1;
input [5:0] s2;
input [4:0] d;
input [31:0] pc;
// output
output [31:0] s1val;
output [31:0] s2val;
// local
reg [31:... |
#include <bits/stdc++.h> using namespace std; bool letras[26]; int main() { list<char> kbd; list<char>::iterator i; int t, j; bool foundKbd; string s; for (cin >> t; t > 0; t--) { foundKbd = true; cin >> s; for (j = 0; j < s.size() && foundKbd; j++) { if (kbd.size... |
#include <bits/stdc++.h> using namespace std; int x[110], y[110], n, epsilon, k; double dist[110], p[110], mem[110][110]; double solve(int idx, int k) { if (k == 0) return 1; if (idx == n) return 0; double& res = mem[idx][k]; if (res != -1) return res; res = p[idx] * solve(idx + 1, k - 1); ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03/15/2016 01:13:48 PM
// Design Name:
// Module Name: Add_Subt
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// R... |
#include <bits/stdc++.h> using namespace std; bool sortbysec(const pair<long long, long long> &a, const pair<long long, long long> &b) { return (a.second < b.second); } inline long long mx(long long a, long long b) { if (a > b) return a; else return b; } long long gc... |
// DESCRIPTION: Verilator: Verilog Test module
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2008 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=0;
reg [63:0] crc;
reg [63:0] sum;
reg reset;
/*AUTOWIRE*/
// Be... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1ll << 18; long long a, b, top, now; queue<long long> q; map<long long, int> mp; long long rev(long long x) { long long y = 0; while (x != 0) { y = (y << 1) | (x & 1); x >>= 1; } return y; } void push(long lo... |
#include <bits/stdc++.h> int main() { int n, m, z; std::cin >> n >> m >> z; int counter = 0; for (int i = 1; i * n <= z; i++) { if ((i * n) % m == 0) counter++; } std::cout << counter; return 0; } |
/*
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; long long n; long long arr[100005]; int c5; int find(long long a, long long b, long long c) { long long arr[4]; arr[0] = a; arr[1] = b; arr[2] = c; sort(arr, arr + 3); if (arr[0] < arr[1] && arr[1] < arr[2]) return 6; else if (arr... |
/*
* Copyright (c) 2001 Stephan Boettcher <>
*
* 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; long long n; long long a[100005][4]; set<long long> se; map<long long, long long> mp; pair<long long, long long> ve[400005][5]; pair<long long, long long> pe[400005][5]; long long prim(long long i) { for (long long j = 2; j * j <= i; j++) { 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; int main() { string str; cin >> str; str[0] = toupper(str[0]); cout << str; } |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:200000000 ) using namespace std; char a[105][105]; int n, m; bool u[105][105]; int main() { memset(u, false, sizeof(u)); scanf( %d %d n , &n, &m); for (int i = 0; i < n; i++, scanf( n )) for (int j = 0; j < m; j++) scanf( %c , &a[i]... |
#include <bits/stdc++.h> int cmp(const void* a, const void* b); int main() { long long t = 1; while (t--) { long long n, n1, n2; scanf( %lld%lld%lld , &n, &n1, &n2); long long arr[n]; for (long long i = 0; i < n; i++) { scanf( %lld , &arr[i]); } qsort(arr, n, size... |
#include <bits/stdc++.h> using namespace std; vector<long long int> primes; void SOE(long long int n) { primes.erase(primes.begin(), primes.end()); bool prime[n + 1]; memset(prime, true, sizeof(prime)); for (long long int p = 2; p * p <= n; p++) { if (prime[p] == true) { for (long lo... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long N = 1e2 + 10; vector<long long> g[N]; void dfs(long long node, long long par, long long dd, vector<long long>& fre) { fre[dd]++; for (auto x : g[node]) if (x != par) dfs(x, node, dd + 1, fre); } long... |
#include <bits/stdc++.h> using namespace std; const int mxnn = 300000 + 10, inf = 0x3f3f3f3f; int n, q, a, cnt; int head[mxnn], son[mxnn], ans[mxnn], fa[mxnn]; struct node { int u, v, next; } e[mxnn << 1]; void adde(int u, int v) { e[++cnt].u = u; e[cnt].v = v; e[cnt].next = head[u]; h... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; bool pd(complex<double> a, complex<double> b, complex<double> c, complex<double> d) { return imag((b - a) * conj(d - a)) * imag((b - a) * conj(c - a)) < -eps; } bool aa(complex<double> a, complex<double> b, complex<double> c)... |
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; inline int add(int a, int b) { if ((a += b) >= mod) a -= mod; return a; } inline int mult(int a, int b) { long long t = 1ll * a * b; if (t >= mod) t %= mod; return t; } inline int dec(int a, int b) { if ((a -... |
#include <bits/stdc++.h> using namespace std; long long L[200005], R[200005], U[200005], D[200005]; long long n; string S; long long x, y, sx = 0, sy = 0; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> S >> x >> y; S = _ + S; L[0] = R[0] = U[... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:38:12 11/20/2015
// Design Name:
// Module Name: HazardsUnit
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
/... |
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's Freeze logic ////
//// ////
//// This file is part of the OpenR... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2 * 1000 * 100 + 100; long long nums[maxn]; long long ans = 0; long long cou[30]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> nums[i]; cou[nums[i] + 10]++; } ans += (cou[0 + 10] * (cou[10] -... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2015(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 100; long long n, m, dau, cuoi, giua, pos1, pos2, t; bool kt; struct point { long long x, y; } p[N], ab, ac, z; long long ccw(point a, point b, point c) { ab = {b.x - a.x, b.y - a.y}; ac = {c.x - a.x, c.y - a.y}; return ab.x... |
#include <bits/stdc++.h> using namespace std; class myistream { static const int maxsize = 1000007, tmpsize = 50; char *s, *tmp; char *cur, *upperbound; FILE *fp; bool last_read; bool end_of_file; bool to_return; void upd() { int num = fread(s, sizeof(char), maxsize, fp); ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.