Showing preview only (4,758K chars total). Download the full file or copy to clipboard to get everything.
Repository: utshabkg/Competitive_Contest_Problem_Solves
Branch: master
Commit: 8e07e7936912
Files: 452
Total size: 4.5 MB
Directory structure:
gitextract_qxpdei06/
├── .gitattributes
├── .gitignore
├── 1.Template.py
├── Atcoder/
│ ├── abc175/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── abc176/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── abc177/
│ │ ├── A.py
│ │ └── B.py
│ ├── abc184/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── arc104/
│ │ ├── A.py
│ │ └── B.py
│ └── arc110/
│ └── A.py
├── CODECHEF/
│ ├── Ciel and A-B Problem.c
│ ├── Ciel and A-B Problem.o
│ ├── Cleaning Up.c
│ ├── Cleaning Up.o
│ ├── Lapindromes.c
│ ├── Racing Horses.c
│ ├── Racing Horses.o
│ ├── Sums is a Triangle.c
│ └── Sums is a Triangle.o
├── CODEFORCES/
│ ├── C/
│ │ ├── 112A-Petya & Strings.cpp
│ │ ├── 118A. String Task.c
│ │ ├── 118A. String Task.cpp
│ │ ├── 118A. String Task.o
│ │ ├── 12A.Super Agent.c
│ │ ├── 12A.Super Agent.o
│ │ ├── 13A.numbers.c
│ │ ├── 13A.numbers.o
│ │ ├── 158A - Next Round.cpp
│ │ ├── 1A-Theatre Square.c
│ │ ├── 20-21 ICPC, NERC (Mirror)/
│ │ │ ├── C.py
│ │ │ ├── E.cpp
│ │ │ └── N.cpp
│ │ ├── 231A-Team.cpp
│ │ ├── 282A-Bit++.cpp
│ │ ├── 2A.cpp
│ │ ├── 2A.o
│ │ ├── 3A.cpp
│ │ ├── 3A.o
│ │ ├── 428,div 2/
│ │ │ ├── A.Arya and Bran.c
│ │ │ └── A.Arya and Bran.o
│ │ ├── 429,div 2/
│ │ │ └── A.c
│ │ ├── 433,div 2/
│ │ │ ├── A.Fraction.c
│ │ │ └── A.Fraction.o
│ │ ├── 458,div 1+2/
│ │ │ ├── A.cpp
│ │ │ └── A.o
│ │ ├── 459 (Div. 2)/
│ │ │ ├── A. Eleven.cpp
│ │ │ ├── A. Eleven.o
│ │ │ └── A. Eleven2.o
│ │ ├── 463(1+2)/
│ │ │ ├── A.Palidromic Supersequence.cpp
│ │ │ ├── A.Palidromic Supersequence.o
│ │ │ ├── B. Recursive Queries.cpp
│ │ │ └── B. Recursive Queries.o
│ │ ├── 465,div 2/
│ │ │ ├── A. Fafa and his Company.cpp
│ │ │ ├── A. Fafa and his Company.o
│ │ │ ├── B. Fafa and the Gates.cpp
│ │ │ └── B. Fafa and the Gates.o
│ │ ├── 478A-Initial Bet.cpp
│ │ ├── 4A-dividing watermelon.c
│ │ ├── 4A.Chat Server's Outgoing Traffic.c
│ │ ├── 50A-Domino Piling.c
│ │ ├── 677A-Vanya and Fence.cpp
│ │ ├── 6A.triangle.cpp
│ │ ├── 6A.triangle.o
│ │ ├── 705A-Hulk.cpp
│ │ ├── 71A. Way Too Long Words.cpp
│ │ ├── 7A. Kalevitch and Chess.cpp
│ │ ├── 7A. Kalevitch and Chess.o
│ │ ├── 8A. Train and Peter.cpp
│ │ ├── 8A. Train and Peter.o
│ │ ├── 96A-Football.cpp
│ │ ├── A.cpp
│ │ ├── A.o
│ │ ├── Edu 38(div 2)/
│ │ │ ├── A. Word Correction.cpp
│ │ │ └── A. Word Correction.o
│ │ ├── Edu 39(div 2)/
│ │ │ ├── A.cpp
│ │ │ ├── A.o
│ │ │ ├── B.cpp
│ │ │ └── B.o
│ │ ├── Practice - ECPC 2019/
│ │ │ ├── 307919A_T2.cpp
│ │ │ ├── 307919B.cpp
│ │ │ ├── 307919G.cpp
│ │ │ ├── 307919J_T2.cpp
│ │ │ ├── 307919K.cpp
│ │ │ ├── 307919M.cpp
│ │ │ └── 307919N.cpp
│ │ ├── Untitled1.c
│ │ ├── Untitled1.o
│ │ ├── char in 2D.c
│ │ └── char in 2D.o
│ └── Python/
│ ├── 1.Template.py
│ ├── 110A. Nearly Lucky Number.py
│ ├── 116A. Tram.py
│ ├── 118B. Present from Lena.py
│ ├── 122A. Lucky Division.py
│ ├── 122A.py
│ ├── 124A. The number of positions.py
│ ├── 131A. cAPS lOCK.py
│ ├── 1331A. HQ9+.py
│ ├── 1341A. Nastya and Rice.py
│ ├── 1343A. Candies.py
│ ├── 1343B.py
│ ├── 1351A. A+B (Trial Problem).py
│ ├── 1352B. Square.py
│ ├── 139A. Petr and Book.py
│ ├── 13A.py
│ ├── 149A. Business trip.py
│ ├── 158B. Taxi.py
│ ├── 160A. Twins.py
│ ├── 165A. Supercentral Point.py
│ ├── 199A. Hexadecimal's theorem.py
│ ├── 205A. Little Elephant and Rozdil.py
│ ├── 208A. Dubstep.py
│ ├── 214A. System of Equations.py
│ ├── 215A. Bicycle Chain.py
│ ├── 219A. k-String.py
│ ├── 221A. Little Elephant and Function.py
│ ├── 222A. Shooshuns and Sequence.py
│ ├── 227B. Effective Approach.py
│ ├── 230A. Dragons.py
│ ├── 236A.py
│ ├── 266A. Stones on the Table.py
│ ├── 266B. Queue at the School.py
│ ├── 272A. Dima and Friends.py
│ ├── 276B. Little Girl and Game.py
│ ├── 281A. Word Capitalization.py
│ ├── 298B. Sail.py
│ ├── 318A. Even Odds.py
│ ├── 320A. Magic Numbers.py
│ ├── 339B. Xenia and Ringroad.py
│ ├── 34A. Reconnaissance 2.py
│ ├── 34B. Sale.py
│ ├── 352A. Jeff and Digits.py
│ ├── 352B. Jeff and Periods.py
│ ├── 41A. Translation.py
│ ├── 43A. Football.py
│ ├── 445A. DZY Loves Chessboard.py
│ ├── 459B. Pashmak and Flowers.py
│ ├── 467A. George and Accommodation.py
│ ├── 546A. Soldier and Bananas.py
│ ├── 580A. Kefa and First Steps.py
│ ├── 58A. Chat room.py
│ ├── 599A. Patrick and Shopping.py
│ ├── 59A. Word.py
│ ├── 625B. War of the Corporations.py
│ ├── 630C. Lucky Numbers.py
│ ├── 638 (Div. 2)/
│ │ ├── 1348A.py
│ │ └── 1348B.py
│ ├── 639 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 640 (Div. 4)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D. Alice, Bob and Candies.py
│ ├── 641 (Div. 2)/
│ │ └── A.py
│ ├── 642 (Div. 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── 643 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 644 (Div. 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── 645 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 646 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 647 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 648 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 649 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 650 (Div. 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ ├── D.py
│ │ └── Python.lnk
│ ├── 651 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── 652 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── 653 (Div. 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ ├── D.py
│ │ └── E1.py
│ ├── 654 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 655 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 656 (Div. 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── 657 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── 658 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C1.py
│ ├── 659 (Div. 2)/
│ │ └── A.py
│ ├── 660 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 661 (Div. 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 662 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 663 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 664 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 665 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 666 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 667 (Div. 3)/
│ │ ├── A.py
│ │ └── C.py
│ ├── 668 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 669 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 670 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 671 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 672 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 685 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 686 (Div. 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 688 (Div. 2)/
│ │ └── A.py
│ ├── 690 (Div. 3)/
│ │ ├── A.py
│ │ └── C.py
│ ├── 691 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 692 (Div. 2, based on Technocup 2021 Elimination Round 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 693 (Div. 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── 694 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 695 (Div. 2)/
│ │ └── A.py
│ ├── 696 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 697 (Div. 3)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 698 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 699 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 69A.py
│ ├── 700 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 705 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 733A. Grasshopper And the String.py
│ ├── 734A. Anton and Danik.py
│ ├── 791A. Bear and Big Brother.py
│ ├── 946B.py
│ ├── 977A. Wrong Subtraction.py
│ ├── A. Beautiful Matrix.py
│ ├── A. Bit++.py
│ ├── A. Domino piling.py
│ ├── A. Helpful Maths.py
│ ├── A. Next Round.py
│ ├── A. Petya and Strings.py
│ ├── A. Too Long Words.py
│ ├── A. Watermelon.py
│ ├── DP/
│ │ └── 1369D.py
│ ├── Dictionary/
│ │ └── 450A. Jzzhu and Children.py
│ ├── Edu 100 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── Edu 102 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── Edu 103 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── Edu 86 (Div. 2)/
│ │ ├── 1342A. Road To Zero.py
│ │ ├── 1342B. Binary Period.py
│ │ └── 266B. Queue at the School.py
│ ├── Edu 87 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C1. Simple Polygon Embedding.py
│ │ └── C2. Not So Simple Polygon Embedding.py
│ ├── Edu 88 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── Edu 89 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── Edu 90 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── Edu 91 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── Edu 92 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── Edu 93 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── Edu 94 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── Edu 95 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── Global Round 10/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── Global Round 12/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── Global Round 8/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── Global Round 9/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── ICPC Challenge 2020 Practice/
│ │ ├── A.py
│ │ ├── A.txt
│ │ └── sort.in
│ └── Notes.txt
├── CSAcademy/
│ ├── 69 (Div 2)/
│ │ ├── Pokemon Fights.cpp
│ │ └── Pokemon Fights.o
│ ├── Frequent Numbers.c
│ ├── Frequent Numbers.o
│ ├── Round 47/
│ │ ├── Adjacent Vowels.c
│ │ ├── Adjacent Vowels.o
│ │ └── Consecutive Sum.c
│ ├── Round 65/
│ │ ├── Encipherment.cpp
│ │ └── Encipherment.o
│ ├── Round 68(div 2)/
│ │ ├── A. String Concat.cpp
│ │ └── A. String Concat.o
│ └── Square Cover.c
├── GeeksForGeeks/
│ ├── Count the triplets.py
│ ├── Subarray with given sum.py
│ └── Triplets again.py
├── Hackerearth/
│ ├── Algorithm/
│ │ └── Graph/
│ │ └── Stay Healthy! Greedy.py
│ ├── August Circuits '20/
│ │ └── Anti-palindrome strings.py
│ ├── Basic Number Theory-1/
│ │ ├── Can you Guess.py
│ │ ├── Love Triangle.py
│ │ ├── Panda and Chain Reaction.py
│ │ ├── Primen't Divisors.py
│ │ └── Tutorial Code.py
│ ├── January Circuits '21/
│ │ ├── A chessboard.py
│ │ ├── Replace the strings.py
│ │ ├── Scoreboard queries.py
│ │ └── The GCD Function.py
│ └── Notes.txt
├── LIGHTOJ/
│ ├── 1000.c
│ ├── 1000.o
│ ├── 1001.c
│ ├── 1001.o
│ ├── 1006.c
│ ├── 1006.o
│ ├── 1030.cpp
│ ├── 1225.cpp
│ ├── 1225.o
│ ├── 1354 - IP Checking.py
│ ├── 1433. Minimum Arc Distance.cpp
│ ├── 1433. Minimum Arc Distance.o
│ └── Python/
│ ├── 1027.A Dangerous Maze.py
│ ├── 1030.Discovering Gold.py
│ ├── 1038. Race 1 Again.py
│ └── 1225. Palindromic Numbers (II).py
├── LeetCode/
│ ├── 1. Two Sum.py
│ ├── 1108. Defanging an IP Address.py
│ ├── 1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree.py
│ ├── 1480. Running Sum of 1d Array.py
│ ├── 1689. Partitioning Into Minimum Number Of Deci-Binary Numbers.py
│ ├── 1791. Find Center of Star Graph.py
│ ├── 1971. Find if Path Exists in Graph.py
│ ├── 2011. Final Value of Variable After Performing Operations.py
│ ├── 2114. Maximum Number of Words Found in Sentences.py
│ ├── 2236. Root Equals Sum of Children.py
│ ├── 3110. Score of a String.py
│ ├── 535. Encode and Decode TinyURL.py
│ ├── 617. Merge Two Binary Trees.py
│ ├── 724. Find Pivot Index.py
│ ├── 771. Jewels and Stones.py
│ ├── 9. Palindrome Number.py
│ ├── 938. Range Sum of BST.py
│ ├── 94. Binary Tree Inorder Traversal.py
│ └── 997. Find the Town Judge.py
├── Notes.txt
├── README.md
├── Toph/
│ └── SELISE Coding Challenge 2020/
│ ├── A.py
│ ├── B.py
│ ├── C.py
│ ├── D.py
│ ├── E.py
│ ├── F.py
│ ├── G.py
│ ├── H.py
│ └── J.py
├── UVA/
│ ├── 10334 - Ray Through Glasses.cpp
│ ├── 10334 - Ray Through Glasses.o
│ ├── 10334 - Ray Through Glasses.py
│ ├── 10407 - Simple division.py
│ ├── 11388 - GCD LCM.py
│ ├── 11417 - GCD.py
│ ├── 11572 - Unique Snowflakes.py
│ ├── 1433. Minimum Arc Distance.py
│ ├── 495 - Fibonacci Freeze.py
│ ├── 900 - Brick Wall Patterns.py
│ └── Notes.txt
└── Vjudge/
├── RAPL Round 1(376797)/
│ ├── A.py
│ ├── B.py
│ ├── C.py
│ ├── D.py
│ └── E.py
├── RAPL TFC__(413583)/
│ ├── A.py
│ └── C.py
├── TFC - 2/
│ └── E.cpp
├── TFC3/
│ ├── C.py
│ └── D.py
└── Team Practice Contest(419090)/
└── B.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitattributes
================================================
# Auto detect text files and perform LF normalization
* text=auto
================================================
FILE: .gitignore
================================================
*.json
*.xml
*.iml
*.idea
================================================
FILE: 1.Template.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def string2intlist(s):
return list(map(int, s))
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n, p - 2, p)
def nCr(n, r):
i = 1
while i < r:
n *= (n - i)
i += 1
return n // math.factorial(r)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
def knapSack(W, wt, val, n):
K = [[0 for x in range(W + 1)] for x in range(n + 1)]
# Build table K[][] in bottom up manner
for i in range(n + 1):
for w in range(W + 1):
if i == 0 or w == 0:
K[i][w] = 0
elif wt[i-1] <= w:
K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]], K[i-1][w])
else:
K[i][w] = K[i-1][w]
return K[n][W]
"""*******************************************************"""
================================================
FILE: Atcoder/abc175/A.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
s = list(stin())
c = 0; temp = 0
for i in s:
if i=='R':
c+=1
else:
if c>0:
temp = c
c = 0
print(max(temp, c))
================================================
FILE: Atcoder/abc175/B.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
n = inin()
a = lin()
a = sorted((a))
if len(a)<3:
print(0)
exit()
trio = []; c = 0
for i in range(0, len(a)):
for j in range(0, len(a)):
for k in range(0, len(a)):
# m = max([a[i], a[j], a[k]])
# s = sum([a[i], a[j], a[k]])
if a[i]<a[j]<a[k]:
if a[i]+a[j]>a[k]:
# trio.append([a[i], a[j], a[k]])
c += 1
print(c)
# print(len(trio))
================================================
FILE: Atcoder/abc175/C.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
x, k, d = spin()
x = abs(x)
if k%2!=0:
d1 = math.fabs(x - k*d)
d2 = math.fabs(x - k//2*d + k//2*d)
m = min(d1, d2)
else:
d1 = math.fabs(x - k*d)
d2 = math.fabs(x - (k//2+1)*d + (k//2-1)*d)
m = min(d1, d2)
print(int(m))
================================================
FILE: Atcoder/abc176/A.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
n, x, t = spin()
print(math.ceil(n/x)*t)
================================================
FILE: Atcoder/abc176/B.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
n = (list(input()))
n = list(map(int, n))
# print(n)
print("Yes") if sum(n)%9==0 else print("No")
================================================
FILE: Atcoder/abc176/C.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
n = inin()
a = lin()
# m = max(a)
c, d = 0, 0
for i in range(n-1):
if a[i]>a[i+1]:
d = a[i] - a[i+1]
c += d
a[i+1] = a[i]
print(c)
================================================
FILE: Atcoder/abc177/A.py
================================================
<<<<<<< HEAD
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def string2intlist(s):
return list(map(int, s))
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
d, t, s = spin()
if s*t>=d:
print("Yes")
else:
print("No")
=======
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def string2intlist(s):
return list(map(int, s))
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
d, t, s = spin()
if s*t>=d:
print("Yes")
else:
print("No")
>>>>>>> b7522ba5389778e8576c407c6c561f68ab2635c7
================================================
FILE: Atcoder/abc177/B.py
================================================
<<<<<<< HEAD
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def string2intlist(s):
return list(map(int, s))
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
s = stin()
t = stin()
c,d = 0,0
for i in range(len(s)-len(t)+1):
d=0
for j in range(len(t)):
if s[i+j]==t[j]:
d+=1
# print(c, d)
c=max(d,c)
print(len(t)-c)
# for i in range(len(t), 0,-1):
# # print(t[:i])
# if t[:i] in s:
# # print(c)
# break
# else:
# c+=1
# # print(t[:i], t[:i] in s)
# for i in range(len(t)):
# # print(t[i:])
# if t[i:] in s:
# # print(d)
# break
# else:
# d+=1
# # print("ab" in s)
# print(min(c, d))
=======
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def string2intlist(s):
return list(map(int, s))
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
s = stin()
t = stin()
c,d = 0,0
for i in range(len(s)-len(t)+1):
d=0
for j in range(len(t)):
if s[i+j]==t[j]:
d+=1
# print(c, d)
c=max(d,c)
print(len(t)-c)
# for i in range(len(t), 0,-1):
# # print(t[:i])
# if t[:i] in s:
# # print(c)
# break
# else:
# c+=1
# # print(t[:i], t[:i] in s)
# for i in range(len(t)):
# # print(t[i:])
# if t[i:] in s:
# # print(d)
# break
# else:
# d+=1
# # print("ab" in s)
# print(min(c, d))
>>>>>>> b7522ba5389778e8576c407c6c561f68ab2635c7
================================================
FILE: Atcoder/abc184/A.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect # c++ upperbound
import math
import heapq
i_m = 9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int, stin().split())
def lin(): # takes array as input
return list(map(int, stin().split()))
def matrix(n):
#matrix input
return [list(map(int, input().split()))for i in range(n)]
################################################
def string2intlist(s):
return list(map(int, s))
def calculate_sum(a, N): # sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i, list):
return sum(c.count(i) for c in list)
def modinv(n, p):
return pow(n, p - 2, p)
def nCr(n, r):
i = 1
while i < r:
n *= (n - i)
i += 1
return n // math.factorial(r)
def GCD(x, y):
x = abs(x)
y = abs(y)
if(min(x, y) == 0):
return max(x, y)
while(y):
x, y = y, x % y
return x
def LCM(x, y):
return (x * y) // GCD(x, y)
def Divisors(n):
l = []
for i in range(1, int(math.sqrt(n) + 1)):
if (n % i == 0):
if (n // i == i):
l.append(i)
else:
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n % i == 0:
return False
return True
prime = []
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f = []
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q = []
def dfs(n, d, v, c):
global q
v[n] = 1
x = d[n]
q.append(n)
j = c
for i in x:
if i not in v:
f = dfs(i, d, v, c+1)
j = max(j, f)
# print(f)
return j
# d = {}
def knapSack(W, wt, val, n):
K = [[0 for x in range(W + 1)] for x in range(n + 1)]
# Build table K[][] in bottom up manner
for i in range(n + 1):
for w in range(W + 1):
if i == 0 or w == 0:
K[i][w] = 0
elif wt[i-1] <= w:
K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]], K[i-1][w])
else:
K[i][w] = K[i-1][w]
return K[n][W]
"""*******************************************************"""
a, b = spin()
c, d = spin()
print(a*d - b*c)
================================================
FILE: Atcoder/abc184/B.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect # c++ upperbound
import math
import heapq
i_m = 9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int, stin().split())
def lin(): # takes array as input
return list(map(int, stin().split()))
def matrix(n):
#matrix input
return [list(map(int, input().split()))for i in range(n)]
################################################
def string2intlist(s):
return list(map(int, s))
def calculate_sum(a, N): # sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i, list):
return sum(c.count(i) for c in list)
def modinv(n, p):
return pow(n, p - 2, p)
def nCr(n, r):
i = 1
while i < r:
n *= (n - i)
i += 1
return n // math.factorial(r)
def GCD(x, y):
x = abs(x)
y = abs(y)
if(min(x, y) == 0):
return max(x, y)
while(y):
x, y = y, x % y
return x
def LCM(x, y):
return (x * y) // GCD(x, y)
def Divisors(n):
l = []
for i in range(1, int(math.sqrt(n) + 1)):
if (n % i == 0):
if (n // i == i):
l.append(i)
else:
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n % i == 0:
return False
return True
prime = []
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f = []
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q = []
def dfs(n, d, v, c):
global q
v[n] = 1
x = d[n]
q.append(n)
j = c
for i in x:
if i not in v:
f = dfs(i, d, v, c+1)
j = max(j, f)
# print(f)
return j
# d = {}
def knapSack(W, wt, val, n):
K = [[0 for x in range(W + 1)] for x in range(n + 1)]
# Build table K[][] in bottom up manner
for i in range(n + 1):
for w in range(W + 1):
if i == 0 or w == 0:
K[i][w] = 0
elif wt[i-1] <= w:
K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]], K[i-1][w])
else:
K[i][w] = K[i-1][w]
return K[n][W]
"""*******************************************************"""
n, x = spin()
s = stin()
for i in range(n):
if s[i] == 'o':
x += 1
elif x != 0 and s[i] == 'x':
x -= 1
print(x)
================================================
FILE: Atcoder/abc184/C.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect # c++ upperbound
import math
import heapq
i_m = 9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int, stin().split())
def lin(): # takes array as input
return list(map(int, stin().split()))
def matrix(n):
#matrix input
return [list(map(int, input().split()))for i in range(n)]
################################################
def string2intlist(s):
return list(map(int, s))
def calculate_sum(a, N): # sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i, list):
return sum(c.count(i) for c in list)
def modinv(n, p):
return pow(n, p - 2, p)
def nCr(n, r):
i = 1
while i < r:
n *= (n - i)
i += 1
return n // math.factorial(r)
def GCD(x, y):
x = abs(x)
y = abs(y)
if(min(x, y) == 0):
return max(x, y)
while(y):
x, y = y, x % y
return x
def LCM(x, y):
return (x * y) // GCD(x, y)
def Divisors(n):
l = []
for i in range(1, int(math.sqrt(n) + 1)):
if (n % i == 0):
if (n // i == i):
l.append(i)
else:
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n % i == 0:
return False
return True
prime = []
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f = []
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q = []
def dfs(n, d, v, c):
global q
v[n] = 1
x = d[n]
q.append(n)
j = c
for i in x:
if i not in v:
f = dfs(i, d, v, c+1)
j = max(j, f)
# print(f)
return j
# d = {}
def knapSack(W, wt, val, n):
K = [[0 for x in range(W + 1)] for x in range(n + 1)]
# Build table K[][] in bottom up manner
for i in range(n + 1):
for w in range(W + 1):
if i == 0 or w == 0:
K[i][w] = 0
elif wt[i-1] <= w:
K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]], K[i-1][w])
else:
K[i][w] = K[i-1][w]
return K[n][W]
"""*******************************************************"""
r1, c1 = spin()
r2, c2 = spin()
if r1 == r2 and c1 == c2:
print(0)
elif r1+c1 == r2+c2 or r1-c1 == r2-c2 or abs(r1-r2)+abs(c1-c2) <= 3:
print(1)
elif (abs(r1-r2)+abs(c1-c2)) % 2 == 0 or abs(r2+c2-r1-c1) <= 3 or abs(r2-c2-r1+c1) <= 3 or abs(r1-r2)+abs(c1-c2) <= 6:
print(2)
else:
print(3)
================================================
FILE: Atcoder/arc104/A.py
================================================
<<<<<<< HEAD
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def string2intlist(s):
return list(map(int, s))
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
a, b = spin()
=======
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def string2intlist(s):
return list(map(int, s))
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
a, b = spin()
>>>>>>> b7522ba5389778e8576c407c6c561f68ab2635c7
print((a+b)//2, (a-b)//2)
================================================
FILE: Atcoder/arc104/B.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def string2intlist(s):
return list(map(int, s))
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
s = stin()
t = stin()
c,d = 0,0
for i in range(len(s)-len(t)+1):
d=0
for j in range(len(t)):
if s[i+j]==t[j]:
d+=1
# print(c, d)
c=max(d,c)
print(len(t)-c)
# for i in range(len(t), 0,-1):
# # print(t[:i])
# if t[:i] in s:
# # print(c)
# break
# else:
# c+=1
# # print(t[:i], t[:i] in s)
# for i in range(len(t)):
# # print(t[i:])
# if t[i:] in s:
# # print(d)
# break
# else:
# d+=1
# # print("ab" in s)
# print(min(c, d))
================================================
FILE: Atcoder/arc110/A.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def string2intlist(s):
return list(map(int, s))
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
n = inin()
m = 1
for i in range(2, 31):
m = LCM(i, m)
print(m + 1)
================================================
FILE: CODECHEF/Ciel and A-B Problem.c
================================================
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int A,B,S;
scanf("%d %d",&A,&B);
S=abs(A-B);
if(S%10==9)
printf("%d",--S);
else
printf("%d",++S);
}
================================================
FILE: CODECHEF/Cleaning Up.c
================================================
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int T,n,m,i,k,flag;
scanf("%d",&T);
while(T--)
{
int ax[1005]={0};
scanf("%d %d",&n,&m);
for(i=0;i<m;i++)
{
scanf("%d",&k);
ax[k]=1;
}
flag=1;
for(i=1;i<=n;i++)
{
if(ax[i]==0)
{
if(flag==1)
{
printf("%d ",i);
flag=0;
ax[i]=1;
}
else
flag=1;
}
}
printf("\n");
for(i=1;i<=n;i++)
{
if(ax[i]==0)
printf("%d ",i);
}
printf("\n");
}
return 0;
}
================================================
FILE: CODECHEF/Lapindromes.c
================================================
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main()
{
int T,i,j,flag=0,x,y;
char s;
scanf("%d",&T);
while(T--)
{
scanf("%s",s);
if(strlen(s)%2==0)
{
for(i=0,j=strlen(s)-1;i<strlen(s)/2,j>=strlen(s)/2;i++,j--)
{
x=s[i];
y=s[j];
if(x==y)
flag=1;
}
}
}
}
================================================
FILE: CODECHEF/Racing Horses.c
================================================
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
long long n,i,j,d,e,T;
scanf("%lld",&T);
while(T--)
{
scanf("%lld",&n);
long long ax[n];
for(i=0;i<n;i++)
scanf("%lld",&ax[i]);
for(i=0;i<n;i++)
for(j=i+1;j<n;j++)
{
if(j==1)
e=0;
d=abs(ax[i]-ax[j]);
if(d>=e&&j==1)
e=d;
else if(d<e)
e=d;
}
printf("%lld\n",e);
}
}
================================================
FILE: CODECHEF/Sums is a Triangle.c
================================================
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int T,n,i,j,s1=0,s=0,temp=0;
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
int ax[n][n];
for(i=1;i<=n;i++)
for(j=1;j<=i;j++)
scanf("%d",&ax[i][j]);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
ax[j][i]=ax[i][j];
}
}
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
if(s1!=0&&j==1)
{
s1=0;
s1=s1+ax[i][j];
}
else
s1=s1+ax[i][j];
}
if(temp<s1)
temp=s1;
s=temp;
if(temp==6)
temp--;
if (tepm==7)
temp=temp+2;
}
printf("%d\n",temp);
}
}
================================================
FILE: CODEFORCES/C/112A-Petya & Strings.cpp
================================================
#include<bits/stdc++.h>
int main()
{
char ax[110],bx[110];
int i;
scanf("%s %s",ax,bx);
for(i=0;i<(strlen(ax));i++)
{
{
if((tolower(ax[i])<tolower(bx[i]))||(tolower(ax[i])>tolower(bx[i])))
break;
}
}
if(tolower(ax[i])<tolower(bx[i]))
printf("-1");
else if(tolower(ax[i])>tolower(bx[i]))
printf("1");
else if(tolower(ax[i])==tolower(bx[i]))
printf("0");
}
================================================
FILE: CODEFORCES/C/118A. String Task.c
================================================
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main()
{
char sx[100],sy[100];
int i,j=0;
scanf("%s",sx);
for(i=0;i<strlen(sx);i++)
{
if(sx[i]!='A'||sx[i]!='E'||sx[i]!='I'||sx[i]!='O'||sx[i]!='U'||sx[i]!='a'||sx[i]!='e'||sx[i]!='i'||sx[i]!='o'||sx[i]!='u')
{sy[j]=sx[i];j++;}
}
printf(".%s",sy);
return 0;
}
================================================
FILE: CODEFORCES/C/118A. String Task.cpp
================================================
#include<bits/stdc++.h>
main()
{
char a[101];int i;
gets(a);
strlwr(a);
for(i=0;a[i]!='\0';i++)
{
if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'||a[i]=='y')
;
else
printf(".%c",a[i]);}
}
/*int main()
{
char c;
while((c=getchar())!='\n'){
c=tolower(c);
if(c!='a' && c!='e'&&c!='i'&&c!='o'&&c!='u'&&c!='y'){
printf(".%c",c);
}
}
}*/
================================================
FILE: CODEFORCES/C/12A.Super Agent.c
================================================
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main()
{
char ax[3][3];
int i,j;
for(i=1;i<=3;i++){
for(j=1;j<=3;j++)
{
scanf("%c",&ax[i][j]);
}
}
if((ax[1][1]==ax[3][3])&&(ax[1][2]==ax[3][2])&&(ax[1][3]==ax[3][1])&&(ax[2][1]==ax[2][3]))
printf("YES");
else
printf("NO");
}
================================================
FILE: CODEFORCES/C/13A.numbers.c
================================================
#include<stdio.h>
int main()
{
int A,i,j,d=0,q=0,s1=0,s2=1,count=0;
scanf("%d",&A);
for(i=2;i<A;i++)
{
for(j=i,d=A; ;)
{
d=d/i;
q=d%i;
s1=s1+q;
if(d==0)
break;
}
s2=s2+s1;
count++;
}
printf("%d/%d",s2,count);
}
================================================
FILE: CODEFORCES/C/158A - Next Round.cpp
================================================
#include<bits/stdc++.h>
int main()
{
int n,k,i,cnt=0;
scanf("%d %d",&n,&k);
int a[n+1];
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
for(i=1;i<=n;i++)
if(a[i]>=a[k]&&a[i]!=0)
cnt++;
printf("%d",cnt);
}
================================================
FILE: CODEFORCES/C/1A-Theatre Square.c
================================================
#include<stdio.h>
int main()
{
long long n,m,a;
long long x,y,total;
scanf("%lld %lld %lld",&n,&m,&a);
x=n/a;
y=m/a;
if(n%a!=0){x=x+1;}
if(m%a!=0){y=y+1;}
printf("%lld",x*y);
return 0;
}
================================================
FILE: CODEFORCES/C/20-21 ICPC, NERC (Mirror)/C.py
================================================
from __future__ import division, print_function
from collections import Counter
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect # c++ upperbound
import math
import heapq
i_m = 9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int, stin().split())
def lin(): # takes array as input
return list(map(int, stin().split()))
def matrix(n):
#matrix input
return [list(map(int, input().split()))for i in range(n)]
################################################
def count2Dmatrix(i, list):
return sum(c.count(i) for c in list)
def modinv(n, p):
return pow(n, p - 2, p)
def nCr(n, r):
i = 1
while i < r:
n *= (n - i)
i += 1
return n // math.factorial(r)
def GCD(x, y):
x = abs(x)
y = abs(y)
if(min(x, y) == 0):
return max(x, y)
while(y):
x, y = y, x % y
return x
def Divisors(n):
l = []
for i in range(1, int(math.sqrt(n) + 1)):
if (n % i == 0):
if (n // i == i):
l.append(i)
else:
l.append(i)
l.append(n//i)
return l
prime = []
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f = []
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q = []
def dfs(n, d, v, c):
global q
v[n] = 1
x = d[n]
q.append(n)
j = c
for i in x:
if i not in v:
f = dfs(i, d, v, c+1)
j = max(j, f)
# print(f)
return j
# d = {}
"""*******************************************************"""
money, index_list, result = [], [], []
for i in range(5*100000+1):
index_list.append(i)
for q in range(inin()):
a = lin()
index = 0
if a[0] == 1:
money.append(a[1])
# print(money)
elif a[0] == 2:
# print(index_list[0] + 1)
result.append(index_list[0] + 1)
money[index_list[0]] = 0
index_list.pop(0)
else:
index = money.index(max(money))
# print(money, index)
result.append(index + 1)
money[index] = 0
index_list.remove(index)
# print(index_list)
print(*result)
================================================
FILE: CODEFORCES/C/20-21 ICPC, NERC (Mirror)/E.cpp
================================================
/// In the name of Allah SWT
using namespace std;
#include <bits/stdc++.h>
#define ll long long int
#define dd double
#define scl(x) scanf("%lld", &x)
#define scll(x, y) scanf("%lld %lld", &x, &y)
#define scd(x) scanf("%lf", &x)
#define scdd(x, y) scanf("%lf %lf", &x, &y)
#define prl(x) printf("%lld\n", x)
#define prll(x, y) printf("%lld %lld\n", x, y)
#define prYes printf("YES\n")
#define prNo printf("NO\n")
#define aNewLine printf("\n")
#define ON(n, i) (n | (1LL << i))
#define OFF(n, i) (n & (~(1LL << i)))
#define CHK(n, i) (n & (1LL << i))
#define For(i, x, y) for (ll i = x; i < y; i++)
#define Mem(ara, x) memset(ara, x, sizeof(ara))
#define pb push_back
#define pll pair<ll, ll>
#define ff first
#define ss second
#define maxn 200005LL ///2x10^5 + 5
//#define maxn 1000006LL ///10^6 + 6
//#define maxn 1000000009LL ///10^9 + 9
#define pi acos(-1.00)
#define eps 0.0000000001 ///10^-10
#define inf LONG_LONG_MAX
#define mod 1000000007LL ///10^9+7
ll t, test, temp;
ll n, m, k, kount;
ll a, b, c, ans, u, v;
ll x, y, z = -1, maxi, mini;
void solve()
{
ll ara[4];
scll(ara[0], ara[1]);
scll(ara[2], ara[3]);
sort(ara, ara + 4);
prl(ara[0] * ara[2]);
}
int main()
{
test = 1;
scl(test);
while (test--)
solve();
}
================================================
FILE: CODEFORCES/C/20-21 ICPC, NERC (Mirror)/N.cpp
================================================
/// In the name of Allah SWT
using namespace std;
#include <bits/stdc++.h>
#define ll long long int
#define dd double
#define scl(x) scanf("%lld", &x)
#define scll(x, y) scanf("%lld %lld", &x, &y)
#define scd(x) scanf("%lf", &x)
#define scdd(x, y) scanf("%lf %lf", &x, &y)
#define prl(x) printf("%lld\n", x)
#define prll(x, y) printf("%lld %lld\n", x, y)
#define prYes printf("YES\n")
#define prNo printf("NO\n")
#define aNewLine printf("\n")
#define ON(n, i) (n | (1LL << i))
#define OFF(n, i) (n & (~(1LL << i)))
#define CHK(n, i) (n & (1LL << i))
#define For(i, x, y) for (ll i = x; i < y; i++)
#define Mem(ara, x) memset(ara, x, sizeof(ara))
#define pb push_back
#define pll pair<ll, ll>
#define ff first
#define ss second
#define maxn 200005LL ///2x10^5 + 5
//#define maxn 1000006LL ///10^6 + 6
//#define maxn 1000000009LL ///10^9 + 9
#define pi acos(-1.00)
#define eps 0.0000000001 ///10^-10
#define inf LONG_LONG_MAX
#define mod 1000000007LL ///10^9+7
ll t, test, temp;
ll n, m, k, kount;
ll a, b, c, ans, u, v;
ll x, y, z = -1, maxi, mini;
ll c1, c2, c3, a1, a2, a3, a4, a5;
void solve()
{
cin >> c1 >> c2 >> c3;
cin >> a1 >> a2 >> a3 >> a4 >> a5;
if (a1 <= c1)
{
c1 -= a1;
}
else
{
prNo;
return;
}
if (a2 <= c2)
{
c2 -= a2;
}
else
{
prNo;
return;
}
if (a3 <= c3)
{
c3 -= a3;
}
else
{
prNo;
return;
}
if (a4 <= c1 + c3)
{
if (a4 <= c1)
{
c1 -= a4;
}
else
{
c3 -= (a4 - c1);
c1 = 0;
}
}
else
{
prNo;
return;
}
if (a5 <= c2 + c3)
{
}
else
{
prNo;
return;
}
prYes;
}
int main()
{
test = 1;
scl(test);
while (test--)
solve();
}
================================================
FILE: CODEFORCES/C/231A-Team.cpp
================================================
#include<bits/stdc++.h>
int main()
{
long long n,a,b,c,cnt=0,i;
scanf("%lld",&n);
while(n--)
{
scanf("%lld %lld %lld",&a,&b,&c);
if(a+b+c>=2)
cnt++;
}
printf("%lld",cnt);
}
================================================
FILE: CODEFORCES/C/282A-Bit++.cpp
================================================
#include<bits/stdc++.h>
int main()
{
int n,x=0;
char s[4];
scanf("%d",&n);
while(n--)
{
scanf("%s",s);
if(s[1]=='+')
x++;
else
x--;
}
printf("%d",x);
return 0;
}
================================================
FILE: CODEFORCES/C/2A.cpp
================================================
#include <bits/stdc++.h>
using namespace std;
// Input macros
#define si(n) scanf("%d",&n)
#define sc(n) scanf("%c",&n)
#define sl(n) scanf("%lld",&n)
#define sf(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
// Useful constants
#define INF (int)1e9
#define EPS 1e-9
#define MOD1 1000000009
#define MOD2 1000000007
// Useful hardware instructions
#define bitcount __builtin_popcount
#define gcd __gcd
// Useful container manipulation / traversal macros
#define FORI(i,n) for(i=0 ; i< n ;i++)
#define FORD(i,n) for(i=n-1; i>=0 ;i--)
#define FORall(i,a,b) for(i=a ; i<=b ;i++)
#define FOReach(v, c) for( typeof( (c).begin()) v = (c).begin(); v != (c).end(); ++v)
#define all(a) a.begin(), a.end()
#define in(a,b) ( (b).find(a) != (b).end())
#define pb push_back
#define fill(a,v) memset(a, v, sizeof a)
#define sz(a) ((int)(a.size()))
#define mp make_pair
// Some common useful functions
#define MAX(a,b) ( (a) > (b) ? (a) : (b))
#define MIN(a,b) ( (a) < (b) ? (a) : (b))
#define checkbit(n,b) ( (n >> b) & 1)
#define DREP(a) sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind) (lower_bound(all(arr),ind)-arr.begin())
// datatypes
#define ll long long int
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define vi vector<int>
#define pii pair<int,int>
#define gc getchar
#define pc putchar
int main()
{
map<string,int>score,test;
map<string,int>::iterator it;
string s[1001];
int i,m=0,n,a[1001];
cin>>n;
for(i=0;i<n;i++)
{
cin>>s[i]>>a[i];
score[s[i]]+=a[i];
}
it=score.begin();
while(it!=score.end())
cout<<it->first<<" got "<<it->second<<endl;
}
================================================
FILE: CODEFORCES/C/3A.cpp
================================================
#include <bits/stdc++.h>
using namespace std;
// Input macros
#define si(n) scanf("%d",&n)
#define sc(n) scanf("%c",&n)
#define sl(n) scanf("%lld",&n)
#define sf(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
// Useful constants
#define INF (int)1e9
#define EPS 1e-9
#define MOD1 1000000009
#define MOD2 1000000007
// Useful hardware instructions
#define bitcount __builtin_popcount
#define gcd __gcd
// Useful container manipulation / traversal macros
#define FORI(i,n) for(i=0 ; i< n ;i++)
#define FORD(i,n) for(i=n-1; i>=0 ;i--)
#define FORall(i,a,b) for(i=a ; i<=b ;i++)
#define FOReach(v, c) for( typeof( (c).begin()) v = (c).begin(); v != (c).end(); ++v)
#define all(a) a.begin(), a.end()
#define in(a,b) ( (b).find(a) != (b).end())
#define pb push_back
#define fill(a,v) memset(a, v, sizeof a)
#define sz(a) ((int)(a.size()))
#define mp make_pair
// Some common useful functions
#define MAX(a,b) ( (a) > (b) ? (a) : (b))
#define MIN(a,b) ( (a) < (b) ? (a) : (b))
#define checkbit(n,b) ( (n >> b) & 1)
#define DREP(a) sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind) (lower_bound(all(arr),ind)-arr.begin())
// datatypes
#define ll long long int
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define vi vector<int>
#define pii pair<int,int>
#define gc getchar
#define pc putchar
char a[3], b[3], p, q;
int x, y;
int main()
{
gets(a), gets(b);
x = a[0] - b[0], y = a[1] - b[1];
if (x < 0)
p = 'R', x = -x;
else
p = 'L';
if (y < 0)
q = 'U', y = -y;
else
q = 'D';
cout<<(x>y?x:y)<<"\n";
while(x>0||y>0)
{
if(x>0)
{putchar(p);
--x;}
if(y>0)
{putchar(q);
--y;}
cout<<"\n";
}
}
================================================
FILE: CODEFORCES/C/428,div 2/A.Arya and Bran.c
================================================
#include<stdio.h>
int main()
{
int n,k,i,sum=0,count=0,r=0;
scanf("%d %d",&n,&k);
int a[n];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
{
sum=sum+a[i]+r;
if(sum>8)
{
r=sum-8;
count++;
}
else
{
count++;
sum=0;
}
}
if(k>8*n)
printf("-1");
else
printf("%d",count);
}
================================================
FILE: CODEFORCES/C/429,div 2/A.c
================================================
#include<stdio.h>
#include<stdlib.h>
#include<string.h
#include<math.h>
int main()
{
int n,k,i;
scanf("%d %d",&n,&k);
char sx[n];
for(i=0;i<n;i++)
{
scanf("%s",sx[i]);
}
for(i=0;i<n;i++)
{
if(sx[i]==sx[0])
count++;
}
}
================================================
FILE: CODEFORCES/C/433,div 2/A.Fraction.c
================================================
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main()
{
int sum,a,b,i,j;
scanf("%d",&sum);
if(sum%2!=0)
{
a=sum/2;b=sum/2+1;
}
else
{
if((sum/2)%2==0)
{
a=sum/2-1;b=sum/2+1;
}
else
{
a=sum/2-2;b=sum/2+2;
}
}
printf("%d %d",a,b);
}
================================================
FILE: CODEFORCES/C/458,div 1+2/A.cpp
================================================
#include <bits/stdc++.h>
using namespace std;
// Input macros
#define si(n) scanf("%d",&n)
#define sc(n) scanf("%c",&n)
#define sl(n) scanf("%lld",&n)
#define sf(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
// Useful constants
#define INF (int)1e9
#define EPS 1e-9
#define MOD1 1000000009
#define MOD2 1000000007
// Useful hardware instructions
#define bitcount __builtin_popcount
#define gcd __gcd
// Useful container manipulation / traversal macros
#define FORI(i,n) for(i=0 ; i< n ;i++)
#define FORD(i,n) for(i=n-1; i>=0 ;i--)
#define FORall(i,a,b) for(i=a ; i<=b ;i++)
#define FOReach(v, c) for( typeof( (c).begin()) v = (c).begin(); v != (c).end(); ++v)
#define all(a) a.begin(), a.end()
#define in(a,b) ( (b).find(a) != (b).end())
#define pb push_back
#define fill(a,v) memset(a, v, sizeof a)
#define sz(a) ((int)(a.size()))
#define mp make_pair
// Some common useful functions
#define MAX(a,b) ( (a) > (b) ? (a) : (b))
#define MIN(a,b) ( (a) < (b) ? (a) : (b))
#define checkbit(n,b) ( (n >> b) & 1)
#define DREP(a) sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind) (lower_bound(all(arr),ind)-arr.begin())
// datatypes
#define ll long long int
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define vi vector<int>
#define pii pair<int,int>
#define gc getchar
#define pc putchar
int main()
{
ll n,i,j=0,mx;
ll iVar;
float fVar;
scanf("%lld",&n);
ll a[n],b[n];
FORI(i,n)
scanf("%lld",&a[i]);
FORI(i,n)
{
if(a[i]>=0)
{
fVar=sqrt((double)a[i]);
iVar=fVar;
if(iVar!=fVar)
{
b[j]=a[i];
j++;
}
}
if(a[i]<0)
{
b[j]=a[i];
j++;
}
}
mx=b[0];
FORI(i,j)
{
if(b[i]>mx)
mx=b[i];
}
cout<<mx<<endl;
}
================================================
FILE: CODEFORCES/C/459 (Div. 2)/A. Eleven.cpp
================================================
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,j=0,x=0,y=1;
scanf("%lld",&n);
char s[1001];
for(long long i=1;i<=n;i++)
{
if(x<=n&&y<=n)
{
j=x+y;
x=y;
y=j;
}
if(s[i]!='O')
s[i]='o';
if(j<=n)
s[j]='O';
}
for(long long i=1;i<=n;i++)
printf("%c",s[i]);
}
================================================
FILE: CODEFORCES/C/463(1+2)/A.Palidromic Supersequence.cpp
================================================
#include<bits/stdc++.h>
using namespace std;
int main()
{
char a[1010];
scanf("%s",a);
cout<<a;
for(long long i=strlen(a)-1; i>=0; i--)
{
printf("%c",a[i]);
}
}
================================================
FILE: CODEFORCES/C/463(1+2)/B. Recursive Queries.cpp
================================================
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,l,r,k,i,j,a,b,c=0,cnt=0;
scanf("%lld",&n);
while(n--)
{
scanf("%lld%lld%lld",&l,&r,&k);
for(i=l;i<=r;i++)
{
a=l/10;
b=l%10;
c=a*b;
if(c==k)
cnt++;
}
printf("%lld",cnt);
}
}
================================================
FILE: CODEFORCES/C/465,div 2/A. Fafa and his Company.cpp
================================================
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,i,cnt=0;
cin>>n;
for(i=1;i<n;i++)
{
if(n%i==0)
cnt++;
}
cout<<cnt<<endl;
}
================================================
FILE: CODEFORCES/C/465,div 2/B. Fafa and the Gates.cpp
================================================
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,i,x=0,y=0,p,q,cnt=0;
scanf("%lld",&n);
char s[n+1];
scanf("%s",s);
for(i=0;i<n;i++)
{
if(s[i]=='U')
y++;
else if(s[i]=='R')
x++;
if(x==y)
{
p=x,q=y;
if(s[i]==s[i+1]&&s[i+1]=='U')
{
q++;
if(y<q)
cnt++;
}
else if(s[i]==s[i+1]&&s[i+1]=='R')
{
p++;
if(x<p)
cnt++;
}
}
}
printf("%lld\n",cnt);
}
================================================
FILE: CODEFORCES/C/478A-Initial Bet.cpp
================================================
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long a,b,c,d,e,x;
scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e);
if(a>=0&&b>=0&&c>=0&&d>=0&&e>=0)
{
x=(a+b+c+d+e)/5;
if((a+b+c+d+e)%5==0&&(a+b+c+d+e)!=0)
cout<<x<<endl;
else
cout<<"-1\n";
}
else
cout<<"-1\n";
}
================================================
FILE: CODEFORCES/C/4A-dividing watermelon.c
================================================
#include<stdio.h>
int main()
{
int w;
scanf("%d",&w);
if(1<=w&&w<=100&&w!=2)
{
if(w%2==0)
printf("YES");
else
printf("NO");
}
else
printf("NO");
}
================================================
FILE: CODEFORCES/C/4A.Chat Server's Outgoing Traffic.c
================================================
================================================
FILE: CODEFORCES/C/50A-Domino Piling.c
================================================
#include<stdio.h>
int main()
{
int M,N,x;
scanf("%d %d",&M,&N);
if((M*N)<=256)
x=(M*N)/2;
printf("%d",x);
}
================================================
FILE: CODEFORCES/C/677A-Vanya and Fence.cpp
================================================
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long a,n,h,i,cnt=0;
cin>>n>>h;
while(n--)
{
scanf("%lld",&a);
if(a<=h)
cnt++;
else
cnt+=2;
}
printf("%lld\n",cnt);
}
================================================
FILE: CODEFORCES/C/6A.triangle.cpp
================================================
#include <bits/stdc++.h>
using namespace std;
// Input macros
#define si(n) scanf("%d",&n)
#define sc(n) scanf("%c",&n)
#define sl(n) scanf("%lld",&n)
#define sf(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
// Useful constants
#define INF (int)1e9
#define EPS 1e-9
#define MOD1 1000000009
#define MOD2 1000000007
// Useful hardware instructions
#define bitcount __builtin_popcount
#define gcd __gcd
// Useful container manipulation / traversal macros
#define FORI(i,n) for(i=0 ; i< n ;i++)
#define FORD(i,n) for(i=n-1; i>=0 ;i--)
#define FORall(i,a,b) for(i=a ; i<=b ;i++)
#define FOReach(v, c) for( typeof( (c).begin()) v = (c).begin(); v != (c).end(); ++v)
#define all(a) a.begin(), a.end()
#define in(a,b) ( (b).find(a) != (b).end())
#define pb push_back
#define fill(a,v) memset(a, v, sizeof a)
#define sz(a) ((int)(a.size()))
#define mp make_pair
// Some common useful functions
#define MAX(a,b) ( (a) > (b) ? (a) : (b))
#define MIN(a,b) ( (a) < (b) ? (a) : (b))
#define checkbit(n,b) ( (n >> b) & 1)
#define DREP(a) sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind) (lower_bound(all(arr),ind)-arr.begin())
// datatypes
#define ll long long int
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define vi vector<int>
#define pii pair<int,int>
#define gc getchar
#define pc putchar
int main()
{
int ax[10],i,j,temp,flag=0;
for(i=1;i<=4;i++)
scanf("%d",&ax[i]);3
for(i=1;i<=4;i++)
for(j=i+1;j<=4;j++)
{
if(ax[i]>ax[j])
{
temp=ax[i];
ax[i]=ax[j];
ax[j]=temp;
}
}
if((ax[2]+ax[3])>ax[4]||(ax[1]+ax[2])>ax[3])
printf("TRIANGLE\n");
else if((ax[2]+ax[3])==ax[4]||(ax[1]+ax[2])==ax[3])
printf("SEGMENT\n");
else if((ax[1]+ax[2]<ax[3])||(ax[1]+ax[2]<ax[4]))
printf("IMPOSSIBLE\n");
}
================================================
FILE: CODEFORCES/C/705A-Hulk.cpp
================================================
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,i;
scanf("%lld",&n);
for(i=1;i<=n;i++)
{
if(i%2!=0&&i==n)
cout<<"I hate ";
else if(i%2!=0&&i!=n)
cout<<"I hate that ";
else if(i%2==0&&i==n)
cout<<"I love ";
else if(i%2==0&&i!=n)
cout<<"I love that ";
}
cout<<"it"<<endl;
}
================================================
FILE: CODEFORCES/C/71A. Way Too Long Words.cpp
================================================
#include<bits/stdc++.h>
int main()
{
int n,i,a;
char sx[100];
scanf("%d",&n);
for(i=1;n>=i;i++)
{
scanf("%s",sx);
int a=(int)strlen(sx);
if(a>10)
printf("%c%d%c\n",sx[0],a-2,sx[a-1]);
else
printf("%s\n",sx);
}
}
================================================
FILE: CODEFORCES/C/7A. Kalevitch and Chess.cpp
================================================
#include <bits/stdc++.h>
using namespace std;
// Input macros
#define si(n) scanf("%d",&n)
#define sc(n) scanf("%c",&n)
#define sl(n) scanf("%lld",&n)
#define sf(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
// Useful constants
#define INF (int)1e9
#define EPS 1e-9
#define MOD1 1000000009
#define MOD2 1000000007
// Useful hardware instructions
#define bitcount __builtin_popcount
#define gcd __gcd
// Useful container manipulation / traversal macros
#define FORI(i,n) for(i=0 ; i< n ;i++)
#define FORD(i,n) for(i=n-1; i>=0 ;i--)
#define FORall(i,a,b) for(i=a ; i<=b ;i++)
#define FOReach(v, c) for( typeof( (c).begin()) v = (c).begin(); v != (c).end(); ++v)
#define all(a) a.begin(), a.end()
#define in(a,b) ( (b).find(a) != (b).end())
#define pb push_back
#define fill(a,v) memset(a, v, sizeof a)
#define sz(a) ((int)(a.size()))
#define mp make_pair
// Some common useful functions
#define MAX(a,b) ( (a) > (b) ? (a) : (b))
#define MIN(a,b) ( (a) < (b) ? (a) : (b))
#define checkbit(n,b) ( (n >> b) & 1)
#define DREP(a) sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind) (lower_bound(all(arr),ind)-arr.begin())
// datatypes
#define ll long long int
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define vi vector<int>
#define pii pair<int,int>
#define gc getchar
#define pc putchar
int main()
{
char s[8][9];
int i,j,cnt=0,t,x=0;
for(i=0;i<8;i++)
{
gets(s[i]);
t=0;
for(j=0;j<8;j++)
if(s[i][j]=='B')t++;
if(t==8)cnt++;
else x=t;
}
cnt=cnt+x;
printf("%d\n",cnt);
return 0;
}
================================================
FILE: CODEFORCES/C/8A. Train and Peter.cpp
================================================
#include <bits/stdc++.h>
using namespace std;
// Input macros
#define si(n) scanf("%d",&n)
#define sc(n) scanf("%c",&n)
#define sl(n) scanf("%lld",&n)
#define sf(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
// Useful constants
#define INF (int)1e9
#define EPS 1e-9
#define MOD1 1000000009
#define MOD2 1000000007
// Useful hardware instructions
#define bitcount __builtin_popcount
#define gcd __gcd
// Useful container manipulation / traversal macros
#define FORI(i,n) for(i=0 ; i< n ;i++)
#define FORD(i,n) for(i=n-1; i>=0 ;i--)
#define FORall(i,a,b) for(i=a ; i<=b ;i++)
#define FOReach(v, c) for( typeof( (c).begin()) v = (c).begin(); v != (c).end(); ++v)
#define all(a) a.begin(), a.end()
#define in(a,b) ( (b).find(a) != (b).end())
#define pb push_back
#define fill(a,v) memset(a, v, sizeof a)
#define sz(a) ((int)(a.size()))
#define mp make_pair
// Some common useful functions
#define MAX(a,b) ( (a) > (b) ? (a) : (b))
#define MIN(a,b) ( (a) < (b) ? (a) : (b))
#define checkbit(n,b) ( (n >> b) & 1)
#define DREP(a) sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind) (lower_bound(all(arr),ind)-arr.begin())
// datatypes
#define ll long long int
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define vi vector<int>
#define pii pair<int,int>
#define gc getchar
#define pc putchar
int main()
{
char a[100001],x[101],y[101];
gets(a),gets(x),gets(y);
}
================================================
FILE: CODEFORCES/C/96A-Football.cpp
================================================
#include<bits/stdc++.h>
int main()
{
char a,sx[100];
scanf("%s",sx);
int i,k=0,p=0;
for(i=0,a=sx[0];strlen(sx)>i;i++)
{
if(a!=sx[i])
p=1;
else
p++;
if(p==7)
break;
a=sx[i];
}
if(p==7)
printf("YES\n");
else
printf("NO\n");
}
================================================
FILE: CODEFORCES/C/A.cpp
================================================
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long l,r,a,s;
cin>>l>>r>>a;
if((l==0&&a==0)||(r==0&&a==0))
s=0;
else
{
if((s=l+r+a)%2==0)
s=l+r+a;
else
s=l+r+a-1;
}
cout<<s;
}
================================================
FILE: CODEFORCES/C/Edu 38(div 2)/A. Word Correction.cpp
================================================
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,i,j,k;
cin>>n;
char s[n+1];
for(i=0;i<=n;i++)
scanf("%c",&s[i]);
for(i=0;i<n;i++)
{
if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='y')
{
if(s[i+1]=='a'||s[i+1]=='e'||s[i+1]=='i'||s[i+1]=='o'||s[i+1]=='u'||s[i+1]=='y')
{
s[i+1]='\0';
}
}
for(j=0,k=0;k<n;k++)
if(s[k]!='\0')
{
s[j]=s[k];
j++;
}
}
for(i=0;i<=n;i++)
if(s[i]!='\0')
printf("%c",s[i]);
}
================================================
FILE: CODEFORCES/C/Edu 39(div 2)/A.cpp
================================================
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,a,s1=0,s2=0;
scanf("%lld",&n);
while(n--)
{
scanf("%lld",&a);
if(a>=0)
s1=s1+a;
else
s2=s2+a;
}
printf("%lld\n",s1-s2);
}
================================================
FILE: CODEFORCES/C/Edu 39(div 2)/B.cpp
================================================
#include<bits/stdc++.h>
using namespace std;
int main()
{
double a,b;long long i;
scanf("%lf %lf",&a,&b);
a=a/1000000000000000000,b=b/1000000000000000000;
for(i=0;;i++)
{
if(a==0&&b==0)
break;
else if(a>=2*b&&a!=0&&b!=0)
a=a-2*b;
else if(b>=2*a&&a!=0&&b!=0)
b=b-2*a;
else
break;
}
printf("%lf %lf\n",a,b);
}
================================================
FILE: CODEFORCES/C/Practice - ECPC 2019/307919A_T2.cpp
================================================
/// In the name of Allah SWT
using namespace std;
#include <bits/stdc++.h>
#define ll long long int
#define dd double
#define scl(x) scanf("%lld", &x)
#define scll(x, y) scanf("%lld %lld", &x, &y)
#define scd(x) scanf("%lf", &x)
#define scdd(x, y) scanf("%lf %lf", &x, &y)
#define prl(x) printf("%lld\n", x)
#define prll(x, y) printf("%lld %lld\n", x, y)
#define prYes printf("YES\n")
#define prNo printf("NO\n")
#define aNewLine printf("\n")
#define ON(n, i) (n|(1LL<<i))
#define OFF(n, i) (n&(~(1LL<<i)))
#define CHK(n, i) (n&(1LL<<i))
#define For(i, x, y) for(ll i = x; i < y; i++)
#define Mem(ara, x) memset(ara, x, sizeof(ara))
#define pb push_back
#define pll pair<ll, ll >
#define ff first
#define ss second
#define maxn 200005 ///2x10^5 + 5
//#define maxn 1000006 ///10^6 + 6
//#define maxn 1000000009 ///10^9 + 9
#define pi acos(-1.00)
#define eps 0.0000000001 ///10^-10
#define inf LONG_LONG_MAX
#define mod 1000000007 ///10^9+7
ll t, test, temp;
ll n, m, k, kount;
ll a, b, c, ans, u, v;
ll x, y, z = -1, maxi, mini;
string str;
void solve() {
scl(n);
cin >> str;
ans = inf;
ll target = 1;
For (i, 0, n) {
for (ll j = i+1; j < n and str[i] == 'A'; j++) {
if (str[j]-'A' == target and target == 'Z'-'A') {
ans = min(ans, j-i+1);
target = 1;
break;
}
else if (str[j]-'A' == target) {
target++;
}
}
target = 1;
}
cout << ans << endl;
}
int main() {
#ifndef ONLINE_JUDGE
#else
freopen("collectingofficer.in", "r", stdin);
#endif
test = 1;
scl(test);
while (test--) solve();
}
================================================
FILE: CODEFORCES/C/Practice - ECPC 2019/307919B.cpp
================================================
/// In the name of Allah SWT
using namespace std;
#include <bits/stdc++.h>
#define ll long long int
#define dd double
#define scl(x) scanf("%lld", &x)
#define scll(x, y) scanf("%lld %lld", &x, &y)
#define scd(x) scanf("%lf", &x)
#define scdd(x, y) scanf("%lf %lf", &x, &y)
#define prl(x) printf("%lld\n", x)
#define prll(x, y) printf("%lld %lld\n", x, y)
#define prYes printf("YES\n")
#define prNo printf("NO\n")
#define aNewLine printf("\n")
#define ON(n, i) (n|(1LL<<i))
#define OFF(n, i) (n&(~(1LL<<i)))
#define CHK(n, i) (n&(1LL<<i))
#define For(i, x, y) for(ll i = x; i < y; i++)
#define Mem(ara, x) memset(ara, x, sizeof(ara))
#define pb push_back
#define pll pair<ll, ll >
#define ff first
#define ss second
#define maxn 200005 ///2x10^5 + 5
//#define maxn 1000006 ///10^6 + 6
//#define maxn 1000000009 ///10^9 + 9
#define pi acos(-1.00)
#define eps 0.0000000001 ///10^-10
#define inf LONG_LONG_MAX
#define mod 1000000007 ///10^9+7
ll t, test, temp;
ll n, m, k, kount;
ll a, b, c, ans, u, v;
ll x, y, z = -1, maxi, mini;
double heron(double a, double b, double c)
{
if (max({a, b, c}) * 2 > a + b + c)
return 0;
double s = (a + b + c) / 2.0;
return sqrt(s * (s - a) * (s - b) * (s - c));
}
double solve(double x, double y, double z)
{
double ret = 0;
double l = z, r = min(z + k, x + y);
for (int i = 0; i < 100; ++i)
{
double per = (r - l) / 3.0;
if (heron(x, y, l + per) > heron(x, y, r - per))
r -= per;
else
l += per;
}
return heron(x, y, l);
}
dd ans2;
void solve2() {
ll ara[3];
cin >> ara[0] >> ara[1] >> ara[2] >> k;
sort(ara, ara+3);
ans2 = solve(ara[1], ara[2], ara[0]);
cout << fixed << setprecision(11) << ans2 << endl;
}
int main() {
#ifndef ONLINE_JUDGE
#else
freopen("sticks.in", "r", stdin);
#endif
test = 1;
scl(test);
while (test--) solve2();
}
================================================
FILE: CODEFORCES/C/Practice - ECPC 2019/307919G.cpp
================================================
/// In the name of Allah SWT
using namespace std;
#include <bits/stdc++.h>
#define ll long long int
#define dd double
#define scl(x) scanf("%lld", &x)
#define scll(x, y) scanf("%lld %lld", &x, &y)
#define scd(x) scanf("%lf", &x)
#define scdd(x, y) scanf("%lf %lf", &x, &y)
#define prl(x) printf("%lld\n", x)
#define prll(x, y) printf("%lld %lld\n", x, y)
#define prYes printf("YES\n")
#define prNo printf("NO\n")
#define aNewLine printf("\n")
#define ON(n, i) (n|(1LL<<i))
#define OFF(n, i) (n&(~(1LL<<i)))
#define CHK(n, i) (n&(1LL<<i))
#define For(i, x, y) for(ll i = x; i < y; i++)
#define Mem(ara, x) memset(ara, x, sizeof(ara))
#define pb push_back
#define pll pair<ll, ll >
#define ff first
#define ss second
#define maxn 200005 ///2x10^5 + 5
//#define maxn 1000006 ///10^6 + 6
//#define maxn 1000000009 ///10^9 + 9
#define pi acos(-1.00)
#define eps 0.0000000001 ///10^-10
#define inf LONG_LONG_MAX
#define mod 1000000007 ///10^9+7
ll t, test, temp;
ll n, m, k, kount;
ll a, b, c, ans, u, v;
ll x, y, z = -1, maxi, mini;
string str;
bool entered = false;
void solve() {
scll(a, b);
if (not entered) {
if (a == b) {
ans = a;
}
else {
ans = 1;
}
entered = true;
}
else {
if (a != b) {
ans = 1;
}
else {
ans = __gcd(a, ans);
}
}
cout << ans << endl;
}
int main() {
#ifndef ONLINE_JUDGE
#else
freopen("gcd.in", "r", stdin);
#endif
test = 1;
scl(test);
while (test--) solve();
}
================================================
FILE: CODEFORCES/C/Practice - ECPC 2019/307919J_T2.cpp
================================================
/// In the name of Allah SWT
using namespace std;
#include <bits/stdc++.h>
#define ll long long int
#define dd double
#define scl(x) scanf("%lld", &x)
#define scll(x, y) scanf("%lld %lld", &x, &y)
#define scd(x) scanf("%lf", &x)
#define scdd(x, y) scanf("%lf %lf", &x, &y)
#define prl(x) printf("%lld\n", x)
#define prll(x, y) printf("%lld %lld\n", x, y)
#define prYes printf("YES\n")
#define prNo printf("NO\n")
#define aNewLine printf("\n")
#define ON(n, i) (n|(1LL<<i))
#define OFF(n, i) (n&(~(1LL<<i)))
#define CHK(n, i) (n&(1LL<<i))
#define For(i, x, y) for(ll i = x; i < y; i++)
#define Mem(ara, x) memset(ara, x, sizeof(ara))
#define pb push_back
#define pll pair<ll, ll >
#define ff first
#define ss second
#define maxn 200005 ///2x10^5 + 5
//#define maxn 1000006 ///10^6 + 6
//#define maxn 1000000009 ///10^9 + 9
#define pi acos(-1.00)
#define eps 0.0000000001 ///10^-10
#define inf LONG_LONG_MAX
#define mod 1000000007 ///10^9+7
ll t, test, temp;
ll n, m, k, kount;
ll a, b, c, ans, u, v;
ll x, y, z = -1, maxi, mini;
string str;
void solve() {
cin >> n;
cin >> str;
ll bPosGiven = -1;
ll aKount = 0, cKount = 0;
bool aPresent = false, cPresent = false, bPresent = false;
For (i, 0, n) {
if (str[i] == 'b') {
bPosGiven = i;
bPresent = true;
}
else if (str[i] == 'a') {
aKount++;
aPresent = true;
}
else {
cKount++;
cPresent = true;
}
}
if (bPresent and aPresent and (not cPresent)) {
prl(z-z);
return;
}
if (bPresent and cPresent and (not aPresent)) {
prl(z-z);
return;
}
if (aPresent and (not bPresent) and (not cPresent)) {
prl(z-z);
return;
}
if ((not aPresent) and (not bPresent) and cPresent) {
prl(z-z);
return;
}
if (bPosGiven == -1) {
prl(z);
return;
}
// abc
string str1 = str;
ll reqBPos = aKount;
ll z1 = 0, z2 = 0;
if (str1[reqBPos] != 'b') {
swap(str1[bPosGiven], str1[reqBPos]);
z1++;
}
for (ll i = 0; i < n; i++) {
if (str1[i] == 'b') {
break;
}
if (str1[i] != 'a') {
z1++;
}
}
//cba
string str2 = str;
reqBPos = cKount;
if (str2[reqBPos] != 'b') {
swap(str2[bPosGiven], str2[reqBPos]);
z2++;
}
for (ll i = 0; i < n; i++) {
if (str2[i] == 'b') {
break;
}
if (str2[i] != 'c') {
z2++;
}
}
cout << min(z1, z2) << endl;
}
int main() {
#ifndef ONLINE_JUDGE
#else
freopen("abc.in", "r", stdin);
#endif
test = 1;
//scl(test);
while (test--) solve();
}
================================================
FILE: CODEFORCES/C/Practice - ECPC 2019/307919K.cpp
================================================
/// In the name of Allah SWT
using namespace std;
#include <bits/stdc++.h>
#define ll long long int
#define dd double
#define scl(x) scanf("%lld", &x)
#define scll(x, y) scanf("%lld %lld", &x, &y)
#define scd(x) scanf("%lf", &x)
#define scdd(x, y) scanf("%lf %lf", &x, &y)
#define prl(x) printf("%lld\n", x)
#define prll(x, y) printf("%lld %lld\n", x, y)
#define prYes printf("YES\n")
#define prNo printf("NO\n")
#define aNewLine printf("\n")
#define ON(n, i) (n|(1LL<<i))
#define OFF(n, i) (n&(~(1LL<<i)))
#define CHK(n, i) (n&(1LL<<i))
#define For(i, x, y) for(ll i = x; i < y; i++)
#define Mem(ara, x) memset(ara, x, sizeof(ara))
#define pb push_back
#define pll pair<ll, ll >
#define ff first
#define ss second
#define maxn 200005 ///2x10^5 + 5
//#define maxn 1000006 ///10^6 + 6
//#define maxn 1000000009 ///10^9 + 9
#define pi acos(-1.00)
#define eps 0.0000000001 ///10^-10
#define inf LONG_LONG_MAX
#define mod 1000000007 ///10^9+7
ll t, test, temp;
ll n, m, k, kount;
ll a, b, c, ans, u, v;
ll x, y, z = -1, maxi, mini;
void solve() {
scl(n);
ll init[n];
ll speed[n];
For (i, 0, n) scl(init[i]);
For (i, 0, n) scl(speed[i]);
/*
k = 25;
while (k--) {
For (i, 0, n) {
printf("%lld ", init[i]);
init[i] += speed[i];
}
aNewLine;
}
*/
ll secondSpent = 0;
For (i, 1, n) {
init[i] += speed[i]*secondSpent;
// printf("%lld -> ", i);
// For (j, 0, n) {
// printf(":%lld ", init[j]);
// }
// aNewLine;
if (init[i-1] <= init[i]) {
}
else {
ll toMovUp = init[i-1]-init[i];
ll numerator = init[i-1] - init[i];
ll denominator = speed[i] - speed[i-1];
ll timeReq = numerator / denominator;
if (timeReq < 0) {
prl(z);
return;
}
if (timeReq*denominator != numerator) {
timeReq++;
}
init[i] += speed[i]*timeReq;
secondSpent += timeReq;
}
// printf("%lld -> ", i);
// For (j, 0, n) {
// printf(":%lld ", init[j]);
// }
// aNewLine;
}
prl(secondSpent);
}
int main() {
#ifndef ONLINE_JUDGE
#else
freopen("plants.in", "r", stdin);
#endif
test = 1;
//scl(test);
while (test--) solve();
}
================================================
FILE: CODEFORCES/C/Practice - ECPC 2019/307919M.cpp
================================================
/// In the name of Allah SWT
using namespace std;
#include <bits/stdc++.h>
#define ll long long int
#define dd double
#define scl(x) scanf("%lld", &x)
#define scll(x, y) scanf("%lld %lld", &x, &y)
#define scd(x) scanf("%lf", &x)
#define scdd(x, y) scanf("%lf %lf", &x, &y)
#define prl(x) printf("%lld\n", x)
#define prll(x, y) printf("%lld %lld\n", x, y)
#define prYes printf("YES\n")
#define prNo printf("NO\n")
#define aNewLine printf("\n")
#define ON(n, i) (n|(1LL<<i))
#define OFF(n, i) (n&(~(1LL<<i)))
#define CHK(n, i) (n&(1LL<<i))
#define For(i, x, y) for(ll i = x; i < y; i++)
#define Mem(ara, x) memset(ara, x, sizeof(ara))
#define pb push_back
#define pll pair<ll, ll >
#define ff first
#define ss second
#define maxn 200005 ///2x10^5 + 5
//#define maxn 1000006 ///10^6 + 6
//#define maxn 1000000009 ///10^9 + 9
#define pi acos(-1.00)
#define eps 0.0000000001 ///10^-10
#define inf LONG_LONG_MAX
#define mod 1000000007 ///10^9+7
ll t, test, temp;
ll n, m, k, kount;
ll a, b, c, ans, u, v;
ll x, y, z = -1, maxi, mini;
string str;
void solve() {
cin >> str;
ans = 9*(str.length());
bool allothernine = true;
For (i, 1, str.length()) {
if (str[i] != '9') {
allothernine = false;
}
}
ll firstNum = str[0]-'0';
ans -= (9-firstNum);
if (not allothernine) ans--;
cout << ans << endl;
}
int main() {
#ifndef ONLINE_JUDGE
#else
freopen("lis.in", "r", stdin);
#endif
test = 1;
//scl(test);
while (test--) solve();
}
================================================
FILE: CODEFORCES/C/Practice - ECPC 2019/307919N.cpp
================================================
/// In the name of Allah SWT
using namespace std;
#include <bits/stdc++.h>
#define ll long long int
#define dd double
#define scl(x) scanf("%lld", &x)
#define scll(x, y) scanf("%lld %lld", &x, &y)
#define scd(x) scanf("%lf", &x)
#define scdd(x, y) scanf("%lf %lf", &x, &y)
#define prl(x) printf("%lld\n", x)
#define prll(x, y) printf("%lld %lld\n", x, y)
#define prYes printf("YES\n")
#define prNo printf("NO\n")
#define aNewLine printf("\n")
#define ON(n, i) (n|(1LL<<i))
#define OFF(n, i) (n&(~(1LL<<i)))
#define CHK(n, i) (n&(1LL<<i))
#define For(i, x, y) for(ll i = x; i < y; i++)
#define Mem(ara, x) memset(ara, x, sizeof(ara))
#define pb push_back
#define pll pair<ll, ll >
#define ff first
#define ss second
#define maxn 200005 ///2x10^5 + 5
//#define maxn 1000006 ///10^6 + 6
//#define maxn 1000000009 ///10^9 + 9
#define pi acos(-1.00)
#define eps 0.0000000001 ///10^-10
#define inf LONG_LONG_MAX
#define mod 1000000007 ///10^9+7
ll t, test, temp;
ll n, m, k, kount;
ll a, b, c, ans, u, v;
ll x, y, z = -1, maxi, mini;
void solve() {
scl(a);
scll(b, c);
if (a == b or b == c or a == c) {
prYes;
}
else {
prNo;
}
}
int main() {
#ifndef ONLINE_JUDGE
#else
freopen("equal.in", "r", stdin);
#endif
test = 1;
scl(test);
while (test--) solve();
}
================================================
FILE: CODEFORCES/C/Untitled1.c
================================================
#include <stdio.h>
#include<math.h>
// Input macros
#define si(n) scanf("%d",&n)
#define sc(n) scanf("%c",&n)
#define sl(n) scanf("%lld",&n)
#define sf(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
// Useful constants
#define INF (int)1e9
#define EPS 1e-9
#define MOD1 1000000009
#define MOD2 1000000007
// Useful hardware instructions
#define bitcount __builtin_popcount
#define gcd __gcd
// Useful container manipulation / traversal macros
#define FORI(i,n) for(i=0 ; i< n ;i++)
#define FORD(i,n) for(i=n-1; i>=0 ;i--)
#define FORall(i,a,b) for(i=a ; i<=b ;i++)
#define FOReach(v, c) for( typeof( (c).begin()) v = (c).begin(); v != (c).end(); ++v)
#define all(a) a.begin(), a.end()
#define in(a,b) ( (b).find(a) != (b).end())
#define pb push_back
#define fill(a,v) memset(a, v, sizeof a)
#define sz(a) ((int)(a.size()))
#define mp make_pair
// Some common useful functions
#define MAX(a,b) ( (a) > (b) ? (a) : (b))
#define MIN(a,b) ( (a) < (b) ? (a) : (b))
#define checkbit(n,b) ( (n >> b) & 1)
#define DREP(a) sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind) (lower_bound(all(arr),ind)-arr.begin())
// datatypes
#define ll long long int
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define vi vector<int>
#define pii pair<int,int>
#define gc getchar
#define pc putchar
int main()
{
int i,j,n, a[5][5];
int ii=0, jj=0;
FORI(i,5)
{
FORI(j,5)
{
si(a[i][j]);
if(a[i][j]==1)
{
ii=i;
jj=j;
}
}
}
printf("%d", abs(jj-2) + abs(ii-2));
}
================================================
FILE: CODEFORCES/C/char in 2D.c
================================================
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main()
{
char ax[3][3];
int i,j;
for(i=1;i<=3;i++)
for(j=1;j<=3;j++)
{
gets(ax);
}
}
================================================
FILE: CODEFORCES/Python/1.Template.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect # c++ upperbound
import math
import heapq
i_m = 9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin(): # take inputs with space. e.g. n, m = spin()
return map(int, stin().split())
def lin(): # takes array as input
return list(map(int, stin().split()))
def matrix(n):
#matrix input
return [list(map(int, input().split()))for i in range(n)]
################################################
def string2intlist(s):
return list(map(int, s))
def calculate_sum(a, N): # sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i, list):
return sum(c.count(i) for c in list)
def modinv(n, p):
return pow(n, p - 2, p)
def nCr(n, r):
i = 1
while i < r:
n *= (n - i)
i += 1
return n // math.factorial(r)
def LCM(x, y):
return (x * y) // math.gcd(x, y)
def Divisors(n):
l = []
for i in range(1, int(math.sqrt(n) + 1)):
if (n % i == 0):
if (n // i == i):
l.append(i)
else:
l.append(i)
l.append(n//i)
return l
def isprime(n):
if n == 2 or n == 3:
return True
if n % 2 == 0 or n % 3 == 0:
return False
for i in range(5, int(math.sqrt(n))+1, 6):
if n % i == 0 or n % (i+2) == 0:
return False
return True
prime = []
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f = []
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q = []
def dfs(n, d, v, c):
global q
v[n] = 1
x = d[n]
q.append(n)
j = c
for i in x:
if i not in v:
f = dfs(i, d, v, c+1)
j = max(j, f)
# print(f)
return j
# d = {}
def knapSack(W, wt, val, n):
K = [[0 for x in range(W + 1)] for x in range(n + 1)]
# Build table K[][] in bottom up manner
for i in range(n + 1):
for w in range(W + 1):
if i == 0 or w == 0:
K[i][w] = 0
elif wt[i-1] <= w:
K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]], K[i-1][w])
else:
K[i][w] = K[i-1][w]
return K[n][W]
def modularExponentiation(x, n):
M = 10**9+7
if(n == 0):
return 1
elif (n % 2 == 0): # n is even
return modularExponentiation((x*x) % M, n//2)
else: # n is odd
return (x * modularExponentiation((x * x) % M, (n - 1) // 2)) % M
def modInverse(a, m):
m0 = m
y = 0
x = 1
if (m == 1):
return 0
while (a > 1):
# q is quotient
q = a // m
t = m
# m is remainder now, process
# same as Euclid's algo
m = a % m
a = t
t = y
# Update x and y
y = x - q * y
x = t
# Make x positive
if (x < 0):
x = x + m0
return x
"""*******************************************************"""
# Round Name: CF 699
# starting time
# start = time.time()
for _ in range(inin()):
n = inin()
a = lin()
================================================
FILE: CODEFORCES/Python/110A. Nearly Lucky Number.py
================================================
n = int(input())
s = str(n)
c = 0
for i in range(len(s)):
if s[i]=='4' or s[i]=='7':
c += 1
if c==4 or c==7:
print("YES")
else:
print("NO")
================================================
FILE: CODEFORCES/Python/116A. Tram.py
================================================
i=lambda:map(int,input().split())
n = int(input())
maxm, capa = 0, 0
for j in range(n):
a,b = i()
if(j==0):
capa = b
if(j>0):
maxm = max(capa, maxm)
capa = capa + b - a
# print(capa, maxm)
print(maxm)
================================================
FILE: CODEFORCES/Python/118B. Present from Lena.py
================================================
n = int(input())
for i in range(n+1):
l = []
for j in range(i+1):
l.append(j)
for j in range(1, i+1):
l.append(l[-j]-j)
q = list([" "]*(n-i))
print(*q,*l)
for i in range(n-1,-1,-1):
l = []
for j in range(i+1):
l.append(j)
for j in range(1, i+1):
l.append(l[-j]-j)
q = list([" "]*(n-i))
print(*q,*l)
================================================
FILE: CODEFORCES/Python/122A. Lucky Division.py
================================================
n = int(input())
flag = 0
for i in[4,7,47,74,44,444,447,474,477,777,774,744]:
if(n%i==0):
flag = 1
break
else:
flag = 0
if flag==1:
print("YES")
else:
print("NO")
================================================
FILE: CODEFORCES/Python/122A.py
================================================
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def MI(): return map(int, sys.stdin.readline().strip().split())
def LI(): return list(map(int, sys.stdin.readline().strip().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().strip().split()]
def LF(): return [float(x) for x in sys.stdin.readline().strip().split()]
def LS(): return sys.stdin.readline().strip().split()
def I(): return int(sys.stdin.readline().strip())
def F(): return float(sys.stdin.readline().strip())
def S(): return sys.stdin.readline().strip()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)
from math import factorial,gcd
from random import choice,randint
from sys import stdin,stdout
inp=stdin.readline
out=stdout.write
def main():
l = [4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777]
n = I()
for i in l:
if n%i==0:
print("YES")
break
else:
print("NO")
================================================
FILE: CODEFORCES/Python/124A. The number of positions.py
================================================
inp=lambda:map(int,input().split())
n,k = inp()
t = int(input())
l = list(inp())
================================================
FILE: CODEFORCES/Python/131A. cAPS lOCK.py
================================================
s = input()
flag = 0
if s[0].isupper():
for i in range(1, len(s)):
if s[i].islower():
flag = 0
break
else:
flag = 1
elif s[0].islower():
for i in range(1, len(s)):
if s[i].islower():
flag = 0
break
else:
flag = 2
if flag == 0 and len(s)!=1:
print(s)
elif len(s)==1 and s[0].islower():
print(s.title())
elif len(s)==1 and s[0].isupper():
print(s.lower())
elif flag == 1:
print(s.lower())
else:
print(s.title())
================================================
FILE: CODEFORCES/Python/1331A. HQ9+.py
================================================
s = input()
flag = 0
# "H" prints "Hello, World!",
# "Q" prints the source code of the program itself,
# "9" prints the lyrics of "99 Bottles of Beer" song,
# "+" increments the value stored in the internal accumulator.
for i in range(len(s)):
if s[i]=='H' or s[i]=='Q' or s[i]=='9': #or s[i]=='+':
flag = 1
break
if flag == 1:
print("YES")
else:
print("NO")
================================================
FILE: CODEFORCES/Python/1341A. Nastya and Rice.py
================================================
t = int(input())
for i in range(t):
#n,a,b,c,d=inp()
a = input().split(' ')
s1 = int(a[1])-int(a[2]); e1 = int(a[1])+int(a[2])
s2 = int(a[3])-int(a[4]); e2 = int(a[3])+int(a[4])
if s2 > e1*int(a[0]) or e2 < s1*int(a[0]):
print("NO")
else:
print("YES")
# if (int(a[0]) * s1, int(a[0]) * e1) in range (s2,e2+1):# or (int(a[0]) * e1) in range (s2,e2+1):
# print("YES")
# else:
# print("NO")
================================================
FILE: CODEFORCES/Python/1343A. Candies.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
for i in range(inin()):
n = inin()
temp = 3
while n%temp > 0:
temp = temp*2 + 1
print(n//temp)
================================================
FILE: CODEFORCES/Python/1343B.py
================================================
t = int(input())
for i in range(t):
a = int(input())
even = [2]
odd = [1]
if a==2 or a%2!=0 or (a//2)%2!=0:
print("NO")
else:
for j in range(0,a//2-1):
even.append(even[j]+2)
for j in range(0, a//4):
odd.append(even[j]-1)
for j in range(a//4, a//2):
odd.append(even[j]+1)
print("YES")
print(*sorted(set(even)), *sorted(set(odd)))
================================================
FILE: CODEFORCES/Python/1351A. A+B (Trial Problem).py
================================================
inp=lambda:map(int,input().split())
for _ in range(int(input())):
n,k=inp()
print(n+k)
================================================
FILE: CODEFORCES/Python/1352B. Square.py
================================================
inp=lambda:map(int,input().split())
for _ in range(int(input())):
a1,b1=inp()
a2,b2=inp()
s1=a1+a2;s2=a1+b2
s3=b1+a2;s4=b1+b2
if (a1+a2==b1 or a1+b2==b1 or b1+b2==a1 or b1+a2==a1):
print("YES")
else:
print("NO")
================================================
FILE: CODEFORCES/Python/139A. Petr and Book.py
================================================
i=lambda:map(int,input().split())
n = int(input())
l=list(i())
c = 0
while True:
if n<=0:
break
j = 0
for j in range(7):
if n<=0:
c = j
break
else:
n = n - l[j]
if c==0:
print(7)
else:
print(c)
================================================
FILE: CODEFORCES/Python/13A.py
================================================
from math import gcd
A = int(input())
s = 0
for i in range(2, A):
x = A
while x!=0:
s += x%i
x = x//i
g = gcd(s, A-2)
print(str(s//g)+"/"+str((A-2)//g))
================================================
FILE: CODEFORCES/Python/149A. Business trip.py
================================================
inp=lambda:map(int,input().split())
t = int(input())
l = list(inp())
s = sorted(l)
sr = s[::-1]
sum,count = 0, 0
for i in range(0,12):
if sum>=t:
break
else:
sum += sr[i]
count += 1
continue
if t>sum:
print(-1)
else:
print(count)
================================================
FILE: CODEFORCES/Python/158B. Taxi.py
================================================
#not solved yet
x=int(input())
a = list(map(int, input().split()))
l = sorted(a)
print(l)
count = 0
vacancy = []
for i in range(x):
if l[i]==4:
count = count+1
vacancy[i]=vacancy.append(0)
else:
for j in range(len(vacancy)):
if vacancy[j] >= l[i]:
vacancy[i] = vacancy[i] - l[i]
else:
vacancy[i] = 4 - l[i]
count = count+1
print(count)
================================================
FILE: CODEFORCES/Python/160A. Twins.py
================================================
inp=lambda:map(int,input().split())
n = int(input())
l=list(inp())
l.sort()
s = sum(l)
# print(l,s)
# print(l[-n])
c = 0
maxm=0
for i in range(1, n+1):
if s < maxm:
break
else:
s = s - l[-i]
maxm = maxm + l[-i]
c = c+1
print(c)
================================================
FILE: CODEFORCES/Python/165A. Supercentral Point.py
================================================
n=int(input())
x=[list(map(int,input().split()))for i in range(n)]
count = 0
for i in range(n):
u, d, l, r = 0, 0, 0, 0
for j in range(n):
if i==j:
continue
else:
if x[i][0]>x[j][0] and x[i][1]==x[j][1]:
r = 1
# else:
# r = 0
if x[i][0]<x[j][0] and x[i][1]==x[j][1]:
l = 1
# else:
# l = 0
if x[i][0]==x[j][0] and x[i][1]<x[j][1]:
d = 1
# else:
# d = 0
if x[i][0]==x[j][0] and x[i][1]>x[j][1]:
u = 1
# else:
# u = 0
if u+d+l+r == 4:
count += 1
print(count)
================================================
FILE: CODEFORCES/Python/199A. Hexadecimal's theorem.py
================================================
print(0, 0, input())
================================================
FILE: CODEFORCES/Python/205A. Little Elephant and Rozdil.py
================================================
import math
inp=lambda:map(int,input().split())
n = int(input())
l = list(inp())
sr = sorted(l)
# print(sr)
if len(sr)==1:
print(1)
exit()
if sr[0]==sr[1]:
print("Still Rozdil")
exit()
minm = l[0]
city = 0
for i in range(n):
if l[i] < minm:
minm = l[i]
city = i
print(city+1)
================================================
FILE: CODEFORCES/Python/208A. Dubstep.py
================================================
s = input()
print(s.replace("WUB"," "))
================================================
FILE: CODEFORCES/Python/214A. System of Equations.py
================================================
inp=lambda:map(int,input().split())
n, m = inp()
count=0
l=[]
for i in range(max(n,m)+1):
for j in range(max(n,m)+1):
if i**2+j==n and i+j**2==m:
if l.count(str(i)+str(j))<1 or l.count(str(j)+str(i))<1:
count += 1
l.append(str(i)+str(j))
# print(l)
print(count)
================================================
FILE: CODEFORCES/Python/215A. Bicycle Chain.py
================================================
inp=lambda:map(int,input().split())
n = int(input())
a = list(inp())
m = int(input())
b = list(inp())
maxm = 0
l=[]
for i in range(m):
for j in range(n):
if b[i]/a[j] - b[i]//a[j] == 0:
maxm = max(maxm, int(b[i]/a[j]))
l.append(int(b[i]/a[j]))
print(l.count(maxm))
================================================
FILE: CODEFORCES/Python/219A. k-String.py
================================================
# NOT solved yet
inp=lambda:map(int,input().split())
n = int(input())
s = input()
sr = sorted(list(set(s)))
sr2 = "".join(sr)
flag = 1
for i in range(len(sr)):
if i+1==len(sr):
break
if s.count(sr[i])==s.count(sr[i+1]):
print(s.count(sr[i]))
flag = 1
else:
flag = 0
if flag==0:
print(-1)
exit()
l = []
for i in range(s.count(sr[0])):
l.append(sr2)
print("".join(l))
================================================
FILE: CODEFORCES/Python/221A. Little Elephant and Function.py
================================================
n = int(input())
l = []
sr = []
for i in range(1,n+1):
l.append(i)
if i==n:
sr = sorted(l)
sr.insert(0, n)
del sr[-1]
print(*sr)
================================================
FILE: CODEFORCES/Python/222A. Shooshuns and Sequence.py
================================================
inp=lambda:map(int,input().split())
n,k = inp()
l = list(inp())
temp = l[k-1]
count = 0
while n and l[n-1] == l[-1]:
n -= 1
print([-1, n][k > n])
================================================
FILE: CODEFORCES/Python/227B. Effective Approach.py
================================================
i=lambda:map(int,input().split())
n = int(input())
l = list(i())
m = int(input())
q = list(i())
p, v, j = 0, 0, 0
pos = {}
for li in l:
pos[li] = j
j += 1
# print(pos)
for qi in q:
v += pos[qi] + 1
p += n - pos[qi]
### TLE ###
# for x in range(m): #and x in range(m):
# for y in range(0,n,1):
# if q[x]==l[y]:
# v += 1
# break
# else:
# v += 1
# p = v - n + 1
# for z in range(n-1,-1, -1):
# if q[x]==l[z]:
# p += 1
# break
# else:
# p += 1
# p = v - n + 1
print(v, p)
================================================
FILE: CODEFORCES/Python/230A. Dragons.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
s, n = spin()
d = []
for i in range(n):
x, y = spin()
d.append([x, y])
d = sorted(d)
# print(d)
for i in range(n):
if s>d[i][0]:
s+=d[i][1]
else:
print("NO")
exit()
print("YES")
================================================
FILE: CODEFORCES/Python/236A.py
================================================
s = input()
sr = sorted(s)
count = 0
for i in range(len(s)):
if i>0 and sr[i-1]!=sr[i]:
count = count+1
count = count+1
if count % 2 == 0:
print('CHAT WITH HER!')
else:
print('IGNORE HIM!')
================================================
FILE: CODEFORCES/Python/266A. Stones on the Table.py
================================================
x = int(input())
l = input()
count = 0
for i in range(x):
if i>0 and l[i] == l[i-1]:
count = count + 1
print(count)
================================================
FILE: CODEFORCES/Python/266B. Queue at the School.py
================================================
i=lambda:map(int,input().split())
n,k=i()
s = input()
t = list(s)
for _ in range(k):
j = 0
while (j!=n):
if(j==n-1):
break
if t[j] == 'B' and t[j+1]=='G':
t[j] , t[j+1] = t[j+1], t[j]
j = j+2
else:
j = j+1
# print(t)
print("".join(t))
================================================
FILE: CODEFORCES/Python/272A. Dima and Friends.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
#solved, but not accoring to ans somewhere
n = inin()
a = lin()
if sum(a)%5==0:
print(5)
else:
print(sum(a)%5)
# #solved, but not accoring to ans somewhere
# i=lambda:map(int,input().split())
# n = int(input())
# l = list(i())
# s = sum(l)
# T,c = 0, 0
# while T>=0:
# if T!=0 and s%(n+1)==0 and c!=1:
# break
# else:
# s = s + 1
# c = c + 1
# T = T + 1
# if c>5:
# print(c%5)
# else:
# print(c)
================================================
FILE: CODEFORCES/Python/276B. Little Girl and Game.py
================================================
### NOT solved yet
# s = input()
# r = s[::-1]
# if s==r or len(s)%2==1:
# print("First")
# else:
# print("Second")
s0 = input()
r0 = s0[::-1]
s = list(s0)
r = list(r0)
i=0;j=-1;count=0
while i<len(s) and j>-len(s)-1:
if s==r:
if count%2==0:
print("First")
break
else:
print("Second")
break
if s[i]==s[j]:
i+=1;j-=1
# print(s, r)
# continue
else:
del s[j]
del r[i]
count+=1
# i+=1;j-=1
# print(s, r)
================================================
FILE: CODEFORCES/Python/281A. Word Capitalization.py
================================================
s = input()
sr = s[0].capitalize()
print(sr+s[1:])
================================================
FILE: CODEFORCES/Python/298B. Sail.py
================================================
inp=lambda:map(int,input().split())
l = list(inp())
s = input()
dx = l[3] - l[1]
dy = l[4] - l[2]
count = 0
for i in range(l[0]):
if dx==0 and dy==0:
break
if dx < 0:
if s[i]=='W':
dx += 1
elif dx > 0:
if s[i]=='E':
dx -= 1
if dy < 0:
if s[i]=='S':
dy += 1
elif dy > 0:
if s[i]=='N':
dy -= 1
count += 1
# print(i,count,dx, dy)
if dx==0 and dy==0:
print(count)
else:
print(-1)
================================================
FILE: CODEFORCES/Python/318A. Even Odds.py
================================================
import math
inp=lambda:map(int,input().split())
n,k=inp()
div = math.ceil(n/2)
# print(div)
if k<=div:
print(2*k - 1)
else:
print(2 * (k-div))
================================================
FILE: CODEFORCES/Python/320A. Magic Numbers.py
================================================
s = input()
flag = 0
for i in range(0,len(s)):
if s[0]!='1':
flag = 0
break
if s[i]!='1' and s[i]!='4':
flag = 0
break
if s[i]=='1':
flag = 1
continue
if s[i]=='4' and i>0:
if s[i-1]=='1':
flag = 1
continue
elif s[i-1]=='4' and s[i-2]=='1':
flag = 1
continue
else:
flag = 0
break
if flag==1:
print("YES")
else:
print("NO")
================================================
FILE: CODEFORCES/Python/339B. Xenia and Ringroad.py
================================================
inp=lambda:map(int,input().split())
n,k=inp()
l=list(inp())
time = 0
for i in range(k):
if i==0:
time = time + l[i] - 1
if i!=0 and l[i-1]>l[i]:
time += n - l[i-1] + l[i]
# print(i+1,":",time)
continue
elif i!=0 and l[i-1]<l[i]:
time = time + l[i] - l[i-1]
else:
pass
# print(i+1,":",time)
# if sr[i]==sr[i+1]:
# time+=0
# else:
print(time)
================================================
FILE: CODEFORCES/Python/34A. Reconnaissance 2.py
================================================
import math
n = int(input())
inp=lambda:map(int,input().split())
l=list(inp())
minm = 1000
a, b = 0, 0
# for i in range(n):
for j in range(n):
# if i==j:
# continue
# else:
if j == n-1:
if abs(l[j]-l[0]) < minm:
a,b = j, 0
minm = abs(l[0]-l[j])
elif abs(l[j]-l[j+1]) < minm:
a,b = j, j+1
minm = abs(l[j]-l[j+1])
print(a+1, b+1)
================================================
FILE: CODEFORCES/Python/34B. Sale.py
================================================
inp=lambda:map(int,input().split())
n, m = inp()
a = list(inp())
sr = sorted(a)
total = 0
for i in range(m):
if sr[i]<0:
total += sr[i]
print(-total)
================================================
FILE: CODEFORCES/Python/352A. Jeff and Digits.py
================================================
n = int(input())
cnt = input().count('5')
if n == cnt:
print('-1')
elif cnt < 9:
print('0')
else:
print('5' * (cnt // 9 * 9) + '0' * (n - cnt))
================================================
FILE: CODEFORCES/Python/352B. Jeff and Periods.py
================================================
## NOT solved yet
inp=lambda:map(int,input().split())
n = int(input())
l = list(inp())
sr = sorted(list(set(l)))
index=[]
for i in sr:
count = 0
temp = 0
for j in range(n):
if i==l[j]:
if count==0:
count += 1
continue
if count==1:
temp = j - temp
count += 1
continue
if count!=0 and j-temp!=temp:
count = -100
break
# else:
# temp = j - temp
# count += 1
# if count==0 and i==l[j]:
# temp = j
# count += 1
# continue
# if count!=0 and i==l[j]:
# temp = j - temp
# count += 1
# break
if count!=-100:
index.append(temp)
print(len(index))
if count==1:
print(i, 0)
elif count==-100:
pass
else:
print(i, temp)
================================================
FILE: CODEFORCES/Python/41A. Translation.py
================================================
s = input()
t = input()
if s==t[::-1]:
print("YES")
else:
print("NO")
================================================
FILE: CODEFORCES/Python/43A. Football.py
================================================
n = int(input())
c1, c2 = 0, 0
for i in range(n):
s = input()
if i==0:
t1 = s
c1 += 1
elif i>0 and t1!=s:
t2 = s
c2 += 1
else:
t1 = s
c1 += 1
if c1>c2:
print(t1)
else:
print(t2)
================================================
FILE: CODEFORCES/Python/445A. DZY Loves Chessboard.py
================================================
inp=lambda:map(int,input().split())
n, m = inp()
for i in range(n):
s = input()
l=[]
for j in range(len(s)):
if s[j]=='-':
l.append('-')
continue
if (i%2==0 and j%2==0) or (i%2!=0 and j%2!=0):
l.append('B')
if (i%2!=0 and j%2==0) or (i%2==0 and j%2!=0):
l.append('W')
print("".join(l))
================================================
FILE: CODEFORCES/Python/459B. Pashmak and Flowers.py
================================================
import operator as op
from functools import reduce
def ncr(n, r):
r = min(r, n-r)
numer = reduce(op.mul, range(n, n-r, -1), 1)
denom = reduce(op.mul, range(1, r+1), 1)
return numer / denom
inp=lambda:map(int,input().split())
n = int(input())
l = list(inp())
if max(l)!=min(l):
print(max(l)-min(l), l.count(max(l)) * l.count(min(l)))
else:
print(max(l)-min(l), int(ncr(l.count(max(l)), 2)))
================================================
FILE: CODEFORCES/Python/467A. George and Accommodation.py
================================================
i=lambda:map(int,input().split())
n = int(input())
c=0
for _ in range(n):
p, q = i()
if q-p >=2:
c += 1
print(c)
================================================
FILE: CODEFORCES/Python/546A. Soldier and Bananas.py
================================================
i=lambda:map(int,input().split())
k, n, w = i()
total = 0
for i in range(1,w+1):
total = total + i*k
if total-n <=0:
print(0)
else:
print(total - n)
================================================
FILE: CODEFORCES/Python/580A. Kefa and First Steps.py
================================================
i=lambda:map(int,input().split())
n = int(input())
l=list(i())
maxm = 1
c = 1
# l.append(0)
# print(len(l))
for j in range(n):
if n == 1:
break
if j==n-1:
if c>maxm:
maxm = c
break
if l[j]>l[j+1]:
maxm = max(c, maxm)
c = 1
if l[j]<=l[j+1]:
c += 1
# print("loop",j,":",l[j], l[j+1])
# print(c, maxm)
# print()
print(maxm)
================================================
FILE: CODEFORCES/Python/58A. Chat room.py
================================================
s = input()
sh = 'hello'
c = 0
for i in range(len(s)):
if c<5:
if s[i]==sh[c]:
c+=1
if c==5:
print("YES")
else:
print("NO")
# import re
# print("YES"if re.search("h.*e.*l.*l.*o",input())else"NO")
================================================
FILE: CODEFORCES/Python/599A. Patrick and Shopping.py
================================================
i=lambda:map(int,input().split())
d1, d2, d3 =i()
min1=min(d1+d2+d3, 2*(d1+d2))
min2=min(2*(d1+d3), 2*(d2+d3))
print(min(min1, min2))
================================================
FILE: CODEFORCES/Python/59A. Word.py
================================================
s = input()
u, l = 0,0
for i in range(len(s)):
if s[i].islower():
l += 1
else:
u += 1
if u==l or u<l:
print(s.lower())
else:
print(s.upper())
================================================
FILE: CODEFORCES/Python/625B. War of the Corporations.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def calculate_sum(a, N): #sum of a to N
# Number of multiples
m = N / a
# sum of first m natural numbers
sum = m * (m + 1) / 2
# sum of multiples
ans = a * sum
return ans
def series(N):
return (N*(N+1))//2
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def LCM (x, y):
return (x * y) // GCD(x, y)
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
def isprime(n):
for i in range(2, int(math.sqrt(n))+1):
if n%i==0:
return False
return True
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
a = stin()
b = stin()
c = a.count(b)
print(c)
================================================
FILE: CODEFORCES/Python/630C. Lucky Numbers.py
================================================
n = int(input())
count = 0
for i in range(1, n+1):
count = count + 2**i
print(count)
================================================
FILE: CODEFORCES/Python/638 (Div. 2)/1348A.py
================================================
import math
T = int(input())
while T>0:
n = int(input())
a, b = pow(2, n), pow(2, n-1)
for i in range(1, n//2):
a = a + pow(2, i)
b = b + pow(2, i+n//2-1)
print(int(math.fabs(a-b)))
T -= 1
================================================
FILE: CODEFORCES/Python/638 (Div. 2)/1348B.py
================================================
T = int(input())
i=lambda:map(int,input().split())
while T >0:
n,k=i()
l = list(i())
s=list(set(l))
if(len(s)>k):
print(-1)
else:
s.extend([l[0]]*(k-len(s)))
# print(s)
s=s*n
# print(s)
print(n*k)
print(*s)
T -= 1
================================================
FILE: CODEFORCES/Python/639 (Div. 2)/A.py
================================================
inp=lambda:map(int,input().split())
for _ in range(int(input())):
a, b=inp()
if a == 1 or b == 1 or a + b == 4:
print("YES")
else:
print("NO")
================================================
FILE: CODEFORCES/Python/639 (Div. 2)/B.py
================================================
l = [2, 7]
for i in range(2, 100000,):
l.append(l[i-1] + l[i-1]-l[i-2]+3)
for _ in range(int(input())):
n = int(input())
out, index, count = 0, 0, 0
outl = []
for j in range(len(l)):
outl.append(l[j])
if l[j]>=n:
# out = l[j]
# index = j-1
break
for k in range(len(outl)-1, -1, -1):
if n<2:
break
if outl[k]<=n:
n = n - outl[k]
count += 1
# print(out, index, outl)
print(count)
================================================
FILE: CODEFORCES/Python/640 (Div. 4)/A.py
================================================
inp=lambda:map(int,input().split())
t = int(input())
for i in range(t):
n = int(input())
count = 0
q, r = n, 0
l = []
if n<10:
print(1)
print(n)
continue
s = str(n)
x = len(s)-1
for j in range(0, len(s)):
if s[j]!='0':
l.append(int(s[j]) * pow(10, x))
x-=1
else:
x-=1
continue
print(len(l))
print(*l)
================================================
FILE: CODEFORCES/Python/640 (Div. 4)/B.py
================================================
inp=lambda:map(int,input().split())
t = int(input())
for _ in range(t):
n,k = inp()
if n % 2 == 0 and n >= 2 * k:
print("YES")
print(*([2] * (k - 1)), n - 2 * k + 2)
elif n >= k and (n - k + 1) % 2 == 1:
print("YES")
print(*([1] * (k - 1)), n - k + 1)
else:
print("NO")
================================================
FILE: CODEFORCES/Python/640 (Div. 4)/C.py
================================================
inp=lambda:map(int,input().split())
t = int(input())
for j in range(t):
n, k = inp()
x = n*(k//(n-1))
if k%(n-1)==0:
x-=1
else:
x+= k%(n-1)
print(x)
================================================
FILE: CODEFORCES/Python/640 (Div. 4)/D. Alice, Bob and Candies.py
================================================
inp=lambda:map(int,input().split())
t = int(input())
for _ in range(t):
n = int(input())
l = list(inp())
r, a, b = 0, 0, 0
ta,tb=0,0
i=0;j=-1
while True:
if len(l)==0:
break
# print(r,ta,tb)
# print(*l)
if i==0:
ta = l[i]
a += l[i]
del l[i]
r += 1
i += 1
continue
if tb<=ta and r%2!=0:
tb += l[j]
b += l[j]
del l[j]
if tb>ta:
r += 1
ta = 0
if tb<=ta and len(l)==0:
r += 1
break
continue
if tb>=ta and r%2==0:
ta += l[i-1]
a += l[i-1]
del l[i-1]
if tb<ta:
r += 1
tb = 0
if tb>=ta and len(l)==0:
r += 1
break
continue
print(r, a, b)
================================================
FILE: CODEFORCES/Python/641 (Div. 2)/A.py
================================================
t = int(input())
inp=lambda:map(int,input().split())
import math
def f_n(n):
i = 2
flag = 0
for i in range(2, int(math.ceil(math.sqrt(n)))+1):
if n % i == 0:
flag = 1
break
if flag==1:
x = i
else:
x = n
return x
for _ in range(t):
n,k = inp()
if n%2==0:
n += 2 * k
else:
n += f_n(n) + (k-1)*2
print(n)
================================================
FILE: CODEFORCES/Python/642 (Div. 3)/A.py
================================================
inp=lambda:map(int,input().split())
t = int(input())
for i in range(t):
n,m = inp()
if n==1:
print(0)
continue
elif n==2:
print(m)
continue
else:
print(2*m)
================================================
FILE: CODEFORCES/Python/642 (Div. 3)/B.py
================================================
inp=lambda:map(int,input().split())
t = int(input())
for _ in range(t):
n,k = inp()
a = list(inp())
b = list(inp())
sa = sorted(a)
sb = sorted(b)
sb = sb[::-1]
for i in range(k):
if sa[i]<sb[i]:
sa[i],sb[i] = sb[i], sa[i]
else:
pass
print(sum(sa))
================================================
FILE: CODEFORCES/Python/642 (Div. 3)/C.py
================================================
inp=lambda:map(int,input().split())
t = int(input())
for _ in range(t):
# import time
# start_time = time.time()
n = int(input())
count = 0
remain = 0
i, j = 1, 1
while i<n:
if i==1:
count += pow(2, i+2) * j
j +=1
i+=2
# count += remain * j
# count += pow(2, i+3) * (j+1) + pow(2, i+4) * (j+2)
if i<n:
remain = pow(i+2, 2) - pow(i, 2)
count += remain * j
j += 1
if i==n-2:
break
remain = pow(i+4, 2) - pow(i+2, 2)
count += remain * j
j += 1
if i==n-4:
break
remain = pow(i+6, 2) - pow(i+4, 2)
count += remain * j
j += 1
if i==n-6:
break
remain = pow(i+8, 2) - pow(i+6, 2)
count += remain * j
j += 1
if i==n-8:
break
remain = pow(i+10, 2) - pow(i+8, 2)
count += remain * j
j += 1
i+=10
print(count)
# print("--- %s seconds ---" % (time.time() - start_time))
================================================
FILE: CODEFORCES/Python/642 (Div. 3)/D.py
================================================
#Not solved yet
# inp=lambda:map(int,input().split())
# n,k = inp()
for _ in range(int(input())):
n = int(input())
l = 1; r = n
i = 1; a = [0]*n
# print(a)
while i<=n:
if (r-l+1)%2!=0:
a[(l+r)//2-1] = i
else:
a[(l+r-1)//2-1] = i
if (l+r)//2 <= n/2:
l = (l+r)//2+i
r = n
else:
l = 1
r = (l+r)//2-i
i+=1
print(a)
# print(a)
================================================
FILE: CODEFORCES/Python/643 (Div. 2)/A.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
for _ in range(inin()):
n, k = spin()
while k>1:
if not '0' in str(n):
r = str(n)
# print(r, type(r))
n += int(min(r)) * int(max(r))
k -= 1
else:
break
print(n)
================================================
FILE: CODEFORCES/Python/643 (Div. 2)/B.py
================================================
import math
inp=lambda:map(int,input().split())
t = int(input())
for _ in range(t):
n = int(input())
# n,k = inp()
l = list(inp())
sr = sorted(l)
count = 0; i = 0
while i<n:
if len(sr)<sr[0]:
break
if i==0:
count+=sr.count(i+1)
sr = [x for x in sr if x != i+1]
if len(sr)==0:
break
sr = sr[::-1]
i=sr[0]
# print(i,sr)
continue
if len(sr)>=i:
count += 1
del sr[0:i]
if len(sr)==0:
break
i = sr[0]
# print(sr)
# else:
# if len(sr)!=0:
# count += sum(sr)/len(sr)
# break
# else:
# if sr.count(i+2)>=2:
# else:
# if i==n-2:
# break
# count+=sr.count((i+1))//(i+1)
# if sr.count((i+1))/(i+1) - (i+1)>0:
# sr = [x for x in sr if x != i+2]
# sr.insert(0, i+1)
# elif sr.count((i+1))/(i+1) - (i+1)==0:
# sr = [x for x in sr if x != i+2]
# if i==n-3:
# break
# if sr.count(i+1)+sr.count(i+2) >= sr.count(i+2):
# if sr.count(i+2) >= (i+2):
# count+=sr.count((i+2))//(i+2)
# else:
# count+=sr.count((i+2))//(i+2) + 1
# if sr.count((i+2)/(i+2)) - (i+2)>0:
# sr.remove(i+2)
# sr.insert(0, i+2)
# if i==n-4:
# break
# count+=sr.count((i+3))//(i+3)
# if sr.count((i+3)/(i+3)) - (i+3)>0:
# sr.remove(i+3)
# sr.insert(0, i+3)
# if i==n-5:
# break
# count+=sr.count((i+4))//(i+4)
# if sr.count((i+4)/(i+4)) - (i+4)>0:
# sr.remove(i+4)
# sr.insert(0, i+4)
# i+=5
print(count)
================================================
FILE: CODEFORCES/Python/643 (Div. 2)/C.py
================================================
import math
inp=lambda:map(int,input().split())
t = int(input())
for _ in range(t):
n = int(input())
# n,k = inp()
# l = list(inp())
================================================
FILE: CODEFORCES/Python/644 (Div. 3)/A.py
================================================
inp=lambda:map(int,input().split())
t = int(input())
for _ in range(t):
# n = int(input())
a, b = inp()
ma = max(a, b)
mi = min(a, b)
# l = list(inp())
# if a%2==0 and b%2==0:
# if a!=b:
# print(pow(m, 2))
# else:
# print(4*a*b)
# continue
# if a%2!=0 and b%2!=0:
# print(pow((m), 2))
# continue
# if a%2!=0 and a>=b:
# print((a+1) * (a+1))
# continue
# if b%2!=0 and b>=a:
# print((b+1) * (b+1))
# continue
if a!=b:
if ma>=2*mi:
print(ma*ma)
else:
print(4*mi*mi)
continue
else:
print(4*a*b)
continue
================================================
FILE: CODEFORCES/Python/644 (Div. 3)/B.py
================================================
inp=lambda:map(int,input().split())
t = int(input())
for _ in range(t):
n = int(input())
# n,k = inp()
l = list(inp())
d = []
l = sorted(l)
for i in range(1, len(l)):
d.append(abs(l[i-1] - l[i]))
print(min(d))
================================================
FILE: CODEFORCES/Python/644 (Div. 3)/C.py
================================================
## WA on test case 2
inp=lambda:map(int,input().split())
t = int(input())
for _ in range(t):
n = int(input())
# n,k = inp()
l = list(inp())
even = []; odd = []; d = []; i= 0
while i<len(l):
if l[i]%2==0:
even.append(l[i])
else:
odd.append(l[i])
i+=1
if len(even)%2==0 and len(odd)%2==0:# and len(l)==0:
print("YES")
continue
even = []; odd = []; d = []; i= 0
l = sorted(l)
# while i<len(l)-1:
# # d.append(abs(l[i] - l[i+1]))
# if abs(l[i] - l[i+1])==1:
# del l[i]; del l[i]
# else:
# i+=1
# for i in l:
# if i%2==0:
# even.append(i)
# else:
# odd.append(i)
i = 0
while i<len(l)-1:
# d.append(abs(l[i] - l[i+1]))
if abs(l[i] - l[i+1])!=1 and (l[i]%2==0 and l[i+1]%2==0):
if abs(l[i] - l[i+1])>1:
even.append(l[i]);even.append(l[i+1])
del l[i]; del l[i]
elif abs(l[i] - l[i+1])==0:
i+=1
continue
elif abs(l[i] - l[i+1])!=1 and (l[i]%2!=0 and l[i+1]%2!=0):
if abs(l[i] - l[i+1])>1:
odd.append(l[i]);odd.append(l[i+1])
del l[i]; del l[i]
elif abs(l[i] - l[i+1])==0:
i+=1
continue
else:
i+=2
print(even, odd, l)
i = 0
while i<len(l)-1:
if abs(l[i] - l[i+1])==1:# and (l[i]%2==0 and l[i+1]%2==0):# or (l[i]%2!=0 and l[i+1]%2!=0)):
del l[i]; del l[i]
elif abs(l[i] - l[i+1])==0:
i+=1
continue
else:
i+=2
i = 0
while i<len(l):
if l[i]%2==0:
even.append(l[i])
del l[i]
elif l[i]%2!=0:
odd.append(l[i])
del l[i]
else:
i+=1
print(even, odd, l)
if len(even)%2==0 and len(odd)%2==0 and len(l)==0:
print("YES")
else:
print("NO")
print(even, odd, l)
================================================
FILE: CODEFORCES/Python/644 (Div. 3)/D.py
================================================
import math
inp=lambda:map(int,input().split())
t = int(input())
def factor(n, k):
i = 1; s= []
while i <= math.sqrt(n):
if (n % i == 0) :
if n // i == i:
if i<=k:
s.append(i)
else :
if i <=k:
s.append(i)
if n//i <=k:
s.append(n//i)
i = i + 1
sr = sorted(s)
if sr[-1]==n:
return sr[-2]
else:
return sr[-1]
for _ in range(t):
# n = int(input())
n,k = inp()
if n<=k:
print(1)
continue
if n%k==0:
print(n//k)
else:
print(n//factor(n,k))
# print(factor(n, k))
================================================
FILE: CODEFORCES/Python/645 (Div. 2)/A.py
================================================
import math
inp=lambda:map(int,input().split())
t = int(input())
for _ in range(t):
n,m = inp()
# l = list(inp())
print(math.ceil((n*m)/2))
================================================
FILE: CODEFORCES/Python/645 (Div. 2)/B.py
================================================
import math
inp=lambda:map(int,input().split())
t = int(input())
for _ in range(t):
n = int(input())
l = list(inp())
l = sorted(l)
l.insert(0,0)
pre = 1;count = pre;res = 0
# i=0
for i in range(n, 0, -1):
if l[i]<=i:
pre += i
break
print(pre)
# while i<len(l):
# if len(l)==0:
# break
# if pre+res>=l[i]:
# if res==0:
# pre += l.count(l[i])
# l = l[l.count(l[i]):]
# else:
# pre += res + 1
# l = l[i+1:]
# res = 0
# i=0
# count = pre
# else:
# res += 1
# i+=1
# # print(l)
# print(count)
# l = [0, 1, 2, 3, 4, 5]
# print(l[-3:])
================================================
FILE: CODEFORCES/Python/645 (Div. 2)/C.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
#######################################
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
t = inin()
for _ in range(t):
h,c,t = spin()
count = 0;i = 0
d = abs(h-t)
final = h
while i>=0:
if final==t:
print(i)
break
else:
if i%2!=0:
final -= c
else:
final += h
i+=1
================================================
FILE: CODEFORCES/Python/646 (Div. 2)/A.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
#######################################
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
for _ in range(inin()):
n, x = spin()
l = lin()
s = 0
for i in range(len(l)):
if l[i]%2!=0:
s+=1
if s==0 or (n==x and s%2==0) or (n==s and x%2==0):
print('No')
else:
print('Yes')
================================================
FILE: CODEFORCES/Python/646 (Div. 2)/B.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
#######################################
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
for i in range(int(input())):
s=input();t=10**18
for j in range(len(s)):
a=s[:j].count('1');b=s[:j].count('0')
c=s[j:].count('1');d=s[j:].count('0')
t=min(t,b+c,a+d)
print(t)
# for _ in range(inin()):
# l = list(stin())
# num0, num1 = l.count('0'), l.count('1')
# done0, done1 = 0, 0
# # ans1, ans2 = 0, 0
# for i in range(1,len(l),1):
# if l[0]=='0':
# done0+=1
# ans1 = done0 + num1 - done1
# elif l[0]=='1':
# done1+=1
# ans2 = done1 + num0 - done0
# print(min(ans1, ans2))
# # c = 0
# # f0, f1 = 0, 0
# # for i in range(1,len(l),1):
# # if l[0]=='0' and i<len(l):
# # if l[i]=='1':
# # f0=1
# # if l[i]=='0' and f0==1:
# # f1=1
# # if l[0]=='1' and i<len(l):
# # if l[i]=='0':
# # f0=1
# # if l[i]=='1' and f0==1:
# # f1=1
# # # print(f0, f1)
# # if f1==0:
# # print(0)
# # else:
# # if l[0]==l[-1]:
# # del l[0];
# # if len(l)!=0:
# # del l[-1]
# # if l.count('0')!=0 and l.count('1')!=0:
# # print(min(l.count('0'), l.count('1')))
# # elif l.count('0')==0:
# # print(l.count('1'))
# # elif l.count('1')==0:
# # print(l.count('0'))
# # else:
# # del l[0];
# # if len(l)!=0:
# # del l[-1]
# # print(min(l.count('0'), l.count('1')))
================================================
FILE: CODEFORCES/Python/646 (Div. 2)/C.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
#######################################
def count2D(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
for _ in range(inin()):
n, x = spin()
m = matrix(n-1)
# print(m)
# count = {}
c = count2D(x, m)
# print(count[x])
if c<=1:
print("Ayush")
else:
if n%2!=0:
print("Ashish")
else:
print("Ayush")
================================================
FILE: CODEFORCES/Python/647 (Div. 2)/A.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
#######################################
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
for _ in range(inin()):
a, b = spin()
c = 0
if a==b:
print(0)
elif max(a,b)%min(a,b)!=0:
print(-1)
else:
q = max(a,b)//min(a,b)
while q%8==0:
c+=1
q = q//8
while q%4==0:
c+=1
q = q//4
while q%2==0:
c+=1
q = q//2
if q>1:
c = -1
print(c)
# print(1100611139403776/1001)
================================================
FILE: CODEFORCES/Python/647 (Div. 2)/B.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
############################################
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
for _ in range(inin()):
n = inin()
l = [0]*1025
def check(k):
for i in range(1, n+1, 1):
if not l[i] ^ k:
return False
return True
def solve():
booler = [False]*1025
for i in range(1, n+1, 1):
l[i] =
booler[l[i]] = True
for i in range(1, 1024, 1):
if check(k):
print(k)
return
print(-1)
solve()
# def bin2dec(n):
# return int(n,2)
# for _ in range(inin()):
# n = inin()
# l = lin()
# new = []
# m = max(l)
# # print(m)
# mb = bin(m).replace("0b","")
# mblen = len(mb)
# if l.count(0)>=1:
# if len(set(l))==2:
# print(m)
# continue
# # print(len(set(l)), l.count(0))
# k = [0]*(mblen-2)
# k.insert(0,1)
# k = str("".join(map(str, k)))
# # print(k)
# for i in l:
# xor = bin(bin2dec(bin(i).replace("0b","")) ^ bin2dec(k))
# new.append(bin2dec(xor.replace("0b","")))
# if sorted(l) == sorted(new):
# print(bin2dec(k))
# else:
# print(-1)
# # print(type(new.sort()))
# # print(l.sort()==new.sort())
================================================
FILE: CODEFORCES/Python/647 (Div. 2)/C.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
#######################################
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
================================================
FILE: CODEFORCES/Python/648 (Div. 2)/A.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
for _ in range(inin()):
n, m = spin()
l = matrix(n)
row = []; col = []; c = 0
for i in range(n):
for j in range(m):
if l[i][j] == 1:
row.append(i)
col.append(j)
# print(row, col)
for i in range(n):
if row.count(i)==0:
for j in range(m):
if row.count(i)==0 and col.count(j)==0:
if l[i][j]==0:
c += 1
row.append(i)
col.append(j)
# print(i, j, c)
if c%2==0:
print("Vivek")
else:
print("Ashish")
================================================
FILE: CODEFORCES/Python/648 (Div. 2)/B.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
for _ in range(inin()):
n = inin()
a = lin()
b = lin()
if a==sorted(a):
print("Yes")
continue
else:
if len(set(a))==1 or len(set(b))==1:
print("No")
continue
if b.count(0)>=1 and b.count(1)>=1:
print("Yes")
else:
print("No")
================================================
FILE: CODEFORCES/Python/648 (Div. 2)/C.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
for _ in range(inin()):
n = inin()
a = lin()
b = lin()
if a==sorted(a):
print("Yes")
continue
else:
if len(set(a))==1 or len(set(b))==1:
print("No")
continue
if b.count(0)>=1 and b.count(1)>=1:
print("Yes")
else:
print("No")
================================================
FILE: CODEFORCES/Python/649 (Div. 2)/A.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
for _ in range(inin()):
n, x = spin()
a = lin()
s = sum(a)
t = []
if s%x!=0:
print(n)
else:
for i in range(len(a)):
if a[i]%x!=0:
t.append(a[i])
================================================
FILE: CODEFORCES/Python/649 (Div. 2)/B.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
================================================
FILE: CODEFORCES/Python/650 (Div. 3)/A.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
for _ in range(inin()):
s = stin()
n = []
for i in range(len(s)):
if i==0 or i==len(s)-1:
n.append(s[i])
else:
if s[i]==s[i+1] and i%2!=0:
n.append(s[i])
print("".join(n))
================================================
FILE: CODEFORCES/Python/650 (Div. 3)/B.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
for _ in range(inin()):
n = inin()
a = lin()
even, odd, even_idx, odd_idx = 0, 0, 0, 0
c = 0
for i in range(n):
if a[i]%2==0:
even += 1
else:
odd += 1
if i%2==0:
even_idx += 1
else:
odd_idx += 1
# print(even, odd, even_idx, odd_idx)
if (even!=even_idx or odd_idx!=odd):
print(-1)
else:
for i in range(n):
if a[i]%2!=i%2:
c += 1
print(c//2)
================================================
FILE: CODEFORCES/Python/650 (Div. 3)/C.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
for _ in range(inin()):
n, k = spin()
s = list(stin())
# c = 0; temp = 0; t = 0; i = 0
l = []; p = -1
for i in range(n):
if s[i]=='1':
if p==-1 or i>p+k:
p = i
else:
l.pop()
p = i
else:
if i==0 or i>p+k:
l.append(i)
p = i
# while i<n:
# if s[i]=='1':
# temp = 0
# i = i+k
# else:
# if i-k<0:
# if (s[i:i+k+1].count('1')==0 and s[0:i].count('1')==0):
# s[i]='1'
# temp = 0
# c += 1
# i = i+k
# # continue
# else:
# if (s[i:i+k+1].count('1')==0 and s[i-k:i].count('1')==0):
# s[i]='1'
# temp = 0
# c += 1
# i = i+k
print(len(l))
================================================
FILE: CODEFORCES/Python/650 (Div. 3)/D.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
return int(input())
def stin():
return input()
def spin():
return map(int,stin().split())
def lin(): #takes array as input
return list(map(int,stin().split()))
def matrix(n):
#matrix input
return [list(map(int,input().split()))for i in range(n)]
################################################
def count2Dmatrix(i,list):
return sum(c.count(i) for c in list)
def modinv(n,p):
return pow(n,p-2,p)
def GCD(x, y):
x=abs(x)
y=abs(y)
if(min(x,y)==0):
return max(x,y)
while(y):
x, y = y, x % y
return x
def Divisors(n) :
l = []
for i in range(1, int(math.sqrt(n) + 1)) :
if (n % i == 0) :
if (n // i == i) :
l.append(i)
else :
l.append(i)
l.append(n//i)
return l
prime=[]
def SieveOfEratosthenes(n):
global prime
prime = [True for i in range(n+1)]
p = 2
while (p * p <= n):
if (prime[p] == True):
for i in range(p * p, n+1, p):
prime[i] = False
p += 1
f=[]
for p in range(2, n):
if prime[p]:
f.append(p)
return f
q=[]
def dfs(n,d,v,c):
global q
v[n]=1
x=d[n]
q.append(n)
j=c
for i in x:
if i not in v:
f=dfs(i,d,v,c+1)
j=max(j,f)
# print(f)
return j
# d = {}
"""*******************************************************"""
================================================
FILE: CODEFORCES/Python/651 (Div. 2)/A.py
================================================
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
gitextract_qxpdei06/
├── .gitattributes
├── .gitignore
├── 1.Template.py
├── Atcoder/
│ ├── abc175/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── abc176/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── abc177/
│ │ ├── A.py
│ │ └── B.py
│ ├── abc184/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── arc104/
│ │ ├── A.py
│ │ └── B.py
│ └── arc110/
│ └── A.py
├── CODECHEF/
│ ├── Ciel and A-B Problem.c
│ ├── Ciel and A-B Problem.o
│ ├── Cleaning Up.c
│ ├── Cleaning Up.o
│ ├── Lapindromes.c
│ ├── Racing Horses.c
│ ├── Racing Horses.o
│ ├── Sums is a Triangle.c
│ └── Sums is a Triangle.o
├── CODEFORCES/
│ ├── C/
│ │ ├── 112A-Petya & Strings.cpp
│ │ ├── 118A. String Task.c
│ │ ├── 118A. String Task.cpp
│ │ ├── 118A. String Task.o
│ │ ├── 12A.Super Agent.c
│ │ ├── 12A.Super Agent.o
│ │ ├── 13A.numbers.c
│ │ ├── 13A.numbers.o
│ │ ├── 158A - Next Round.cpp
│ │ ├── 1A-Theatre Square.c
│ │ ├── 20-21 ICPC, NERC (Mirror)/
│ │ │ ├── C.py
│ │ │ ├── E.cpp
│ │ │ └── N.cpp
│ │ ├── 231A-Team.cpp
│ │ ├── 282A-Bit++.cpp
│ │ ├── 2A.cpp
│ │ ├── 2A.o
│ │ ├── 3A.cpp
│ │ ├── 3A.o
│ │ ├── 428,div 2/
│ │ │ ├── A.Arya and Bran.c
│ │ │ └── A.Arya and Bran.o
│ │ ├── 429,div 2/
│ │ │ └── A.c
│ │ ├── 433,div 2/
│ │ │ ├── A.Fraction.c
│ │ │ └── A.Fraction.o
│ │ ├── 458,div 1+2/
│ │ │ ├── A.cpp
│ │ │ └── A.o
│ │ ├── 459 (Div. 2)/
│ │ │ ├── A. Eleven.cpp
│ │ │ ├── A. Eleven.o
│ │ │ └── A. Eleven2.o
│ │ ├── 463(1+2)/
│ │ │ ├── A.Palidromic Supersequence.cpp
│ │ │ ├── A.Palidromic Supersequence.o
│ │ │ ├── B. Recursive Queries.cpp
│ │ │ └── B. Recursive Queries.o
│ │ ├── 465,div 2/
│ │ │ ├── A. Fafa and his Company.cpp
│ │ │ ├── A. Fafa and his Company.o
│ │ │ ├── B. Fafa and the Gates.cpp
│ │ │ └── B. Fafa and the Gates.o
│ │ ├── 478A-Initial Bet.cpp
│ │ ├── 4A-dividing watermelon.c
│ │ ├── 4A.Chat Server's Outgoing Traffic.c
│ │ ├── 50A-Domino Piling.c
│ │ ├── 677A-Vanya and Fence.cpp
│ │ ├── 6A.triangle.cpp
│ │ ├── 6A.triangle.o
│ │ ├── 705A-Hulk.cpp
│ │ ├── 71A. Way Too Long Words.cpp
│ │ ├── 7A. Kalevitch and Chess.cpp
│ │ ├── 7A. Kalevitch and Chess.o
│ │ ├── 8A. Train and Peter.cpp
│ │ ├── 8A. Train and Peter.o
│ │ ├── 96A-Football.cpp
│ │ ├── A.cpp
│ │ ├── A.o
│ │ ├── Edu 38(div 2)/
│ │ │ ├── A. Word Correction.cpp
│ │ │ └── A. Word Correction.o
│ │ ├── Edu 39(div 2)/
│ │ │ ├── A.cpp
│ │ │ ├── A.o
│ │ │ ├── B.cpp
│ │ │ └── B.o
│ │ ├── Practice - ECPC 2019/
│ │ │ ├── 307919A_T2.cpp
│ │ │ ├── 307919B.cpp
│ │ │ ├── 307919G.cpp
│ │ │ ├── 307919J_T2.cpp
│ │ │ ├── 307919K.cpp
│ │ │ ├── 307919M.cpp
│ │ │ └── 307919N.cpp
│ │ ├── Untitled1.c
│ │ ├── Untitled1.o
│ │ ├── char in 2D.c
│ │ └── char in 2D.o
│ └── Python/
│ ├── 1.Template.py
│ ├── 110A. Nearly Lucky Number.py
│ ├── 116A. Tram.py
│ ├── 118B. Present from Lena.py
│ ├── 122A. Lucky Division.py
│ ├── 122A.py
│ ├── 124A. The number of positions.py
│ ├── 131A. cAPS lOCK.py
│ ├── 1331A. HQ9+.py
│ ├── 1341A. Nastya and Rice.py
│ ├── 1343A. Candies.py
│ ├── 1343B.py
│ ├── 1351A. A+B (Trial Problem).py
│ ├── 1352B. Square.py
│ ├── 139A. Petr and Book.py
│ ├── 13A.py
│ ├── 149A. Business trip.py
│ ├── 158B. Taxi.py
│ ├── 160A. Twins.py
│ ├── 165A. Supercentral Point.py
│ ├── 199A. Hexadecimal's theorem.py
│ ├── 205A. Little Elephant and Rozdil.py
│ ├── 208A. Dubstep.py
│ ├── 214A. System of Equations.py
│ ├── 215A. Bicycle Chain.py
│ ├── 219A. k-String.py
│ ├── 221A. Little Elephant and Function.py
│ ├── 222A. Shooshuns and Sequence.py
│ ├── 227B. Effective Approach.py
│ ├── 230A. Dragons.py
│ ├── 236A.py
│ ├── 266A. Stones on the Table.py
│ ├── 266B. Queue at the School.py
│ ├── 272A. Dima and Friends.py
│ ├── 276B. Little Girl and Game.py
│ ├── 281A. Word Capitalization.py
│ ├── 298B. Sail.py
│ ├── 318A. Even Odds.py
│ ├── 320A. Magic Numbers.py
│ ├── 339B. Xenia and Ringroad.py
│ ├── 34A. Reconnaissance 2.py
│ ├── 34B. Sale.py
│ ├── 352A. Jeff and Digits.py
│ ├── 352B. Jeff and Periods.py
│ ├── 41A. Translation.py
│ ├── 43A. Football.py
│ ├── 445A. DZY Loves Chessboard.py
│ ├── 459B. Pashmak and Flowers.py
│ ├── 467A. George and Accommodation.py
│ ├── 546A. Soldier and Bananas.py
│ ├── 580A. Kefa and First Steps.py
│ ├── 58A. Chat room.py
│ ├── 599A. Patrick and Shopping.py
│ ├── 59A. Word.py
│ ├── 625B. War of the Corporations.py
│ ├── 630C. Lucky Numbers.py
│ ├── 638 (Div. 2)/
│ │ ├── 1348A.py
│ │ └── 1348B.py
│ ├── 639 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 640 (Div. 4)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D. Alice, Bob and Candies.py
│ ├── 641 (Div. 2)/
│ │ └── A.py
│ ├── 642 (Div. 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── 643 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 644 (Div. 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── 645 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 646 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 647 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 648 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 649 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 650 (Div. 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ ├── D.py
│ │ └── Python.lnk
│ ├── 651 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── 652 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── 653 (Div. 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ ├── D.py
│ │ └── E1.py
│ ├── 654 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 655 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 656 (Div. 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── 657 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── 658 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C1.py
│ ├── 659 (Div. 2)/
│ │ └── A.py
│ ├── 660 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 661 (Div. 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 662 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 663 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 664 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 665 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 666 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 667 (Div. 3)/
│ │ ├── A.py
│ │ └── C.py
│ ├── 668 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 669 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 670 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 671 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 672 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 685 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 686 (Div. 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 688 (Div. 2)/
│ │ └── A.py
│ ├── 690 (Div. 3)/
│ │ ├── A.py
│ │ └── C.py
│ ├── 691 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 692 (Div. 2, based on Technocup 2021 Elimination Round 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 693 (Div. 3)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── 694 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 695 (Div. 2)/
│ │ └── A.py
│ ├── 696 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── 697 (Div. 3)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 698 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 699 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 69A.py
│ ├── 700 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 705 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── 733A. Grasshopper And the String.py
│ ├── 734A. Anton and Danik.py
│ ├── 791A. Bear and Big Brother.py
│ ├── 946B.py
│ ├── 977A. Wrong Subtraction.py
│ ├── A. Beautiful Matrix.py
│ ├── A. Bit++.py
│ ├── A. Domino piling.py
│ ├── A. Helpful Maths.py
│ ├── A. Next Round.py
│ ├── A. Petya and Strings.py
│ ├── A. Too Long Words.py
│ ├── A. Watermelon.py
│ ├── DP/
│ │ └── 1369D.py
│ ├── Dictionary/
│ │ └── 450A. Jzzhu and Children.py
│ ├── Edu 100 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── Edu 102 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── Edu 103 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── Edu 86 (Div. 2)/
│ │ ├── 1342A. Road To Zero.py
│ │ ├── 1342B. Binary Period.py
│ │ └── 266B. Queue at the School.py
│ ├── Edu 87 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C1. Simple Polygon Embedding.py
│ │ └── C2. Not So Simple Polygon Embedding.py
│ ├── Edu 88 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── Edu 89 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── Edu 90 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── Edu 91 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── Edu 92 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── Edu 93 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── Edu 94 (Div. 2)/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── Edu 95 (Div. 2)/
│ │ ├── A.py
│ │ └── B.py
│ ├── Global Round 10/
│ │ ├── A.py
│ │ ├── B.py
│ │ ├── C.py
│ │ └── D.py
│ ├── Global Round 12/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── Global Round 8/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── Global Round 9/
│ │ ├── A.py
│ │ ├── B.py
│ │ └── C.py
│ ├── ICPC Challenge 2020 Practice/
│ │ ├── A.py
│ │ ├── A.txt
│ │ └── sort.in
│ └── Notes.txt
├── CSAcademy/
│ ├── 69 (Div 2)/
│ │ ├── Pokemon Fights.cpp
│ │ └── Pokemon Fights.o
│ ├── Frequent Numbers.c
│ ├── Frequent Numbers.o
│ ├── Round 47/
│ │ ├── Adjacent Vowels.c
│ │ ├── Adjacent Vowels.o
│ │ └── Consecutive Sum.c
│ ├── Round 65/
│ │ ├── Encipherment.cpp
│ │ └── Encipherment.o
│ ├── Round 68(div 2)/
│ │ ├── A. String Concat.cpp
│ │ └── A. String Concat.o
│ └── Square Cover.c
├── GeeksForGeeks/
│ ├── Count the triplets.py
│ ├── Subarray with given sum.py
│ └── Triplets again.py
├── Hackerearth/
│ ├── Algorithm/
│ │ └── Graph/
│ │ └── Stay Healthy! Greedy.py
│ ├── August Circuits '20/
│ │ └── Anti-palindrome strings.py
│ ├── Basic Number Theory-1/
│ │ ├── Can you Guess.py
│ │ ├── Love Triangle.py
│ │ ├── Panda and Chain Reaction.py
│ │ ├── Primen't Divisors.py
│ │ └── Tutorial Code.py
│ ├── January Circuits '21/
│ │ ├── A chessboard.py
│ │ ├── Replace the strings.py
│ │ ├── Scoreboard queries.py
│ │ └── The GCD Function.py
│ └── Notes.txt
├── LIGHTOJ/
│ ├── 1000.c
│ ├── 1000.o
│ ├── 1001.c
│ ├── 1001.o
│ ├── 1006.c
│ ├── 1006.o
│ ├── 1030.cpp
│ ├── 1225.cpp
│ ├── 1225.o
│ ├── 1354 - IP Checking.py
│ ├── 1433. Minimum Arc Distance.cpp
│ ├── 1433. Minimum Arc Distance.o
│ └── Python/
│ ├── 1027.A Dangerous Maze.py
│ ├── 1030.Discovering Gold.py
│ ├── 1038. Race 1 Again.py
│ └── 1225. Palindromic Numbers (II).py
├── LeetCode/
│ ├── 1. Two Sum.py
│ ├── 1108. Defanging an IP Address.py
│ ├── 1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree.py
│ ├── 1480. Running Sum of 1d Array.py
│ ├── 1689. Partitioning Into Minimum Number Of Deci-Binary Numbers.py
│ ├── 1791. Find Center of Star Graph.py
│ ├── 1971. Find if Path Exists in Graph.py
│ ├── 2011. Final Value of Variable After Performing Operations.py
│ ├── 2114. Maximum Number of Words Found in Sentences.py
│ ├── 2236. Root Equals Sum of Children.py
│ ├── 3110. Score of a String.py
│ ├── 535. Encode and Decode TinyURL.py
│ ├── 617. Merge Two Binary Trees.py
│ ├── 724. Find Pivot Index.py
│ ├── 771. Jewels and Stones.py
│ ├── 9. Palindrome Number.py
│ ├── 938. Range Sum of BST.py
│ ├── 94. Binary Tree Inorder Traversal.py
│ └── 997. Find the Town Judge.py
├── Notes.txt
├── README.md
├── Toph/
│ └── SELISE Coding Challenge 2020/
│ ├── A.py
│ ├── B.py
│ ├── C.py
│ ├── D.py
│ ├── E.py
│ ├── F.py
│ ├── G.py
│ ├── H.py
│ └── J.py
├── UVA/
│ ├── 10334 - Ray Through Glasses.cpp
│ ├── 10334 - Ray Through Glasses.o
│ ├── 10334 - Ray Through Glasses.py
│ ├── 10407 - Simple division.py
│ ├── 11388 - GCD LCM.py
│ ├── 11417 - GCD.py
│ ├── 11572 - Unique Snowflakes.py
│ ├── 1433. Minimum Arc Distance.py
│ ├── 495 - Fibonacci Freeze.py
│ ├── 900 - Brick Wall Patterns.py
│ └── Notes.txt
└── Vjudge/
├── RAPL Round 1(376797)/
│ ├── A.py
│ ├── B.py
│ ├── C.py
│ ├── D.py
│ └── E.py
├── RAPL TFC__(413583)/
│ ├── A.py
│ └── C.py
├── TFC - 2/
│ └── E.cpp
├── TFC3/
│ ├── C.py
│ └── D.py
└── Team Practice Contest(419090)/
└── B.py
SYMBOL INDEX (3127 symbols across 294 files)
FILE: 1.Template.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function string2intlist (line 26) | def string2intlist(s):
function calculate_sum (line 29) | def calculate_sum(a, N): #sum of a to N
function series (line 37) | def series(N):
function count2Dmatrix (line 40) | def count2Dmatrix(i,list):
function modinv (line 43) | def modinv(n,p):
function nCr (line 46) | def nCr(n, r):
function GCD (line 53) | def GCD(x, y):
function LCM (line 61) | def LCM (x, y):
function Divisors (line 64) | def Divisors(n) :
function isprime (line 74) | def isprime(n):
function SieveOfEratosthenes (line 80) | def SieveOfEratosthenes(n):
function dfs (line 95) | def dfs(n,d,v,c):
function knapSack (line 109) | def knapSack(W, wt, val, n):
FILE: Atcoder/abc175/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: Atcoder/abc175/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: Atcoder/abc175/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: Atcoder/abc176/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: Atcoder/abc176/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: Atcoder/abc176/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: Atcoder/abc177/A.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function matrix (line 22) | def matrix(n):
function string2intlist (line 27) | def string2intlist(s):
function calculate_sum (line 30) | def calculate_sum(a, N): #sum of a to N
function series (line 38) | def series(N):
function count2Dmatrix (line 41) | def count2Dmatrix(i,list):
function modinv (line 44) | def modinv(n,p):
function GCD (line 47) | def GCD(x, y):
function LCM (line 55) | def LCM (x, y):
function Divisors (line 58) | def Divisors(n) :
function isprime (line 68) | def isprime(n):
function SieveOfEratosthenes (line 74) | def SieveOfEratosthenes(n):
function dfs (line 89) | def dfs(n,d,v,c):
function inin (line 122) | def inin():
function stin (line 124) | def stin():
function spin (line 126) | def spin():
function lin (line 128) | def lin(): #takes array as input
function matrix (line 130) | def matrix(n):
function string2intlist (line 135) | def string2intlist(s):
function calculate_sum (line 138) | def calculate_sum(a, N): #sum of a to N
function series (line 146) | def series(N):
function count2Dmatrix (line 149) | def count2Dmatrix(i,list):
function modinv (line 152) | def modinv(n,p):
function GCD (line 155) | def GCD(x, y):
function LCM (line 163) | def LCM (x, y):
function Divisors (line 166) | def Divisors(n) :
function isprime (line 176) | def isprime(n):
function SieveOfEratosthenes (line 182) | def SieveOfEratosthenes(n):
function dfs (line 197) | def dfs(n,d,v,c):
FILE: Atcoder/abc177/B.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function matrix (line 22) | def matrix(n):
function string2intlist (line 27) | def string2intlist(s):
function calculate_sum (line 30) | def calculate_sum(a, N): #sum of a to N
function series (line 38) | def series(N):
function count2Dmatrix (line 41) | def count2Dmatrix(i,list):
function modinv (line 44) | def modinv(n,p):
function GCD (line 47) | def GCD(x, y):
function LCM (line 55) | def LCM (x, y):
function Divisors (line 58) | def Divisors(n) :
function isprime (line 68) | def isprime(n):
function SieveOfEratosthenes (line 74) | def SieveOfEratosthenes(n):
function dfs (line 89) | def dfs(n,d,v,c):
function inin (line 145) | def inin():
function stin (line 147) | def stin():
function spin (line 149) | def spin():
function lin (line 151) | def lin(): #takes array as input
function matrix (line 153) | def matrix(n):
function string2intlist (line 158) | def string2intlist(s):
function calculate_sum (line 161) | def calculate_sum(a, N): #sum of a to N
function series (line 169) | def series(N):
function count2Dmatrix (line 172) | def count2Dmatrix(i,list):
function modinv (line 175) | def modinv(n,p):
function GCD (line 178) | def GCD(x, y):
function LCM (line 186) | def LCM (x, y):
function Divisors (line 189) | def Divisors(n) :
function isprime (line 199) | def isprime(n):
function SieveOfEratosthenes (line 205) | def SieveOfEratosthenes(n):
function dfs (line 220) | def dfs(n,d,v,c):
FILE: Atcoder/abc184/A.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function GCD (line 72) | def GCD(x, y):
function LCM (line 82) | def LCM(x, y):
function Divisors (line 86) | def Divisors(n):
function isprime (line 98) | def isprime(n):
function SieveOfEratosthenes (line 108) | def SieveOfEratosthenes(n):
function dfs (line 126) | def dfs(n, d, v, c):
function knapSack (line 141) | def knapSack(W, wt, val, n):
FILE: Atcoder/abc184/B.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function GCD (line 72) | def GCD(x, y):
function LCM (line 82) | def LCM(x, y):
function Divisors (line 86) | def Divisors(n):
function isprime (line 98) | def isprime(n):
function SieveOfEratosthenes (line 108) | def SieveOfEratosthenes(n):
function dfs (line 127) | def dfs(n, d, v, c):
function knapSack (line 142) | def knapSack(W, wt, val, n):
FILE: Atcoder/abc184/C.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function GCD (line 72) | def GCD(x, y):
function LCM (line 82) | def LCM(x, y):
function Divisors (line 86) | def Divisors(n):
function isprime (line 98) | def isprime(n):
function SieveOfEratosthenes (line 108) | def SieveOfEratosthenes(n):
function dfs (line 127) | def dfs(n, d, v, c):
function knapSack (line 142) | def knapSack(W, wt, val, n):
FILE: Atcoder/arc104/A.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function matrix (line 22) | def matrix(n):
function string2intlist (line 27) | def string2intlist(s):
function calculate_sum (line 30) | def calculate_sum(a, N): #sum of a to N
function series (line 38) | def series(N):
function count2Dmatrix (line 41) | def count2Dmatrix(i,list):
function modinv (line 44) | def modinv(n,p):
function GCD (line 47) | def GCD(x, y):
function LCM (line 55) | def LCM (x, y):
function Divisors (line 58) | def Divisors(n) :
function isprime (line 68) | def isprime(n):
function SieveOfEratosthenes (line 74) | def SieveOfEratosthenes(n):
function dfs (line 89) | def dfs(n,d,v,c):
function inin (line 119) | def inin():
function stin (line 121) | def stin():
function spin (line 123) | def spin():
function lin (line 125) | def lin(): #takes array as input
function matrix (line 127) | def matrix(n):
function string2intlist (line 132) | def string2intlist(s):
function calculate_sum (line 135) | def calculate_sum(a, N): #sum of a to N
function series (line 143) | def series(N):
function count2Dmatrix (line 146) | def count2Dmatrix(i,list):
function modinv (line 149) | def modinv(n,p):
function GCD (line 152) | def GCD(x, y):
function LCM (line 160) | def LCM (x, y):
function Divisors (line 163) | def Divisors(n) :
function isprime (line 173) | def isprime(n):
function SieveOfEratosthenes (line 179) | def SieveOfEratosthenes(n):
function dfs (line 194) | def dfs(n,d,v,c):
FILE: Atcoder/arc104/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function string2intlist (line 26) | def string2intlist(s):
function calculate_sum (line 29) | def calculate_sum(a, N): #sum of a to N
function series (line 37) | def series(N):
function count2Dmatrix (line 40) | def count2Dmatrix(i,list):
function modinv (line 43) | def modinv(n,p):
function GCD (line 46) | def GCD(x, y):
function LCM (line 54) | def LCM (x, y):
function Divisors (line 57) | def Divisors(n) :
function isprime (line 67) | def isprime(n):
function SieveOfEratosthenes (line 73) | def SieveOfEratosthenes(n):
function dfs (line 88) | def dfs(n,d,v,c):
FILE: Atcoder/arc110/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function string2intlist (line 26) | def string2intlist(s):
function calculate_sum (line 29) | def calculate_sum(a, N): #sum of a to N
function series (line 37) | def series(N):
function count2Dmatrix (line 40) | def count2Dmatrix(i,list):
function modinv (line 43) | def modinv(n,p):
function GCD (line 46) | def GCD(x, y):
function LCM (line 54) | def LCM (x, y):
function Divisors (line 57) | def Divisors(n) :
function isprime (line 67) | def isprime(n):
function SieveOfEratosthenes (line 73) | def SieveOfEratosthenes(n):
function dfs (line 88) | def dfs(n,d,v,c):
FILE: CODECHEF/Ciel and A-B Problem.c
function main (line 4) | int main()
FILE: CODECHEF/Cleaning Up.c
function main (line 4) | int main()
FILE: CODECHEF/Lapindromes.c
function main (line 6) | int main()
FILE: CODECHEF/Racing Horses.c
function main (line 4) | int main()
FILE: CODECHEF/Sums is a Triangle.c
function main (line 5) | int main()
FILE: CODEFORCES/C/112A-Petya & Strings.cpp
function main (line 2) | int main()
FILE: CODEFORCES/C/118A. String Task.c
function main (line 6) | int main()
FILE: CODEFORCES/C/118A. String Task.cpp
function main (line 2) | main()
FILE: CODEFORCES/C/12A.Super Agent.c
function main (line 6) | int main()
FILE: CODEFORCES/C/13A.numbers.c
function main (line 2) | int main()
FILE: CODEFORCES/C/158A - Next Round.cpp
function main (line 2) | int main()
FILE: CODEFORCES/C/1A-Theatre Square.c
function main (line 2) | int main()
FILE: CODEFORCES/C/20-21 ICPC, NERC (Mirror)/C.py
function inin (line 16) | def inin():
function stin (line 20) | def stin():
function spin (line 24) | def spin():
function lin (line 28) | def lin(): # takes array as input
function matrix (line 32) | def matrix(n):
function count2Dmatrix (line 39) | def count2Dmatrix(i, list):
function modinv (line 43) | def modinv(n, p):
function nCr (line 47) | def nCr(n, r):
function GCD (line 55) | def GCD(x, y):
function Divisors (line 65) | def Divisors(n):
function SieveOfEratosthenes (line 80) | def SieveOfEratosthenes(n):
function dfs (line 99) | def dfs(n, d, v, c):
FILE: CODEFORCES/C/20-21 ICPC, NERC (Mirror)/E.cpp
function solve (line 46) | void solve()
function main (line 55) | int main()
FILE: CODEFORCES/C/20-21 ICPC, NERC (Mirror)/N.cpp
function solve (line 47) | void solve()
function main (line 112) | int main()
FILE: CODEFORCES/C/231A-Team.cpp
function main (line 2) | int main()
FILE: CODEFORCES/C/282A-Bit++.cpp
function main (line 2) | int main()
FILE: CODEFORCES/C/2A.cpp
function main (line 51) | int main()
FILE: CODEFORCES/C/3A.cpp
function main (line 52) | int main()
FILE: CODEFORCES/C/428,div 2/A.Arya and Bran.c
function main (line 2) | int main()
FILE: CODEFORCES/C/429,div 2/A.c
function main (line 6) | int main()
FILE: CODEFORCES/C/433,div 2/A.Fraction.c
function main (line 6) | int main()
FILE: CODEFORCES/C/458,div 1+2/A.cpp
function main (line 50) | int main()
FILE: CODEFORCES/C/459 (Div. 2)/A. Eleven.cpp
function main (line 4) | int main()
FILE: CODEFORCES/C/463(1+2)/A.Palidromic Supersequence.cpp
function main (line 3) | int main()
FILE: CODEFORCES/C/463(1+2)/B. Recursive Queries.cpp
function main (line 3) | int main()
FILE: CODEFORCES/C/465,div 2/A. Fafa and his Company.cpp
function main (line 4) | int main()
FILE: CODEFORCES/C/465,div 2/B. Fafa and the Gates.cpp
function main (line 4) | int main()
FILE: CODEFORCES/C/478A-Initial Bet.cpp
function main (line 4) | int main()
FILE: CODEFORCES/C/4A-dividing watermelon.c
function main (line 2) | int main()
FILE: CODEFORCES/C/50A-Domino Piling.c
function main (line 2) | int main()
FILE: CODEFORCES/C/677A-Vanya and Fence.cpp
function main (line 4) | int main()
FILE: CODEFORCES/C/6A.triangle.cpp
function main (line 50) | int main()
FILE: CODEFORCES/C/705A-Hulk.cpp
function main (line 4) | int main()
FILE: CODEFORCES/C/71A. Way Too Long Words.cpp
function main (line 2) | int main()
FILE: CODEFORCES/C/7A. Kalevitch and Chess.cpp
function main (line 50) | int main()
FILE: CODEFORCES/C/8A. Train and Peter.cpp
function main (line 50) | int main()
FILE: CODEFORCES/C/96A-Football.cpp
function main (line 2) | int main()
FILE: CODEFORCES/C/A.cpp
function main (line 3) | int main()
FILE: CODEFORCES/C/Edu 38(div 2)/A. Word Correction.cpp
function main (line 4) | int main()
FILE: CODEFORCES/C/Edu 39(div 2)/A.cpp
function main (line 4) | int main()
FILE: CODEFORCES/C/Edu 39(div 2)/B.cpp
function main (line 4) | int main()
FILE: CODEFORCES/C/Practice - ECPC 2019/307919A_T2.cpp
function solve (line 47) | void solve() {
function main (line 72) | int main() {
FILE: CODEFORCES/C/Practice - ECPC 2019/307919B.cpp
function heron (line 45) | double heron(double a, double b, double c)
function solve (line 52) | double solve(double x, double y, double z)
function solve2 (line 69) | void solve2() {
function main (line 77) | int main() {
FILE: CODEFORCES/C/Practice - ECPC 2019/307919G.cpp
function solve (line 49) | void solve() {
function main (line 74) | int main() {
FILE: CODEFORCES/C/Practice - ECPC 2019/307919J_T2.cpp
function solve (line 47) | void solve() {
function main (line 132) | int main() {
FILE: CODEFORCES/C/Practice - ECPC 2019/307919K.cpp
function solve (line 45) | void solve() {
function main (line 110) | int main() {
FILE: CODEFORCES/C/Practice - ECPC 2019/307919M.cpp
function solve (line 47) | void solve() {
function main (line 66) | int main() {
FILE: CODEFORCES/C/Practice - ECPC 2019/307919N.cpp
function solve (line 45) | void solve() {
function main (line 57) | int main() {
FILE: CODEFORCES/C/Untitled1.c
function main (line 51) | int main()
FILE: CODEFORCES/C/char in 2D.c
function main (line 6) | int main()
FILE: CODEFORCES/Python/1.Template.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin(): # take inputs with space. e.g. n, m = spin()
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/122A.py
function MI (line 10) | def MI(): return map(int, sys.stdin.readline().strip().split())
function LI (line 11) | def LI(): return list(map(int, sys.stdin.readline().strip().split()))
function LLI (line 12) | def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readline...
function LI_ (line 13) | def LI_(): return [int(x)-1 for x in sys.stdin.readline().strip().split()]
function LF (line 14) | def LF(): return [float(x) for x in sys.stdin.readline().strip().split()]
function LS (line 15) | def LS(): return sys.stdin.readline().strip().split()
function I (line 16) | def I(): return int(sys.stdin.readline().strip())
function F (line 17) | def F(): return float(sys.stdin.readline().strip())
function S (line 18) | def S(): return sys.stdin.readline().strip()
function pf (line 19) | def pf(s): return print(s, flush=True)
function pe (line 20) | def pe(s): return print(str(s), file=sys.stderr)
function JA (line 21) | def JA(a, sep): return sep.join(map(str, a))
function JAA (line 22) | def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)
function main (line 30) | def main():
FILE: CODEFORCES/Python/1343A. Candies.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/230A. Dragons.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/272A. Dima and Friends.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/459B. Pashmak and Flowers.py
function ncr (line 4) | def ncr(n, r):
FILE: CODEFORCES/Python/625B. War of the Corporations.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/641 (Div. 2)/A.py
function f_n (line 6) | def f_n(n):
FILE: CODEFORCES/Python/643 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/644 (Div. 3)/D.py
function factor (line 5) | def factor(n, k):
FILE: CODEFORCES/Python/645 (Div. 2)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function modinv (line 22) | def modinv(n,p):
function GCD (line 25) | def GCD(x, y):
function Divisors (line 33) | def Divisors(n) :
function SieveOfEratosthenes (line 44) | def SieveOfEratosthenes(n):
function dfs (line 59) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/646 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function modinv (line 22) | def modinv(n,p):
function GCD (line 25) | def GCD(x, y):
function Divisors (line 33) | def Divisors(n) :
function SieveOfEratosthenes (line 44) | def SieveOfEratosthenes(n):
function dfs (line 59) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/646 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function modinv (line 22) | def modinv(n,p):
function GCD (line 25) | def GCD(x, y):
function Divisors (line 33) | def Divisors(n) :
function SieveOfEratosthenes (line 44) | def SieveOfEratosthenes(n):
function dfs (line 59) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/646 (Div. 2)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2D (line 26) | def count2D(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/647 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function modinv (line 22) | def modinv(n,p):
function GCD (line 25) | def GCD(x, y):
function Divisors (line 33) | def Divisors(n) :
function SieveOfEratosthenes (line 44) | def SieveOfEratosthenes(n):
function dfs (line 59) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/647 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function modinv (line 22) | def modinv(n,p):
function GCD (line 25) | def GCD(x, y):
function Divisors (line 33) | def Divisors(n) :
function SieveOfEratosthenes (line 44) | def SieveOfEratosthenes(n):
function dfs (line 59) | def dfs(n,d,v,c):
function check (line 78) | def check(k):
function solve (line 84) | def solve():
FILE: CODEFORCES/Python/647 (Div. 2)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function modinv (line 22) | def modinv(n,p):
function GCD (line 25) | def GCD(x, y):
function Divisors (line 33) | def Divisors(n) :
function SieveOfEratosthenes (line 44) | def SieveOfEratosthenes(n):
function dfs (line 59) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/648 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/648 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/648 (Div. 2)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/649 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/649 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/650 (Div. 3)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/650 (Div. 3)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/650 (Div. 3)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/650 (Div. 3)/D.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/651 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/651 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/651 (Div. 2)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function isprime (line 41) | def isprime(n):
function Divisors (line 47) | def Divisors(n) :
function SieveOfEratosthenes (line 58) | def SieveOfEratosthenes(n):
function dfs (line 73) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/651 (Div. 2)/D.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/652 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/652 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/652 (Div. 2)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/652 (Div. 2)/D.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/653 (Div. 3)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/653 (Div. 3)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/653 (Div. 3)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/653 (Div. 3)/D.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/653 (Div. 3)/E1.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/654 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/654 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
function series (line 85) | def series(N):
FILE: CODEFORCES/Python/654 (Div. 2)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/655 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/655 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function LCM (line 40) | def LCM (x, y):
function Divisors (line 43) | def Divisors(n):
function SieveOfEratosthenes (line 54) | def SieveOfEratosthenes(n):
function dfs (line 69) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/655 (Div. 2)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/656 (Div. 3)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/656 (Div. 3)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/656 (Div. 3)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/656 (Div. 3)/D.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/657 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/657 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function LCM (line 40) | def LCM (x, y):
function Divisors (line 43) | def Divisors(n):
function SieveOfEratosthenes (line 54) | def SieveOfEratosthenes(n):
function dfs (line 69) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/657 (Div. 2)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/657 (Div. 2)/D.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/658 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
function intersection (line 86) | def intersection(lst1, lst2):
FILE: CODEFORCES/Python/658 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function LCM (line 40) | def LCM (x, y):
function Divisors (line 43) | def Divisors(n):
function SieveOfEratosthenes (line 54) | def SieveOfEratosthenes(n):
function dfs (line 69) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/658 (Div. 2)/C1.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/659 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/660 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/660 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/661 (Div. 3)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/661 (Div. 3)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/661 (Div. 3)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/662 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/662 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/663 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/663 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/664 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
function check (line 84) | def check(r,g,b,w):
FILE: CODEFORCES/Python/664 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/664 (Div. 2)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/665 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/665 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/665 (Div. 2)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/666 (Div. 2)/B.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function matrix (line 22) | def matrix(n):
function string2intlist (line 27) | def string2intlist(s):
function calculate_sum (line 30) | def calculate_sum(a, N): #sum of a to N
function series (line 38) | def series(N):
function count2Dmatrix (line 41) | def count2Dmatrix(i,list):
function modinv (line 44) | def modinv(n,p):
function GCD (line 47) | def GCD(x, y):
function LCM (line 55) | def LCM (x, y):
function Divisors (line 58) | def Divisors(n) :
function isprime (line 68) | def isprime(n):
function SieveOfEratosthenes (line 74) | def SieveOfEratosthenes(n):
function dfs (line 89) | def dfs(n,d,v,c):
function inin (line 145) | def inin():
function stin (line 147) | def stin():
function spin (line 149) | def spin():
function lin (line 151) | def lin(): #takes array as input
function matrix (line 153) | def matrix(n):
function string2intlist (line 158) | def string2intlist(s):
function calculate_sum (line 161) | def calculate_sum(a, N): #sum of a to N
function series (line 169) | def series(N):
function count2Dmatrix (line 172) | def count2Dmatrix(i,list):
function modinv (line 175) | def modinv(n,p):
function GCD (line 178) | def GCD(x, y):
function LCM (line 186) | def LCM (x, y):
function Divisors (line 189) | def Divisors(n) :
function isprime (line 199) | def isprime(n):
function SieveOfEratosthenes (line 205) | def SieveOfEratosthenes(n):
function dfs (line 220) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/666 (Div. 2)/C.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function matrix (line 22) | def matrix(n):
function string2intlist (line 27) | def string2intlist(s):
function calculate_sum (line 30) | def calculate_sum(a, N): #sum of a to N
function series (line 38) | def series(N):
function count2Dmatrix (line 41) | def count2Dmatrix(i,list):
function modinv (line 44) | def modinv(n,p):
function GCD (line 47) | def GCD(x, y):
function LCM (line 55) | def LCM (x, y):
function Divisors (line 58) | def Divisors(n) :
function isprime (line 68) | def isprime(n):
function SieveOfEratosthenes (line 74) | def SieveOfEratosthenes(n):
function dfs (line 89) | def dfs(n,d,v,c):
function inin (line 152) | def inin():
function stin (line 154) | def stin():
function spin (line 156) | def spin():
function lin (line 158) | def lin(): #takes array as input
function matrix (line 160) | def matrix(n):
function string2intlist (line 165) | def string2intlist(s):
function calculate_sum (line 168) | def calculate_sum(a, N): #sum of a to N
function series (line 176) | def series(N):
function count2Dmatrix (line 179) | def count2Dmatrix(i,list):
function modinv (line 182) | def modinv(n,p):
function GCD (line 185) | def GCD(x, y):
function LCM (line 193) | def LCM (x, y):
function Divisors (line 196) | def Divisors(n) :
function isprime (line 206) | def isprime(n):
function SieveOfEratosthenes (line 212) | def SieveOfEratosthenes(n):
function dfs (line 227) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/667 (Div. 3)/A.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function matrix (line 22) | def matrix(n):
function string2intlist (line 27) | def string2intlist(s):
function calculate_sum (line 30) | def calculate_sum(a, N): #sum of a to N
function series (line 38) | def series(N):
function count2Dmatrix (line 41) | def count2Dmatrix(i,list):
function modinv (line 44) | def modinv(n,p):
function GCD (line 47) | def GCD(x, y):
function LCM (line 55) | def LCM (x, y):
function Divisors (line 58) | def Divisors(n) :
function isprime (line 68) | def isprime(n):
function SieveOfEratosthenes (line 74) | def SieveOfEratosthenes(n):
function dfs (line 89) | def dfs(n,d,v,c):
function inin (line 123) | def inin():
function stin (line 125) | def stin():
function spin (line 127) | def spin():
function lin (line 129) | def lin(): #takes array as input
function matrix (line 131) | def matrix(n):
function string2intlist (line 136) | def string2intlist(s):
function calculate_sum (line 139) | def calculate_sum(a, N): #sum of a to N
function series (line 147) | def series(N):
function count2Dmatrix (line 150) | def count2Dmatrix(i,list):
function modinv (line 153) | def modinv(n,p):
function GCD (line 156) | def GCD(x, y):
function LCM (line 164) | def LCM (x, y):
function Divisors (line 167) | def Divisors(n) :
function isprime (line 177) | def isprime(n):
function SieveOfEratosthenes (line 183) | def SieveOfEratosthenes(n):
function dfs (line 198) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/667 (Div. 3)/C.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function matrix (line 22) | def matrix(n):
function string2intlist (line 27) | def string2intlist(s):
function calculate_sum (line 30) | def calculate_sum(a, N): #sum of a to N
function series (line 38) | def series(N):
function count2Dmatrix (line 41) | def count2Dmatrix(i,list):
function modinv (line 44) | def modinv(n,p):
function GCD (line 47) | def GCD(x, y):
function LCM (line 55) | def LCM (x, y):
function Divisors (line 58) | def Divisors(n) :
function isprime (line 68) | def isprime(n):
function SieveOfEratosthenes (line 74) | def SieveOfEratosthenes(n):
function dfs (line 89) | def dfs(n,d,v,c):
function inin (line 138) | def inin():
function stin (line 140) | def stin():
function spin (line 142) | def spin():
function lin (line 144) | def lin(): #takes array as input
function matrix (line 146) | def matrix(n):
function string2intlist (line 151) | def string2intlist(s):
function calculate_sum (line 154) | def calculate_sum(a, N): #sum of a to N
function series (line 162) | def series(N):
function count2Dmatrix (line 165) | def count2Dmatrix(i,list):
function modinv (line 168) | def modinv(n,p):
function GCD (line 171) | def GCD(x, y):
function LCM (line 179) | def LCM (x, y):
function Divisors (line 182) | def Divisors(n) :
function isprime (line 192) | def isprime(n):
function SieveOfEratosthenes (line 198) | def SieveOfEratosthenes(n):
function dfs (line 213) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/668 (Div. 2)/A.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function matrix (line 22) | def matrix(n):
function string2intlist (line 27) | def string2intlist(s):
function calculate_sum (line 30) | def calculate_sum(a, N): #sum of a to N
function series (line 38) | def series(N):
function count2Dmatrix (line 41) | def count2Dmatrix(i,list):
function modinv (line 44) | def modinv(n,p):
function GCD (line 47) | def GCD(x, y):
function LCM (line 55) | def LCM (x, y):
function Divisors (line 58) | def Divisors(n) :
function isprime (line 68) | def isprime(n):
function SieveOfEratosthenes (line 74) | def SieveOfEratosthenes(n):
function dfs (line 89) | def dfs(n,d,v,c):
function inin (line 121) | def inin():
function stin (line 123) | def stin():
function spin (line 125) | def spin():
function lin (line 127) | def lin(): #takes array as input
function matrix (line 129) | def matrix(n):
function string2intlist (line 134) | def string2intlist(s):
function calculate_sum (line 137) | def calculate_sum(a, N): #sum of a to N
function series (line 145) | def series(N):
function count2Dmatrix (line 148) | def count2Dmatrix(i,list):
function modinv (line 151) | def modinv(n,p):
function GCD (line 154) | def GCD(x, y):
function LCM (line 162) | def LCM (x, y):
function Divisors (line 165) | def Divisors(n) :
function isprime (line 175) | def isprime(n):
function SieveOfEratosthenes (line 181) | def SieveOfEratosthenes(n):
function dfs (line 196) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/668 (Div. 2)/B.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function matrix (line 22) | def matrix(n):
function string2intlist (line 27) | def string2intlist(s):
function calculate_sum (line 30) | def calculate_sum(a, N): #sum of a to N
function series (line 38) | def series(N):
function count2Dmatrix (line 41) | def count2Dmatrix(i,list):
function modinv (line 44) | def modinv(n,p):
function GCD (line 47) | def GCD(x, y):
function LCM (line 55) | def LCM (x, y):
function Divisors (line 58) | def Divisors(n) :
function isprime (line 68) | def isprime(n):
function SieveOfEratosthenes (line 74) | def SieveOfEratosthenes(n):
function dfs (line 89) | def dfs(n,d,v,c):
function inin (line 125) | def inin():
function stin (line 127) | def stin():
function spin (line 129) | def spin():
function lin (line 131) | def lin(): #takes array as input
function matrix (line 133) | def matrix(n):
function string2intlist (line 138) | def string2intlist(s):
function calculate_sum (line 141) | def calculate_sum(a, N): #sum of a to N
function series (line 149) | def series(N):
function count2Dmatrix (line 152) | def count2Dmatrix(i,list):
function modinv (line 155) | def modinv(n,p):
function GCD (line 158) | def GCD(x, y):
function LCM (line 166) | def LCM (x, y):
function Divisors (line 169) | def Divisors(n) :
function isprime (line 179) | def isprime(n):
function SieveOfEratosthenes (line 185) | def SieveOfEratosthenes(n):
function dfs (line 200) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/669 (Div. 2)/A.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function matrix (line 22) | def matrix(n):
function count2Dmatrix (line 27) | def count2Dmatrix(i,list):
function modinv (line 30) | def modinv(n,p):
function GCD (line 33) | def GCD(x, y):
function Divisors (line 41) | def Divisors(n) :
function SieveOfEratosthenes (line 52) | def SieveOfEratosthenes(n):
function dfs (line 67) | def dfs(n,d,v,c):
function inin (line 155) | def inin():
function stin (line 157) | def stin():
function spin (line 159) | def spin():
function lin (line 161) | def lin(): #takes array as input
function matrix (line 163) | def matrix(n):
function count2Dmatrix (line 168) | def count2Dmatrix(i,list):
function modinv (line 171) | def modinv(n,p):
function GCD (line 174) | def GCD(x, y):
function Divisors (line 182) | def Divisors(n) :
function SieveOfEratosthenes (line 193) | def SieveOfEratosthenes(n):
function dfs (line 208) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/669 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/670 (Div. 2)/A.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function matrix (line 22) | def matrix(n):
function count2Dmatrix (line 27) | def count2Dmatrix(i,list):
function modinv (line 30) | def modinv(n,p):
function GCD (line 33) | def GCD(x, y):
function Divisors (line 41) | def Divisors(n) :
function SieveOfEratosthenes (line 52) | def SieveOfEratosthenes(n):
function dfs (line 67) | def dfs(n,d,v,c):
function inin (line 107) | def inin():
function stin (line 109) | def stin():
function spin (line 111) | def spin():
function lin (line 113) | def lin(): #takes array as input
function matrix (line 115) | def matrix(n):
function count2Dmatrix (line 120) | def count2Dmatrix(i,list):
function modinv (line 123) | def modinv(n,p):
function GCD (line 126) | def GCD(x, y):
function Divisors (line 134) | def Divisors(n) :
function SieveOfEratosthenes (line 145) | def SieveOfEratosthenes(n):
function dfs (line 160) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/670 (Div. 2)/B.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function matrix (line 22) | def matrix(n):
function count2Dmatrix (line 27) | def count2Dmatrix(i,list):
function modinv (line 30) | def modinv(n,p):
function GCD (line 33) | def GCD(x, y):
function Divisors (line 41) | def Divisors(n) :
function SieveOfEratosthenes (line 52) | def SieveOfEratosthenes(n):
function dfs (line 67) | def dfs(n,d,v,c):
function inin (line 128) | def inin():
function stin (line 130) | def stin():
function spin (line 132) | def spin():
function lin (line 134) | def lin(): #takes array as input
function matrix (line 136) | def matrix(n):
function count2Dmatrix (line 141) | def count2Dmatrix(i,list):
function modinv (line 144) | def modinv(n,p):
function GCD (line 147) | def GCD(x, y):
function Divisors (line 155) | def Divisors(n) :
function SieveOfEratosthenes (line 166) | def SieveOfEratosthenes(n):
function dfs (line 181) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/671 (Div. 2)/A.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function matrix (line 22) | def matrix(n):
function count2Dmatrix (line 27) | def count2Dmatrix(i,list):
function modinv (line 30) | def modinv(n,p):
function GCD (line 33) | def GCD(x, y):
function Divisors (line 41) | def Divisors(n) :
function SieveOfEratosthenes (line 52) | def SieveOfEratosthenes(n):
function dfs (line 67) | def dfs(n,d,v,c):
function inin (line 110) | def inin():
function stin (line 112) | def stin():
function spin (line 114) | def spin():
function lin (line 116) | def lin(): #takes array as input
function matrix (line 118) | def matrix(n):
function count2Dmatrix (line 123) | def count2Dmatrix(i,list):
function modinv (line 126) | def modinv(n,p):
function GCD (line 129) | def GCD(x, y):
function Divisors (line 137) | def Divisors(n) :
function SieveOfEratosthenes (line 148) | def SieveOfEratosthenes(n):
function dfs (line 163) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/671 (Div. 2)/B.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function matrix (line 22) | def matrix(n):
function count2Dmatrix (line 27) | def count2Dmatrix(i,list):
function modinv (line 30) | def modinv(n,p):
function GCD (line 33) | def GCD(x, y):
function Divisors (line 41) | def Divisors(n) :
function SieveOfEratosthenes (line 52) | def SieveOfEratosthenes(n):
function dfs (line 67) | def dfs(n,d,v,c):
function inin (line 110) | def inin():
function stin (line 112) | def stin():
function spin (line 114) | def spin():
function lin (line 116) | def lin(): #takes array as input
function matrix (line 118) | def matrix(n):
function count2Dmatrix (line 123) | def count2Dmatrix(i,list):
function modinv (line 126) | def modinv(n,p):
function GCD (line 129) | def GCD(x, y):
function Divisors (line 137) | def Divisors(n) :
function SieveOfEratosthenes (line 148) | def SieveOfEratosthenes(n):
function dfs (line 163) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/672 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/672 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function nCr (line 32) | def nCr(n, r):
function GCD (line 39) | def GCD(x, y):
function Divisors (line 47) | def Divisors(n) :
function SieveOfEratosthenes (line 58) | def SieveOfEratosthenes(n):
function dfs (line 73) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/685 (Div. 2)/A.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function count2Dmatrix (line 38) | def count2Dmatrix(i, list):
function modinv (line 42) | def modinv(n, p):
function nCr (line 46) | def nCr(n, r):
function GCD (line 54) | def GCD(x, y):
function Divisors (line 64) | def Divisors(n):
function SieveOfEratosthenes (line 79) | def SieveOfEratosthenes(n):
function dfs (line 98) | def dfs(n, d, v, c):
FILE: CODEFORCES/Python/685 (Div. 2)/B.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function count2Dmatrix (line 38) | def count2Dmatrix(i, list):
function modinv (line 42) | def modinv(n, p):
function nCr (line 46) | def nCr(n, r):
function GCD (line 54) | def GCD(x, y):
function Divisors (line 64) | def Divisors(n):
function SieveOfEratosthenes (line 79) | def SieveOfEratosthenes(n):
function dfs (line 98) | def dfs(n, d, v, c):
FILE: CODEFORCES/Python/686 (Div. 3)/A.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function count2Dmatrix (line 38) | def count2Dmatrix(i, list):
function modinv (line 42) | def modinv(n, p):
function nCr (line 46) | def nCr(n, r):
function GCD (line 54) | def GCD(x, y):
function Divisors (line 64) | def Divisors(n):
function SieveOfEratosthenes (line 79) | def SieveOfEratosthenes(n):
function dfs (line 98) | def dfs(n, d, v, c):
FILE: CODEFORCES/Python/686 (Div. 3)/B.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function count2Dmatrix (line 38) | def count2Dmatrix(i, list):
function modinv (line 42) | def modinv(n, p):
function nCr (line 46) | def nCr(n, r):
function GCD (line 54) | def GCD(x, y):
function Divisors (line 64) | def Divisors(n):
function SieveOfEratosthenes (line 79) | def SieveOfEratosthenes(n):
function dfs (line 98) | def dfs(n, d, v, c):
FILE: CODEFORCES/Python/686 (Div. 3)/C.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function count2Dmatrix (line 38) | def count2Dmatrix(i, list):
function modinv (line 42) | def modinv(n, p):
function nCr (line 46) | def nCr(n, r):
function GCD (line 54) | def GCD(x, y):
function Divisors (line 64) | def Divisors(n):
function SieveOfEratosthenes (line 79) | def SieveOfEratosthenes(n):
function dfs (line 98) | def dfs(n, d, v, c):
FILE: CODEFORCES/Python/688 (Div. 2)/A.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function count2Dmatrix (line 38) | def count2Dmatrix(i, list):
function modinv (line 42) | def modinv(n, p):
function nCr (line 46) | def nCr(n, r):
function GCD (line 54) | def GCD(x, y):
function Divisors (line 64) | def Divisors(n):
function SieveOfEratosthenes (line 79) | def SieveOfEratosthenes(n):
function dfs (line 98) | def dfs(n, d, v, c):
FILE: CODEFORCES/Python/690 (Div. 3)/A.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function count2Dmatrix (line 38) | def count2Dmatrix(i, list):
function modinv (line 42) | def modinv(n, p):
function nCr (line 46) | def nCr(n, r):
function GCD (line 54) | def GCD(x, y):
function Divisors (line 64) | def Divisors(n):
function SieveOfEratosthenes (line 79) | def SieveOfEratosthenes(n):
function dfs (line 98) | def dfs(n, d, v, c):
FILE: CODEFORCES/Python/690 (Div. 3)/C.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function count2Dmatrix (line 38) | def count2Dmatrix(i, list):
function modinv (line 42) | def modinv(n, p):
function nCr (line 46) | def nCr(n, r):
function GCD (line 54) | def GCD(x, y):
function Divisors (line 64) | def Divisors(n):
function SieveOfEratosthenes (line 79) | def SieveOfEratosthenes(n):
function dfs (line 98) | def dfs(n, d, v, c):
FILE: CODEFORCES/Python/691 (Div. 2)/A.py
function inin (line 16) | def inin():
function stin (line 20) | def stin():
function spin (line 24) | def spin():
function lin (line 28) | def lin(): # takes array as input
function matrix (line 32) | def matrix(n):
function string2intlist (line 39) | def string2intlist(s):
function calculate_sum (line 43) | def calculate_sum(a, N): # sum of a to N
function series (line 53) | def series(N):
function count2Dmatrix (line 57) | def count2Dmatrix(i, list):
function modinv (line 61) | def modinv(n, p):
function nCr (line 65) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/691 (Div. 2)/B.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/691 (Div. 2)/C.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/692 (Div. 2, based on Technocup 2021 Elimination Round 3)/A.py
function inin (line 16) | def inin():
function stin (line 20) | def stin():
function spin (line 24) | def spin():
function lin (line 28) | def lin(): # takes array as input
function matrix (line 32) | def matrix(n):
function string2intlist (line 39) | def string2intlist(s):
function calculate_sum (line 43) | def calculate_sum(a, N): # sum of a to N
function series (line 53) | def series(N):
function count2Dmatrix (line 57) | def count2Dmatrix(i, list):
function modinv (line 61) | def modinv(n, p):
function nCr (line 65) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/692 (Div. 2, based on Technocup 2021 Elimination Round 3)/B.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/692 (Div. 2, based on Technocup 2021 Elimination Round 3)/C.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/693 (Div. 3)/A.py
function inin (line 16) | def inin():
function stin (line 20) | def stin():
function spin (line 24) | def spin():
function lin (line 28) | def lin(): # takes array as input
function matrix (line 32) | def matrix(n):
function string2intlist (line 39) | def string2intlist(s):
function calculate_sum (line 43) | def calculate_sum(a, N): # sum of a to N
function series (line 53) | def series(N):
function count2Dmatrix (line 57) | def count2Dmatrix(i, list):
function modinv (line 61) | def modinv(n, p):
function nCr (line 65) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/693 (Div. 3)/B.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/693 (Div. 3)/C.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/693 (Div. 3)/D.py
function inin (line 3) | def inin():
function stin (line 7) | def stin():
function spin (line 11) | def spin():
function lin (line 15) | def lin(): # takes array as input
function matrix (line 19) | def matrix(n):
function string2intlist (line 26) | def string2intlist(s):
function calculate_sum (line 30) | def calculate_sum(a, N): # sum of a to N
function series (line 40) | def series(N):
function count2Dmatrix (line 44) | def count2Dmatrix(i, list):
function modinv (line 48) | def modinv(n, p):
function nCr (line 52) | def nCr(n, r):
function LCM (line 60) | def LCM(x, y):
function Divisors (line 64) | def Divisors(n):
function isprime (line 76) | def isprime(n):
function SieveOfEratosthenes (line 90) | def SieveOfEratosthenes(n):
function dfs (line 109) | def dfs(n, d, v, c):
function knapSack (line 124) | def knapSack(W, wt, val, n):
function modularExponentiation (line 140) | def modularExponentiation(x, n):
function modInverse (line 150) | def modInverse(a, m):
FILE: CODEFORCES/Python/694 (Div. 2)/A.py
function inin (line 16) | def inin():
function stin (line 20) | def stin():
function spin (line 24) | def spin():
function lin (line 28) | def lin(): # takes array as input
function matrix (line 32) | def matrix(n):
function string2intlist (line 39) | def string2intlist(s):
function calculate_sum (line 43) | def calculate_sum(a, N): # sum of a to N
function series (line 53) | def series(N):
function count2Dmatrix (line 57) | def count2Dmatrix(i, list):
function modinv (line 61) | def modinv(n, p):
function nCr (line 65) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/694 (Div. 2)/B.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/694 (Div. 2)/C.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/695 (Div. 2)/A.py
function inin (line 16) | def inin():
function stin (line 20) | def stin():
function spin (line 24) | def spin():
function lin (line 28) | def lin(): # takes array as input
function matrix (line 32) | def matrix(n):
function string2intlist (line 39) | def string2intlist(s):
function calculate_sum (line 43) | def calculate_sum(a, N): # sum of a to N
function series (line 53) | def series(N):
function count2Dmatrix (line 57) | def count2Dmatrix(i, list):
function modinv (line 61) | def modinv(n, p):
function nCr (line 65) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/696 (Div. 2)/A.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/696 (Div. 2)/B.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/696 (Div. 2)/C.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/697 (Div. 3)/A.py
function inin (line 16) | def inin():
function stin (line 20) | def stin():
function spin (line 24) | def spin():
function lin (line 28) | def lin(): # takes array as input
function matrix (line 32) | def matrix(n):
function string2intlist (line 39) | def string2intlist(s):
function calculate_sum (line 43) | def calculate_sum(a, N): # sum of a to N
function series (line 53) | def series(N):
function count2Dmatrix (line 57) | def count2Dmatrix(i, list):
function modinv (line 61) | def modinv(n, p):
function nCr (line 65) | def nCr(n, r):
function LCM (line 73) | def LCM(x, y):
function Divisors (line 77) | def Divisors(n):
function isprime (line 89) | def isprime(n):
function SieveOfEratosthenes (line 103) | def SieveOfEratosthenes(n):
function dfs (line 122) | def dfs(n, d, v, c):
function knapSack (line 137) | def knapSack(W, wt, val, n):
function modularExponentiation (line 153) | def modularExponentiation(x, n):
function modInverse (line 163) | def modInverse(a, m):
FILE: CODEFORCES/Python/697 (Div. 3)/B.py
function inin (line 16) | def inin():
function stin (line 20) | def stin():
function spin (line 24) | def spin():
function lin (line 28) | def lin(): # takes array as input
function matrix (line 32) | def matrix(n):
function string2intlist (line 39) | def string2intlist(s):
function calculate_sum (line 43) | def calculate_sum(a, N): # sum of a to N
function series (line 53) | def series(N):
function count2Dmatrix (line 57) | def count2Dmatrix(i, list):
function modinv (line 61) | def modinv(n, p):
function nCr (line 65) | def nCr(n, r):
function LCM (line 73) | def LCM(x, y):
function Divisors (line 77) | def Divisors(n):
function isprime (line 89) | def isprime(n):
function SieveOfEratosthenes (line 103) | def SieveOfEratosthenes(n):
function dfs (line 122) | def dfs(n, d, v, c):
function knapSack (line 137) | def knapSack(W, wt, val, n):
function modularExponentiation (line 153) | def modularExponentiation(x, n):
function modInverse (line 163) | def modInverse(a, m):
FILE: CODEFORCES/Python/698 (Div. 2)/A.py
function inin (line 16) | def inin():
function stin (line 20) | def stin():
function spin (line 24) | def spin():
function lin (line 28) | def lin(): # takes array as input
function matrix (line 32) | def matrix(n):
function string2intlist (line 39) | def string2intlist(s):
function calculate_sum (line 43) | def calculate_sum(a, N): # sum of a to N
function series (line 53) | def series(N):
function count2Dmatrix (line 57) | def count2Dmatrix(i, list):
function modinv (line 61) | def modinv(n, p):
function nCr (line 65) | def nCr(n, r):
function LCM (line 73) | def LCM(x, y):
function Divisors (line 77) | def Divisors(n):
function isprime (line 89) | def isprime(n):
function SieveOfEratosthenes (line 103) | def SieveOfEratosthenes(n):
function dfs (line 122) | def dfs(n, d, v, c):
function knapSack (line 137) | def knapSack(W, wt, val, n):
function modularExponentiation (line 153) | def modularExponentiation(x, n):
function modInverse (line 163) | def modInverse(a, m):
FILE: CODEFORCES/Python/698 (Div. 2)/B.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/699 (Div. 2)/A.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/699 (Div. 2)/B.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/700 (Div. 2)/A.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/700 (Div. 2)/B.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/705 (Div. 2)/A.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: CODEFORCES/Python/705 (Div. 2)/B.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
function change (line 199) | def change(prev):
FILE: CODEFORCES/Python/A. Bit++.py
function solution (line 11) | def solution():
FILE: CODEFORCES/Python/DP/1369D.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 100 (Div. 2)/A.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function GCD (line 72) | def GCD(x, y):
function LCM (line 82) | def LCM(x, y):
function Divisors (line 86) | def Divisors(n):
function isprime (line 98) | def isprime(n):
function SieveOfEratosthenes (line 108) | def SieveOfEratosthenes(n):
function dfs (line 127) | def dfs(n, d, v, c):
function knapSack (line 142) | def knapSack(W, wt, val, n):
function modularExponentiation (line 158) | def modularExponentiation(x, n):
function modInverse (line 168) | def modInverse(a, m):
FILE: CODEFORCES/Python/Edu 100 (Div. 2)/B.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function GCD (line 72) | def GCD(x, y):
function LCM (line 82) | def LCM(x, y):
function Divisors (line 86) | def Divisors(n):
function isprime (line 98) | def isprime(n):
function SieveOfEratosthenes (line 108) | def SieveOfEratosthenes(n):
function dfs (line 127) | def dfs(n, d, v, c):
function knapSack (line 142) | def knapSack(W, wt, val, n):
function modularExponentiation (line 158) | def modularExponentiation(x, n):
function modInverse (line 168) | def modInverse(a, m):
FILE: CODEFORCES/Python/Edu 102 (Div. 2)/A.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function GCD (line 72) | def GCD(x, y):
function LCM (line 82) | def LCM(x, y):
function Divisors (line 86) | def Divisors(n):
function isprime (line 98) | def isprime(n):
function SieveOfEratosthenes (line 108) | def SieveOfEratosthenes(n):
function dfs (line 127) | def dfs(n, d, v, c):
function knapSack (line 142) | def knapSack(W, wt, val, n):
function modularExponentiation (line 158) | def modularExponentiation(x, n):
function modInverse (line 168) | def modInverse(a, m):
FILE: CODEFORCES/Python/Edu 102 (Div. 2)/B.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function GCD (line 72) | def GCD(x, y):
function LCM (line 82) | def LCM(x, y):
function Divisors (line 86) | def Divisors(n):
function isprime (line 98) | def isprime(n):
function SieveOfEratosthenes (line 108) | def SieveOfEratosthenes(n):
function dfs (line 127) | def dfs(n, d, v, c):
function knapSack (line 142) | def knapSack(W, wt, val, n):
function modularExponentiation (line 158) | def modularExponentiation(x, n):
function modInverse (line 168) | def modInverse(a, m):
FILE: CODEFORCES/Python/Edu 103 (Div. 2)/A.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function GCD (line 72) | def GCD(x, y):
function LCM (line 82) | def LCM(x, y):
function Divisors (line 86) | def Divisors(n):
function isprime (line 98) | def isprime(n):
function SieveOfEratosthenes (line 108) | def SieveOfEratosthenes(n):
function dfs (line 127) | def dfs(n, d, v, c):
function knapSack (line 142) | def knapSack(W, wt, val, n):
function modularExponentiation (line 158) | def modularExponentiation(x, n):
function modInverse (line 168) | def modInverse(a, m):
FILE: CODEFORCES/Python/Edu 103 (Div. 2)/B.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function GCD (line 72) | def GCD(x, y):
function LCM (line 82) | def LCM(x, y):
function Divisors (line 86) | def Divisors(n):
function isprime (line 98) | def isprime(n):
function SieveOfEratosthenes (line 108) | def SieveOfEratosthenes(n):
function dfs (line 127) | def dfs(n, d, v, c):
function knapSack (line 142) | def knapSack(W, wt, val, n):
function modularExponentiation (line 158) | def modularExponentiation(x, n):
function modInverse (line 168) | def modInverse(a, m):
FILE: CODEFORCES/Python/Edu 89 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 89 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 90 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 90 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 90 (Div. 2)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
function process (line 82) | def process():
FILE: CODEFORCES/Python/Edu 90 (Div. 2)/D.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 91 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 91 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 91 (Div. 2)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 92 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 92 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 92 (Div. 2)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 93 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 93 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 93 (Div. 2)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 94 (Div. 2)/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function string2intlist (line 26) | def string2intlist(s):
function calculate_sum (line 29) | def calculate_sum(a, N): #sum of a to N
function series (line 37) | def series(N):
function count2Dmatrix (line 40) | def count2Dmatrix(i,list):
function modinv (line 43) | def modinv(n,p):
function GCD (line 46) | def GCD(x, y):
function LCM (line 54) | def LCM (x, y):
function Divisors (line 57) | def Divisors(n) :
function isprime (line 67) | def isprime(n):
function SieveOfEratosthenes (line 73) | def SieveOfEratosthenes(n):
function dfs (line 88) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 94 (Div. 2)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function string2intlist (line 26) | def string2intlist(s):
function calculate_sum (line 29) | def calculate_sum(a, N): #sum of a to N
function series (line 37) | def series(N):
function count2Dmatrix (line 40) | def count2Dmatrix(i,list):
function modinv (line 43) | def modinv(n,p):
function GCD (line 46) | def GCD(x, y):
function LCM (line 54) | def LCM (x, y):
function Divisors (line 57) | def Divisors(n) :
function isprime (line 67) | def isprime(n):
function SieveOfEratosthenes (line 73) | def SieveOfEratosthenes(n):
function dfs (line 88) | def dfs(n,d,v,c):
function knapSack (line 103) | def knapSack(W, wt, val, n):
FILE: CODEFORCES/Python/Edu 94 (Div. 2)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function string2intlist (line 26) | def string2intlist(s):
function calculate_sum (line 29) | def calculate_sum(a, N): #sum of a to N
function series (line 37) | def series(N):
function count2Dmatrix (line 40) | def count2Dmatrix(i,list):
function modinv (line 43) | def modinv(n,p):
function GCD (line 46) | def GCD(x, y):
function LCM (line 54) | def LCM (x, y):
function Divisors (line 57) | def Divisors(n) :
function isprime (line 67) | def isprime(n):
function SieveOfEratosthenes (line 73) | def SieveOfEratosthenes(n):
function dfs (line 88) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Edu 95 (Div. 2)/A.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function matrix (line 22) | def matrix(n):
function string2intlist (line 27) | def string2intlist(s):
function calculate_sum (line 30) | def calculate_sum(a, N): #sum of a to N
function series (line 38) | def series(N):
function count2Dmatrix (line 41) | def count2Dmatrix(i,list):
function modinv (line 44) | def modinv(n,p):
function GCD (line 47) | def GCD(x, y):
function LCM (line 55) | def LCM (x, y):
function Divisors (line 58) | def Divisors(n) :
function isprime (line 68) | def isprime(n):
function SieveOfEratosthenes (line 74) | def SieveOfEratosthenes(n):
function dfs (line 89) | def dfs(n,d,v,c):
function knapSack (line 103) | def knapSack(W, wt, val, n):
function inin (line 138) | def inin():
function stin (line 140) | def stin():
function spin (line 142) | def spin():
function lin (line 144) | def lin(): #takes array as input
function matrix (line 146) | def matrix(n):
function string2intlist (line 151) | def string2intlist(s):
function calculate_sum (line 154) | def calculate_sum(a, N): #sum of a to N
function series (line 162) | def series(N):
function count2Dmatrix (line 165) | def count2Dmatrix(i,list):
function modinv (line 168) | def modinv(n,p):
function GCD (line 171) | def GCD(x, y):
function LCM (line 179) | def LCM (x, y):
function Divisors (line 182) | def Divisors(n) :
function isprime (line 192) | def isprime(n):
function SieveOfEratosthenes (line 198) | def SieveOfEratosthenes(n):
function dfs (line 213) | def dfs(n,d,v,c):
function knapSack (line 227) | def knapSack(W, wt, val, n):
FILE: CODEFORCES/Python/Edu 95 (Div. 2)/B.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function matrix (line 22) | def matrix(n):
function string2intlist (line 27) | def string2intlist(s):
function calculate_sum (line 30) | def calculate_sum(a, N): #sum of a to N
function series (line 38) | def series(N):
function count2Dmatrix (line 41) | def count2Dmatrix(i,list):
function modinv (line 44) | def modinv(n,p):
function GCD (line 47) | def GCD(x, y):
function LCM (line 55) | def LCM (x, y):
function Divisors (line 58) | def Divisors(n) :
function isprime (line 68) | def isprime(n):
function SieveOfEratosthenes (line 74) | def SieveOfEratosthenes(n):
function dfs (line 89) | def dfs(n,d,v,c):
function knapSack (line 103) | def knapSack(W, wt, val, n):
function inin (line 138) | def inin():
function stin (line 140) | def stin():
function spin (line 142) | def spin():
function lin (line 144) | def lin(): #takes array as input
function matrix (line 146) | def matrix(n):
function string2intlist (line 151) | def string2intlist(s):
function calculate_sum (line 154) | def calculate_sum(a, N): #sum of a to N
function series (line 162) | def series(N):
function count2Dmatrix (line 165) | def count2Dmatrix(i,list):
function modinv (line 168) | def modinv(n,p):
function GCD (line 171) | def GCD(x, y):
function LCM (line 179) | def LCM (x, y):
function Divisors (line 182) | def Divisors(n) :
function isprime (line 192) | def isprime(n):
function SieveOfEratosthenes (line 198) | def SieveOfEratosthenes(n):
function dfs (line 213) | def dfs(n,d,v,c):
function knapSack (line 227) | def knapSack(W, wt, val, n):
FILE: CODEFORCES/Python/Global Round 10/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Global Round 10/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Global Round 10/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Global Round 10/D.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Global Round 12/A.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function count2Dmatrix (line 38) | def count2Dmatrix(i, list):
function modinv (line 42) | def modinv(n, p):
function nCr (line 46) | def nCr(n, r):
function GCD (line 54) | def GCD(x, y):
function Divisors (line 64) | def Divisors(n):
function SieveOfEratosthenes (line 79) | def SieveOfEratosthenes(n):
function dfs (line 98) | def dfs(n, d, v, c):
FILE: CODEFORCES/Python/Global Round 12/B.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function count2Dmatrix (line 38) | def count2Dmatrix(i, list):
function modinv (line 42) | def modinv(n, p):
function nCr (line 46) | def nCr(n, r):
function GCD (line 54) | def GCD(x, y):
function Divisors (line 64) | def Divisors(n):
function SieveOfEratosthenes (line 79) | def SieveOfEratosthenes(n):
function dfs (line 98) | def dfs(n, d, v, c):
FILE: CODEFORCES/Python/Global Round 12/C.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function count2Dmatrix (line 38) | def count2Dmatrix(i, list):
function modinv (line 42) | def modinv(n, p):
function nCr (line 46) | def nCr(n, r):
function GCD (line 54) | def GCD(x, y):
function Divisors (line 64) | def Divisors(n):
function SieveOfEratosthenes (line 79) | def SieveOfEratosthenes(n):
function dfs (line 98) | def dfs(n, d, v, c):
FILE: CODEFORCES/Python/Global Round 8/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Global Round 8/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Global Round 8/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Global Round 9/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Global Round 9/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/Global Round 9/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CODEFORCES/Python/ICPC Challenge 2020 Practice/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: CSAcademy/Frequent Numbers.c
function main (line 5) | int main()
FILE: CSAcademy/Round 47/Adjacent Vowels.c
function main (line 6) | int main()
FILE: CSAcademy/Round 47/Consecutive Sum.c
function main (line 6) | int main()
FILE: CSAcademy/Round 65/Encipherment.cpp
function main (line 4) | int main()
FILE: CSAcademy/Round 68(div 2)/A. String Concat.cpp
function main (line 4) | int main()
FILE: GeeksForGeeks/Count the triplets.py
class Solution (line 2) | class Solution:
method countTriplet (line 3) | def countTriplet(self, arr, n):
FILE: GeeksForGeeks/Subarray with given sum.py
class Solution (line 4) | class Solution:
method subArraySum (line 5) | def subArraySum(self, arr, n, s):
function main (line 32) | def main():
FILE: GeeksForGeeks/Triplets again.py
function getijk (line 6) | def getijk(array):
FILE: Hackerearth/Algorithm/Graph/Stay Healthy! Greedy.py
function inin (line 16) | def inin():
function stin (line 20) | def stin():
function spin (line 24) | def spin():
function lin (line 28) | def lin(): # takes array as input
function matrix (line 32) | def matrix(n):
function string2intlist (line 40) | def string2intlist(s):
function calculate_sum (line 44) | def calculate_sum(a, N): # sum of a to N
function series (line 54) | def series(N):
function count2Dmatrix (line 58) | def count2Dmatrix(i, list):
function modinv (line 62) | def modinv(n, p):
function nCr (line 66) | def nCr(n, r):
function LCM (line 74) | def LCM(x, y):
function Divisors (line 78) | def Divisors(n):
function isprime (line 90) | def isprime(n):
function SieveOfEratosthenes (line 104) | def SieveOfEratosthenes(n):
function dfs (line 123) | def dfs(n, d, v, c):
function knapSack (line 140) | def knapSack(W, wt, val, n):
function modularExponentiation (line 156) | def modularExponentiation(x, n):
function modInverse (line 166) | def modInverse(a, m):
FILE: Hackerearth/August Circuits '20/Anti-palindrome strings.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function calculate_sum (line 26) | def calculate_sum(a, N): #sum of a to N
function series (line 34) | def series(N):
function count2Dmatrix (line 37) | def count2Dmatrix(i,list):
function modinv (line 40) | def modinv(n,p):
function GCD (line 43) | def GCD(x, y):
function LCM (line 51) | def LCM (x, y):
function Divisors (line 54) | def Divisors(n) :
function isprime (line 64) | def isprime(n):
function SieveOfEratosthenes (line 70) | def SieveOfEratosthenes(n):
function dfs (line 85) | def dfs(n,d,v,c):
FILE: Hackerearth/Basic Number Theory-1/Love Triangle.py
function love (line 3) | def love(i):
FILE: Hackerearth/Basic Number Theory-1/Tutorial Code.py
function binaryExponentiation (line 16) | def binaryExponentiation(b, n, m):
function modInverse (line 24) | def modInverse(a, m) :
FILE: Hackerearth/January Circuits '21/A chessboard.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: Hackerearth/January Circuits '21/Replace the strings.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: Hackerearth/January Circuits '21/Scoreboard queries.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: Hackerearth/January Circuits '21/The GCD Function.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function string2intlist (line 38) | def string2intlist(s):
function calculate_sum (line 42) | def calculate_sum(a, N): # sum of a to N
function series (line 52) | def series(N):
function count2Dmatrix (line 56) | def count2Dmatrix(i, list):
function modinv (line 60) | def modinv(n, p):
function nCr (line 64) | def nCr(n, r):
function LCM (line 72) | def LCM(x, y):
function Divisors (line 76) | def Divisors(n):
function isprime (line 88) | def isprime(n):
function SieveOfEratosthenes (line 102) | def SieveOfEratosthenes(n):
function dfs (line 121) | def dfs(n, d, v, c):
function knapSack (line 136) | def knapSack(W, wt, val, n):
function modularExponentiation (line 152) | def modularExponentiation(x, n):
function modInverse (line 162) | def modInverse(a, m):
FILE: LIGHTOJ/1000.c
function main (line 4) | int main()
FILE: LIGHTOJ/1001.c
function main (line 4) | int main()
FILE: LIGHTOJ/1006.c
function fn (line 5) | int fn( long long int n ) {
function main (line 16) | int main() {
FILE: LIGHTOJ/1030.cpp
function main (line 49) | int main()
FILE: LIGHTOJ/1225.cpp
function main (line 49) | int main()
FILE: LIGHTOJ/1433. Minimum Arc Distance.cpp
function main (line 4) | int main()
FILE: LIGHTOJ/Python/1027.A Dangerous Maze.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function modinv (line 23) | def modinv(n,p):
function GCD (line 26) | def GCD(x, y):
function Divisors (line 34) | def Divisors(n) :
function SieveOfEratosthenes (line 45) | def SieveOfEratosthenes(n):
function dfs (line 60) | def dfs(n,d,v,c):
function gcd (line 72) | def gcd(x ,y):
FILE: LIGHTOJ/Python/1030.Discovering Gold.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function modinv (line 23) | def modinv(n,p):
function GCD (line 26) | def GCD(x, y):
function Divisors (line 34) | def Divisors(n) :
function SieveOfEratosthenes (line 45) | def SieveOfEratosthenes(n):
function dfs (line 60) | def dfs(n,d,v,c):
function gcd (line 72) | def gcd(x ,y):
FILE: LIGHTOJ/Python/1038. Race 1 Again.py
function inin (line 14) | def inin():
function stin (line 16) | def stin():
function spin (line 18) | def spin():
function lin (line 20) | def lin(): #takes array as input
function modinv (line 23) | def modinv(n,p):
function GCD (line 26) | def GCD(x, y):
function Divisors (line 34) | def Divisors(n) :
function SieveOfEratosthenes (line 45) | def SieveOfEratosthenes(n):
function dfs (line 60) | def dfs(n,d,v,c):
function gcd (line 72) | def gcd(x ,y):
FILE: LeetCode/1. Two Sum.py
class Solution (line 1) | class Solution:
method twoSum (line 2) | def twoSum(self, nums: List[int], target: int) -> List[int]:
FILE: LeetCode/1108. Defanging an IP Address.py
class Solution (line 1) | class Solution:
method defangIPaddr (line 2) | def defangIPaddr(self, address: str) -> str:
FILE: LeetCode/1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree.py
class Solution (line 8) | class Solution:
method getTargetCopy (line 10) | def getTargetCopy(self, original: TreeNode, cloned: TreeNode, target: ...
FILE: LeetCode/1480. Running Sum of 1d Array.py
class Solution (line 1) | class Solution:
method runningSum (line 2) | def runningSum(self, nums: List[int]) -> List[int]:
FILE: LeetCode/1689. Partitioning Into Minimum Number Of Deci-Binary Numbers.py
class Solution (line 1) | class Solution:
method minPartitions (line 2) | def minPartitions(self, n: str) -> int:
FILE: LeetCode/1791. Find Center of Star Graph.py
class Solution (line 1) | class Solution:
method findCenter (line 2) | def findCenter(self, edges: List[List[int]]) -> int:
FILE: LeetCode/1971. Find if Path Exists in Graph.py
class Solution (line 4) | class Solution:
method validPath (line 5) | def validPath(self, n: int, edges: List[List[int]], source: int, desti...
FILE: LeetCode/2011. Final Value of Variable After Performing Operations.py
class Solution (line 1) | class Solution:
method finalValueAfterOperations (line 2) | def finalValueAfterOperations(self, operations: List[str]) -> int:
FILE: LeetCode/2114. Maximum Number of Words Found in Sentences.py
class Solution (line 1) | class Solution:
method mostWordsFound (line 2) | def mostWordsFound(self, sentences: List[str]) -> int:
FILE: LeetCode/2236. Root Equals Sum of Children.py
class Solution (line 7) | class Solution:
method checkTree (line 8) | def checkTree(self, root: Optional[TreeNode]) -> bool:
FILE: LeetCode/3110. Score of a String.py
class Solution (line 1) | class Solution:
method scoreOfString (line 2) | def scoreOfString(self, s: str) -> int:
FILE: LeetCode/535. Encode and Decode TinyURL.py
class Codec (line 1) | class Codec:
method __init__ (line 2) | def __init__(self):
method encode (line 5) | def encode(self, longUrl: str) -> str:
method decode (line 14) | def decode(self, shortUrl: str) -> str:
FILE: LeetCode/617. Merge Two Binary Trees.py
class Solution (line 7) | class Solution:
method mergeTrees (line 8) | def mergeTrees(self, root1: Optional[TreeNode], root2: Optional[TreeNo...
FILE: LeetCode/724. Find Pivot Index.py
class Solution (line 1) | class Solution(object):
method pivotIndex (line 2) | def pivotIndex(self, nums):
FILE: LeetCode/771. Jewels and Stones.py
class Solution (line 1) | class Solution:
method numJewelsInStones (line 2) | def numJewelsInStones(self, jewels: str, stones: str) -> int:
FILE: LeetCode/9. Palindrome Number.py
class Solution (line 1) | class Solution:
method isPalindrome (line 2) | def isPalindrome(self, x: int) -> bool:
FILE: LeetCode/938. Range Sum of BST.py
class Solution (line 7) | class Solution:
method rangeSumBST (line 8) | def rangeSumBST(self, root: Optional[TreeNode], low: int, high: int) -...
FILE: LeetCode/94. Binary Tree Inorder Traversal.py
class TreeNode (line 2) | class TreeNode:
method __init__ (line 4) | def __init__(self, val=0, left=None, right=None):
class Solution (line 10) | class Solution:
method inorderTraversal (line 12) | def inorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
FILE: LeetCode/997. Find the Town Judge.py
class Solution (line 4) | class Solution:
method findJudge (line 6) | def findJudge(self, n: int, trust: List[List[int]]) -> int:
FILE: Toph/SELISE Coding Challenge 2020/A.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
function dfs_cycle (line 86) | def dfs_cycle(u, p, color: list,
function addEdge (line 112) | def addEdge(u, v):
function printCycles (line 116) | def printCycles(edges, mark: list):
FILE: Toph/SELISE Coding Challenge 2020/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: Toph/SELISE Coding Challenge 2020/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: Toph/SELISE Coding Challenge 2020/D.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: Toph/SELISE Coding Challenge 2020/E.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: Toph/SELISE Coding Challenge 2020/F.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: Toph/SELISE Coding Challenge 2020/G.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: Toph/SELISE Coding Challenge 2020/H.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
function knapsack (line 81) | def knapsack(c, space, fun, n):
FILE: Toph/SELISE Coding Challenge 2020/J.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function matrix (line 21) | def matrix(n):
function count2Dmatrix (line 26) | def count2Dmatrix(i,list):
function modinv (line 29) | def modinv(n,p):
function GCD (line 32) | def GCD(x, y):
function Divisors (line 40) | def Divisors(n) :
function SieveOfEratosthenes (line 51) | def SieveOfEratosthenes(n):
function dfs (line 66) | def dfs(n,d,v,c):
FILE: UVA/10334 - Ray Through Glasses.cpp
function main (line 4) | int main() {
FILE: UVA/10407 - Simple division.py
function solve (line 5) | def solve(row):
FILE: Vjudge/RAPL Round 1(376797)/B.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function modinv (line 22) | def modinv(n,p):
function GCD (line 25) | def GCD(x, y):
function Divisors (line 33) | def Divisors(n) :
function SieveOfEratosthenes (line 44) | def SieveOfEratosthenes(n):
function dfs (line 59) | def dfs(n,d,v,c):
function bin2dec (line 74) | def bin2dec(n):
FILE: Vjudge/RAPL Round 1(376797)/C.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function modinv (line 22) | def modinv(n,p):
function GCD (line 25) | def GCD(x, y):
function Divisors (line 33) | def Divisors(n) :
function SieveOfEratosthenes (line 44) | def SieveOfEratosthenes(n):
function dfs (line 59) | def dfs(n,d,v,c):
FILE: Vjudge/RAPL Round 1(376797)/D.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function modinv (line 22) | def modinv(n,p):
function GCD (line 25) | def GCD(x, y):
function Divisors (line 33) | def Divisors(n) :
function SieveOfEratosthenes (line 44) | def SieveOfEratosthenes(n):
function dfs (line 59) | def dfs(n,d,v,c):
FILE: Vjudge/RAPL Round 1(376797)/E.py
function inin (line 13) | def inin():
function stin (line 15) | def stin():
function spin (line 17) | def spin():
function lin (line 19) | def lin(): #takes array as input
function modinv (line 22) | def modinv(n,p):
function GCD (line 25) | def GCD(x, y):
function Divisors (line 33) | def Divisors(n) :
function SieveOfEratosthenes (line 44) | def SieveOfEratosthenes(n):
function dfs (line 59) | def dfs(n,d,v,c):
FILE: Vjudge/RAPL TFC__(413583)/A.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function count2Dmatrix (line 38) | def count2Dmatrix(i, list):
function modinv (line 42) | def modinv(n, p):
function nCr (line 46) | def nCr(n, r):
function GCD (line 54) | def GCD(x, y):
function Divisors (line 64) | def Divisors(n):
function SieveOfEratosthenes (line 79) | def SieveOfEratosthenes(n):
function dfs (line 98) | def dfs(n, d, v, c):
function modularExponentiation (line 122) | def modularExponentiation(x, n):
function modInverse (line 131) | def modInverse(a, m):
FILE: Vjudge/RAPL TFC__(413583)/C.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # takes array as input
function matrix (line 31) | def matrix(n):
function count2Dmatrix (line 38) | def count2Dmatrix(i, list):
function modinv (line 42) | def modinv(n, p):
function nCr (line 46) | def nCr(n, r):
function GCD (line 54) | def GCD(x, y):
function Divisors (line 64) | def Divisors(n):
function SieveOfEratosthenes (line 79) | def SieveOfEratosthenes(n):
function dfs (line 98) | def dfs(n, d, v, c):
FILE: Vjudge/TFC - 2/E.cpp
function main (line 4) | int main()
FILE: Vjudge/TFC3/C.py
function inin (line 15) | def inin():
function stin (line 19) | def stin():
function spin (line 23) | def spin():
function lin (line 27) | def lin(): # tashiftes array as input
function matrix (line 31) | def matrix(n):
function count2Dmatrix (line 38) | def count2Dmatrix(i, list):
function modinv (line 42) | def modinv(n, p):
function nCr (line 46) | def nCr(n, r):
function GCD (line 54) | def GCD(x, y):
function Divisors (line 64) | def Divisors(n):
function SieveOfEratosthenes (line 79) | def SieveOfEratosthenes(n):
function dfs (line 98) | def dfs(n, d, v, c):
FILE: Vjudge/TFC3/D.py
function inin (line 16) | def inin():
function stin (line 20) | def stin():
function spin (line 24) | def spin():
function lin (line 28) | def lin(): # takes array as input
function matrix (line 32) | def matrix(n):
function count2Dmatrix (line 39) | def count2Dmatrix(i, list):
function modinv (line 43) | def modinv(n, p):
function nCr (line 47) | def nCr(n, r):
function GCD (line 55) | def GCD(x, y):
function Divisors (line 65) | def Divisors(n):
function SieveOfEratosthenes (line 80) | def SieveOfEratosthenes(n):
function dfs (line 99) | def dfs(n, d, v, c):
FILE: Vjudge/Team Practice Contest(419090)/B.py
function inin (line 16) | def inin():
function stin (line 20) | def stin():
function spin (line 24) | def spin():
function lin (line 28) | def lin(): # takes array as input
function matrix (line 32) | def matrix(n):
function count2Dmatrix (line 39) | def count2Dmatrix(i, list):
function modinv (line 43) | def modinv(n, p):
function nCr (line 47) | def nCr(n, r):
function GCD (line 55) | def GCD(x, y):
function Divisors (line 65) | def Divisors(n):
function SieveOfEratosthenes (line 80) | def SieveOfEratosthenes(n):
function dfs (line 99) | def dfs(n, d, v, c):
Condensed preview — 452 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (4,743K chars).
[
{
"path": ".gitattributes",
"chars": 66,
"preview": "# Auto detect text files and perform LF normalization\n* text=auto\n"
},
{
"path": ".gitignore",
"chars": 25,
"preview": "*.json\n*.xml\n*.iml\n*.idea"
},
{
"path": "1.Template.py",
"chars": 2873,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "Atcoder/abc175/A.py",
"chars": 2411,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "Atcoder/abc175/B.py",
"chars": 2704,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "Atcoder/abc175/C.py",
"chars": 2502,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "Atcoder/abc176/A.py",
"chars": 2298,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "Atcoder/abc176/B.py",
"chars": 2356,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "Atcoder/abc176/C.py",
"chars": 2418,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "Atcoder/abc177/A.py",
"chars": 4824,
"preview": "<<<<<<< HEAD\nfrom __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import s"
},
{
"path": "Atcoder/abc177/B.py",
"chars": 5760,
"preview": "<<<<<<< HEAD\nfrom __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import s"
},
{
"path": "Atcoder/abc184/A.py",
"chars": 2906,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "Atcoder/abc184/B.py",
"chars": 3000,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "Atcoder/abc184/C.py",
"chars": 3166,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "Atcoder/arc104/A.py",
"chars": 4745,
"preview": "<<<<<<< HEAD\nfrom __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import s"
},
{
"path": "Atcoder/arc104/B.py",
"chars": 2845,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "Atcoder/arc110/A.py",
"chars": 2383,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODECHEF/Ciel and A-B Problem.c",
"chars": 204,
"preview": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint main()\n{\n int A,B,S;\n scanf(\"%d %d\",&A,&B);\n S=abs(A-"
},
{
"path": "CODECHEF/Cleaning Up.c",
"chars": 774,
"preview": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint main()\n{\n int T,n,m,i,k,flag;\n scanf(\"%d\",&T);\n while"
},
{
"path": "CODECHEF/Lapindromes.c",
"chars": 443,
"preview": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<string.h>\n\nint main()\n{\n int T,i,j,flag=0,x,y;\n cha"
},
{
"path": "CODECHEF/Racing Horses.c",
"chars": 528,
"preview": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint main()\n{\n long long n,i,j,d,e,T;\n scanf(\"%lld\",&T);\n "
},
{
"path": "CODECHEF/Sums is a Triangle.c",
"chars": 921,
"preview": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n\nint main()\n{\n int T,n,i,j,s1=0,s=0,temp=0;\n scanf(\"%d\",&T);"
},
{
"path": "CODEFORCES/C/112A-Petya & Strings.cpp",
"chars": 532,
"preview": "#include<bits/stdc++.h>\nint main()\n{\n char ax[110],bx[110];\n int i;\n scanf(\"%s %s\",ax,bx);\n for(i=0;i<(strle"
},
{
"path": "CODEFORCES/C/118A. String Task.c",
"chars": 393,
"preview": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n\nint main()\n{\n char sx[100],sy[100];\n int"
},
{
"path": "CODEFORCES/C/118A. String Task.cpp",
"chars": 451,
"preview": "#include<bits/stdc++.h>\nmain()\n{\n char a[101];int i;\n gets(a);\n strlwr(a);\n for(i=0;a[i]!='\\0';i++)\n {\n "
},
{
"path": "CODEFORCES/C/12A.Super Agent.c",
"chars": 369,
"preview": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n\nint main()\n{\n char ax[3][3];\n int i,j;\n "
},
{
"path": "CODEFORCES/C/13A.numbers.c",
"chars": 340,
"preview": "#include<stdio.h>\nint main()\n{\n int A,i,j,d=0,q=0,s1=0,s2=1,count=0;\n scanf(\"%d\",&A);\n\n for(i=2;i<A;i++)\n {\n"
},
{
"path": "CODEFORCES/C/158A - Next Round.cpp",
"chars": 250,
"preview": "#include<bits/stdc++.h>\nint main()\n{\n int n,k,i,cnt=0;\n scanf(\"%d %d\",&n,&k);\n int a[n+1];\n\n for(i=1;i<=n;i+"
},
{
"path": "CODEFORCES/C/1A-Theatre Square.c",
"chars": 223,
"preview": "#include<stdio.h>\nint main()\n{\n long long n,m,a;\n long long x,y,total;\n scanf(\"%lld %lld %lld\",&n,&m,&a);\n x"
},
{
"path": "CODEFORCES/C/20-21 ICPC, NERC (Mirror)/C.py",
"chars": 2570,
"preview": "from __future__ import division, print_function\nfrom collections import Counter\n# import threading\n# threading.stack_siz"
},
{
"path": "CODEFORCES/C/20-21 ICPC, NERC (Mirror)/E.cpp",
"chars": 1274,
"preview": "/// In the name of Allah SWT\n\nusing namespace std;\n#include <bits/stdc++.h>\n\n#define ll long long int\n#define dd double\n"
},
{
"path": "CODEFORCES/C/20-21 ICPC, NERC (Mirror)/N.cpp",
"chars": 1890,
"preview": "/// In the name of Allah SWT\n\nusing namespace std;\n#include <bits/stdc++.h>\n\n#define ll long long int\n#define dd double\n"
},
{
"path": "CODEFORCES/C/231A-Team.cpp",
"chars": 225,
"preview": "#include<bits/stdc++.h>\nint main()\n{\n long long n,a,b,c,cnt=0,i;\n scanf(\"%lld\",&n);\n while(n--)\n {\n s"
},
{
"path": "CODEFORCES/C/282A-Bit++.cpp",
"chars": 244,
"preview": "#include<bits/stdc++.h>\nint main()\n{\n int n,x=0;\n char s[4];\n scanf(\"%d\",&n);\n while(n--)\n {\n scan"
},
{
"path": "CODEFORCES/C/2A.cpp",
"chars": 2409,
"preview": "#include <bits/stdc++.h>\n\nusing namespace std;\n\n// Input macros\n#define si(n) scanf(\"%d\",&n)\n#defi"
},
{
"path": "CODEFORCES/C/3A.cpp",
"chars": 2510,
"preview": "#include <bits/stdc++.h>\nusing namespace std;\n\n// Input macros\n#define si(n) scanf(\"%d\",&n)\n#defin"
},
{
"path": "CODEFORCES/C/428,div 2/A.Arya and Bran.c",
"chars": 430,
"preview": "#include<stdio.h>\nint main()\n{\n int n,k,i,sum=0,count=0,r=0;\n scanf(\"%d %d\",&n,&k);\n int a[n];\n for(i=0;i<n;"
},
{
"path": "CODEFORCES/C/429,div 2/A.c",
"chars": 285,
"preview": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h\n#include<math.h>\n\nint main()\n{\n int n,k,i;\n scanf(\"%d %d\",&"
},
{
"path": "CODEFORCES/C/433,div 2/A.Fraction.c",
"chars": 378,
"preview": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n\nint main()\n{\n int sum,a,b,i,j;\n scanf(\"%"
},
{
"path": "CODEFORCES/C/458,div 1+2/A.cpp",
"chars": 2643,
"preview": "#include <bits/stdc++.h>\nusing namespace std;\n\n// Input macros\n#define si(n) scanf(\"%d\",&n)\n#defin"
},
{
"path": "CODEFORCES/C/459 (Div. 2)/A. Eleven.cpp",
"chars": 414,
"preview": "#include<bits/stdc++.h>\nusing namespace std;\n\nint main()\n{\n long long n,j=0,x=0,y=1;\n scanf(\"%lld\",&n);\n char s"
},
{
"path": "CODEFORCES/C/463(1+2)/A.Palidromic Supersequence.cpp",
"chars": 199,
"preview": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n char a[1010];\n scanf(\"%s\",a);\n\n cout<<a;\n\n for(lo"
},
{
"path": "CODEFORCES/C/463(1+2)/B. Recursive Queries.cpp",
"chars": 367,
"preview": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n long long n,l,r,k,i,j,a,b,c=0,cnt=0;\n scanf(\"%lld\",&n);"
},
{
"path": "CODEFORCES/C/465,div 2/A. Fafa and his Company.cpp",
"chars": 190,
"preview": "#include<bits/stdc++.h>\nusing namespace std;\n\nint main()\n{\n long long n,i,cnt=0;\n cin>>n;\n for(i=1;i<n;i++)\n "
},
{
"path": "CODEFORCES/C/465,div 2/B. Fafa and the Gates.cpp",
"chars": 645,
"preview": "#include<bits/stdc++.h>\nusing namespace std;\n\nint main()\n{\n long long n,i,x=0,y=0,p,q,cnt=0;\n scanf(\"%lld\",&n);\n "
},
{
"path": "CODEFORCES/C/478A-Initial Bet.cpp",
"chars": 360,
"preview": "#include<bits/stdc++.h>\nusing namespace std;\n\nint main()\n{\n long long a,b,c,d,e,x;\n scanf(\"%lld %lld %lld %lld %ll"
},
{
"path": "CODEFORCES/C/4A-dividing watermelon.c",
"chars": 219,
"preview": "#include<stdio.h>\nint main()\n{\n int w;\n scanf(\"%d\",&w);\n if(1<=w&&w<=100&&w!=2)\n {\n if(w%2==0)\n "
},
{
"path": "CODEFORCES/C/4A.Chat Server's Outgoing Traffic.c",
"chars": 1,
"preview": "\n"
},
{
"path": "CODEFORCES/C/50A-Domino Piling.c",
"chars": 132,
"preview": "#include<stdio.h>\nint main()\n{\n int M,N,x;\n scanf(\"%d %d\",&M,&N);\n if((M*N)<=256)\n x=(M*N)/2;\n printf"
},
{
"path": "CODEFORCES/C/677A-Vanya and Fence.cpp",
"chars": 253,
"preview": "#include<bits/stdc++.h>\nusing namespace std;\n\nint main()\n{\n long long a,n,h,i,cnt=0;\n cin>>n>>h;\n while(n--)\n "
},
{
"path": "CODEFORCES/C/6A.triangle.cpp",
"chars": 2615,
"preview": "#include <bits/stdc++.h>\nusing namespace std;\n\n// Input macros\n#define si(n) scanf(\"%d\",&n)\n#defin"
},
{
"path": "CODEFORCES/C/705A-Hulk.cpp",
"chars": 400,
"preview": "#include<bits/stdc++.h>\nusing namespace std;\n\nint main()\n{\n long long n,i;\n scanf(\"%lld\",&n);\n\n for(i=1;i<=n;i+"
},
{
"path": "CODEFORCES/C/71A. Way Too Long Words.cpp",
"chars": 292,
"preview": "#include<bits/stdc++.h>\nint main()\n{\n int n,i,a;\n char sx[100];\n scanf(\"%d\",&n);\n for(i=1;n>=i;i++)\n {\n "
},
{
"path": "CODEFORCES/C/7A. Kalevitch and Chess.cpp",
"chars": 2301,
"preview": "#include <bits/stdc++.h>\nusing namespace std;\n\n// Input macros\n#define si(n) scanf(\"%d\",&n)\n#defin"
},
{
"path": "CODEFORCES/C/8A. Train and Peter.cpp",
"chars": 2167,
"preview": "#include <bits/stdc++.h>\nusing namespace std;\n\n// Input macros\n#define si(n) scanf(\"%d\",&n)\n#defin"
},
{
"path": "CODEFORCES/C/96A-Football.cpp",
"chars": 342,
"preview": "#include<bits/stdc++.h>\nint main()\n{\n char a,sx[100];\n scanf(\"%s\",sx);\n int i,k=0,p=0;\n for(i=0,a=sx[0];strl"
},
{
"path": "CODEFORCES/C/A.cpp",
"chars": 269,
"preview": "#include<bits/stdc++.h>\nusing namespace std;\nint main()\n{\n long long l,r,a,s;\n cin>>l>>r>>a;\n if((l==0&&a==0)||"
},
{
"path": "CODEFORCES/C/Edu 38(div 2)/A. Word Correction.cpp",
"chars": 663,
"preview": "#include<bits/stdc++.h>\nusing namespace std;\n\nint main()\n{\n long long n,i,j,k;\n cin>>n;\n char s[n+1];\n for(i"
},
{
"path": "CODEFORCES/C/Edu 39(div 2)/A.cpp",
"chars": 266,
"preview": "#include<bits/stdc++.h>\nusing namespace std;\n\nint main()\n{\n long long n,a,s1=0,s2=0;\n scanf(\"%lld\",&n);\n while("
},
{
"path": "CODEFORCES/C/Edu 39(div 2)/B.cpp",
"chars": 420,
"preview": "#include<bits/stdc++.h>\nusing namespace std;\n\nint main()\n{\n double a,b;long long i;\n scanf(\"%lf %lf\",&a,&b);\n\n\n\n "
},
{
"path": "CODEFORCES/C/Practice - ECPC 2019/307919A_T2.cpp",
"chars": 1698,
"preview": "/// In the name of Allah SWT\n\nusing namespace std;\n#include <bits/stdc++.h>\n\n#define ll long long int\n#define dd double\n"
},
{
"path": "CODEFORCES/C/Practice - ECPC 2019/307919B.cpp",
"chars": 1933,
"preview": "/// In the name of Allah SWT\n\nusing namespace std;\n#include <bits/stdc++.h>\n\n#define ll long long int\n#define dd double\n"
},
{
"path": "CODEFORCES/C/Practice - ECPC 2019/307919G.cpp",
"chars": 1577,
"preview": "/// In the name of Allah SWT\n\nusing namespace std;\n#include <bits/stdc++.h>\n\n#define ll long long int\n#define dd double\n"
},
{
"path": "CODEFORCES/C/Practice - ECPC 2019/307919J_T2.cpp",
"chars": 2804,
"preview": "/// In the name of Allah SWT\n\nusing namespace std;\n#include <bits/stdc++.h>\n\n#define ll long long int\n#define dd double\n"
},
{
"path": "CODEFORCES/C/Practice - ECPC 2019/307919K.cpp",
"chars": 2423,
"preview": "/// In the name of Allah SWT\n\nusing namespace std;\n#include <bits/stdc++.h>\n\n#define ll long long int\n#define dd double\n"
},
{
"path": "CODEFORCES/C/Practice - ECPC 2019/307919M.cpp",
"chars": 1532,
"preview": "/// In the name of Allah SWT\n\nusing namespace std;\n#include <bits/stdc++.h>\n\n#define ll long long int\n#define dd double\n"
},
{
"path": "CODEFORCES/C/Practice - ECPC 2019/307919N.cpp",
"chars": 1338,
"preview": "/// In the name of Allah SWT\n\nusing namespace std;\n#include <bits/stdc++.h>\n\n#define ll long long int\n#define dd double\n"
},
{
"path": "CODEFORCES/C/Untitled1.c",
"chars": 2368,
"preview": "#include <stdio.h>\n#include<math.h>\n\n\n// Input macros\n#define si(n) scanf(\"%d\",&n)\n#define sc(n) "
},
{
"path": "CODEFORCES/C/char in 2D.c",
"chars": 199,
"preview": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n\nint main()\n{\n char ax[3][3];\n int i,j;\n "
},
{
"path": "CODEFORCES/Python/1.Template.py",
"chars": 3688,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/110A. Nearly Lucky Number.py",
"chars": 162,
"preview": "n = int(input())\n\ns = str(n)\nc = 0\n\nfor i in range(len(s)):\n if s[i]=='4' or s[i]=='7':\n c += 1\n\nif c==4 or c="
},
{
"path": "CODEFORCES/Python/116A. Tram.py",
"chars": 245,
"preview": "i=lambda:map(int,input().split())\n\nn = int(input())\nmaxm, capa = 0, 0\nfor j in range(n):\n a,b = i()\n if(j==0):\n "
},
{
"path": "CODEFORCES/Python/118B. Present from Lena.py",
"chars": 372,
"preview": "n = int(input())\n\nfor i in range(n+1):\n l = []\n for j in range(i+1):\n l.append(j)\n for j in range(1, i+1"
},
{
"path": "CODEFORCES/Python/122A. Lucky Division.py",
"chars": 205,
"preview": "n = int(input())\n\nflag = 0\n\nfor i in[4,7,47,74,44,444,447,474,477,777,774,744]:\n if(n%i==0):\n flag = 1\n "
},
{
"path": "CODEFORCES/Python/122A.py",
"chars": 1370,
"preview": "import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools\n \nsys.setrecursionlimit(10**"
},
{
"path": "CODEFORCES/Python/124A. The number of positions.py",
"chars": 80,
"preview": "inp=lambda:map(int,input().split())\nn,k = inp()\nt = int(input())\nl = list(inp())"
},
{
"path": "CODEFORCES/Python/131A. cAPS lOCK.py",
"chars": 546,
"preview": "s = input()\n\nflag = 0\n\nif s[0].isupper():\n for i in range(1, len(s)):\n if s[i].islower():\n flag = 0"
},
{
"path": "CODEFORCES/Python/1331A. HQ9+.py",
"chars": 390,
"preview": "s = input()\nflag = 0\n\n# \"H\" prints \"Hello, World!\",\n# \"Q\" prints the source code of the program itself,\n# \"9\" prints the"
},
{
"path": "CODEFORCES/Python/1341A. Nastya and Rice.py",
"chars": 464,
"preview": "\nt = int(input())\n\nfor i in range(t):\n #n,a,b,c,d=inp()\n a = input().split(' ')\n \n s1 = int(a[1])-int(a[2]);"
},
{
"path": "CODEFORCES/Python/1343A. Candies.py",
"chars": 2361,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/1343B.py",
"chars": 476,
"preview": "t = int(input())\nfor i in range(t):\n a = int(input())\n\n even = [2]\n odd = [1]\n\n if a==2 or a%2!=0 or (a//2)%"
},
{
"path": "CODEFORCES/Python/1351A. A+B (Trial Problem).py",
"chars": 95,
"preview": "inp=lambda:map(int,input().split())\nfor _ in range(int(input())):\n n,k=inp()\n\n print(n+k)"
},
{
"path": "CODEFORCES/Python/1352B. Square.py",
"chars": 251,
"preview": "inp=lambda:map(int,input().split())\nfor _ in range(int(input())):\n a1,b1=inp()\n a2,b2=inp()\n s1=a1+a2;s2=a1+b2\n"
},
{
"path": "CODEFORCES/Python/139A. Petr and Book.py",
"chars": 276,
"preview": "i=lambda:map(int,input().split())\nn = int(input())\nl=list(i())\n\nc = 0\n\nwhile True:\n if n<=0:\n break\n j = 0\n"
},
{
"path": "CODEFORCES/Python/13A.py",
"chars": 183,
"preview": "from math import gcd\nA = int(input())\ns = 0\nfor i in range(2, A):\n x = A\n while x!=0:\n s += x%i\n x ="
},
{
"path": "CODEFORCES/Python/149A. Business trip.py",
"chars": 280,
"preview": "inp=lambda:map(int,input().split())\nt = int(input())\nl = list(inp())\n\ns = sorted(l)\nsr = s[::-1]\n\nsum,count = 0, 0\n\nfor "
},
{
"path": "CODEFORCES/Python/158B. Taxi.py",
"chars": 452,
"preview": "#not solved yet\n\nx=int(input())\na = list(map(int, input().split()))\nl = sorted(a)\nprint(l)\ncount = 0\nvacancy = []\n\nfor i"
},
{
"path": "CODEFORCES/Python/160A. Twins.py",
"chars": 271,
"preview": "inp=lambda:map(int,input().split())\nn = int(input())\nl=list(inp())\nl.sort()\ns = sum(l)\n# print(l,s)\n# print(l[-n])\n\nc = "
},
{
"path": "CODEFORCES/Python/165A. Supercentral Point.py",
"chars": 730,
"preview": "n=int(input())\nx=[list(map(int,input().split()))for i in range(n)]\n\ncount = 0\n\nfor i in range(n):\n u, d, l, r = 0, 0,"
},
{
"path": "CODEFORCES/Python/199A. Hexadecimal's theorem.py",
"chars": 20,
"preview": "print(0, 0, input())"
},
{
"path": "CODEFORCES/Python/205A. Little Elephant and Rozdil.py",
"chars": 317,
"preview": "import math\ninp=lambda:map(int,input().split())\n\nn = int(input())\nl = list(inp())\n\nsr = sorted(l)\n# print(sr)\n\nif len(sr"
},
{
"path": "CODEFORCES/Python/208A. Dubstep.py",
"chars": 41,
"preview": "s = input()\n\n\nprint(s.replace(\"WUB\",\" \"))"
},
{
"path": "CODEFORCES/Python/214A. System of Equations.py",
"chars": 335,
"preview": "inp=lambda:map(int,input().split())\nn, m = inp()\n\ncount=0\nl=[]\nfor i in range(max(n,m)+1):\n for j in range(max(n,m)+1"
},
{
"path": "CODEFORCES/Python/215A. Bicycle Chain.py",
"chars": 303,
"preview": "inp=lambda:map(int,input().split())\nn = int(input())\na = list(inp())\nm = int(input())\nb = list(inp())\n\nmaxm = 0\nl=[]\n\nfo"
},
{
"path": "CODEFORCES/Python/219A. k-String.py",
"chars": 424,
"preview": "# NOT solved yet\ninp=lambda:map(int,input().split())\nn = int(input())\ns = input()\n\nsr = sorted(list(set(s)))\nsr2 = \"\".jo"
},
{
"path": "CODEFORCES/Python/221A. Little Elephant and Function.py",
"chars": 184,
"preview": "n = int(input())\n\nl = []\nsr = []\n\nfor i in range(1,n+1):\n l.append(i)\n\n if i==n:\n sr = sorted(l"
},
{
"path": "CODEFORCES/Python/222A. Shooshuns and Sequence.py",
"chars": 152,
"preview": "inp=lambda:map(int,input().split())\nn,k = inp()\nl = list(inp())\n\ntemp = l[k-1]\ncount = 0\n\nwhile n and l[n-1] == l[-1]:\n "
},
{
"path": "CODEFORCES/Python/227B. Effective Approach.py",
"chars": 615,
"preview": "i=lambda:map(int,input().split())\n\nn = int(input())\nl = list(i())\nm = int(input())\nq = list(i())\n\np, v, j = 0, 0, 0\npos "
},
{
"path": "CODEFORCES/Python/230A. Dragons.py",
"chars": 2476,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/236A.py",
"chars": 212,
"preview": "s = input()\nsr = sorted(s)\ncount = 0\n\nfor i in range(len(s)):\n if i>0 and sr[i-1]!=sr[i]:\n count = count+1\n\nco"
},
{
"path": "CODEFORCES/Python/266A. Stones on the Table.py",
"chars": 138,
"preview": "x = int(input())\nl = input()\ncount = 0\n\nfor i in range(x):\n if i>0 and l[i] == l[i-1]:\n count = count + 1\n "
},
{
"path": "CODEFORCES/Python/266B. Queue at the School.py",
"chars": 316,
"preview": "i=lambda:map(int,input().split())\nn,k=i()\ns = input()\nt = list(s)\n\nfor _ in range(k):\n j = 0\n while (j!=n):\n "
},
{
"path": "CODEFORCES/Python/272A. Dima and Friends.py",
"chars": 2711,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/276B. Little Girl and Game.py",
"chars": 552,
"preview": "### NOT solved yet\n\n# s = input()\n# r = s[::-1]\n# if s==r or len(s)%2==1:\n# print(\"First\")\n# else:\n# print(\"Seco"
},
{
"path": "CODEFORCES/Python/281A. Word Capitalization.py",
"chars": 53,
"preview": "s = input()\n\nsr = s[0].capitalize()\n\nprint(sr+s[1:])\n"
},
{
"path": "CODEFORCES/Python/298B. Sail.py",
"chars": 538,
"preview": "inp=lambda:map(int,input().split())\n\nl = list(inp())\ns = input()\n\ndx = l[3] - l[1]\ndy = l[4] - l[2]\ncount = 0\n\nfor i in "
},
{
"path": "CODEFORCES/Python/318A. Even Odds.py",
"chars": 152,
"preview": "import math\n\ninp=lambda:map(int,input().split())\nn,k=inp()\n\ndiv = math.ceil(n/2)\n# print(div)\nif k<=div:\n print(2*k -"
},
{
"path": "CODEFORCES/Python/320A. Magic Numbers.py",
"chars": 505,
"preview": "s = input()\nflag = 0\nfor i in range(0,len(s)):\n if s[0]!='1':\n flag = 0\n break\n if s[i]!='1' and s[i"
},
{
"path": "CODEFORCES/Python/339B. Xenia and Ringroad.py",
"chars": 427,
"preview": "inp=lambda:map(int,input().split())\nn,k=inp()\nl=list(inp())\n\ntime = 0\n\nfor i in range(k):\n if i==0:\n time = ti"
},
{
"path": "CODEFORCES/Python/34A. Reconnaissance 2.py",
"chars": 425,
"preview": "import math\n\nn = int(input())\ninp=lambda:map(int,input().split())\nl=list(inp())\nminm = 1000\na, b = 0, 0\n\n\n# for i in ran"
},
{
"path": "CODEFORCES/Python/34B. Sale.py",
"chars": 170,
"preview": "inp=lambda:map(int,input().split())\nn, m = inp()\na = list(inp())\n\nsr = sorted(a)\ntotal = 0\n\nfor i in range(m):\n if sr"
},
{
"path": "CODEFORCES/Python/352A. Jeff and Digits.py",
"chars": 146,
"preview": "n = int(input())\ncnt = input().count('5')\nif n == cnt:\n\tprint('-1')\nelif cnt < 9:\n\tprint('0')\nelse:\n\tprint('5' * (cnt //"
},
{
"path": "CODEFORCES/Python/352B. Jeff and Periods.py",
"chars": 984,
"preview": "## NOT solved yet\n\ninp=lambda:map(int,input().split())\nn = int(input())\nl = list(inp())\n\nsr = sorted(list(set(l)))\nindex"
},
{
"path": "CODEFORCES/Python/41A. Translation.py",
"chars": 78,
"preview": "s = input()\nt = input()\n\nif s==t[::-1]:\n print(\"YES\")\nelse:\n print(\"NO\")"
},
{
"path": "CODEFORCES/Python/43A. Football.py",
"chars": 252,
"preview": "n = int(input())\n\nc1, c2 = 0, 0\n\nfor i in range(n):\n s = input()\n if i==0:\n t1 = s\n c1 += 1\n elif"
},
{
"path": "CODEFORCES/Python/445A. DZY Loves Chessboard.py",
"chars": 383,
"preview": "inp=lambda:map(int,input().split())\nn, m = inp()\n\nfor i in range(n):\n s = input()\n l=[]\n for j in range(len(s))"
},
{
"path": "CODEFORCES/Python/459B. Pashmak and Flowers.py",
"chars": 417,
"preview": "import operator as op\nfrom functools import reduce\n\ndef ncr(n, r):\n r = min(r, n-r)\n numer = reduce(op.mul, range("
},
{
"path": "CODEFORCES/Python/467A. George and Accommodation.py",
"chars": 131,
"preview": "i=lambda:map(int,input().split())\n\nn = int(input())\nc=0\n\nfor _ in range(n):\n p, q = i()\n if q-p >=2:\n c += "
},
{
"path": "CODEFORCES/Python/546A. Soldier and Bananas.py",
"chars": 164,
"preview": "i=lambda:map(int,input().split())\n\nk, n, w = i()\n\ntotal = 0\n\nfor i in range(1,w+1):\n total = total + i*k\n\nif total-n "
},
{
"path": "CODEFORCES/Python/580A. Kefa and First Steps.py",
"chars": 426,
"preview": "i=lambda:map(int,input().split())\nn = int(input())\nl=list(i())\n \nmaxm = 1\nc = 1\n# l.append(0)\n \n# print(len(l))\nfor j in"
},
{
"path": "CODEFORCES/Python/58A. Chat room.py",
"chars": 231,
"preview": "s = input()\n\nsh = 'hello'\nc = 0\n\nfor i in range(len(s)):\n if c<5:\n if s[i]==sh[c]:\n c+=1\n\nif c==5:\n"
},
{
"path": "CODEFORCES/Python/599A. Patrick and Shopping.py",
"chars": 135,
"preview": "i=lambda:map(int,input().split())\nd1, d2, d3 =i()\n\nmin1=min(d1+d2+d3, 2*(d1+d2))\nmin2=min(2*(d1+d3), 2*(d2+d3))\n\nprint(m"
},
{
"path": "CODEFORCES/Python/59A. Word.py",
"chars": 176,
"preview": "s = input()\n\nu, l = 0,0\n\nfor i in range(len(s)):\n if s[i].islower():\n l += 1\n else:\n u += 1\n\nif u==l"
},
{
"path": "CODEFORCES/Python/625B. War of the Corporations.py",
"chars": 2303,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/630C. Lucky Numbers.py",
"chars": 90,
"preview": "n = int(input())\ncount = 0\n\nfor i in range(1, n+1):\n count = count + 2**i\n\nprint(count)"
},
{
"path": "CODEFORCES/Python/638 (Div. 2)/1348A.py",
"chars": 229,
"preview": "import math\n\nT = int(input())\n\n\nwhile T>0:\n n = int(input())\n a, b = pow(2, n), pow(2, n-1)\n for i in range(1, "
},
{
"path": "CODEFORCES/Python/638 (Div. 2)/1348B.py",
"chars": 295,
"preview": "T = int(input())\n\ni=lambda:map(int,input().split())\n\nwhile T >0:\n n,k=i()\n l = list(i())\n s=list(set(l))\n if"
},
{
"path": "CODEFORCES/Python/639 (Div. 2)/A.py",
"chars": 171,
"preview": "inp=lambda:map(int,input().split())\n\nfor _ in range(int(input())):\n a, b=inp()\n if a == 1 or b == 1 or a + b == 4:"
},
{
"path": "CODEFORCES/Python/639 (Div. 2)/B.py",
"chars": 517,
"preview": "l = [2, 7]\nfor i in range(2, 100000,):\n l.append(l[i-1] + l[i-1]-l[i-2]+3)\n\n\nfor _ in range(int(input())):\n n = in"
},
{
"path": "CODEFORCES/Python/640 (Div. 4)/A.py",
"chars": 435,
"preview": "inp=lambda:map(int,input().split())\nt = int(input())\n\n\nfor i in range(t):\n n = int(input())\n count = 0\n q, r = "
},
{
"path": "CODEFORCES/Python/640 (Div. 4)/B.py",
"chars": 329,
"preview": "inp=lambda:map(int,input().split())\nt = int(input())\n\n\nfor _ in range(t):\n n,k = inp()\n if n % 2 == 0 and n >= 2 *"
},
{
"path": "CODEFORCES/Python/640 (Div. 4)/C.py",
"chars": 188,
"preview": "inp=lambda:map(int,input().split())\nt = int(input())\n\nfor j in range(t):\n n, k = inp()\n x = n*(k//(n-1))\n\n if k"
},
{
"path": "CODEFORCES/Python/640 (Div. 4)/D. Alice, Bob and Candies.py",
"chars": 1000,
"preview": "inp=lambda:map(int,input().split())\nt = int(input())\n\nfor _ in range(t):\n n = int(input())\n l = list(inp())\n\n r"
},
{
"path": "CODEFORCES/Python/641 (Div. 2)/A.py",
"chars": 416,
"preview": "t = int(input())\ninp=lambda:map(int,input().split())\n\nimport math\n\ndef f_n(n):\n i = 2\n flag = 0\n for i in range"
},
{
"path": "CODEFORCES/Python/642 (Div. 3)/A.py",
"chars": 214,
"preview": "inp=lambda:map(int,input().split())\nt = int(input())\n\nfor i in range(t):\n n,m = inp()\n\n if n==1:\n print(0)\n"
},
{
"path": "CODEFORCES/Python/642 (Div. 3)/B.py",
"chars": 332,
"preview": "inp=lambda:map(int,input().split())\nt = int(input())\n\nfor _ in range(t):\n n,k = inp()\n a = list(inp())\n b = lis"
},
{
"path": "CODEFORCES/Python/642 (Div. 3)/C.py",
"chars": 1181,
"preview": "inp=lambda:map(int,input().split())\nt = int(input())\n\nfor _ in range(t):\n # import time\n # start_time = time.time("
},
{
"path": "CODEFORCES/Python/642 (Div. 3)/D.py",
"chars": 489,
"preview": "#Not solved yet\n\n# inp=lambda:map(int,input().split())\n# n,k = inp()\nfor _ in range(int(input())):\n n = int(input())\n"
},
{
"path": "CODEFORCES/Python/643 (Div. 2)/A.py",
"chars": 2090,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/643 (Div. 2)/B.py",
"chars": 2039,
"preview": "import math\n\ninp=lambda:map(int,input().split())\nt = int(input())\n\nfor _ in range(t):\n n = int(input())\n # n,k = i"
},
{
"path": "CODEFORCES/Python/643 (Div. 2)/C.py",
"chars": 146,
"preview": "import math\n\ninp=lambda:map(int,input().split())\nt = int(input())\n\nfor _ in range(t):\n n = int(input())\n # n,k = i"
},
{
"path": "CODEFORCES/Python/644 (Div. 3)/A.py",
"chars": 712,
"preview": "inp=lambda:map(int,input().split())\nt = int(input())\nfor _ in range(t):\n # n = int(input())\n a, b = inp()\n ma ="
},
{
"path": "CODEFORCES/Python/644 (Div. 3)/B.py",
"chars": 246,
"preview": "inp=lambda:map(int,input().split())\nt = int(input())\nfor _ in range(t):\n n = int(input())\n # n,k = inp()\n l = l"
},
{
"path": "CODEFORCES/Python/644 (Div. 3)/C.py",
"chars": 2090,
"preview": "## WA on test case 2\n\ninp=lambda:map(int,input().split())\nt = int(input())\nfor _ in range(t):\n n = int(input())\n #"
},
{
"path": "CODEFORCES/Python/644 (Div. 3)/D.py",
"chars": 720,
"preview": "import math\ninp=lambda:map(int,input().split())\nt = int(input())\n\ndef factor(n, k):\n i = 1; s= []\n while i <= math"
},
{
"path": "CODEFORCES/Python/645 (Div. 2)/A.py",
"chars": 157,
"preview": "import math\ninp=lambda:map(int,input().split())\nt = int(input())\nfor _ in range(t):\n n,m = inp()\n \n # l = list("
},
{
"path": "CODEFORCES/Python/645 (Div. 2)/B.py",
"chars": 834,
"preview": "import math\ninp=lambda:map(int,input().split())\nt = int(input())\nfor _ in range(t):\n n = int(input())\n \n l = li"
},
{
"path": "CODEFORCES/Python/645 (Div. 2)/C.py",
"chars": 1971,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/646 (Div. 2)/A.py",
"chars": 1912,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/646 (Div. 2)/B.py",
"chars": 3321,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/646 (Div. 2)/C.py",
"chars": 2100,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/647 (Div. 2)/A.py",
"chars": 2105,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/647 (Div. 2)/B.py",
"chars": 2936,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/647 (Div. 2)/C.py",
"chars": 1668,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/648 (Div. 2)/A.py",
"chars": 2483,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/648 (Div. 2)/B.py",
"chars": 2164,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/648 (Div. 2)/C.py",
"chars": 2164,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/649 (Div. 2)/A.py",
"chars": 2071,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/649 (Div. 2)/B.py",
"chars": 1841,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/650 (Div. 3)/A.py",
"chars": 2093,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/650 (Div. 3)/B.py",
"chars": 2364,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/650 (Div. 3)/C.py",
"chars": 2808,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/650 (Div. 3)/D.py",
"chars": 1841,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/651 (Div. 2)/A.py",
"chars": 1954,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/651 (Div. 2)/B.py",
"chars": 2536,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/651 (Div. 2)/C.py",
"chars": 2152,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/651 (Div. 2)/D.py",
"chars": 1869,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/652 (Div. 2)/A.py",
"chars": 1945,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/652 (Div. 2)/B.py",
"chars": 3371,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/652 (Div. 2)/C.py",
"chars": 2523,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/652 (Div. 2)/D.py",
"chars": 2097,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/653 (Div. 3)/A.py",
"chars": 1951,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/653 (Div. 3)/B.py",
"chars": 2515,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/653 (Div. 3)/C.py",
"chars": 2820,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/653 (Div. 3)/D.py",
"chars": 2034,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/653 (Div. 3)/E1.py",
"chars": 2759,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/654 (Div. 2)/A.py",
"chars": 1905,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/654 (Div. 2)/B.py",
"chars": 2287,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/654 (Div. 2)/C.py",
"chars": 1985,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/655 (Div. 2)/A.py",
"chars": 1944,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/655 (Div. 2)/B.py",
"chars": 2412,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/655 (Div. 2)/C.py",
"chars": 2149,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/656 (Div. 3)/A.py",
"chars": 2416,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/656 (Div. 3)/B.py",
"chars": 2419,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/656 (Div. 3)/C.py",
"chars": 3403,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/656 (Div. 3)/D.py",
"chars": 2285,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/657 (Div. 2)/A.py",
"chars": 2278,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/657 (Div. 2)/B.py",
"chars": 2504,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/657 (Div. 2)/C.py",
"chars": 1905,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/657 (Div. 2)/D.py",
"chars": 1885,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/658 (Div. 2)/A.py",
"chars": 2175,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/658 (Div. 2)/B.py",
"chars": 2395,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/658 (Div. 2)/C1.py",
"chars": 2779,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/659 (Div. 2)/A.py",
"chars": 6553,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/660 (Div. 2)/A.py",
"chars": 2152,
"preview": "from __future__ import division, print_function\r\n# import threading\r\n# threading.stack_size(2**27)\r\n# import sys\r\n# sys."
},
{
"path": "CODEFORCES/Python/660 (Div. 2)/B.py",
"chars": 2794,
"preview": "from __future__ import division, print_function\r\n# import threading\r\n# threading.stack_size(2**27)\r\n# import sys\r\n# sys."
},
{
"path": "CODEFORCES/Python/661 (Div. 3)/A.py",
"chars": 2204,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/661 (Div. 3)/B.py",
"chars": 2119,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/661 (Div. 3)/C.py",
"chars": 3451,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
},
{
"path": "CODEFORCES/Python/662 (Div. 2)/A.py",
"chars": 2198,
"preview": "from __future__ import division, print_function\n# import threading\n# threading.stack_size(2**27)\n# import sys\n# sys.setr"
}
]
// ... and 252 more files (download for full content)
About this extraction
This page contains the full source code of the utshabkg/Competitive_Contest_Problem_Solves GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 452 files (4.5 MB), approximately 1.2M tokens, and a symbol index with 3127 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.