├── .gitignore ├── A1.cpp ├── ABSTRING.cpp ├── ACBALL.cpp ├── ACCURACY.cpp ├── ACS.cpp ├── ACTEMP.cpp ├── ADACRA.cpp ├── ADASCOOL.cpp ├── ADASTAIR.cpp ├── ADIGIT.cpp ├── ADJHATE.cpp ├── ADJSUMPAR.cpp ├── ADVANCE.cpp ├── AFK.cpp ├── AGELIMIT.cpp ├── AIANALYSE.cpp ├── AIRHOCKEY.cpp ├── AIRLINE.cpp ├── ALEXNUMB.cpp ├── ALEXTASK.cpp ├── ALPHABET.cpp ├── ALTARAY.cpp ├── ALTER.cpp ├── ALTERADD.cpp ├── ALTSTR.cpp ├── AMBOXES.cpp ├── AMIFIB.cpp ├── AMMEAT.cpp ├── AMMEAT2.cpp ├── AMPRO.cpp ├── AMR15A.cpp ├── AMR15D.cpp ├── AMSGAME1.cpp ├── AND.cpp ├── ANDOR.cpp ├── ANTIPAL.cpp ├── ANTSCHEF.cpp ├── ANUARM.cpp ├── ANUBTG.cpp ├── ANUDTC.cpp ├── ANUMLA.cpp ├── ANUTHM.cpp ├── ANUUND.cpp ├── ANUWTA.cpp ├── AORB.cpp ├── APPLORNG.cpp ├── APPROX.cpp ├── APPROX2.cpp ├── AREAPERI.cpp ├── ARRANGE.cpp ├── ARRAYTRM.cpp ├── ARRGAME.cpp ├── ARRP.cpp ├── ARRROT.cpp ├── ASP.cpp ├── ATM2.cpp ├── ATOMS.cpp ├── ATOMS_old.cpp ├── ATTENDU.cpp ├── ATTIC.cpp ├── ATTND.cpp ├── AUCTION.cpp ├── AUDIBLE.cpp ├── AVDSQUARPLZ.cpp ├── AVG.cpp ├── AVGOF3.cpp ├── AVGPR.cpp ├── AVGPROBLEM.cpp ├── AVGSORT.cpp ├── AVOIDCONTACT.cpp ├── BADMINTON.cpp ├── BAL.cpp ├── BAL01.cpp ├── BALLBOX.cpp ├── BALLOON.cpp ├── BATH.cpp ├── BATTERYLOW.cpp ├── BEGGASOL.cpp ├── BENCHP.cpp ├── BESTBATS.cpp ├── BFRIEND.cpp ├── BFTT.cpp ├── BIGSALE.cpp ├── BINOP.cpp ├── BINSUBS.cpp ├── BINTREE.cpp ├── BIN_BAT.cpp ├── BIRDFARM.cpp ├── BIRYANI.cpp ├── BIT2A.cpp ├── BLACKCEL.cpp ├── BLACKJACK.cpp ├── BLITZ3_2.cpp ├── BMI.cpp ├── BOBBANK.cpp ├── BOMBTHEBASE.cpp ├── BOOKCHEF.cpp ├── BOOKPACK.cpp ├── BOTTOM.cpp ├── BOWLERS.cpp ├── BRACKETS.cpp ├── BREAKSTICK.cpp ├── BRKBKS.cpp ├── BRLADDER.cpp ├── BROKENPHONE.cpp ├── BROKENSTRING.cpp ├── BROKPHON.cpp ├── BSCOST.cpp ├── BTAR.cpp ├── BUDGET_.cpp ├── BUGCAL.cpp ├── BUILDINGRACE.cpp ├── BULBLIFE.cpp ├── BULLBEAR.cpp ├── BULLET.cpp ├── BURGERS.cpp ├── BUTYPAIR.cpp ├── BUY1GET1.cpp ├── BUYING2.cpp ├── BUYLAMP.cpp ├── BWCELL.cpp ├── C00K0FF.cpp ├── CABS.cpp ├── CANDLE.cpp ├── CANDY123.cpp ├── CANDYDIST.cpp ├── CAN_REACH.cpp ├── CAPPLE.cpp ├── CARCHOICE.cpp ├── CARRANGE.cpp ├── CARRYGOLD.cpp ├── CARSELL.cpp ├── CARTRIP.cpp ├── CARVANS.cpp ├── CASH.cpp ├── CATFEED.cpp ├── CATHIEF.cpp ├── CATSDOGS.cpp ├── CBLCRS.cpp ├── CBSPEED.cpp ├── CCBTS01.cpp ├── CCBTS02.cpp ├── CCBTS03.cpp ├── CCHEAVEN.cpp ├── CCHOCOLATES.cpp ├── CCISLAND.cpp ├── CCOOK.cpp ├── CDSUMS.cpp ├── CENS20D.cpp ├── CEQUAL.cpp ├── CFMM.cpp ├── CFRTEST.cpp ├── CGAAST.cpp ├── CGYM.cpp ├── CHAIRS.cpp ├── CHAIRS_.cpp ├── CHANGEPOS.cpp ├── CHBLLNS.cpp ├── CHCBOX.cpp ├── CHCHCL.cpp ├── CHCOINSG.cpp ├── CHCUBE.cpp ├── CHDOGS.cpp ├── CHEAPFOOD.cpp ├── CHEAPFUEL.cpp ├── CHECHOC.cpp ├── CHEF1010.cpp ├── CHEFA.cpp ├── CHEFANUP.cpp ├── CHEFAPAR.cpp ├── CHEFAPPS.cpp ├── CHEFARRP.cpp ├── CHEFBARBER.cpp ├── CHEFBOTTLE.cpp ├── CHEFCAND.cpp ├── CHEFCBA.cpp ├── CHEFCH.cpp ├── CHEFCHOCO.cpp ├── CHEFCHR.cpp ├── CHEFCONTEST.cpp ├── CHEFDETE.cpp ├── CHEFEQ.cpp ├── CHEFFED.cpp ├── CHEFGAMES.cpp ├── CHEFGR.cpp ├── CHEFHOME.cpp ├── CHEFKEY.cpp ├── CHEFLR.cpp ├── CHEFLUCK.cpp ├── CHEFNWRK.cpp ├── CHEFONDATE.cpp ├── CHEFPAGES.cpp ├── CHEFPATH.cpp ├── CHEFRACES.cpp ├── CHEFRECP.cpp ├── CHEFROUT.cpp ├── CHEFRP.cpp ├── CHEFRUN.cpp ├── CHEFSCORE.cpp ├── CHEFSETC.cpp ├── CHEFSLP.cpp ├── CHEFSOCK.cpp ├── CHEFSQ.cpp ├── CHEFST.cpp ├── CHEFSTEP.cpp ├── CHEFSTLT.cpp ├── CHEFSTON.cpp ├── CHEFSTR1.cpp ├── CHEFSTUD.cpp ├── CHEFSUM.cpp ├── CHEFTEAM.cpp ├── CHEFTRANS.cpp ├── CHEFVACATION.cpp ├── CHEFVOTE.cpp ├── CHEFWARS.cpp ├── CHEFWORK.cpp ├── CHEFZOT.cpp ├── CHEGLOVE.cpp ├── CHESSDIST.cpp ├── CHESSTIME.cpp ├── CHFAR.cpp ├── CHFCHK.cpp ├── CHFCLASS.cpp ├── CHFDBT.cpp ├── CHFGCD.cpp ├── CHFICRM.cpp ├── CHFINTRO.cpp ├── CHFM.cpp ├── CHFMOT18.cpp ├── CHFPARTY.cpp ├── CHFPLN.cpp ├── CHFPROFIT.cpp ├── CHFRICH.cpp ├── CHFSPL.cpp ├── CHFTIRED.cpp ├── CHGIFT1.cpp ├── CHN05.cpp ├── CHN09.cpp ├── CHN15A.cpp ├── CHNGIT.cpp ├── CHNGOR.cpp ├── CHNUM.cpp ├── CHOPRT.cpp ├── CHPINTU.cpp ├── CHRECT.cpp ├── CHRL1.cpp ├── CHRL2.cpp ├── CHRL4.cpp ├── CHSERVE.cpp ├── CHSFORMT.cpp ├── CIELAB.cpp ├── CIELDIST.cpp ├── CIELRCPT.cpp ├── CK87MEDI.cpp ├── CK87QUER.cpp ├── CKISSHUG.cpp ├── CKWLK.cpp ├── CLEANUP.cpp ├── CLFIBD.cpp ├── CLIPLX.cpp ├── CLLCM.cpp ├── CLMBSTRS.cpp ├── CM164364.cpp ├── CMASKS.cpp ├── CMB01.cpp ├── CNDLOVE.cpp ├── CNDY.cpp ├── CNOTE.cpp ├── CNTWRD.cpp ├── CO92JUDG.cpp ├── CO92MATR.cpp ├── CO92SUBW.cpp ├── COC.cpp ├── COCONUT.cpp ├── CODERLIF.cpp ├── COINS.cpp ├── COLGLF5.cpp ├── COLOR.cpp ├── COMM3.cpp ├── COMMUTE.cpp ├── COMPCAND.cpp ├── COMPILER.cpp ├── COMPLEXITY.cpp ├── COMPRESSVD.cpp ├── CONFLIP.cpp ├── CONN.cpp ├── COOK82A.cpp ├── COOKMACH.cpp ├── COOLGUYS.cpp ├── COOLING.cpp ├── COOMILK.cpp ├── COPRIMEX.cpp ├── COPS.cpp ├── COUNTP.cpp ├── COUPON.cpp ├── COUPSYS.cpp ├── COURSEREG.cpp ├── COVID19.cpp ├── COVIDLQ.cpp ├── COVID_19.cpp ├── CPAIRS.cpp ├── CRDGAME.cpp ├── CRDGM.cpp ├── CREDCOINS.cpp ├── CREDITS.cpp ├── CREDS.cpp ├── CREDSCORE.cpp ├── CRICRANK.cpp ├── CRICUP.cpp ├── CSTOCK.cpp ├── CSUB.cpp ├── CSUBS.cpp ├── CSUM.cpp ├── CUTBOARD.cpp ├── CUTPAPER.cpp ├── CV.cpp ├── CVDRUN.cpp ├── CWIREFRAME.cpp ├── CYBV.cpp ├── CYCLICQD.cpp ├── C_RATING.cpp ├── DANCEMOVES.cpp ├── DANOW.cpp ├── DARLIG.cpp ├── DATATYPE.cpp ├── DCE05.cpp ├── DECINC.cpp ├── DECREM.cpp ├── DECSTR.cpp ├── DEPCHEF.cpp ├── DESTROY.cpp ├── DETSCORE.cpp ├── DEVARRAY.cpp ├── DEVSPORTS.cpp ├── DEVUGRAP.cpp ├── DIAGMOVE.cpp ├── DIET.cpp ├── DIFFCONSEC.cpp ├── DIFFSUM.cpp ├── DIFSTR.cpp ├── DIGARR.cpp ├── DIGJUMP.cpp ├── DIGJUMP^^^.cpp ├── DIGSMPAR.cpp ├── DIRECTN.cpp ├── DISABLEDKING.cpp ├── DISCHAR-OLD.cpp ├── DISCHAR.cpp ├── DISCNT.cpp ├── DISCSHOP.cpp ├── DISCUS.cpp ├── DISTCODE.cpp ├── DISTINCTCOL.cpp ├── DIV03.cpp ├── DIV3.cpp ├── DIVGAME-old.cpp ├── DIVGAME.cpp ├── DIVGOLD.cpp ├── DIVIDING.cpp ├── DIVNINE.cpp ├── DIVSUBS.cpp ├── DIVTHREE.cpp ├── DIWALI1.cpp ├── DNASTORAGE.cpp ├── DNASTRAND.cpp ├── DOBDELIV.cpp ├── DOLL.cpp ├── DOMINANT.cpp ├── DOMINANT2.cpp ├── DONUTS.cpp ├── DOUBLE.cpp ├── DPOLY.cpp ├── DRAGNXOR.cpp ├── DREDIV.cpp ├── DRUNKALK.cpp ├── DSTAPLS.cpp ├── DUMPLING.cpp ├── DWNLD.cpp ├── DWW19K.cpp ├── EASYPERM.cpp ├── EASYPROB.cpp ├── ECOCLASS.cpp ├── EGRANDR.cpp ├── EID.cpp ├── EID2.cpp ├── EITA.cpp ├── ELECTIONS.cpp ├── ELEVSTRS.cpp ├── EMA01.cpp ├── EMAILREM.cpp ├── EMITL.cpp ├── ENCMSG.cpp ├── ENDSORTED.cpp ├── ENSPACE.cpp ├── ENTEXAM.cpp ├── EOEO.cpp ├── EOOPR.cpp ├── EQCARDGAME.cpp ├── EQDIFFER.cpp ├── EQLZING.cpp ├── EQUALCOIN.cpp ├── EQUALDIST.cpp ├── EQUALISE.cpp ├── EQUALITY.cpp ├── EQUALIZEAB.cpp ├── EQUALSTRING.cpp ├── EQUATION.cpp ├── EQUINOX.cpp ├── ERROR.cpp ├── EUREKA.cpp ├── EVEDG.cpp ├── EVENDIFF.cpp ├── EVENGAME.cpp ├── EVENPSUM.cpp ├── EVENTUAL.cpp ├── EXAM1.cpp ├── EXAMCHT.cpp ├── EXPENSES.cpp ├── EXPERT.cpp ├── EXPIRY.cpp ├── EXPWEI.cpp ├── EXTRAN.cpp ├── EXUNA.cpp ├── EZSPEAK.cpp ├── F1RULE.cpp ├── FACEDIR.cpp ├── FAIRELECT.cpp ├── FAIRPASS.cpp ├── FAKEGCD.cpp ├── FALSNUM.cpp ├── FANCY.cpp ├── FARAWAY.cpp ├── FBC.cpp ├── FBMT.cpp ├── FCTRL.cpp ├── FCTRL2.cpp ├── FEVER.cpp ├── FGFS.cpp ├── FILL01.cpp ├── FILLCANDIES.cpp ├── FILLGRID.cpp ├── FINALSUM.cpp ├── FINDSHOES.cpp ├── FIRESC.cpp ├── FIRSTANDLAST.cpp ├── FIRSTTEST.cpp ├── FIT.cpp ├── FIXT.cpp ├── FLIP.cpp ├── FLIPCARDS.cpp ├── FLIPPAL.cpp ├── FLOORS.cpp ├── FLOW001.cpp ├── FLOW002.cpp ├── FLOW004.cpp ├── FLOW005.cpp ├── FLOW006.cpp ├── FLOW007.cpp ├── FLOW008.cpp ├── FLOW009.cpp ├── FLOW010.cpp ├── FLOW011.cpp ├── FLOW013.cpp ├── FLOW014.cpp ├── FLOW015.cpp ├── FLOW016.cpp ├── FLOW017.cpp ├── FLOW018.cpp ├── FODCHAIN.cpp ├── FOOTCUP.cpp ├── FRGAME.cpp ├── FRGTNLNG.cpp ├── FRIEZA.cpp ├── FRIMEET.cpp ├── FRK.cpp ├── FRNTR.cpp ├── FROGV.cpp ├── FRUITCHAAT.cpp ├── FRUITS.cpp ├── FSQRT.cpp ├── GAMEOFPILES1.cpp ├── GCD2.cpp ├── GCDDIV.cpp ├── GCDOPS.cpp ├── GCDPRF.cpp ├── GCDSET.cpp ├── GDOG.cpp ├── GENE01.cpp ├── GIFTSRC.cpp ├── GIT01.cpp ├── GIVCANDY.cpp ├── GOODBAD.cpp ├── GOODPREF.cpp ├── GOODSET.cpp ├── GOODWEAT.cpp ├── GQR.cpp ├── GRIDBL.cpp ├── GROUPASSGN.cpp ├── GROUPS.cpp ├── GRPASSN.cpp ├── GVAWAY.cpp ├── HAPPYSTR.cpp ├── HARDBET.cpp ├── HARRYWND.cpp ├── HCAGMAM1.cpp ├── HDIVISR.cpp ├── HEADBOB.cpp ├── HEIGHTRATION.cpp ├── HELIUM3.cpp ├── HELPLIRA.cpp ├── HELPVOLD.cpp ├── HIGHSCORE.cpp ├── HIGHWAYC.cpp ├── HILLS.cpp ├── HIRETEST.cpp ├── HIRINGWO.cpp ├── HMAPPY2.cpp ├── HOLES.cpp ├── HOLIDAYS.cpp ├── HOOPS.cpp ├── HORSES.cpp ├── HOSTELROOM.cpp ├── HOTCOLD.cpp ├── HOWMANY.cpp ├── HS08TEST.cpp ├── ICL1902.cpp ├── ICM0013.cpp ├── ICM2008.cpp ├── ICPC16A.cpp ├── ICPC16B.cpp ├── ICPC16C.cpp ├── IMDB.cpp ├── INCREAR.cpp ├── INCRIQ.cpp ├── INOI1201.cpp ├── INSTAGRAM.cpp ├── INSTNOODLE.cpp ├── INSURANCE.cpp ├── INTEG.cpp ├── INTEST.cpp ├── INTRDSGN.cpp ├── INTRVS.cpp ├── INVESTMENT.cpp ├── IPCCERT.cpp ├── ISITCAKE.cpp ├── J7.cpp ├── JASSIGNMENTS.cpp ├── JAVELIN.cpp ├── JCOINS.cpp ├── JDELAY.cpp ├── JENGA.cpp ├── JGAMES.cpp ├── JMARKET.cpp ├── JOHNY.cpp ├── JOINING.cpp ├── KDIAMS.cpp ├── KEPLERSLAW.cpp ├── KFIB.cpp ├── KINGSHIP.cpp ├── KITCHENCOST.cpp ├── KITCHENSPICE.cpp ├── KITCHENTIME.cpp ├── KMAX2.cpp ├── KNGTOR.cpp ├── KNIGHT2.cpp ├── KOL15A.cpp ├── KOL16B.cpp ├── KOL16J.cpp ├── KPRIME.cpp ├── KPRIME^^^.cpp ├── KTTABLE.cpp ├── L56GAME.cpp ├── LAPIN.cpp ├── LAPTOPREC.cpp ├── LASTLEVELS.cpp ├── LAZYCHF.cpp ├── LCH15JAB.cpp ├── LCKYST.cpp ├── LCOLLIS.cpp ├── LCPESY.cpp ├── LEAGUE.cpp ├── LEBOMBS.cpp ├── LECANDY.cpp ├── LEDIV.cpp ├── LELEMON.cpp ├── LEPERMUT.cpp ├── LEVY.cpp ├── LFEB14B.cpp ├── LICENSE ├── LIFE.cpp ├── LIFELTD.cpp ├── LIFTME.cpp ├── LIKECS01.cpp ├── LINCHESS.cpp ├── LISDIGIT.cpp ├── LOCKDRAW.cpp ├── LONGSEQ.cpp ├── LOOP.cpp ├── LOSTWKND.cpp ├── LTIME.cpp ├── LTM40AB.cpp ├── LUCKFOUR.cpp ├── LUCKY5.cpp ├── LUCKYFR.cpp ├── LUCKYNUM.cpp ├── LUCKYSTR.cpp ├── M1ENROL.cpp ├── MAGC.cpp ├── MAGDOORS.cpp ├── MAGICHF.cpp ├── MAKEAP.cpp ├── MAKEART.cpp ├── MAKEDIV3.cpp ├── MAKEEQUAL.cpp ├── MAKEMONEY.cpp ├── MAKEMULTIPLE.cpp ├── MAKPERM.cpp ├── MANGOES.cpp ├── MANIPULATE.cpp ├── MANYCHEF.cpp ├── MANYSUMS.cpp ├── MARARUN.cpp ├── MARBLES.cpp ├── MARCHA1.cpp ├── MARKSTW.cpp ├── MARM.cpp ├── MASKPOL.cpp ├── MATCHES.cpp ├── MATPAN.cpp ├── MAX2.cpp ├── MAXCOMP.cpp ├── MAXCOUNT.cpp ├── MAXDIFF.cpp ├── MAXDIFFMIN.cpp ├── MAXFUN.cpp ├── MAXIMUMSUBS.cpp ├── MAXISUM.cpp ├── MAXMEX.cpp ├── MAXREM.cpp ├── MAXTASTE.cpp ├── MAX_DIFF.cpp ├── MAYOR_PARTY.cpp ├── MCHAIRS.cpp ├── MDL.cpp ├── MEMOLOG.cpp ├── MGCRNK.cpp ├── MGCSET.cpp ├── MIKE2.cpp ├── MILEAGE.cpp ├── MINCARS.cpp ├── MINCOINS.cpp ├── MINCOINSREQ.cpp ├── MINDAYSRET.cpp ├── MINEAT.cpp ├── MINFLIPS.cpp ├── MINHEIGHT.cpp ├── MINIAND.cpp ├── MINNOO.cpp ├── MINPERM.cpp ├── MINPIZZA.cpp ├── MINPIZZAS.cpp ├── MINVOTE.cpp ├── MINWORK.cpp ├── MISINTER.cpp ├── MISSP.cpp ├── MIXCOLOR.cpp ├── MIXTURE.cpp ├── MIXTURES.cpp ├── MKSMEVN.cpp ├── MNMX.cpp ├── MODEQUAL.cpp ├── MODULO3.cpp ├── MONOPOLY.cpp ├── MOVIE2X.cpp ├── MOVIEWKN.cpp ├── MSTEP.cpp ├── MSV.cpp ├── MUFFINS3.cpp ├── MVALUE.cpp ├── MXCH.cpp ├── MXEVNSUB.cpp ├── MXMEDIAN.cpp ├── MXMTRIO.cpp ├── MXZERO.cpp ├── MY1STCONTEST.cpp ├── MYSERVE.cpp ├── N1VALUES.cpp ├── NAICHEF.cpp ├── NAME1.cpp ├── NAME2.cpp ├── NDIFFPAL.cpp ├── NEARESTCOURT.cpp ├── NEARESTEXIT.cpp ├── NEWPIECE.cpp ├── NEWSCH.cpp ├── NFS.cpp ├── NIBBLE.cpp ├── NOBEL.cpp ├── NOCODING.cpp ├── NODRUGS.cpp ├── NOMATCH.cpp ├── NONADJFLIP.cpp ├── NONNEGPROD.cpp ├── NOTATRI.cpp ├── NOTEBOOK.cpp ├── NOTIME.cpp ├── NOTINCOM.cpp ├── NOTUNIT.cpp ├── NPLQ18A.cpp ├── NPORP.cpp ├── NUKES.cpp ├── NUM239.cpp ├── NUMBERS.cpp ├── NUMCOMP.cpp ├── NUMFACT.cpp ├── NUMGAME.cpp ├── NUMGAME2.cpp ├── NW1.cpp ├── OBTTRNGL.cpp ├── ODDDIV.cpp ├── ODDPAIRS.cpp ├── ODDSEVENS.cpp ├── ODDSUM.cpp ├── ODDSUMPAIR.cpp ├── OFFICE.cpp ├── OJUMPS.cpp ├── OLYRANK.cpp ├── OMWG.cpp ├── ONEKING.cpp ├── ONOZ.cpp ├── ONP.cpp ├── ON_OFF.cpp ├── ORDERS.cpp ├── ORDTEAMS.cpp ├── P1Z2S.cpp ├── PAIREQ.cpp ├── PAIRING.cpp ├── PAJAPONG.cpp ├── PALIN.cpp ├── PALL01.cpp ├── PALPALS.cpp ├── PAR2.cpp ├── PARTY2.cpp ├── PASSORFAIL.cpp ├── PASSTHEEXAM.cpp ├── PATHPAR.cpp ├── PCJ18A.cpp ├── PCJ18B.cpp ├── PCYCLE.cpp ├── PENALTY.cpp ├── PERFCONT.cpp ├── PERFECTTRIO.cpp ├── PERFNEC.cpp ├── PERMEXIS.cpp ├── PERMSUFF.cpp ├── PERMUT2.cpp ├── PERMUTATION.cpp ├── PETERSEN.cpp ├── PETSTORE.cpp ├── PHYSICS.cpp ├── PINS.cpp ├── PIZZA_BURGER.cpp ├── PLAYFIT.cpp ├── PLAYPIAN.cpp ├── PLAYSTR.cpp ├── PLMU.cpp ├── PLZLYKME.cpp ├── PODIUM.cpp ├── POINTS.cpp ├── POLTHIEF.cpp ├── POLYBAGS.cpp ├── POOK.cpp ├── POPCORN.cpp ├── POPGATES.cpp ├── POPULATION.cpp ├── POSAND.cpp ├── POSPREFS.cpp ├── POTATOES.cpp ├── PPATTERN.cpp ├── PPNUM.cpp ├── PPSUM.cpp ├── PRACLIST.cpp ├── PRACTICEPERF.cpp ├── PRB01.cpp ├── PREDICT.cpp ├── PRESENTS.cpp ├── PRFXGD.cpp ├── PRGIFT.cpp ├── PRICECON.cpp ├── PRIME1.cpp ├── PRIMEDICE.cpp ├── PRIMEREVERSE.cpp ├── PRIMES2.cpp ├── PRIZEPOOL.cpp ├── PRLADDU.cpp ├── PROB.cpp ├── PROBCAT.cpp ├── PROBDIFF.cpp ├── PROC18A.cpp ├── PRODUCT.cpp ├── PROGLANG.cpp ├── PROSUM.cpp ├── PRPALIN.cpp ├── PSEUDOSORT.cpp ├── PSGRADE.cpp ├── PSHTRG.cpp ├── PTUPLES.cpp ├── PUPPYGM.cpp ├── PWNCHESS.cpp ├── QUADROOT.cpp ├── QUALIFY.cpp ├── QUALPREL.cpp ├── QUEENATTACK.cpp ├── RAINBOWA.cpp ├── RAINFALL1.cpp ├── RANKLIST.cpp ├── RANKLISTPAGE.cpp ├── RATING.cpp ├── RCBPLAY.cpp ├── RD19.cpp ├── REACHFAST.cpp ├── REACHTARGET.cpp ├── README.md ├── REALBIN.cpp ├── REARRSTR.cpp ├── RECENTCONT.cpp ├── RECIPE.cpp ├── RECNDNOS.cpp ├── RECTANGL.cpp ├── RECTSQ.cpp ├── REDALERT.cpp ├── REDONE.cpp ├── REIGN.cpp ├── RELATIVE.cpp ├── REMISS.cpp ├── REMOVEBAD.cpp ├── REMOVECARDS.cpp ├── REPEAT.cpp ├── RESQ.cpp ├── RETPO.cpp ├── RGAME.cpp ├── RIGHTTRI-B.cpp ├── RIGHTTRI.cpp ├── RNDPAIR.cpp ├── ROBOTG.cpp ├── ROOTTREE.cpp ├── ROTATION.cpp ├── ROWCOLOP.cpp ├── RPD.cpp ├── RRCODE.cpp ├── RRCOPY.cpp ├── RRECIPE.cpp ├── RRFRNDS.cpp ├── RRJOKE.cpp ├── RRPLAYER.cpp ├── RRSTONE.cpp ├── RRSUM.cpp ├── RUNDIR.cpp ├── S01E01.cpp ├── S02E10.cpp ├── S10E.cpp ├── SAFEROBO.cpp ├── SALARY.cpp ├── SALE.cpp ├── SALESEASON.cpp ├── SAVWATER.cpp ├── SC31.cpp ├── SCALENE.cpp ├── SDSQUARE.cpp ├── SEAARASU.cpp ├── SEAVOTE.cpp ├── SEBIHWY.cpp ├── SEDARR.cpp ├── SEGM01.cpp ├── SELFDEF.cpp ├── SEMCOURSES.cpp ├── SETDIFF.cpp ├── SFRF.cpp ├── SHOEFIT.cpp ├── SHOPCHANGE.cpp ├── SHUFFLE.cpp ├── SIGNMOVE.cpp ├── SIMDISH.cpp ├── SIMPLEPRO.cpp ├── SIMPSTAT.cpp ├── SINS.cpp ├── SIXFRIENDS.cpp ├── SKYSCR.cpp ├── SLEEP.cpp ├── SLOOP.cpp ├── SLOWSOLN.cpp ├── SMAPHONE.cpp ├── SMOL.cpp ├── SMPAIR.cpp ├── SMRSTR.cpp ├── SMSAN.cpp ├── SMSQR.cpp ├── SNAKPROC.cpp ├── SNAPCHAT.cpp ├── SNCKYEAR.cpp ├── SNDMAX.cpp ├── SNELECT.cpp ├── SNIPE.cpp ├── SNUG_FIT.cpp ├── SOCKS1.cpp ├── SOD3.cpp ├── SOLBLTY.cpp ├── SONGS.cpp ├── SPALNUM.cpp ├── SPAMCLAS.cpp ├── SPCANDY.cpp ├── SPECIALITY.cpp ├── SPECIES.cpp ├── SPEEDTEST.cpp ├── SPELLBOB.cpp ├── SPLITIT.cpp ├── SPLST.cpp ├── SPOTWO.cpp ├── SQNUMBF.cpp ├── SQUATS.cpp ├── SQUIDRULE.cpp ├── SRTARR.cpp ├── SSCRIPT.cpp ├── SSO.cpp ├── SST.cpp ├── STACKS.cpp ├── STADIUM.cpp ├── START01.cpp ├── STDDEV.cpp ├── STFOOD.cpp ├── STICKBREAK.cpp ├── STICKS.cpp ├── STONES.cpp ├── STRLBP.cpp ├── STRP.cpp ├── STRPALIN.cpp ├── STUDVOTE.cpp ├── STUPMACH.cpp ├── SUBGCD.cpp ├── SUBINC.cpp ├── SUBMEXS.cpp ├── SUBSCRIBE.cpp ├── SUBSCRIBE_.cpp ├── SUBTASK.cpp ├── SUGARCANE.cpp ├── SUMNEQ.cpp ├── SUMPAIR.cpp ├── SUMPOS.cpp ├── SUMTRIAN.cpp ├── SUNDAY.cpp ├── SUPCHEF.cpp ├── SURVIVE.cpp ├── SVRT.cpp ├── SWAP10HG.cpp ├── SWPDGT.cpp ├── T20MCH.cpp ├── TAAND.cpp ├── TAAPLUSB.cpp ├── TABLET.cpp ├── TACHSTCK.cpp ├── TADELIVE.cpp ├── TALAZY.cpp ├── TALLER.cpp ├── TAPALIN.cpp ├── TASTEDEC.cpp ├── TATU.cpp ├── TAVISUAL.cpp ├── TAXES.cpp ├── TCKTFINE.cpp ├── TEA.cpp ├── TEAMFOR.cpp ├── TEMPLATE.cpp ├── TEMPLELA.cpp ├── TESTAVG.cpp ├── TESTSERIES.cpp ├── TFPAPER.cpp ├── THREDICE.cpp ├── THREE.cpp ├── THREEBOX.cpp ├── THREEDIF.cpp ├── THREEFR.cpp ├── THREEQ.cpp ├── THREETOPICS.cpp ├── TICKETS5.cpp ├── TIDRICE.cpp ├── TIMELY.cpp ├── TLG.cpp ├── TODOLIST.cpp ├── TOTR.cpp ├── TOWIN.cpp ├── TRACE.cpp ├── TRAINSET.cpp ├── TRANSFORM.cpp ├── TRAVELPS.cpp ├── TREE3.cpp ├── TREEROOT.cpp ├── TRICOIN.cpp ├── TRISQ.cpp ├── TRNSN.cpp ├── TRO.cpp ├── TRUESCORE.cpp ├── TSORT.cpp ├── TSTROBOT.cpp ├── TTENIS.cpp ├── TUZGMBR.cpp ├── TVDISC.cpp ├── TWEED.cpp ├── TWINGFT.cpp ├── TWODISH.cpp ├── TWONIM.cpp ├── TWONMS.cpp ├── TWOROOKS.cpp ├── TWOSTR.cpp ├── TWOVSTEN.cpp ├── TWTCLOSE.cpp ├── TYRE.cpp ├── TYRES.cpp ├── UKROBOT.cpp ├── UNQEQ.cpp ├── URCALC.cpp ├── UTKPLC.cpp ├── UTMOPR.cpp ├── UWCOI20A.cpp ├── UWCOI21A.cpp ├── VACCINE1.cpp ├── VACCINE2.cpp ├── VACCINQ.cpp ├── VALENTINE.cpp ├── VALIDMIN.cpp ├── VALIDSTK.cpp ├── VCOUPLE.cpp ├── VCS.cpp ├── VDATES.cpp ├── VILLINE.cpp ├── VILTRIBE.cpp ├── VOLCONTROL.cpp ├── VOTERS.cpp ├── VOWELTB.cpp ├── WAITTIME.cpp ├── WALK.cpp ├── WATERCONS.cpp ├── WATERCOOLER1.cpp ├── WATERCOOLER2.cpp ├── WATERFLOW.cpp ├── WATERREQ.cpp ├── WATESTCASES.cpp ├── WATMELON.cpp ├── WATSCORE.cpp ├── WCC.cpp ├── WCOUNT.cpp ├── WDTBAM.cpp ├── WEIGHTBL.cpp ├── WGHTNUM.cpp ├── WGHTS.cpp ├── WHICHDIV.cpp ├── WINERR.cpp ├── WORDLE.cpp ├── WSC.cpp ├── WTRMIXING.cpp ├── WWALK.cpp ├── XENTASK.cpp ├── XJUMP.cpp ├── XLSQUARE.cpp ├── XORAGN.cpp ├── XORNEY.cpp ├── XORNUBER.cpp ├── XORSUB.cpp ├── XOR_PAL.cpp ├── XXOR.cpp ├── XYSTR.cpp ├── ZCO13001.cpp ├── ZCO14003.cpp ├── ZCOSCH.cpp ├── ZOOZ.cpp ├── ZOZ.cpp └── ZUBREACH.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /ACCURACY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | printf("%ld\n", (3 - x % 3) % 3); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /ACS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long p; scanf("%ld", &p); 8 | long res = (p / 100) + (p % 100); 9 | long tst = 100 * (p / 100) + (p % 100); 10 | if(res > 10 || tst != p){puts("-1");} 11 | else{printf("%ld\n", res);} 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /ACTEMP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 8 | puts(a <= b && c <= b ? "Yes" : "No"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /ADACRA.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | std::string s; std::cin >> s; 8 | long cnt(0); 9 | for(long p = 1; p < s.size(); p++){if(s[p - 1] != s[p]){++cnt;}} 10 | cnt = (cnt + 1) / 2; 11 | printf("%ld\n", cnt); 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /ADASCOOL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, m; scanf("%ld %ld", &n, &m); 8 | puts(m * n % 2 ? "NO" : "YES"); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /ADJSUMPAR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | int s(0); 9 | for(long p = 0; p < n; p++){ 10 | int x; scanf("%d", &x); 11 | s = (s ^ x); 12 | } 13 | 14 | puts(s ? "NO" : "YES"); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /ADVANCE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | puts((x <= y && y <= x + 200) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /AGELIMIT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, a; scanf("%ld %ld %ld", &x, &y, &a); 8 | puts((x <= a && a < y) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /AIANALYSE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long c; scanf("%ld", &c); 6 | puts(c <= 1000 ? "Yes" : "No"); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /AIRHOCKEY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b; scanf("%ld %ld", &a, &b); 8 | printf("%ld\n", 7 - (a > b ? a : b)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /AIRLINE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c, d, e; scanf("%ld %ld %ld %ld %ld", &a, &b, &c, &d, &e); 8 | bool possible = (a + b <= d && c <= e) || (a + c <= d && b <= e) || (b + c <= d && a <= e) ; 9 | puts(possible ? "YES" : "NO"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /ALEXNUMB.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | long long n; scanf("%lld\n", &n); 8 | for(long long p = 0; p < n; p++){long a; scanf("%ld", &a);} //Irrelevant 9 | printf("%lld\n", n * (n - 1) / 2); 10 | 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /ALTER.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long A, B, P, Q; scanf("%ld %ld %ld %ld", &A, &B, &P, &Q); 8 | if((P % A) || (Q % B)){puts("NO"); continue;} 9 | P /= A; Q /=B; 10 | if((P == Q) || (P == Q - 1) || (P == Q + 1)){puts("YES");} 11 | else{puts("NO");} 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /ALTERADD.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b; scanf("%ld %ld", &a, &b); 8 | puts((b - a - 2) % 3 ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /AMR15A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int n; scanf("%d\n", &n); 6 | int ready(0); 7 | while(n--){ 8 | int a; scanf("%d", &a); 9 | ready += (a % 2) ? (-1) : 1; 10 | } 11 | 12 | puts((ready > 0) ? "READY FOR BATTLE" : "NOT READY"); 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /ANDOR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | ll x; scanf("%lld", &x); 9 | printf("0 %lld\n", x); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ANTIPAL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | if(n % 2){puts("-1"); continue;} 9 | for(long p = 0; p < n; p++){printf("%d", (2 * p < n));} 10 | puts(""); 11 | } 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /ANUTHM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | double n, m; scanf("%lf %lf\n", &n, &m); 8 | printf("%.7lf\n", m + n - 1); //The sum of each diagonal is equal to 1 :-) 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /ANUWTA.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld\n", &t); 6 | while(t--){ 7 | long long n; scanf("%lld\n", &n); 8 | printf("%lld\n", n * (n + 3) / 2); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /AORB.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | long res = 1500 - ((y > 2 * x) ? (6 * x + 4 * y) : (6 * y + 2 * x)); 9 | printf("%ld\n", res); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /APPLORNG.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long x, a, b; scanf("%ld %ld %ld", &x, &a, &b); 6 | printf(x >= a + b ? "YES": "NO"); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /AREAPERI.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long x, y; scanf("%ld %ld", &x, &y); 6 | if(x * y > 2 * (x + y)){printf("Area\n%ld", x * y);} 7 | else if(x * y < 2 * (x + y)){printf("Peri\n%ld", 2 * (x + y));} 8 | else if(x * y == 2 * (x + y)){printf("Eq\n%ld", x * y);} 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /ARRROT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | const ll MOD = 1e9 + 7; 7 | ll n; scanf("%lld", &n); 8 | ll s(0); for(ll p = 0; p < n; p++){ll x; scanf("%lld", &x); s += x; s = (s + MOD) % MOD;} 9 | ll q; scanf("%lld", &q); 10 | ll mult(1); 11 | for(ll p = 0; p < q; p++){mult *= 2; mult %= MOD; printf("%lld\n", (s * mult) % MOD);} 12 | 13 | } 14 | -------------------------------------------------------------------------------- /ATM2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | for(long p = 0; p < n; p++){ 9 | long x; scanf("%ld", &x); 10 | if(x <= k){printf("1"); k -= x;} 11 | else{printf("0");} 12 | } 13 | puts(""); 14 | } 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /ATOMS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | double n, k, m; scanf("%lf %lf %lf", &n, &k, &m); 9 | int count(0); 10 | while(m >= n){m /= k; ++count;} 11 | if(count > 0){--count;} 12 | 13 | printf("%d\n", count); 14 | } 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /ATOMS_old.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | double n, k, m; scanf("%lf %lf %lf", &n, &k, &m); 9 | int ans = log(m / n) / log(k); 10 | if(ans < 0 || m <= n){ans = 0;} 11 | printf("%d\n", ans); 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /ATTENDU.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | long n; std::cin >> n; 8 | std::string s; std::cin >> s; 9 | long cnt(0); for(long p = 0; p < s.size(); p++){cnt += (s[p] == '0');} 10 | std::cout << ((cnt <= 30) ? "YES" : "NO") << std::endl; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /AUCTION.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 8 | if(a > b && a > c){puts("Alice");} 9 | else if(b > a && b > c){puts("Bob");} 10 | else if(c > a && c > b){puts("Charlie");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /AUDIBLE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | puts((67 <= x && x <= 45000) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /AVDSQUARPLZ.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | for(long p = 1; p <= n; p++){printf("%ld ", p);} 9 | puts(""); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /AVG.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k, v; scanf("%ld %ld %ld", &n, &k, &v); 8 | long s(0); for(long p = 0; p < n; p++){long x; scanf("%ld", &x); s += x;} 9 | long ans((v * (n + k) - s) / k); 10 | printf("%ld\n", ((ans > 0) && (v * (n + k) - s) == ans * k) ? ans : -1); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /AVGOF3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | printf("%ld %ld %ld\n", x - 1, x , x + 1); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /AVGPROBLEM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 8 | puts((a + b > 2 * c) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /AVOIDCONTACT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", x + y - (x == y)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /BADMINTON.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("%ld\n", 1 + n / 2); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /BALLBOX.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | puts(n >= k * (k + 1) / 2 ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /BATH.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", x / (2 * y)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /BATTERYLOW.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | puts(x <= 15 ? "Yes" : "No"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /BIN_BAT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, a, b; scanf("%ld %ld %ld", &n, &a, &b); 8 | long res(-b); 9 | while(n > 1){res += (a + b); n /= 2;} 10 | printf("%ld\n", res); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /BIRDFARM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | if(z % x == 0 && z % y == 0){puts("ANY");} 9 | else if(z % x == 0){puts("CHICKEN");} 10 | else if(z % y == 0){puts("DUCK");} 11 | else{puts("NONE");} 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /BIRYANI.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", x * y); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /BLACKCEL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long n; scanf("%ld", &n); 6 | printf("%ld\n", n * n / 2); 7 | } 8 | -------------------------------------------------------------------------------- /BLACKJACK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b; scanf("%ld %ld", &a, &b); 8 | long res = 21 - a - b; 9 | printf("%ld\n", (1 <= res && res <= 10) ? res : -1); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /BLITZ3_2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, a, b; scanf("%ld %ld %ld", &n, &a, &b); 8 | long x = 180 + 2 * ((n + 1) / 2) - a; 9 | long y = 180 + 2 * (n / 2) - b; 10 | long total = x + y; total = (total > 0) ? total : 0; 11 | printf("%ld\n", total); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /BMI.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long m, h; scanf("%ld %ld", &m, &h); 8 | m /= (h * h); 9 | printf("%d\n", 1 + (m > 18) + (m > 24) + (m > 29)); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /BOBBANK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long w, x, y, z; scanf(" %ld %ld %ld %ld", &w, &x, &y, &z); 8 | printf("%ld\n", w + (x - y) * z); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /BOMBTHEBASE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x; scanf("%ld %ld", &n, &x); 8 | long res(0); 9 | for(long p = 0; p < n; p++){ 10 | long a; scanf("%ld", &a); 11 | if(x > a){res = p + 1;} 12 | } 13 | 14 | printf("%ld\n", res); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /BOOKPACK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | printf("%ld\n", x * ((y + z - 1) / z)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /BOTTOM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | int x; scanf("%d", &x); 8 | printf("%d\n", 7 - x); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /BOWLERS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k, l; scanf("%ld %ld %ld", &n, &k, &l); 8 | if(k * l < n || (k == 1 && n > 1)){puts("-1"); continue;} 9 | for(long p = 0; p < n; p++){printf("%ld ", (p % k) + 1);} 10 | puts(""); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /BREAKSTICK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x; scanf("%ld %ld", &n, &x); 8 | bool possible = (n % 2 == 0) || (x % 2 == 1 && (n >= x + 2)); 9 | puts(possible ? "YES" : "NO"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /BRKBKS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long s, wa, wb, wc; scanf("%ld %ld %ld %ld", &s, &wa, &wb, &wc); 8 | if(wa + wb + wc <= s){puts("1");} 9 | else if(wa + wb <= s || wb + wc <= s){puts("2");} 10 | else{puts("3");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /BRLADDER.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int q; scanf("%d", &q); 6 | while(q--){ 7 | long a, b; scanf("%ld %ld", &a, &b); 8 | if(a > b){long t = a; a = b; b = t;} 9 | puts((((a % 2) && (b - a <= 2)) || ((a % 2 == 0) && (b == a + 2))) ? "YES" : "NO"); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /BROKENPHONE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | if(x < y){puts("REPAIR");} 9 | else if(y < x){puts("NEW PHONE");} 10 | else{puts("ANY");} 11 | 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /BROKENSTRING.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | long n; std::cin >> n; 8 | std::string s; std::cin >> s; 9 | bool res(true); 10 | for(long p = 0; p < n / 2; p++){if(s[p] != s[n / 2 + p]){res = false; break;}} 11 | std::cout << (res ? "YES" : "NO") << std::endl; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /BUDGET_.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | puts(30 * y <= x ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /BUILDINGRACE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, x, y; scanf("%ld %ld %ld %ld", &a, &b, &x, &y); 8 | long diff = a * y - b * x; 9 | if(diff < 0){puts("Chef");} 10 | else if(diff > 0){puts("Chefina");} 11 | else{puts("Both");} 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /BULBLIFE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x; scanf("%ld %ld", &n, &x); 8 | long s(0); 9 | for(long p = 1; p < n; p++){long a; scanf("%ld", &a); s += a;} 10 | long diff = n * x - s; 11 | printf("%ld\n", diff > 0 ? diff : 0); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /BULLBEAR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | if(x < y){puts("PROFIT");} 9 | else if(x == y){puts("NEUTRAL");} 10 | else if(x > y){puts("LOSS");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /BULLET.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | long t = (y + x - 1) / x; 9 | printf("%ld\n", (t > z ? 0 : (z - t))); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /BURGERS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b; scanf("%ld %ld", &a, &b); 8 | printf("%ld\n", a < b ? a : b); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /BUYLAMP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k, x, y; scanf("%ld %ld %ld %ld", &n, &k, &x, &y); 8 | printf("%ld\n", k * x + (n - k) * (x < y ? x : y)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CABS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | if(x < y){puts("FIRST");} 9 | else if(y < x){puts("SECOND");} 10 | else{puts("ANY");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /CANDYDIST.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, m; scanf("%ld %ld", &n, &m); 8 | puts(n % (2 * m) ? "No" : "Yes"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CAN_REACH.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, k; scanf("%ld %ld %ld", &x, &y, &k); 8 | puts( ((x % k == 0) && (y % k == 0)) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CAPPLE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | 6 | int t; scanf("%d\n", &t); 7 | while(t--){ 8 | long n; scanf("%ld\n", &n); 9 | std::set s; 10 | while(n--){long x; scanf("%ld", &x); s.insert(x);} 11 | printf("%ld\n", s.size()); 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /CARCHOICE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x1, x2, y1, y2; scanf("%ld %ld %ld %ld", &x1, &x2, &y1, &y2); 8 | long res = y1 * x2 - x1 * y2; 9 | if(res < 0){puts("-1");} 10 | else if(res > 0){puts("1");} 11 | else{puts("0");} 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /CARRANGE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long s, m, v; scanf("%ld %ld %ld", &s, &m, &v); 8 | printf("%ld\n", v * (m - s + 1)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CARRYGOLD.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x, y; scanf("%ld %ld %ld", &n, &x, &y); 8 | puts( ((n + 1) * y >= x) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CARTRIP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | printf("%ld\n", 10 * (x > 300 ? x : 300)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CASH.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, m; scanf("%ld %ld", &n, &m); 8 | long res(0); 9 | for(long p = 0; p < n; p++){long x; scanf("%ld", &x); res += x; res %= m;} 10 | printf("%ld\n", res); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /CATHIEF.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, k, n; scanf("%ld %ld %ld %ld", &x, &y, &k, &n); 8 | puts( (x - y) % (2 * k) ? "No" : "Yes"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CBSPEED.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long x, y; scanf("%ld %ld", &x, &y); 6 | puts(x < y ? "YES" : "NO"); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /CCBTS01.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | std::string s; std::cin >> s; 8 | bool ans = (s[0] != s[1]) && (s[0] != s[2]) && (s[1] != s[2]); 9 | std::cout << (ans ? "YES" : "NO") << std::endl; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /CCHOCOLATES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | printf("%ld\n", (5 * x + 10 * y) / z); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CCISLAND.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, xr, yr, D; scanf("%ld %ld %ld %ld %ld", &x, &y, &xr, &yr, &D); 8 | puts( ((xr * D <= x) && (yr * D <= y)) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CFRTEST.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | long n; scanf("%ld", &n); 9 | std::set s; 10 | while(n--){long x; scanf("%ld", &x); s.insert(x);} 11 | printf("%ld\n", s.size()); 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /CGYM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | if(x + y <= z){puts("2");} 9 | else if(x <= z){puts("1");} 10 | else{puts("0");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /CHAIRS_.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", y < x ? (x - y) : 0); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHANGEPOS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c, d; scanf("%ld %ld %ld %ld", &a, &b, &c, &d); 8 | printf("%d\n", 1 + (a == c || b == d)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHCHCL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | long long n, m; scanf("%lld %lld\n", &n, &m); 8 | puts( ((m % 2) && (n % 2)) ? "No" : "Yes"); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /CHCOINSG.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | long n; scanf("%ld\n", &n); 8 | puts((n % 6) ? "Chef" : "Misha"); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /CHDOGS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | 5 | long t; scanf("%ld", &t); 6 | while (t--) { 7 | double a, v; scanf("%lf %lf", &a, &v); 8 | double ans = (2 * a) / (3 * v); 9 | printf("%.9lf\n", ans); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /CHEAPFOOD.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | printf("%ld\n", (x < 1000) ? 100 : x / 10); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHEAPFUEL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, a, b, k; scanf("%ld %ld %ld %ld %ld", &x, &y, &a, &b, &k); 8 | long diff = x + a * k - y - b * k; 9 | if(diff == 0){puts("SAME PRICE");} 10 | else{puts(diff < 0 ? "PETROL" : "DIESEL");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /CHEFAPPS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long s, x, y, z; scanf("%ld %ld %ld %ld", &s, &x, &y, &z); 8 | if(x + y + z <= s){puts("0");} 9 | else if(x + z <= s || y + z <= s){puts("1");} 10 | else if(z <= s){puts("2");} 11 | else{puts("-1");} 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /CHEFBARBER.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, m; scanf("%ld %ld", &n, &m); 8 | printf("%ld\n", n * m); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHEFBOTTLE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x, k; scanf("%ld %ld %ld", &n, &x, &k); 8 | printf("%ld\n", (k / x) < n ? (k / x) : n); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHEFCAND.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x; scanf("%ld %ld", &n, &x); 8 | printf("%ld\n", (n <= x) ? 0 : ((n - x + 3) / 4)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHEFCBA.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long a, b, c, d; scanf("%ld %ld %ld %ld\n", &a, &b, &c, &d); 6 | puts((a * b == c * d) || (a * c == b * d) || (a * d == b * c) ? "Possible" : "Impossible"); 7 | 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /CHEFCHOCO.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long c, x, y; scanf("%ld %ld %ld", &c, &x, &y); 8 | printf("%ld\n", (c - x) * y); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHEFCONTEST.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long X, Y, P ,Q; scanf("%ld %ld %ld %ld", &X, &Y, &P, &Q); 8 | long diff = X + 10 * P - (Y + 10 * Q); 9 | if(diff){puts(diff < 0 ? "Chef" : "Chefina");} 10 | else{puts("Draw");} 11 | } 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /CHEFDETE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | 6 | long n; scanf("%ld", &n); 7 | std::vector parent(n + 1, 0); 8 | std::vector isLeaf(n + 1, 1); 9 | 10 | for(long p = 0; p < n; p++){long x; scanf("%ld", &x); isLeaf[x] = 0;} 11 | for(long p = 1; p <= n; p++){if(isLeaf[p]){printf("%ld ", p);}} 12 | puts(""); 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /CHEFGAMES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | int a, b, c, d; scanf("%d %d %d %d", &a, &b, &c, &d); 8 | puts((a + b + c + d == 0) ? "IN" : "OUT"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHEFONDATE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | puts(x >= y ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHEFPAGES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int a, b; scanf("%d %d", &a, &b); 6 | if(!a){puts("https://www.codechef.com/practice");} 7 | else if(!b){puts("https://www.codechef.com/contests");} 8 | else{puts("https://discuss.codechef.com");} 9 | 10 | } 11 | -------------------------------------------------------------------------------- /CHEFPATH.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long long n, m; scanf("%lld %lld", &n, &m); 8 | puts( ((n == 1 && m > 3) || (m == 1 && n > 3) || ((n % 2) && (m % 2))) ? "No" : "Yes"); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /CHEFRACES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, a, b; scanf("%ld %ld %ld %ld", &x, &y, &a, &b); 8 | printf("%d\n", (x != a && x != b) + (y != a && y != b)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHEFSCORE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x, y; scanf("%ld %ld %ld", &n, &x, &y); 8 | puts(y % x ? "NO" : "YES"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHEFSLP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, l, x; scanf("%ld %ld %ld", &n, &l, &x); 8 | printf("%ld\n", x * ((l < n - l) ? l : (n - l))); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHEFSOCK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long j, s, m; scanf("%ld %ld %ld\n", &j, &s, &m); 6 | puts( (((m - j) / s) % 2) ? "Unlucky Chef" : "Lucky Chef"); 7 | 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /CHEFST.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld\n", &t); 6 | while(t--){ 7 | long long n1, n2, m; scanf("%lld %lld %lld\n", &n1, &n2, &m); 8 | long long rem = (n1 < n2) ? n1 : n2; 9 | rem = (rem < (m * (m + 1) / 2)) ? rem : (m * (m + 1) / 2); 10 | printf("%lld\n", n1 + n2 - 2 * rem); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /CHEFSTEP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | while(n--){long x; scanf("%ld", &x); printf("%d", (x % k == 0));} 9 | puts(""); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /CHEFSTUD.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; std::cin >> t; 6 | while(t--){ 7 | std::string s; std::cin >> s; 8 | long count(0); 9 | for(long p = 1; p < s.size(); p++){count += (s[p - 1] == '<' && s[p] == '>');} 10 | std::cout << count << std::endl; 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /CHEFSUM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long mn(1e6), pos(-1); 9 | for(long p = 1; p <= n; p++){ 10 | long x; scanf("%ld", &x); 11 | if(x < mn){mn = x; pos = p;} 12 | } 13 | 14 | printf("%ld\n", pos); 15 | } 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /CHEFTRANS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | x += y; 9 | if(x == z){puts("EQUAL");} 10 | else{puts(x < z ? "PLANEBUS" : "TRAIN");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /CHEFVACATION.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | puts(x + y <= z ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHEFWARS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long h, w; scanf("%ld %ld", &h, &w); 8 | while(h > 0 && w > 0){h -= w; w /= 2;} 9 | puts(w < h ? "0" : "1"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /CHESSDIST.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x1, y1, x2, y2; scanf("%ld %ld %ld %ld", &x1, &y1, &x2, &y2); 8 | long dx = x1 < x2 ? (x2 - x1) : (x1 - x2); 9 | long dy = y1 < y2 ? (y2 - y1) : (y1 - y2); 10 | printf("%ld\n", dx > dy ? dx : dy); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /CHESSTIME.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("%ld\n", 3 * n); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHFAR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | long cnt(0); 9 | while(n--){long x; scanf("%ld", &x); cnt += (x > 1);} 10 | puts(cnt <= k ? "YES" : "NO"); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /CHFCHK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long mn(1e9); 9 | for(long p = 0; p < n; p++){long x; scanf("%ld", &x); mn = (mn < x) ? mn : x;} 10 | printf("%ld\n", mn); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /CHFCLASS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("%ld\n", (n / 7) + (n % 7 == 6)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHFDBT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("%ld\n", (n / 2) + (n % 2)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHFGCD.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long gcd(long a, long b){return (b == 0) ? a : gcd(b, a % b);} 4 | 5 | int main(){ 6 | 7 | long t; scanf("%ld", &t); 8 | while(t--){ 9 | long x, y; scanf("%ld %ld", &x, &y); 10 | if(gcd(x, y) > 1){puts("0");} 11 | else if(gcd(x + 1, y) > 1 || gcd(x, y + 1) > 1){puts("1");} 12 | else{puts("2");} 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /CHFINTRO.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long n, r; scanf("%ld %ld", &n, &r); 6 | while(n--){ 7 | long x; scanf("%ld", &x); 8 | puts(x >= r ? "Good boi" : "Bad boi"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHFMOT18.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long s, n; scanf("%ld %ld", &s, &n); 8 | long res = s / n; s %= n; 9 | if(s % 2){++res; --s;} 10 | res += (s > 0); 11 | printf("%ld\n", res); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /CHFPROFIT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | printf("%ld\n", x * (z - y)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHFRICH.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, x; scanf("%ld %ld %ld", &a, &b, &x); 8 | printf("%ld\n", (b - a + x - 1) / x); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CHFSPL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 8 | long res = a + b; 9 | if(a <= b && a <= c){res = b + c;} 10 | else if(b <= a && b <= c){res = a + c;} 11 | printf("%ld\n", res); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /CHFTIRED.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){puts("YES");} 7 | 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /CHN05.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d", &t); 6 | while(t--){ 7 | int n,m; scanf("%d %d", &n, &m); 8 | if(n == 1){puts("0");} 9 | else if(n == 2){printf("%d\n", m);} 10 | else{printf("%d\n", (n - 1) + 2 * (m - 1));} 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /CHN15A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | long cnt(0); 9 | while(n--){long x; scanf("%ld", &x); cnt += ((x + k) % 7 == 0);} 10 | printf("%ld\n", cnt); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /CHNGOR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long cost(0); 9 | while(n--){long x; scanf("%ld", &x); cost |= x;} 10 | printf("%ld\n", cost); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /CHOPRT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld\n", &x, &y); 8 | if(x < y){puts("<");} 9 | else if(x > y){puts(">");} 10 | else if(x == y){puts("=");} 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /CHRECT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | int n, m, k; scanf("%d %d %d\n", &n, &m, &k); 8 | int ans(0); 9 | if((n==1 && m==1)|| (n==1 && m==2) || (n==2 && m==1)){ans=0;} 10 | else if(n==1 || m==1){ans=k;} 11 | else{ans=(k+1)/2;} 12 | printf("%d\n",ans); 13 | } 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /CHSERVE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | puts(((x + y) / z) % 2 ? "COOK" : "CHEF"); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /CHSFORMT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b; scanf("%ld %ld", &a, &b); 8 | if(a + b < 3){puts("1");} 9 | else if(a + b <= 10){puts("2");} 10 | else if(a + b <= 60){puts("3");} 11 | else{puts("4");} 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /CIELAB.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(){ 5 | 6 | int A,B,result; 7 | scanf("%d %d",&A , &B); 8 | result = ( (A - B) % 10 != 9) ? (A - B + 1):(A - B - 1); 9 | printf("%d\n",result); 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /CK87MEDI.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(){ 6 | 7 | long t; scanf("%ld", &t); 8 | while(t--){ 9 | long n, k; scanf("%ld %ld", &n, &k); 10 | std::vector a(n); for(long p = 0; p < n; p++){scanf("%ld", &a[p]);} 11 | sort(a.begin(), a.end()); 12 | printf("%ld\n", a[(n + k) / 2]); 13 | } 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /CK87QUER.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | typedef long long ll; 4 | 5 | int main(){ 6 | 7 | long t; scanf("%ld", &t); 8 | while(t--){ 9 | ll y; scanf("%lld", &y); 10 | ll cnt(0); for(ll b = 1; b <= 700 && b < y; b++){cnt += sqrt(y - b);} 11 | printf("%lld\n", cnt); 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /CKWLK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long long n; scanf("%lld", &n); 8 | long t(0), w(0); 9 | while(n % 10 == 0){n /= 10; ++t;} 10 | while(n % 2 == 0){n /= 2; ++w;} 11 | bool res = (n == 1) && (t >= w); 12 | puts(res ? "Yes" : "No"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /CLIPLX.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", (x <= y) ? 0 : (x - y)); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /CLLCM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | bool res(true); 9 | for(long p = 0; p < n; p++){ 10 | long x; scanf("%ld", &x); 11 | if(x % 2 == 0){res = false;} 12 | } 13 | 14 | puts(res ? "YES" : "NO"); 15 | } 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /CMASKS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | long diff = 100 * x - 10 * y; 9 | puts(diff >= 0 ? "Cloth" : "Disposable"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /CNDLOVE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long s(0); while(n--){long x; scanf("%ld", &x); s += x; s %= 2;} 9 | puts(s ? "YES" : "NO"); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /CNTWRD.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, m; scanf("%ld %ld", &n, &m); 8 | printf("%ld\n", m * n); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /COCONUT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long xa, xb, Xa, Xb; scanf("%ld %ld %ld %ld", &xa, &xb, &Xa, &Xb); 8 | printf("%ld\n", Xa / xa + Xb / xb); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /COMPCAND.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | printf("%ld\n", (n % k) ? (-1) : (n / k)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /COMPLEXITY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | puts(x > y ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CONN.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | bool res = (n == 2) || (n == 4) || (n >= 6); 9 | puts(res ? "YES" : "NO"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /COOKMACH.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b; scanf("%ld %ld", &a, &b); 8 | long cnt(0); 9 | while((a & (a - 1)) != 0){a /= 2; ++cnt;} 10 | while(a < b){a *= 2; ++cnt;} 11 | while(a > b){a /= 2; ++cnt;} 12 | printf("%ld\n", cnt); 13 | } 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /COUNTP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long cnt(0); 9 | for(long p = 0; p < n; p++){ 10 | long x; scanf("%ld", &x); 11 | cnt += (x % 2); 12 | } 13 | 14 | puts((!cnt) || (cnt % 2) ? "NO" : "YES"); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /COURSEREG.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, m, k; scanf("%ld %ld %ld", &n, &m, &k); 8 | puts(n + k <= m ? "Yes" : "No"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /COVIDLQ.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | bool ans(true); long prev(-11); 9 | for(long p = 0; p < n; p++){ 10 | int x; scanf("%d", &x); 11 | if(x){if(p < prev + 6){ans = false;} prev = p;} 12 | } 13 | 14 | puts(ans ? "YES" : "NO"); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /COVID_19.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, m; scanf("%ld %ld", &n, &m); 8 | printf("%ld\n", ((n + 1) / 2) * ((m + 1) / 2)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CREDCOINS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", (x * y) / 100); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CREDITS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | int x; scanf("%d", &x); 8 | if(x < 35){puts("Underload");} 9 | else if(x <= 65){puts("Normal");} 10 | else{puts("Overload");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /CREDS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | printf("%ld\n", 4 * x + 2 * y); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CREDSCORE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long x; scanf("%ld", &x); 6 | puts(x >= 750 ? "YES" : "NO"); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /CRICRANK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long r1, w1, c1; scanf("%ld %ld %ld", &r1, &w1, &c1); 8 | long r2, w2, c2; scanf("%ld %ld %ld", &r2, &w2, &c2); 9 | long x = (r1 > r2) + (w1 > w2) + (c1 > c2); 10 | puts(x > 1 ? "A" : "B"); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /CRICUP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, d; scanf("%ld %ld %ld", &x, &y, &d); 8 | long res = x - y; if(res < 0){res = -res;} 9 | puts(res <= d ? "YES" : "NO"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /CSTOCK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | double s, a, b, c; scanf("%lf %lf %lf %lf", &s, &a, &b, &c); 8 | double price = s * (1.0 + 0.01 * c); 9 | puts( (a <= price) && (price <= b) ? "Yes" : "No"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /CUTBOARD.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, m; scanf("%ld %ld", &n, &m); 8 | printf("%ld\n", (n - 1) * (m - 1)); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /CUTPAPER.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | printf("%ld\n", (n / k) * (n / k)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CWIREFRAME.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, m, x; scanf("%ld %ld %ld", &n, &m, &x); 8 | printf("%ld\n", 2 * x * (m + n)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CYBV.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld",&t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | printf("%ld\n", k / n); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CYCLICQD.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c, d; scanf("%ld %ld %ld %ld", &a, &b, &c, &d); 8 | puts(a + c == 180 ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /C_RATING.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", (y + 7 - x) / 8); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /DANCEMOVES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | if(x == y){puts("0"); continue;} 9 | else if(y > x){ 10 | long diff = y - x; 11 | printf("%ld\n", (diff + (diff % 2)) / 2 + (diff % 2)); 12 | } 13 | else{printf("%ld\n", x - y);} 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /DARLIG.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | n %= 4; 9 | if(!k && !n){puts("Off");} 10 | else if(!k){puts("On");} 11 | else if(k && !n){puts("On");} 12 | else {puts("Ambiguous");} 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /DATATYPE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x; scanf("%ld %ld", &n, &x); 8 | printf("%ld\n", x % (n + 1)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /DCE05.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(){ 4 | unsigned long applicants = 0, position = 1; 5 | int numCases; scanf("%d\n",&numCases); 6 | while(numCases--){ 7 | scanf("%lu\n",&applicants); 8 | position = 1; while(position <= applicants){position *= 2;}; position /= 2; 9 | printf("%lu\n",position); 10 | } 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /DECINC.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long n; scanf("%ld", &n); 6 | printf("%ld\n", (n % 4) ? (n - 1) : (n + 1)); 7 | 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /DECREM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | ll l, r; scanf("%lld %lld", &l, &r); 9 | printf("%lld\n", (r < 2 * l) ? r : -1); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /DETSCORE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, n; scanf("%ld %ld", &x, &n); 8 | printf("%ld\n", x * n / 10); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /DEVSPORTS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long z, y, a, b, c; scanf("%ld %ld %ld %ld %ld", &z, &y, &a, &b, &c); 8 | puts((a + b + c + y <= z) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /DIAGMOVE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | puts((x - y) % 2 ? "NO" : "YES"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /DIFFCONSEC.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | long n; std::cin >> n; 8 | std::string s; std::cin >> s; 9 | long cnt(0); 10 | for(long p = 1; p < s.size(); p++){cnt += (s[p - 1] == s[p]);} 11 | std::cout << cnt << std::endl; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /DIFFSUM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long x, y; scanf("%ld %ld", &x, &y); 6 | printf("%ld\n", (x > y) ? (x - y) : (x + y)); 7 | 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /DIFSTR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | long n; std::cin >> n; 8 | for(long p = 0; p < n; p++){ 9 | std::string s; std::cin >> s; 10 | std::cout << (1 - (s[p] - '0')); 11 | } 12 | 13 | std::cout << std::endl; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /DISABLEDKING.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("%ld\n", n - n % 2); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /DISCNT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | printf("%ld\n", 100 - x); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /DISCUS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 8 | a = (a > b) ? a : b; a = (a > c) ? a : c; 9 | printf("%ld\n", a); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /DISTINCTCOL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long mx(0); 9 | for(long p = 0; p < n; p++){ 10 | long a; scanf("%ld", &a); 11 | mx = (mx > a) ? mx : a; 12 | } 13 | 14 | printf("%ld\n", mx); 15 | 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /DIV3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long z, a, t; scanf("%ld %ld %ld", &z, &a, &t); 8 | long f = (a < t) ? a : t; a -= f; t -= f; 9 | long res = z + f + (a / 3) + (t / 3); 10 | printf("%ld\n", res); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /DIVIDING.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long long n; scanf("%ld\n", &n); 6 | long long s(0); 7 | for(long p = 0; p < n; p++){long long x; scanf("%lld", &x); s += x;} 8 | puts( (s == (n * (n + 1) / 2)) ? "YES" : "NO"); 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /DIVTHREE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | ll t; scanf("%lld", &t); 7 | while(t--){ 8 | ll n, k, d; scanf("%lld %lld %lld", &n, &k, &d); 9 | ll s(0); 10 | for(ll p = 0; p < n; p++){ll x; scanf("%lld", &x); s += x;} 11 | ll res = s / k; 12 | res = (res < d) ? res : d; 13 | printf("%lld\n", res); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /DIWALI1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long P, a, b, c, x, y; scanf("%ld %ld %ld %ld %ld %ld", &P, &a, &b, &c, &x, &y); 8 | long f(b + x * a), g(c + y * a); 9 | long cost = (f < g) ? f : g; 10 | printf("%ld\n", P / cost); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /DOLL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | long res(0); 9 | for(long p = 0; p < n; p++){ 10 | long h; scanf("%ld", &h); 11 | res += (h > k); 12 | } 13 | 14 | printf("%ld\n", res); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /DOMINANT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 8 | puts((a > b + c || b > a + c || c > a + b) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /DOUBLE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(int argc, char* argv[]){ 5 | size_t N; scanf("%zd",&N); 6 | 7 | size_t temp; 8 | for(size_t k = 0; k < N ; k++){ 9 | scanf("%zd",&temp); 10 | printf("%zd\n", temp - (temp % 2) ); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /DPOLY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long deg(0); 9 | for(long p = 0; p < n; p++){ 10 | long a; scanf("%ld", &a); 11 | if(a){deg = p;} 12 | } 13 | 14 | printf("%ld\n", deg); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /DRUNKALK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long k; scanf("%ld", &k); 8 | printf("%ld\n", 2 * (k / 2) + 3 * (k % 2)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /DSTAPLS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | ll n, k; scanf("%lld %lld", &n, &k); 9 | puts((n / k) % k ? "YES" : "NO"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /EASYPERM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | for(long p = n; p > 0; p--){printf("%ld ", p);} 9 | puts(""); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /EITA.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long d, x, y, z; scanf("%ld %ld %ld %ld", &d, &x, &y, &z); 8 | long res = y * d + z * (7 - d); 9 | res = (res > 7 * x) ? res : (7 * x); 10 | printf("%ld\n", res); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /ELECTIONS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 8 | if(a > b + c){puts("A");} 9 | else if(b > a + c){puts("B");} 10 | else if(c > a + b){puts("C");} 11 | else{puts("NOTA");} 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /ELEVSTRS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | long n; double v1, v2; scanf("%ld %lf %lf", &n, &v1, &v2); 9 | puts(sqrt(2) * v1 < v2 ? "Elevator" : "Stairs"); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /EMA01.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long long x(0); 6 | while(scanf("%lld\n", &x) != EOF){ 7 | long long pow = 5; 8 | long long count(0); 9 | while(pow <= x){count += x / pow; pow *= 5;} 10 | printf("%lld\n", count); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /EMAILREM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long n, u; scanf("%ld %ld", &n, &u); 6 | printf("%ld\n", n - u); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /ENSPACE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x, y; scanf("%ld %ld %ld", &n, &x, &y); 8 | puts(x + 2 * y <= n ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /EOEO.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | ll x; scanf("%lld", &x); 9 | while(x % 2 == 0){x /= 2;} 10 | printf("%lld\n", x / 2); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /EQCARDGAME.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long k; scanf("%ld", &k); 8 | long res(0); for(long p = 1; p * k <= 52; res = p * k, p++); 9 | printf("%ld\n", 52 - res); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /EQLZING.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b; scanf("%ld %ld", &a, &b); 8 | puts( ((a - b) % 2) ? "No" : "Yes"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /EQUALCOIN.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | if(x % 2){puts("NO");} 9 | else if(x == 0){puts(y % 2 ? "NO" : "YES");} 10 | else{puts("YES");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /EQUALDIST.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b; scanf("%ld %ld", &a, &b); 8 | puts( (a + b) % 2 ? "NO" : "YES"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /EQUALIZEAB.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, x; scanf("%ld %ld %ld", &a, &b, &x); 8 | puts( ((b - a) % (2 * x) == 0) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /EUREKA.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | long n; scanf("%ld", &n); 9 | long long res = pow(0.143 * n, n) + 0.5; 10 | printf("%lld\n", res); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /EVENDIFF.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long a(0), b(0); 9 | while(n--){ 10 | long x; scanf("%ld", &x); 11 | x %= 2; x ? (++a) : (++b); 12 | } 13 | 14 | printf("%ld\n", (a < b) ? a : b); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /EVENGAME.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long long s(0); for(long p = 0; p < n; p++){long x; scanf("%ld", &x); s += x;} 9 | printf("%lld\n", 1 + (s % 2)); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /EVENPSUM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b; scanf("%ld %ld", &a, &b); 8 | long x = a / 2; long y = a - x; 9 | long z = b / 2; long w = b - z; 10 | long res = x * z + y * w; 11 | printf("%ld\n", res); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /EXPENSES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x; scanf("%ld %ld", &n, &x); 8 | printf("%ld\n", 1L << (x - n)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /EXPERT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | puts(2 * y >= x ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /EXPIRY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, m, k; scanf("%ld %ld %ld", &n, &m, &k); 8 | puts(k * m >= n ? "Yes" : "No"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /EXUNA.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long mn(1e9 + 7); 9 | for(long p = 0; p < n; p++){long x; scanf("%ld", &x); mn = (mn < x) ? mn : x;} 10 | printf("%ld\n", mn); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /F1RULE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | puts(100 * y <= 107 * x ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /FACEDIR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | x %= 4; 9 | if(x == 0){puts("North");} 10 | else if(x == 1){puts("East");} 11 | else if(x == 2){puts("South");} 12 | else if(x == 3){puts("West");} 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /FAIRPASS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | puts(n + 1 <= k ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /FAKEGCD.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | for(long p = n; p > 0; p--){printf("%ld ", p);} 9 | puts(""); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /FALSNUM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | std::string s; std::cin >> s; 8 | if(s[0] == '1'){s[0] = '0';} 9 | std::cout << "1" << s << std::endl; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /FBC.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long k, x; scanf("%ld %ld", &k, &x); 8 | printf("%ld\n", k - x); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /FEVER.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | puts(x > 98 ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /FILLCANDIES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k, m; scanf("%ld %ld %ld", &n, &k, &m); 8 | printf("%ld\n", (n + k * m - 1) / (k * m)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /FINDSHOES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, m; scanf("%ld %ld", &n, &m); 8 | printf("%ld\n", 2 * n - (m < n ? m : n)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /FIRSTTEST.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main( int argc , char *argv[] ){ 5 | 6 | int inputNumber = 0; 7 | const int answer = 42; 8 | 9 | while(true){ 10 | cin >> inputNumber; 11 | if(inputNumber == answer){break;} 12 | cout << inputNumber << endl; 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /FIT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | printf("%ld\n", 10 * x); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /FIXT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | ll k; scanf("%lld", &k); 7 | ll res = k * (2 * k - 1); 8 | printf("%lld\n", res); 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /FLIPCARDS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x; scanf("%ld %ld", &n, &x); 8 | printf("%ld\n", (x < (n - x)) ? x : (n - x)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /FLOORS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | long res = ((x - 1) / 10) - ((y - 1) / 10); 9 | if(res < 0){res = -res;} 10 | printf("%ld\n", res); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /FLOW001.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int T; scanf("%d\n", &T); 6 | while(T--){ 7 | long a, b; scanf("%ld %ld\n", &a, &b); 8 | printf("%ld\n", a + b); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /FLOW002.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int T; scanf("%d\n", &T); 6 | while(T--){ 7 | long x, y; scanf("%ld %ld\n", &x, &y); 8 | printf("%ld\n", x % y); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /FLOW004.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int getLSD(long x){return (x % 10);} 4 | int getMSD(long x){while(x > 9){x /= 10;}; return x;} 5 | 6 | int main(){ 7 | 8 | int t; scanf("%d\n", &t); 9 | while(t--){ 10 | long a; scanf("%ld\n", &a); 11 | printf("%d\n", getLSD(a) + getMSD(a)); 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /FLOW006.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int sumOfDigits(long x){ 4 | int res(0); 5 | while(x > 0){res += (x % 10); x /= 10;} 6 | return res; 7 | } 8 | 9 | 10 | int main(){ 11 | 12 | int T; scanf("%d\n", &T); 13 | while(T--){ 14 | long num; scanf("%ld\n", &num); 15 | printf("%d\n", sumOfDigits(num)); 16 | } 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /FLOW008.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | int n; scanf("%d\n", &n); 8 | puts((n < 10) ? "What an obedient servant you are!" : "-1"); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /FLOW009.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | const double Q = 1000.0; 6 | const double mult = 0.9; 7 | int t; scanf("%d\n", &t); 8 | while(t--){ 9 | double q, p; scanf("%lf %lf\n", &q, &p); 10 | if(q > Q){p *= mult;} 11 | printf("%.6lf\n", p * q); 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /FLOW011.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | const long B = 1500; 6 | int t; scanf("%d\n", &t); 7 | while(t--){ 8 | long base; scanf("%ld\n", &base); 9 | double total(0); 10 | if(base < B){total = 2 * base;} 11 | else{total = 500 + 1.98 * base;} 12 | printf("%g\n", total); 13 | } 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /FLOW013.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int T; scanf("%d\n", &T); 6 | while(T--){ 7 | int a, b, c; scanf("%d %d %d\n", &a, &b, &c); 8 | puts((a > 0 && b > 0 && c > 0 && a + b + c == 180) ? "YES" : "NO"); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /FLOW016.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long gcd(long a, long b){return (a == 0) ? b : gcd(b % a, a);} 4 | 5 | int main(){ 6 | 7 | int T; scanf("%d\n", &T); 8 | while(T--){ 9 | 10 | long x, y; scanf("%ld %ld\n", &x, &y); 11 | printf("%ld %ld\n", gcd(x, y), (x * y / gcd(x, y))); 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /FLOW018.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int64_t factorial(int a){ 4 | int64_t res(1); 5 | for(int p = 1; p <= a; p++){res *= p;} 6 | return res; 7 | } 8 | 9 | 10 | int main(){ 11 | 12 | int T; std::cin >> T; 13 | while(T--){ 14 | int64_t x; std::cin >> x; 15 | std::cout << factorial(x) << std::endl; 16 | } 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /FODCHAIN.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, k; scanf("%ld %ld", &x, &k); 8 | long cnt(0); while(x){++cnt; x /= k;} 9 | printf("%ld\n", cnt); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /FOOTCUP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | puts((x > 0 && x == y) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /FRGAME.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c, d; scanf("%ld %ld %ld %ld", &a, &b, &c, &d); 8 | if(a < b){a += c;} 9 | else{b += c;} 10 | 11 | if(a < b){a += d;} 12 | else{b += d;} 13 | 14 | puts(a < b ? "S" : "N"); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /FRIMEET.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | puts(x >= y ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /FRUITCHAAT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", (x / 2) < y ? (x / 2) : y); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /FRUITS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | int n, m, k; scanf("%d %d %d\n", &n, &m, &k); 8 | int diff = n - m; if(diff < 0){diff = -diff;} 9 | diff = (diff < k) ? 0 : (diff - k); 10 | printf("%d\n", diff); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /FSQRT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | 6 | int T; std::cin >> T; 7 | while(T--){ 8 | long x; std::cin >> x; 9 | long r = sqrt(x); 10 | std::cout << r << std::endl; 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /GCDOPS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | bool ans(true); 9 | for(long p = 1; p <= n; p++){ 10 | long b; scanf("%ld", &b); 11 | if(p % b){ans = false;} 12 | } 13 | puts(ans ? "YES" : "NO"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /GCDSET.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | ll l, r, g; scanf("%lld %lld %lld", &l, &r, &g); 9 | ll f = r/g - (l - 1) / g; 10 | if(f != 1){printf("%lld\n", f);} 11 | else if(l <= g && g <= r){puts("1");} 12 | else{puts("0");} 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /GDOG.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld\n", &n, &k); 8 | long max(0); 9 | for(int p = 1; p <= k; p++){ 10 | if(max < (n % p)){max = n % p;} 11 | } 12 | 13 | printf("%ld\n", max); 14 | } 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /GENE01.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | std::string s, t; std::cin >> s >> t; 6 | if(s == "R" || t == "R"){std::cout << "R" << std::endl;} 7 | else if(s == "B" || t == "B"){std::cout << "B" << std::endl;} 8 | else{std::cout << "G" << std::endl;} 9 | } 10 | -------------------------------------------------------------------------------- /GOODWEAT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | int cnt(0); 8 | for(int p = 0; p < 7; p++){int x; scanf("%d", &x); cnt +=x;} 9 | puts(cnt > 3 ? "YES" : "NO"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /GRIDBL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, m; scanf("%ld %ld", &n, &m); 8 | long res(0); 9 | if(n % 2 && m % 2){res = n + m - 1;} 10 | else if(n % 2){res = m;} 11 | else if(m % 2){res = n;} 12 | else{res = 0;} 13 | 14 | printf("%ld\n", res); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /GROUPASSGN.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x; scanf("%ld %ld", &n, &x); 8 | printf("%ld\n", 2 * n + 1 - x); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /GROUPS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | std::string s; std::cin >> s; 8 | char prev('0'); long cnt(0); 9 | for(long p = 0; p < s.size(); p++){cnt += (s[p] == '1' && prev == '0'); prev = s[p];} 10 | std::cout << cnt << std::endl; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /GVAWAY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long l, r, k; scanf("%ld %ld %ld", &l, &r, &k); 8 | printf("%ld\n", (l == r) ? 1 : k); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /HARDBET.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long sa, sb, sc; scanf("%ld %ld %ld", &sa, &sb, &sc); 8 | if(sa < sb && sa < sc){puts("Draw");} 9 | else{puts(sc < sb ? "Alice" : "Bob");} 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /HDIVISR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long n; scanf("%ld", &n); 6 | for(long p = 10; p > 0; p--){ 7 | if(n % p){continue;} 8 | printf("%ld\n", p); 9 | break; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /HEIGHTRATION.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long a, b; scanf("%ld %ld", &a, &b); 6 | printf("%ld\n", (a > b) ? a : b); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /HELIUM3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, x, y; scanf("%ld %ld %ld %ld", &a, &b, &x, &y); 8 | puts((a * b <= x * y) ? "Yes" : "No"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /HIGHSCORE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long a, b, c, d; scanf("%ld %ld %ld %ld", &a, &b, &c, &d); 9 | a = (a > b ? a : b); a = (a > c ? a : c); a = (a > d ? a : d); 10 | printf("%ld\n", a); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /HMAPPY2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | ll gcd(ll a, ll b){return (b == 0) ? a : gcd(b, a % b);} 5 | 6 | int main(){ 7 | 8 | long t; scanf("%ld", &t); 9 | while(t--){ 10 | ll n, a, b, k; scanf("%lld %lld %lld %lld", &n, &a, &b, &k); 11 | ll res = (n / a) + (n / b) - 2 * (n / (a * b / gcd(a, b))); 12 | puts(res >= k ? "Win" : "Lose"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /HOOPS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | long t; scanf("%ld", &t); 5 | while(t--){long n; scanf("%ld", &n); printf("%ld\n", (n + 1)/2);} 6 | } 7 | -------------------------------------------------------------------------------- /HOTCOLD.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long c; scanf("%ld", &c); 8 | puts(c > 20 ? "HOT" : "COLD"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /HOWMANY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long n; scanf("%ld", &n); 6 | if(n < 10){puts("1");} 7 | else if(n < 100){puts("2");} 8 | else if(n < 1000){puts("3");} 9 | else{puts("More than 3 digits");} 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /ICL1902.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | 6 | 7 | long t; scanf("%ld", &t); 8 | while(t--){ 9 | long n; scanf("%ld", &n); 10 | long cnt(0); 11 | while(n){ 12 | long sqr = std::sqrt(n); 13 | n -= sqr * sqr; 14 | ++cnt; 15 | } 16 | 17 | printf("%ld\n", cnt); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ICM0013.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | long t; scanf("%ld", &t); 5 | while(t--){long n; scanf("%ld", &n); printf("%ld\n", n);} 6 | } 7 | -------------------------------------------------------------------------------- /ICM2008.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c, d; scanf("%ld %ld %ld %ld", &a, &b, &c, &d); 8 | puts( (a != b) && ((c == d) || (a - b) % (c - d)) ? "NO" : "YES"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /ICPC16C.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long d; scanf("%ld", &d); 8 | printf("%ld\n", (d % 9) + 1); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /INCREAR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", (x < y) ? (y - x) : ( (x - y) / 2 + 2 * ((x - y) % 2) ) ); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /INCRIQ.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long x; scanf("%ld", &x); 6 | puts(x > 163 ? "Yes" : "No"); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /INSTAGRAM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | puts((x > 10 * y) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /INSTNOODLE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long x, y; scanf("%ld %ld", &x, &y); 6 | printf("%ld\n", x * y); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /INSURANCE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", (y < x) ? y : x); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /INTEST.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(){ 5 | 6 | size_t n,k; scanf("%zd %zd", &n, &k); 7 | size_t currentInput, counter = 0; 8 | 9 | for(size_t m = 0; m < n ; m++){ 10 | scanf("%zd", ¤tInput); 11 | if(currentInput % k == 0){counter++;} 12 | } 13 | cout << counter << endl; 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /INTRDSGN.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x1, y1, x2, y2; scanf("%ld %ld %ld %ld", &x1, &y1, &x2, &y2); 8 | long c1 = x1 + y1; 9 | long c2 = x2 + y2; 10 | printf("%ld\n", c1 < c2 ? c1 : c2); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /INVESTMENT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | puts(x >= 2 * y ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /ISITCAKE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n = 100; 8 | long cnt(0); 9 | while(n--){long x; scanf("%ld", &x); cnt += (x <= 30);} 10 | puts(cnt >= 60 ? "yes" : "no"); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /JASSIGNMENTS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | puts(x <= 7 ? "Yes" : "No"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /JCOINS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", 10 * x + 5 * y); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /JDELAY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long cnt(0); 9 | while(n--){ 10 | long x, y; scanf("%ld %ld", &x, &y); 11 | cnt += (y > x + 5); 12 | } 13 | printf("%ld\n", cnt); 14 | } 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /JENGA.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x; scanf("%ld %ld", &n, &x); 8 | puts(x % n ? "NO" : "YES"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /JGAMES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | puts( (x + y) % 2 ? "Jay" : "Janmansh"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /JOINING.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | printf("%ld\n", ((n + 4) / 5) - ((k + 4) / 5)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /KEPLERSLAW.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long t1, t2, r1, r2; scanf("%ld %ld %ld %ld", &t1, &t2, &r1, &r2); 8 | long check = t1 * t1 * r2 * r2 * r2 - t2 * t2 * r1 * r1 * r1; 9 | puts(check ? "No" : "Yes"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /KITCHENSPICE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | if(x < 4){puts("MILD");} 9 | else if(x < 7){puts("MEDIUM");} 10 | else{puts("HOT");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /KITCHENTIME.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", y - x); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /KNGTOR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, m; scanf("%ld %ld", &n, &m); 8 | printf("%ld\n", 5 * n + 7 * m); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /KNIGHT2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x1, y1, x2, y2; scanf("%ld %ld %ld %ld", &x1, &y1, &x2, &y2); 8 | long diff = (x2 - x1) + (y2 - y1); 9 | puts(diff % 2 ? "NO" : "YES"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /KOL15A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | std::string s; std::cin >> s; 8 | long sum(0); 9 | for(long p = 0; p < s.size(); p++){sum += ('0' <= s[p] && s[p] <= '9') * (s[p] - '0');} 10 | std::cout << sum << std::endl; 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /L56GAME.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long cur(0); 9 | while(n--){long x; scanf("%ld", &x); cur += (x % 2); cur %= 2;} 10 | printf("%ld\n", (n == 1) ? 1 : (1 + cur)); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /LASTLEVELS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | printf("%ld\n", x * y + (x > 3) * z * ((x - 1) / 3)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /LAZYCHF.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, m, d; scanf("%ld %ld %ld", &x, &m, &d); 8 | printf("%ld\n", (m * x < x + d) ? m * x : x + d); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /LEAGUE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("%ld\n", 3 * (n / 2)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /LISDIGIT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | int len; scanf("%d", &len); 8 | while(len--){int d; scanf("%d", &d); printf("%d", d);} 9 | puts(""); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /LOCKDRAW.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 8 | bool res = (a + b == c) || (a + c == b) || (b + c == a); 9 | puts(res ? "YES" : "NO"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /LONGSEQ.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | std::ios_base::sync_with_stdio(false); 6 | long t; std::cin >> t; 7 | while(t--){ 8 | std::string s; std::cin >> s; 9 | long z(0), e(0); 10 | for(long p = 0; p < s.size(); p++){if(s[p] == '0'){++z;} else{++e;}} 11 | puts((z == 1 || e == 1) ? "Yes" : "No"); 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /LOOP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, m; scanf("%ld %ld %ld", &a, &b, &m); 8 | long dist = (a < b) ? (b - a) : (a - b); 9 | dist = (2 * dist < m) ? dist : (m - dist); 10 | printf("%ld\n", dist); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /LOSTWKND.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | const long H = 24; 6 | const long D = 5; 7 | 8 | long t; scanf("%ld", &t); 9 | while(t--){ 10 | long s(0); 11 | for(long p = 0; p < D; p++){long x; scanf("%ld", &x); s += x;} 12 | long mult(0); scanf("%ld", &mult); s *= mult; 13 | puts(s > D * H ? "Yes" : "No"); 14 | } 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /LTIME.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | puts((1 <= x && x <= 4) ? "YES" : "NO"); 9 | 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /LUCKFOUR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int T; scanf("%d\n", &T); 6 | while(T--){ 7 | long x; scanf("%ld\n", &x); 8 | int count(0); 9 | while(x > 0){count += (x % 10 == 4); x /= 10;} 10 | printf("%d\n", count); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /LUCKY5.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | std::ios_base::sync_with_stdio(false); 6 | int t; std::cin >> t; 7 | while(t--){ 8 | std::string s; std::cin >> s; 9 | int count(0); 10 | for(size_t p = 0; p < s.size(); p++){count += ((s[p] != '4') && (s[p] != '7'));} 11 | std::cout << count << std::endl; 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /LUCKYFR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long res(0); 9 | while(n){res += (n % 10 == 4); n /= 10;} 10 | printf("%ld\n", res); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /LUCKYNUM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 8 | puts( ((a == 7) || (b == 7) || (c == 7)) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /M1ENROL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", (y > x) ? (y - x) : 0); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MAGC.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long a, b; scanf("%ld %ld", &a, &b); 6 | if(a != 1 && b != 1){puts("1");} 7 | else if(a != 2 && b != 2){puts("2");} 8 | else if(a != 3 && b != 3){puts("3");} 9 | else{puts("Error");} 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /MAGICHF.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x, s; scanf("%ld %ld %ld", &n, &x, &s); 8 | while(s--){ 9 | long a, b; scanf("%ld %ld", &a, &b); 10 | if(x == a){x = b;} 11 | else if(x == b){x = a;} 12 | } 13 | printf("%ld\n", x); 14 | } 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /MAKEAP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, c; scanf("%ld %ld", &a, &c); 8 | if( (a + c) % 2){puts("-1");} 9 | else{printf("%ld\n", (a + c) / 2);} 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /MAKEDIV3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | for(long p = 1; p < n; p++){printf("9");}; puts("3"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MAKEMONEY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x, c; scanf("%ld %ld %ld", &n, &x, &c); 8 | long res(0); 9 | for(long p = 0; p < n; p++){ 10 | long a; scanf("%ld", &a); 11 | res += (a + c < x) ? (x - c) : a; 12 | } 13 | 14 | printf("%ld\n", res); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /MAKEMULTIPLE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b; scanf("%ld %ld", &a, &b); 8 | puts((a == b || (2 * a <= b)) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MANGOES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | printf("%ld\n", (z - y) / x); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MANIPULATE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | puts(x >= y ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MANYSUMS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | ll a,b ; scanf("%lld %lld", &a, &b); 9 | printf("%lld\n", 2 * (b - a) + 1); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /MARARUN.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long D, d, a, b, c; scanf("%ld %ld %ld %ld %ld", &D, &d, &a, &b, &c); 8 | d *= D; 9 | if(d < 10){puts("0");} 10 | else if(d < 21){printf("%ld\n", a);} 11 | else if(d < 42){printf("%ld\n", b);} 12 | else{printf("%ld\n", c);} 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /MARKSTW.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long x, y; scanf("%ld %ld", &x, &y); 6 | puts(x >= 2 * y ? "YES" :"NO"); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /MASKPOL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, a; scanf("%ld %ld", &n, &a); 8 | printf("%ld\n", 2 * a < n ? a : (n - a)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MATCHES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long m[] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6}; 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | long a, b; scanf("%ld %ld", &a, &b); 9 | long s(a + b), res(0); 10 | while(s){res += m[s % 10]; s /= 10;} 11 | printf("%ld\n", res); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /MAX2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long n; std::string s; 6 | std::cin >> n >> s; 7 | int res(0); 8 | for(long p = s.size() - 1; p >= 0; p--){ 9 | if(s[p] == '0'){++res;} 10 | else{break;} 11 | } 12 | 13 | printf("%d\n", res); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /MAXIMUMSUBS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | printf("%ld\n", 2 * x); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MAXREM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | 6 | long n; scanf("%ld", &n); 7 | std::set s; for(long p = 0; p < n; p++){long x; scanf("%ld", &x); s.insert(x);} 8 | if(s.size() <= 1){puts("0");} 9 | else{printf("%ld\n", *(++s.rbegin()));} 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /MAXTASTE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c, d; scanf("%ld %ld %ld %ld", &a, &b, &c, &d); 8 | printf("%ld\n", (a > b ? a : b) + (c > d ? c : d)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MAX_DIFF.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, s; scanf("%ld %ld", &n, &s); 8 | printf("%ld\n", s < n ? s : (2 * n - s)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MAYOR_PARTY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 8 | printf("%ld\n", (a + c) > b ? (a + c) : b); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MGCSET.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, m; scanf("%ld %ld", &n, &m); 8 | long cnt(0); while(n--){long a; scanf("%ld", &a); cnt += (a % m == 0);} 9 | long long total = (1 << cnt) - 1; 10 | printf("%lld\n", total); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /MILEAGE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x, y, a, b; scanf("%ld %ld %ld %ld %ld", &n, &x, &y, &a, &b); 8 | long diff = x * b - y * a; 9 | if(diff < 0){puts("PETROL");} 10 | else if(diff > 0){puts("DIESEL");} 11 | else{puts("ANY");} 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /MINCARS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("%ld\n", (n + 3) / 4); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MINCOINS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | if(x % 5){puts("-1");} 9 | else{printf("%ld\n", (x / 10) + (x % 10 > 0));} 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /MINCOINSREQ.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | printf("%ld\n", x % 10); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MINDAYSRET.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | printf("%ld\n", (n + k - 1) / k); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MINHEIGHT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, h; scanf("%ld %ld", &x, &h); 8 | puts(x >= h ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MINNOO.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("%ld\n", n / 2); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MINPERM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | for(long p = 1; p <= n - 3 * (n % 2); p += 2){printf("%ld %ld ", p + 1, p);} 9 | if(n % 2){printf("%ld %ld %ld", n - 1, n, n - 2);} 10 | puts(""); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /MINPIZZA.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x; scanf("%ld %ld", &n, &x); 8 | printf("%ld\n", (n * x + 3) / 4); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MINPIZZAS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long gcd(long a, long b){return (a == 0) ? b : gcd(b % a, a);} 4 | 5 | int main(){ 6 | 7 | long t; scanf("%ld", &t); 8 | while(t--){ 9 | long n, k; scanf("%ld %ld", &n, &k); 10 | printf("%ld\n", n / gcd(n, k)); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /MISSP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | long n; scanf("%ld\n", &n); 8 | long a(0); 9 | while(n--){long x; scanf("%ld\n", &x); a ^= x;} 10 | printf("%ld\n", a); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /MIXTURE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b; scanf("%ld %ld", &a, &b); 8 | if(a == 0){puts("Liquid");} 9 | else if(b == 0){puts("Solid");} 10 | else{puts("Solution");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /MODULO3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b; scanf("%ld %ld", &a, &b); 8 | if(a % 3 == 0 || b % 3 == 0){puts("0");} 9 | else if(a % 3 == b % 3){puts("1");} 10 | else{puts("2");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /MONOPOLY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | puts((x > y + z || y > x + z || z > x + y) ? "Yes" : "No"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /MOVIE2X.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long x, y; scanf("%ld %ld", &x, &y); 6 | printf("%ld\n", x - y / 2); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /MUFFINS3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(int argc, char *argv[]){ 5 | size_t N,temp; 6 | scanf("%zd",&N); 7 | for(size_t k = 0; k < N ; k++){ 8 | scanf("%zd",&temp); 9 | printf("%zd\n",1 + temp/2); 10 | } 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /MXCH.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | for(long p = n - k; p <= n; p++){printf("%ld ", p);} 9 | for(long p = 1; p < n - k; p++){printf("%ld ", p);} 10 | puts(""); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /MXEVNSUB.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long diff = (n % 4 == 1) || (n % 4 == 2); 9 | printf("%ld\n", n - diff); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /MXMTRIO.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(){ 6 | 7 | long t; scanf("%ld", &t); 8 | while(t--){ 9 | long n; scanf("%ld", &n); 10 | std::vector a(n); for(long p = 0; p < n; p++){scanf("%ld", &a[p]);} 11 | sort(a.begin(), a.end()); 12 | printf("%ld\n", (a[n - 1] - a[0]) * a[n - 2]); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /MXZERO.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long ones(0), m(n); 9 | while(m--){int u; scanf("%d", &u); ones += (u == 1);} 10 | printf("%ld\n", (ones % 2) ? ones : (n - ones)); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /MY1STCONTEST.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long n, a, b; scanf("%ld %ld %ld", &n, &a, &b); 6 | printf("%ld %ld\n", n - a, n - a - b); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /MYSERVE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long p, q; scanf("%ld %ld", &p, &q); 8 | puts( ( (p + q) % 4 < 2) ? "Alice" : "Bob"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /N1VALUES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | int n; scanf("%d", &n); 9 | printf("1 "); 10 | ll x(1); for(long p = 0; p < n; p++){printf("%lld ", x); x *= 2;} 11 | puts(""); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /NDIFFPAL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | std::ios_base::sync_with_stdio(false); 6 | int t; scanf("%d\n", &t); 7 | while(t--){ 8 | long n; std::cin >> n; 9 | std::string s(""); 10 | std::string r("abc"); 11 | for(long p = 0; p < n; p++){s += r[p % 3];} 12 | std::cout << s << std::endl; 13 | } 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /NEARESTCOURT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", (x < y) ? ((y - x + 1) / 2) : ((x - y + 1) / 2)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /NEARESTEXIT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | puts(x <= 50 ? "LEFT" : "RIGHT"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /NEWPIECE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, p, q; scanf("%ld %ld %ld %ld", &a, &b, &p, &q); 8 | if(a == p && b == q){puts("0");} 9 | else if(((a + b) % 2) != ((p + q) % 2)){puts("1");} 10 | else{puts("2");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /NFS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long u, v, a, s; scanf("%ld %ld %ld %ld", &u, &v, &a, &s); 8 | puts( (2 * a * s >= u * u - v * v) ? "Yes" : "No"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /NIBBLE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | puts((n % 4) ? "Not Good" : "Good"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /NOTEBOOK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("%ld\n", 10 * n); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /NOTIME.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long n, h, x; scanf("%ld %ld %ld", &n, &h, &x); 6 | bool ans(false); 7 | for(long p = 0; p < n; p++){ 8 | long t; scanf("%ld", &t); 9 | if(t + x >= h){ans = true;} 10 | } 11 | 12 | puts(ans ? "YES" : "NO"); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /NUKES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(){ 5 | size_t A,N,K; 6 | scanf("%zd %zd %zd", &A, &N, &K); 7 | 8 | for(size_t comp = 0 ; comp < K ; comp++){ 9 | printf("%zd ",A%(N+1)); 10 | A /= (N+1); 11 | } 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /NUMGAME.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | //By induction: Odd numbers are losing numbers, even numbers are winning; 4 | int main(){ 5 | size_t T; scanf("%zd",&T); 6 | size_t N; 7 | for(size_t k = 0; k < T ; k++){ 8 | scanf("%zd",&N); 9 | if(N&1){printf("BOB\n");} 10 | else{printf("ALICE\n");} 11 | } 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /NUMGAME2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(){ 5 | int t; scanf("%d",&t); 6 | int temp; 7 | while(t--){ 8 | scanf("%d",&temp); 9 | if(temp % 4 == 1){printf("ALICE\n");} 10 | else{printf("BOB\n");} 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /ODDPAIRS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("%ld\n", (n + n % 2) * (n / 2)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /ODDSEVENS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | int x, y; scanf("%d %d", &x, &y); 8 | puts((x + y) % 2 ? "Alice" : "Bob"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /ODDSUM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | ll n; scanf("%lld", &n); 9 | printf("%lld\n", n * n - 3 * n + 3); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /ODDSUMPAIR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 8 | long s = (a % 2) + (b % 2) + (c % 2); 9 | puts((0 < s && s < 3) ? "YES" : "NO"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /OFFICE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", 4 * x + y); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /OJUMPS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long long a; scanf("%lld\n", &a); 6 | puts(((a % 6 == 0) || (a % 6 == 1) || (a % 6 == 3)) ? "yes" : "no"); 7 | 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /OLYRANK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long ga, sa, ba, gb, sb, bb; scanf("%ld %ld %ld %ld %ld %ld", &ga, &sa, &ba, &gb, &sb, &bb); 8 | ga += sa + ba; gb += sb + bb; 9 | puts(ga > gb ? "1" : "2"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /OMWG.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | long m, n; scanf("%ld %ld\n", &m, &n); 8 | printf("%ld\n", 2 * m * n - m - n); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /ON_OFF.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | long n; std::cin >> n; 8 | std::string s, r; std::cin >> s >> r; 9 | long cnt(0); 10 | for(long p = 0; p < n; p++){cnt += (r[p] != s[p]);} 11 | std::cout << (1 - cnt % 2) << std::endl; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /P1Z2S.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long n; scanf("%ld\n", &n); 6 | long long count(0); 7 | for(long p = 0; p < n; p++){long a; scanf("%ld", &a); count += a;} 8 | printf("%lld\n", (n > (count + 1)/ 2) ? n : (count + 1) / 2); 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /PAJAPONG.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, k; scanf("%ld %ld %ld", &x, &y, &k); 8 | long z = (x + y) % (2 * k); 9 | puts(z < k ? "Chef" : "Paja"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /PALL01.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; std::cin >> t; 6 | while(t--){ 7 | std::string s; std::cin >> s; 8 | bool pal(true); 9 | for(int p = 0; p < s.size() / 2; p++){ 10 | if(s[p] != s[s.size() - 1 - p]){pal = 0; break;} 11 | } 12 | std::cout << (pal ? "wins" : "losses") << std::endl; 13 | } 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /PAR2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | puts(n % 2 ? "No" : "Yes"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /PARTY2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x, k; scanf("%ld %ld %ld", &n, &x, &k); 8 | puts((n * x <= k) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /PASSORFAIL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x, p; scanf("%ld %ld %ld", &n, &x, &p); 8 | puts(4 * x >= n + p ? "PASS" : "FAIL"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /PASSTHEEXAM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 8 | puts((a >= 10 && b >= 10 && c >= 10 && a + b + c >= 100) ? "PASS" : "FAIL"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /PATHPAR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | puts((n % 2 == 0 || k == 1) ? "Yes" : "No"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /PCJ18A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x; scanf("%ld %ld", &n, &x); 8 | bool res(false); 9 | while(n--){long a; scanf("%ld", &a); if(a >= x){res = true;}} 10 | puts(res ? "YES" : "NO"); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /PCJ18B.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld",&n); 8 | long long sum(0); 9 | for(long p = n; p >= 0; p -= 2){sum+=p*p;} 10 | printf("%lld\n", sum); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /PENALTY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a(0), b(0); 8 | for(long p = 0; p < 10; p++){ 9 | long x; scanf("%ld", &x); 10 | (p % 2) ? (b += x) : (a += x); 11 | } 12 | 13 | if(a == b){puts("0");} 14 | else{printf("%d\n", 1 + (b > a));} 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /PERFECTTRIO.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 8 | puts((a + b == c || a + c == b || b + c == a) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /PINS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("1 1"); 9 | for(long p = 0; p < n / 2; p++){printf("0");} 10 | puts(""); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /PIZZA_BURGER.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | if(x < y && x < z){puts("NOTHING");} 9 | else if(y <= x){puts("PIZZA");} 10 | else if(z <= x){puts("BURGER");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /PODIUM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b; scanf("%ld %ld", &a, &b); 8 | printf("%ld\n", a + b); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /POLTHIEF.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", (x < y) ? (y - x) : (x - y)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /POLYBAGS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("%ld\n", (n + 9) / 10); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /POOK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | long t; scanf("%ld", &t); 5 | while(t--){ 6 | long n; scanf("%ld", &n); 7 | printf("%ld\n", n - (n == 2 || n == 3)); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /POPCORN.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a1, a2, b1, b2, c1, c2; scanf("%ld %ld %ld %ld %ld %ld", &a1, &a2, &b1, &b2, &c1, &c2); 8 | long t1(a1 + a2), t2(b1 + b2), t3(c1 + c2); 9 | long t = (t1 > t2) ? t1 : t2; t = (t > t3) ? t : t3; 10 | printf("%ld\n", t); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /POPULATION.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | printf("%ld\n", x - y + z); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /PPSUM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d", &t); 6 | while(t--){ 7 | long d, n; scanf("%ld %ld", &d, &n); 8 | long s(n); 9 | while(d--){s = s * (s + 1) / 2;} 10 | printf("%ld\n", s); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /PRACLIST.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long x, y; scanf("%ld %ld", &x, &y); 6 | printf("%ld\n", x - y); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /PRACTICEPERF.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long p1, p2, p3, p4; scanf("%ld %ld %ld %ld", &p1, &p2, &p3, &p4); 6 | printf("%d\n", (p1 >= 10) + (p2 >= 10) + (p3 >= 10) + (p4 >= 10)); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /PRB01.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | bool isPrime(long x){ 4 | for(long p = 2; p * p <= x; p++){if(x % p == 0){return false;}} 5 | return true; 6 | } 7 | 8 | 9 | int main(){ 10 | 11 | int T; scanf("%d\n", &T); 12 | while(T--){ 13 | long n; scanf("%ld\n", &n); 14 | puts(isPrime(n) ? "yes" : "no"); 15 | } 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /PREDICT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | const long M = 10000; 6 | long t; scanf("%ld\n", &t); 7 | while(t--){ 8 | double p; scanf("%lf\n", &p); 9 | if(p < 0.5){p = 1 - p;} 10 | printf("%.7lf\n", p * (3 - 2 * p) * M); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /PRESENTS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("%ld\n", 4 * (n / 5) + (n % 5)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /PRGIFT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | long count(0); bool odd(0); 9 | while(n--){long a; scanf("%ld", &a); count += (a % 2 == 0); odd |= (a % 2);} 10 | puts((k == 0 && odd) || (k > 0 && count >= k) ? "YES" : "NO"); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /PRICECON.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | long ans(0); 9 | for(long p = 0; p < n; p++){ 10 | long x; scanf("%ld", &x); 11 | ans += (x > k ? (x - k) : 0); 12 | } 13 | printf("%ld\n", ans); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /PRIMEDICE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b; scanf("%ld %ld", &a, &b); 8 | long s(a + b); 9 | puts((s == 2 || s == 3 || s == 5 || s == 7 || s == 11) ? "Alice " : "Bob"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /PRIZEPOOL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", 10 * x + 90 * y); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /PROB.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | double t1, t2, t3, t4; scanf("%lf %lf %lf %lf\n", &t1, &t2, &t3, &t4); 8 | printf("%.7lf\n", t1 / (t1 + t2)); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /PROBCAT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | if(x < 100){puts("Easy");} 9 | else if(x < 200){puts("Medium");} 10 | else{puts("Hard");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /PRODUCT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long gcd(long a, long b){return (a == 0) ? b : gcd(b % a, a);} 4 | 5 | int main(){ 6 | 7 | long t; scanf("%ld", &t); 8 | while(t--){ 9 | long b, c; scanf("%ld %ld", &b, &c); 10 | printf("%ld\n", c / gcd(b, c)); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /PSGRADE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long amin, bmin, cmin, smin, a, b, c; scanf("%ld %ld %ld %ld %ld %ld %ld", &amin, &bmin, &cmin, &smin, &a, &b, &c); 8 | bool res = (a >= amin) && (b >= bmin) && (c >= cmin) && (a + b + c >= smin); 9 | puts(res ? "YES" : "NO"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /PUPPYGM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | long a, b; scanf("%ld %ld\n", &a, &b); 8 | puts( ((a % 2 == 0) || (b % 2 == 0)) ? "Tuzik" : "Vanka"); //Proof by induction 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /QUADROOT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | 6 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 7 | double d = sqrt(b * b - 4 * a * c); 8 | printf("%.7lf\n%.7lf\n", (-b + d) / (2 * a), (-b - d) / (2 * a)); 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /QUALIFY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, a, b; scanf("%ld %ld %ld", &x, &a, &b); 8 | puts(a + 2 * b >= x ? "Qualify" : "NotQualify"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /QUEENATTACK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x, y; scanf("%ld %ld %ld", &n, &x, &y); 8 | long u = (x - y); if(u < 0){u = -u;} 9 | long v = (x + y); if(v > n + 1){v = 2 * (n + 1) - v;} 10 | long res = 2 * n + (n - u) + (v - 1) - 4; 11 | printf("%ld\n", res); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /RAINFALL1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | if(x < 3){puts("LIGHT");} 9 | else if(x < 7){puts("MODERATE");} 10 | else{puts("HEAVY");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /RANKLIST.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | long long n, s; scanf("%lld %lld\n", &n, &s); 8 | long long S = n * (n + 1) / 2; 9 | long long diff = S - s; 10 | 11 | long count(0); 12 | while(diff > 0){++count; diff -= count;} 13 | printf("%ld\n", count); 14 | } 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /RANKLISTPAGE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | printf("%ld\n", (x + 24) / 25); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /RATING.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long s; scanf("%ld", &s); 8 | printf("%ld\n", -s - 1); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /RCBPLAY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | puts(x + 2 * z >= y ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /RD19.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long gcd(long a, long b){return (b == 0) ? a : gcd(b, a % b);} 4 | 5 | int main(){ 6 | 7 | long t; scanf("%ld", &t); 8 | while(t--){ 9 | long n; scanf("%ld", &n); 10 | long g(0); 11 | while(n--){long x; scanf("%ld", &x); g = gcd(g, x);} 12 | puts((g == 1) ? "0" : "-1"); 13 | } 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /REACHFAST.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, k; scanf("%ld %ld %ld", &x, &y, &k); 8 | long d = x - y; if(d < 0){d = -d;} 9 | printf("%ld\n", (d + k - 1) / k); 10 | } 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /REACHTARGET.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", x - y); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Solutions to CodeChef problems. The problem statements can be found at www.codechef.com 2 | -------------------------------------------------------------------------------- /REALBIN.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | ll a, b; scanf("%lld %lld", &a, &b); 9 | puts(!(b&(b-1)) ? "Yes" : "No"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /RECENTCONT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | long n; std::cin >> n; 8 | long a(0), b(0); 9 | for(long p = 0; p < n; p++){ 10 | std::string s; std::cin >> s; 11 | (s[0] == 'S') ? (++a) : (++b); 12 | } 13 | 14 | std::cout << a << " " << b << std::endl; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /RECTSQ.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long gcd (long a, long b){return (b == 0) ? a : gcd (b, a%b);} 4 | 5 | int main(){ 6 | 7 | int t; scanf("%d\n", &t); 8 | while(t--){ 9 | long m, n; scanf("%ld %ld\n", &n, &m); 10 | printf("%ld\n", m * n / (gcd(m, n) * gcd(m, n))); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /REDONE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | const ll MOD = 1000000007; 7 | const ll N = 1000007; 8 | ll f[N] = {0}; f[1] = 1; 9 | for(ll p = 2; p < N; p++){f[p] = ((f[p - 1] + 1) * (p + 1) - 1) % MOD;} 10 | 11 | ll t; scanf("%lld", &t); 12 | while(t--){ 13 | ll n; scanf("%lld", &n); 14 | printf("%lld\n", f[n]); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /RELATIVE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long g, c; scanf("%ld %ld", &g, &c); 8 | printf("%ld\n", (c * c) / (2 * g)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /REMISS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d", &t); 6 | while(t--){ 7 | long A, B; scanf("%ld %ld\n", &A, &B); 8 | printf("%ld %ld\n", ((A > B) ? A : B), A + B); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /REPEAT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k, s; scanf("%ld %ld %ld", &n, &k, &s); 8 | s -= n * n; s /= (k - 1); 9 | printf("%ld\n", s); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /RETPO.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld\n", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld\n", &x, &y); 8 | if(x < 0){x = -x;} 9 | if(y < 0){y = -y;} 10 | long res = 2 * ((x > y) ? x : y); 11 | res += ((x > y) ? 1 : (-1)) * ((x + y) % 2); 12 | printf("%ld\n", res); 13 | } 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /RRCOPY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | 6 | int t; scanf("%d\n", &t); 7 | while(t--){ 8 | long n; scanf("%ld\n", &n); 9 | std::set s; 10 | while(n--){long a; scanf("%ld", &a); s.insert(a);} 11 | printf("%ld\n", s.size()); 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /RRJOKE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long res(0); 9 | for(long p = 1; p <= n; p++){ 10 | long x, y; scanf("%ld %ld", &x, &y); 11 | res ^= p; 12 | } 13 | 14 | printf("%ld\n", res); 15 | } 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /RRPLAYER.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d", &t); 6 | while(t--){ 7 | int n; scanf("%d",&n); 8 | double total(1.0); 9 | for(int p = 1; p < n; p++){total += 1.0 / (p + 1);} 10 | total *= n; 11 | printf("%.2lf\n", total); 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /RRSUM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | ll n, m; scanf("%lld %lld", &n, &m); 7 | while(m--){ 8 | ll q; scanf("%lld", &q); 9 | if(q <= n + 1 || q > 3 * n){puts("0");} 10 | else if(q <= 2 * n + 1){printf("%lld\n", q - n - 1);} 11 | else if(q <= 3 * n){printf("%lld\n", 3 * n + 1 - q);} 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /S01E01.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | puts(n >= 21 ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SALE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 8 | long res(0); 9 | if(a <= b && a <= c){res = b + c;} 10 | else if(b <= a && b <= c){res = a + c;} 11 | else if(c <= a && c <= b){res = a + b;} 12 | printf("%ld\n", res); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /SALESEASON.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | if(x <= 100){} 9 | else if(x <= 1000){x -= 25;} 10 | else if(x <= 5000){x -= 100;} 11 | else{x -= 500;} 12 | printf("%ld\n", x); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /SAVWATER.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long h, x, y, c; scanf("%ld %ld %ld %ld", &h, &x, &y, &c); 8 | puts( h * (x + y / 2) <= c ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SCALENE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 8 | puts((a == b || b == c || a == c) ? "NO" : "YES"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SEDARR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | long s(0); 9 | for(long p = 0; p < n; p++){long x; scanf("%ld", &x); s += x;} 10 | s %= k; 11 | printf("%d\n", s > 0); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /SELFDEF.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long cnt(0); 9 | for(long p = 0; p < n; p++){ 10 | long x; scanf("%ld", &x); 11 | cnt += (x >= 10 && x <= 60); 12 | } 13 | printf("%ld\n", cnt); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /SEMCOURSES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long long x, y, z; scanf("%lld %lld %lld", &x, &y, &z); 8 | printf("%lld\n", x * y * z); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SHOEFIT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | int a, b, c; scanf("%d %d %d", &a, &b, &c); 8 | printf("%d\n", 1 - (a == b && b == c)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SHOPCHANGE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | printf("%ld\n", 100 - x); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SIGNMOVE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("%ld\n", ((n + 1) / 2) * (n % 2 ? -1 : 1)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SIMPLEPRO.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | ll t; scanf("%lld", &t); 7 | while(t--){ll n; scanf("%lld", &n); printf("%lld\n", n);} 8 | 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /SINS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long gcd(long a, long b){return (b == 0) ? a : gcd(b, a % b);} 4 | 5 | int main(){ 6 | 7 | long t; scanf("%ld", &t); 8 | while(t--){ 9 | long x, y; scanf("%ld %ld", &x, &y); 10 | printf("%ld\n", 2 * gcd(x, y)); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /SIXFRIENDS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", (3 * x) <= (2 * y) ? (3 * x) : (2 * y)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SKYSCR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long long n, m; scanf("%lld %lld", &n, &m); 8 | printf("%lld\n", (n > m) ? (n - m) : (m - n)); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /SLEEP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | puts(x < 7 ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SLOOP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long m, s; scanf("%ld %ld", &m, &s); 8 | printf("%ld\n", m / s); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SLOWSOLN.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | 8 | long long mt, mn, sn; scanf("%lld %lld %lld", &mt, &mn, &sn); 9 | long long res(0); 10 | if(mt * mn <= sn){res = mt * mn * mn;} 11 | else{res = (sn / mn) * mn * mn + (sn % mn) * (sn % mn);} 12 | printf("%lld\n", res); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /SMOL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | printf("%ld\n", k ? n % k : n); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SNCKYEAR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long y; scanf("%ld", &y); 8 | bool res = (y == 2010 || y == 2015 || y == 2016 || y == 2017 || y == 2019); 9 | puts(res ? "HOSTED" : "NOT HOSTED"); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /SNIPE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main(){ 6 | 7 | int T; scanf("%d\n", &T); 8 | 9 | while(T--){ 10 | double b, ls; scanf("%lf %lf\n", &b, &ls); 11 | printf("%.4lf %.4lf\n", sqrt(ls * ls - b * b), sqrt(ls * ls + b * b)); 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /SOCKS1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 6 | bool ans = (a == b) || (a == c) || (b == c); 7 | puts(ans ? "YES" : "NO"); 8 | } 9 | -------------------------------------------------------------------------------- /SOD3.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | ll l, r; scanf("%lld %lld", &l, &r); 9 | printf("%lld\n", (r / 3) - ((l - 1) / 3)); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /SOLBLTY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, a, b; scanf("%ld %ld %ld", &x, &a, &b); 8 | printf("%ld\n", 10 * (a + (100 - x) * b)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SONGS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x; scanf("%ld %ld", &n, &x); 8 | printf("%ld\n", n / (3 * x)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SPCANDY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | long long n, k; scanf("%lld %lld\n", &n, &k); 8 | printf("%lld %lld\n", n / k, n % k); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /SPECIALITY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | if(x > y && x > z){puts("Setter");} 9 | else if(y > x && y > z){puts("Tester");} 10 | else if(z > x && z > y){puts("Editorialist");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /SPEEDTEST.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, x, b, y; scanf("%ld %ld %ld %ld", &a, &x, &b, &y); 8 | long res = a * y - b * x; 9 | if(res > 0){puts("Alice");} 10 | else if(res < 0){puts("Bob");} 11 | else{puts("Equal");} 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /SPLST.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c, x, y; scanf("%ld %ld %ld %ld %ld", &a, &b, &c, &x, &y); 8 | long z = (x < y) ? x : y; 9 | bool res = (a + b + c == x + y) && (z >= a || z >= b || z >= c); 10 | puts(res ? "YES" : "NO"); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /SQUATS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | printf("%ld\n", 15 * x); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SRTARR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | long n; std::cin >> n; 8 | std::string s; std::cin >> s; 9 | long cnt(0); 10 | for(long p = 1; p < n; p++){cnt += (s[p - 1] == '1' && s[p] == '0');} 11 | std::cout << cnt << std::endl; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /SST.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b; scanf("%ld %ld", &a, &b); 8 | if(2 * a > b){puts("FIRST");} 9 | else if(2 * a < b){puts("SECOND");} 10 | else{puts("ANY");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /START01.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long long x; 6 | scanf("%lld\n", &x); 7 | printf("%lld\n", x); 8 | 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /STICKBREAK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | printf("%d\n", (n % k > 0)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /STRLBP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | std::string s; std::cin >> s; 8 | long cnt(0); 9 | for(long p = 1; p < s.size(); p++){cnt += (s[p - 1] != s[p]);} 10 | std::cout << (cnt <= 2 ? "uniform" : "non-uniform") << std::endl; 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /SUBSCRIBE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | puts(x > 30 ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SUBSCRIBE_.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, x; scanf("%ld %ld", &n, &x); 8 | printf("%ld\n", x * ((n + 5) / 6)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SUGARCANE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("%ld\n", 15 * n); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SUMNEQ.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long n; scanf("%ld", &n); 6 | printf("%ld\n", n - 1); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /SUMPOS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | puts((x + y == z || x + z == y || y + z == x) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SUNDAY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long cnt(8); 8 | long n; scanf("%ld", &n); 9 | for(long p = 0; p < n; p++){ 10 | long x; scanf("%ld", &x); 11 | cnt += (x % 7 != 6) && (x % 7 != 0); 12 | } 13 | 14 | printf("%ld\n", cnt); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /SUPCHEF.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long m, n, k; scanf("%ld %ld %ld", &m, &n, &k); 8 | puts(k * n < m ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /SVRT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | long div(n / k), mod(k); 9 | if(n % k){++div; mod = n % k;} 10 | printf("%ld %ld\n", div, mod); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /T20MCH.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long r, o, c; scanf("%ld %ld %ld", &r, &o, &c); 6 | puts((c + 36 * (20 - o) > r) ? "YES" : "NO"); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /TALLER.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | puts(x > y ? "A" : "B"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /TASTEDEC.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | long tst = 2 * x - 5 * y; 9 | if(tst > 0){puts("Chocolate");} 10 | else if(tst < 0){puts("Candy");} 11 | else{puts("Either");} 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /TAXES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | printf("%ld\n", (x > 100) ? (x - 10) : x); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /TCKTFINE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, p, q; scanf("%ld %ld %ld", &x, &p, &q); 8 | printf("%ld\n", x * (p - q)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /TEA.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | printf("%ld\n", z * ((x + y - 1) / y)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /TEMPLATE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(){ 5 | 6 | int numCases; scanf("%d\n",&numCases); 7 | 8 | while(numCases--){ 9 | 10 | 11 | 12 | 13 | 14 | printf("%\n",output); 15 | } 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /TESTAVG.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c; scanf("%ld %ld %ld", &a, &b, &c); 8 | puts((a + b >= 70 && b + c >= 70 && c + a >= 70) ? "Pass" : "Fail"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /TFPAPER.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, k; scanf("%ld %ld", &n, &k); 8 | printf("%ld\n", n - k); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /THREDICE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | x += y; 9 | if(x >= 6){puts("0");} 10 | else{printf("%.8lf\n", 1 - x / 6.0);} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /THREEBOX.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c, d; scanf("%ld %ld %ld %ld", &a, &b, &c, &d); 8 | if(d >= a + b + c){puts("1");} 9 | else if(d >= a + b){puts("2");} 10 | else{puts("3");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /THREEQ.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a(0); for(long p = 0; p < 3; p++){long x; scanf("%ld", &x); a += x;} 8 | long b(0); for(long p = 0; p < 3; p++){long x; scanf("%ld", &x); b += x;} 9 | puts(a == b ? "Pass" : "Fail"); 10 | } 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /THREETOPICS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long a, b, c, x; scanf("%ld %ld %ld %ld", &a, &b, &c, &x); 6 | puts((a == x || b == x || c == x) ? "Yes" : "No"); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /TICKETS5.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; std::cin >> t; 6 | while(t--){ 7 | std::string s; std::cin >> s; 8 | bool lucky(s[0] != s[1]); 9 | for(int p = 2; p < s.size(); p++){if(s[p] != s[p % 2]){lucky = 0; break;}} 10 | puts(lucky ? "YES" : "NO"); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /TIMELY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | puts(x >= 30 ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /TODOLIST.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long cnt(0); 9 | for(long p = 0; p < n; p++){ 10 | long d; scanf("%ld", &d); 11 | cnt += (d >= 1000); 12 | } 13 | printf("%ld\n", cnt); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /TRANSFORM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | if(x % 3 == 0){puts("NORMAL");} 9 | else if(x % 3 == 1){puts("HUGE");} 10 | else if(x % 3 == 2){puts("SMALL");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /TRAVELPS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | long n, a, b; std::cin >> n >> a >> b; 8 | std::string s; std::cin >> s; 9 | long cnt(0); 10 | for(long p = 0; p < s.size(); p++){cnt += a * (s[p] == '0') + b * (s[p] == '1');} 11 | std::cout << cnt << std::endl; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /TRICOIN.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | long n; scanf("%ld\n", &n); 8 | long r(0), sum(0); 9 | for(int p = 1; p <= n; p++){ 10 | sum += p; 11 | if(sum > n){break;} 12 | r = p; 13 | } 14 | printf("%ld\n", r); 15 | } 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /TRISQ.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | int t; scanf("%d\n", &t); 6 | while(t--){ 7 | long b; scanf("%ld\n", &b); 8 | long u = (b - 2) / 2; 9 | printf("%ld\n", u * (u + 1) / 2); 10 | 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /TRNSN.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(){ 6 | 7 | long n; scanf("%ld", &n); 8 | std::vector a(n); for(long p = 0; p < n; p++){scanf("%ld", &a[p]);} 9 | sort(a.begin(), a.end()); 10 | long cnt(0); 11 | for(long p = 1; p < n; p++){cnt += (a[p] != a[p - 1]);} 12 | printf("%ld\n", cnt); 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /TRO.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a; scanf("%ld", &a); 8 | puts( ((a >= 60) && ((360 % (180 - a)) == 0)) ? "YES" : "NO"); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /TRUESCORE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c, d; scanf("%ld %ld %ld %ld", &a, &b, &c, &d); 8 | puts((a <= c && b <= d) ? "POSSIBLE" : "IMPOSSIBLE"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /TSORT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(){ 6 | 7 | long t; scanf("%ld\n", &t); 8 | std::vector a(t); 9 | for(long p = 0; p < t; p++){scanf("%ld\n", &a[p]);} 10 | sort(a.begin(), a.end()); 11 | for(long p = 0; p < t; p++){printf("%ld\n", a[p]);}; 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /TUZGMBR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--) { 7 | long n, m; scanf("%ld %ld", &n, &m); 8 | --n; --m; n -= m % 3; 9 | puts(n % 4 ? "Tuzik" : "Vanya"); 10 | } 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /TVDISC.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c, d; scanf("%ld %ld %ld %ld", &a, &b, &c, &d); 8 | if(a - c < b - d){puts("First");} 9 | else if(b - d < a - c){puts("Second");} 10 | else{puts("Any");} 11 | 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /TWODISH.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, a, b, c; scanf("%ld %ld %ld %ld", &n, &a, &b, &c); 8 | puts(((b >= n) && ((a + c) >= n)) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /TWONIM.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | 5 | int t; scanf("%d", &t); 6 | while (t--){ 7 | int n; scanf("%d", &n); 8 | int acc(0); 9 | for(int p = 0; p < n; p++){int x; scanf("%d", &x); acc ^= x;} 10 | puts( ((acc == 0) || (n % 2 == 0)) ? "First" : "Second"); 11 | } 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /TWONMS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | ll a, b, n; scanf("%lld %lld %lld", &a, &b, &n); 9 | if(n & 1){a *= 2;} 10 | ll mx = (a > b) ? a : b; 11 | ll mn = (a < b) ? a : b; 12 | printf("%lld\n", mx / mn); 13 | } 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /TWOROOKS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x1, y1, x2, y2; scanf("%ld %ld %ld %ld", &x1, &y1, &x2, &y2); 8 | puts( (x1 == x2 || y1 == y2) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /TWOVSTEN.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | if(x % 10 == 0){puts("0");} 9 | else if(x % 5 == 0){puts("1");} 10 | else{puts("-1");} 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /TYRE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, m; scanf("%ld %ld", &n, &m); 8 | printf("%ld\n", 2 * n + 4 * m); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /TYRES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | puts(n % 4 > 1 ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /URCALC.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | double a, b; std::string s; std::cin >> a >> b >> s; 6 | if(s[0] == '+'){printf("%.7lf\n", a + b);} 7 | else if(s[0] == '-'){printf("%.7lf\n", a - b);} 8 | else if(s[0] == '*'){printf("%.7lf\n", a * b);} 9 | else if(s[0] == '/'){printf("%.7lf\n", a / b);} 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /UTKPLC.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | std::string a, b, c; std::cin >> a >> b >> c; 8 | std::string x, y; std::cin >> x >> y; 9 | std::cout << (x == a || y == a ? a : b) << std::endl; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /UTMOPR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | 6 | int t; scanf("%d", &t); 7 | while(t--){ 8 | int64_t n, k; scanf("%lld %lld", &n, &k); 9 | int64_t s(0); 10 | for(int64_t p = 0; p < n; p++){long x; scanf("%ld", &x); s += x;} 11 | puts((s % 2 == 0 && k == 1) ? "odd" : "even"); 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /UWCOI20A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long mx(0); 9 | for(long p = 0; p < n; p++){long x; scanf("%ld", &x); mx = (mx > x) ? mx : x;} 10 | printf("%ld\n", mx); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /UWCOI21A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("%ld %ld\n", 1L, n); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /VACCINE1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long d1, v1, d2, v2, target; scanf("%ld %ld %ld %ld %ld", &d1, &v1, &d2, &v2, &target); 6 | 7 | long sum(0), res(1); 8 | for(long p = 1; p <= 10000; p++){ 9 | if(p >= d1){sum += v1;} 10 | if(p >= d2){sum += v2;} 11 | if(sum >= target){res = p; break;} 12 | } 13 | 14 | printf("%ld\n", res); 15 | } 16 | -------------------------------------------------------------------------------- /VALENTINE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", (x / y)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /VALIDMIN.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, z; scanf("%ld %ld %ld", &x, &y, &z); 8 | bool res = (x <= z && y <= z && x == y) || (x <= y && z <= y && x == z) || (y <= x && z <= x && y == z); 9 | puts(res ? "YES" : "NO"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /VDATES.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long d, l, r; scanf("%ld %ld %ld", &d, &l, &r); 8 | if(d < l){puts("Too Early");} 9 | else if(d <= r){puts("Take second dose now");} 10 | else{puts("Too Late");} 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /VOLCONTROL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", (x < y) ? (y - x) : (x - y)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /VOWELTB.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | std::string s; std::cin >> s; 6 | puts((s[0] == 'a' || s[0] == 'A' || s[0] == 'e' || s[0] == 'E' || s[0] == 'i' || s[0] == 'I' || s[0] == 'o' || s[0] == 'O' || s[0] == 'u' || s[0] == 'U') ? "Vowel" : "Consonant"); 7 | 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /WAITTIME.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long k, x; scanf("%ld %ld", &k, &x); 8 | printf("%ld\n", 7 * k - x); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /WALK.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(){ 5 | 6 | int t; scanf("%d\n", &t); 7 | while(t--){ 8 | long n; scanf("%ld\n", &n); 9 | long v(0); 10 | for(long p = 0; p < n; p++){ 11 | long w; scanf("%ld", &w); 12 | v = (v > (w + p)) ? v : (w + p); 13 | } 14 | printf("%ld\n", v); 15 | } 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /WATERCONS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x; scanf("%ld", &x); 8 | puts(x >= 2000 ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /WATERCOOLER1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y, m; scanf("%ld %ld %ld", &x, &y, &m); 8 | puts((m * x < y) ? "YES" : "NO"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /WATERCOOLER2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", (y - 1) / x); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /WATERFLOW.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long w, x, y, z; scanf("%ld %ld %ld %ld", &w, &x, &y, &z); 8 | long res = w + y * z - x; 9 | if(res < 0){puts("unfilled");} 10 | else if(res > 0){puts("overflow");} 11 | else{puts("filled");} 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /WATERREQ.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | printf("%ld\n", 2 * n); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /WATMELON.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long s(0); 9 | for(long p = 0; p < n; p++){long x; scanf("%ld", &x); s += x;} 10 | puts(s >= 0 ? "YES" : "NO"); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /WEIGHTBL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long w1, w2, x1, x2, m; scanf("%ld %ld %ld %ld %ld", &w1, &w2, &x1, &x2, &m); 8 | printf("%d\n", (w1 + m * x1 <= w2) && (w2 <= w1 + m * x2)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /WGHTS.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long w, x, y, z; scanf("%ld %ld %ld %ld", &w, &x, &y, &z); 8 | bool res = (w == x) || (w == y) || (w == z) || (w == x + y) || w == (y + z) || w == (z + x) || w == (x + y + z); 9 | puts(res ? "YES" : "NO"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /WHICHDIV.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | long t; scanf("%ld", &t); 5 | while(t--){ 6 | long r; scanf("%ld", &r); 7 | if(r < 1600){puts("3");} 8 | else if(r < 2000){puts("2");} 9 | else{puts("1");} 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /WINERR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, c, d; scanf("%ld %ld %ld %ld", &a, &b, &c, &d); 8 | a = (a > b) ? a : b; 9 | c = (c > d) ? c : d; 10 | if(a < c){puts("P");} 11 | else if(a > c){puts("Q");} 12 | else{puts("TIE");} 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /WORDLE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | std::string a, b; std::cin >> a >> b; 8 | for(long p = 0; p < a.size(); p++){std::cout << (a[p] == b[p] ? "G" : "B");} 9 | std::cout << std::endl; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /WTRMIXING.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long a, b, x, y; scanf("%ld %ld %ld %ld", &a, &b, &x, &y); 8 | bool res = (b <= a && y >= a - b) || (a <= b && x >= b - a); 9 | puts(res ? "YES" : "NO"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /XJUMP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long x, y; scanf("%ld %ld", &x, &y); 8 | printf("%ld\n", (x / y) + (x % y)); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /XLSQUARE.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n, a; scanf("%ld %ld", &n, &a); 8 | long mult(1); for(long p = 1; p * p <= n; p++){mult = p;} 9 | printf("%ld\n", mult * a); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /XORAGN.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; scanf("%ld", &t); 6 | while(t--){ 7 | long n; scanf("%ld", &n); 8 | long res(0); 9 | for(long p = 0; p < n; p++){long x; scanf("%ld", &x); res ^= (2 * x);} 10 | printf("%ld\n", res); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /XORNEY.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | typedef long long ll; 3 | 4 | int main(){ 5 | 6 | long t; scanf("%ld", &t); 7 | while(t--){ 8 | ll a, b; scanf("%lld %lld", &a, &b); 9 | a -= (a % 2); b += (b % 2); 10 | ll diff = (b - a) / 2; 11 | puts(diff % 2 ? "Odd" : "Even"); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /XOR_PAL.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long t; std::cin >> t; 6 | while(t--){ 7 | long n; std::cin >> n; 8 | std::string s; std::cin >> s; 9 | long cnt(0); 10 | for(long p = 0; 2 * p < n; p++){cnt += (s[p] != s[n - 1 - p]);} 11 | std::cout << ((cnt + 1) / 2) << std::endl; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /ZCOSCH.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | 5 | long r; scanf("%ld", &r); 6 | if(1 <= r && r <= 50){puts("100");} 7 | else if(51 <= r && r <= 100){puts("50");} 8 | else{puts("0");} 9 | 10 | } 11 | --------------------------------------------------------------------------------