Dataset Viewer
Auto-converted to Parquet Duplicate
problem_id
stringlengths
1
4
problem_name
stringlengths
9
108
solution_id
stringlengths
3
10
time_complexity_inferred
stringclasses
439 values
space_complexity_inferred
stringclasses
262 values
query_code
stringlengths
11
464k
1100
79_A. Bus Game
1100_0
O(n)
O(1)
player_one = 'Ciel' player_two = 'Hanako' c100, c10 = map(int, input().split()) full_moves = min([c100 // 2, c10 // 24]) c100 -= full_moves * 2 c10 -= full_moves * 24 while True: if 100 * c100 + 10 * c10 >= 220 and c10 >= 2: tmp = min([2, c100]) c100 -= tmp c10 -= (220 - 100 * tmp) //...
1100
79_A. Bus Game
1100_1
O(n)
O(1)
import re import itertools from collections import Counter class Task: x, y = 0, 0 answer = "" def getData(self): self.x, self.y = [int(x) for x in input().split(' ')] #inFile = open('input.txt', 'r') #inFile.readline().rstrip() #self.childs = inFile.readline().rstrip() ...
1100
79_A. Bus Game
1100_2
O(nlogn)
O(1)
# bsdk idhar kya dekhne ko aaya hai, khud kr!!! # import math # from itertools import * # import random # import calendar import datetime # import webbrowser hundred_coin, ten_coin = map(int, input().split()) won = 0 for i in range(0, 10000000): if i % 2 == 0: ciel_money = 0 # wrote code for ciel ...
1100
79_A. Bus Game
1100_3
null
null
x, y =map(int, input().split()) p = True dez = [2, 12, 22] cem = [2,1,0] while True: # print(x, y) if p: for i in range(3): if x >= cem[i] and y >= dez[i]: x -= cem[i] y -= dez[i] break else: print("Hanako") exit...
1100
79_A. Bus Game
1100_4
O(n)
O(1)
state = 1 x, y = map(int, input().split()) while True: state = 1-state if state == 0: if x >= 2 and y >= 2: x -= 2 y -= 2 continue elif x >= 1 and y >= 12: x -= 1 y -= 12 continue elif x >= 0 and y >= 22: ...
1100
79_A. Bus Game
1100_5
O(nlogn)
O(1)
x,y=map(int,input().split()) i=0 sum=x*100+y*10 while (sum>=220): if (y<2): break if (i%2==0): if (x>=2): x-=2 if (y>=2): y-=2 else: break else: if (x==1): x-=1 y-=12 ...
1100
79_A. Bus Game
1100_6
O(n)
O(1)
x,y = [int(z) for z in input().split()] n = 1 if x//2>0 and y//24 >0 : n = min(x//2,y//24) x -= 2 * n y -= 24 * n if (n%2 == 0): n += 1 while(True): #print (n,x,y) if n%2 : if y < 2: print('Hanako') break y -= 2 if x < 2: tmp = (200 - x*100)//10 if y < tmp : print('Hanako') break el...
1100
79_A. Bus Game
1100_7
O(nlogn)
O(1)
x,y=map(int,input().split()) cnt=0 while(True): if(cnt%2==0): if(x>=2 and y>=2): x-=2 y-=2 cnt+=1 elif(x>=1 and y>=12): x-=1 y-=12 cnt+=1 elif(y>=22): y-=22 cnt+=1 else: break...
1100
79_A. Bus Game
1100_8
O(nlogn)
O(1)
n = input().split() x = int(n[0]) y = int(n[1]) t = 0 a = [0]*2 a[0] = "Ciel" a[1] = "Hanako" while True: if t % 2==0: if y >=2: if x >= 2: x -=2 y -=2 elif x == 1 and y >= 12: x -=1 y -= 12 elif x ==0 and y...
1100
79_A. Bus Game
1100_9
O(n)
O(1)
import re import itertools from collections import Counter class Task: x, y = 0, 0 answer = "" def getData(self): self.x, self.y = [int(x) for x in input().split(' ')] #inFile = open('input.txt', 'r') #inFile.readline().rstrip() #self.childs = inFile.readline().rstrip() ...
1100
79_A. Bus Game
1100_10
O(n)
O(1)
Piles= {} Piles[100], Piles[10] = [int(x) for x in input().split()] while True: #Ceil's Turn, wins if she gets 220 coins SumOfYens = min(2, Piles[100]) * 100 Piles[100] -= min(2, Piles[100]) if (220 - SumOfYens)/10 <= Piles[10]: Piles[10] -= (220 - SumOfYens)/10 else: print("Hanako"); break #Han...
1100
79_A. Bus Game
1100_11
O(n)
O(1)
def STR(): return list(input()) def INT(): return int(input()) def MAP(): return map(int, input().split()) def MAP2():return map(float,input().split()) def LIST(): return list(map(int, input().split())) def STRING(): return input() import string import sys from heapq import heappop , heappush from bisect import * from...
1100
79_A. Bus Game
1100_12
O(1)
O(1)
def f(a, b): k = min(a, 2) return a - k, b - 22 + 10 * k def g(a, b): if b > 21: return a, b - 22 if b > 11: return a - 1, b - 12 return a - 2, b - 2 def main(): a, b = map(int, input().split()) k = min(a // 2, b // 24) a -= 2 * k b -= 24 * k while a > 0: a, b = f(...
1100
79_A. Bus Game
1100_13
O(n)
O(1)
x, y = map(int, input().split()) CielWon = False while (y > 1 and x * 10 + y > 21): t = min(x, 2) x -= t y -= (2 - t) * 10 + 2 if (y < 2 or 10 * x + y < 22): CielWon = True break y -= 2 t = min(2, y // 10) y -= 10 * t x -= 2 - t print ('Ciel' if CielWon else ...
1100
79_A. Bus Game
1100_14
O(1)
O(1)
def busgame(): x, y = map(int, input().split()) turn = True while True: if y < 2: break y -= 2 if turn: if x >= 2: x -= 2 elif x >= 1 and y >= 10: x -= 1 y -= 10 elif y >= 20: y -= 20 else: break else: if y >= 20: ...
1100
79_A. Bus Game
1100_15
O(n)
O(1)
hundred, ten = [int(x) for x in input().split()] total = 100*hundred + 10*ten #reduce by number of rounds where Ciel can take 2 100-yen and 2 10-yen, and Hanako can take 22 10-yen skipped = min(hundred//2,ten//24) hundred = hundred - 2*skipped ten = ten - 24*skipped while True: win = 0 if hundred >= 2 and ten...
1100
79_A. Bus Game
1100_16
O(1)
O(1)
n , m = map(int,input().split()) c = min(n//2 , m//24) n-=(2*c) m-=(24*c) c = min(n//3 , m//14) n-=(3*c) m-=(14*c) c = min(n//4, m//4) n-=(4*c) m-=(4*c) c = min(n , m//32) n-=(c) m-=(32*c) c=m//44 m-=(44*c) if m>=2 and 10*n +m >=22: print("Ciel") else: print("Hanako")
1100
79_A. Bus Game
1100_17
O(nlogn)
O(1)
x,y=map(int,input().split()) def solve(x,y): valuex=100*x valuey=10*y count=0 while True: if count%2==0: if x>=2 and y>=2: x-=2 valuex-=200 y-=2 valuey-=20 count+=1 elif x==1 and y>=12: ...
1100
79_A. Bus Game
1100_18
null
null
n, m = map(int, input().split()) i = 1 while 2 > 1: if(i & 1): if(n * 100 + m * 10 >= 220): if(n >= 2 and m >= 2): n -= 2 m -= 2 elif(m >= 12 and n >= 1): m -= 12 m -= 1 elif(m >= 22): m -= 22 ...
1100
79_A. Bus Game
1100_19
O(n)
O(1)
a, b = map(int,input().split()) k = "Hanako" z = False while True: if z == True:break if k == 'Ciel': if b >= 22: b -= 22 k = 'Hanako' elif b >= 12 and a >= 1: a-= 1 b-= 12 k = 'Hanako' elif b >= 2 and a >= 2: a -= 2 b -= 2 k = 'Hanako' else:z = True else: if a >= 2 and b > 1: a ...
1100
79_A. Bus Game
1100_20
O(nlogn)
O(1)
n, a = map(int, input().split()) ans = 0 while(1): s =220 op=-1 if a < 2: break if ans%2 == 0: l = min(n, 2) s -= l*100 k = min(a ,s//10) s -= k*10 n -= l a -= k else: k = min((a-2)//10 , 2) s -= k*100 l = min(n, s//100) ...
1100
79_A. Bus Game
1100_21
null
null
inp1, inp2 = [int(i) for i in input().split()] hundred = 100 * inp1 ten = 10 * inp2 lista = ["Ciel", "Hanako"] * 1000000 for i in range(len(lista)): if i % 2 == 0: if (hundred >= 200 and ten >= 20): hundred = hundred - 200 ten = ten - 20 elif (hundred >= 100 and ten >= 120):...
1100
79_A. Bus Game
1100_22
O(n)
O(1)
x, y = list(map(int, input().split())) f = 1 while (True): if f == 1: if x >= 2 and y >= 2: x -= 2; y -= 2 elif x >= 1 and y >= 12: x -= 1; y -= 12 elif y >= 22: y -= 22 else: print("Hanako") break else: if y >= 22: y -= 22 elif y >= 12 and...
1100
79_A. Bus Game
1100_23
O(n)
O(1)
x,y=map(int,input().split()) while(True): if x>=2 and y>=2: x=x-2 y=y-2 elif y>=22: y=y-22 elif x>=1 and y>=12: x=x-1 y=y-12 else: print("Hanako") break if y>=22: y=y-22 elif x>=1 and y>=12: x=x-1 y=y-12 elif x>...
1100
79_A. Bus Game
1100_24
O(n)
O(1)
def busgame(x,y): while 1: if x >= 2 and y >= 2: x -= 2 y -= 2 elif x == 1 and y >= 12: x -= 1 y -= 12 elif x == 0 and y >= 22: y -= 22 else: return 'Hanako' if y >= 22: y -= 22 elif ...
1100
79_A. Bus Game
1100_25
O(n)
O(1)
player_one = 'Ciel' player_two = 'Hanako' c100, c10 = map(int, input().split()) while True: if 100 * c100 + 10 * c10 >= 220 and c10 >= 2: tmp = min([2, c100]) c100 -= tmp c10 -= (220 - 100 * tmp) // 10 else: print(player_two) break if 100 * c100 + 10 * c10 >= 2...
1100
79_A. Bus Game
1100_26
null
null
x,y=map(int,input().split()) t=0 while True: if t%2==0: if x>=2 and y>=2: x-=2;y-=2 elif x==1 and y>=12: x-=1;y-=12 elif x==0 and y>=22: y-=22 else:exit(print('Hanako')) else: if y>=22: y-=22 elif x>=1 and y>=12: ...
1100
79_A. Bus Game
1100_27
O(1)
O(n)
player_one = 'Ciel' player_two = 'Hanako' c100, c10 = map(int, input().split()) full_moves = min([c100 // 2, c10 // 24]) c100 -= full_moves * 2 c10 -= full_moves * 24 if c100 < 2: solved = False if 100 * c100 + 10 * c10 >= 220 and c10 >= 2: c10 -= (220 - 100 * c100) // 10 c100 = 0 els...
1100
79_A. Bus Game
1100_28
O(nlogn)
O(1)
a,b = map(int,input().split()) x=1 while True: if x%2: if a>=0 and b>0: if a>=2: if b>=2: a-=2 b-=2 x+=1 elif b<2: print('Hanako') break eli...
1100
79_A. Bus Game
1100_29
O(n)
O(1)
''' 13.07.2021 CF 071 A ''' s = (input ()).split () x = int (s [0]) y = int (s [1]) go = 0 while x*10 + y >= 22 : if go == 0 : if x >= 2 and y >= 2 : x -= 2; y -= 2 elif x == 1 and y >= 12 : x -= 1; y -= 12 elif x == 0 and y >= 22 : y...
1100
79_A. Bus Game
1100_30
null
null
x,y=map(int,input("").split()) c=0 i=0 while(c==0): if i%2==0: if x>=2: x=x-2 if y>=2: y=y-2 ...
1100
79_A. Bus Game
1100_31
O(n)
O(1)
Piles, Ceil, Hanako= {}, 1, 1 Piles[100], Piles[10] = [int(x) for x in input().split()] while True: #Ceil's Turn, wins if she gets 220 coins SumOfYens = min(2, Piles[100]) * 100 Piles[100] -= min(2, Piles[100]) if (220 - SumOfYens)/10 <= Piles[10]: Piles[10] -= (220 - SumOfYens)/10 else: Ceil = 0 ...
1100
79_A. Bus Game
1100_32
O(nlogn)
O(1)
x,y=list(map(int,input().split())) cnt=0 while True: if cnt%2==0: if x>=2 and y>=2: num_100=2 elif y>=22: num_100=0 elif x>=1 and y>=12: num_100=1 else: break num_10=(220-100*num_100)//10 x-=num_100 y-=num_10 ...
1100
79_A. Bus Game
1100_33
O(1)
O(1)
x, y = map(int, input().split()) c = min(x // 2, y // 24) x -= 2 * c y -= 24 * c c = min(x // 3, y // 14) x -= 3 * c y -= 14 * c c = min(x // 4, y // 4) x -= 4 * c y -= 4 * c c = min(x, y // 34) x -= 1 * c y -= 34 * c c = y // 44 y -= 44 * c if y >= 2 and 10 * x + y >= 22: print('Ciel') else: print('Hanak...
1100
79_A. Bus Game
1100_34
null
null
x, y = map(int, input().split()) ciel = True while True: if ciel: s = 0 while s + 100 <= 220 and x > 0: x -= 1 s += 100 while s + 10 <= 220 and y > 0: y -= 1 s += 10 if s != 220: print('Hanako') quit() ci...
1100
79_A. Bus Game
1100_35
O(n)
O(1)
datos = input().split() monedas_cien = int(datos[0]) monedas_diez = int(datos[1]) rondas_jugadas = min(monedas_cien // 2, monedas_diez // 24) monedas_cien = monedas_cien - (rondas_jugadas*2) monedas_diez = monedas_diez - (rondas_jugadas*24) maneras_sacar_cien = [2,1,0] maneras_sacar_diez = [2,12,22] ganando = 'Hana...
1100
79_A. Bus Game
1100_36
null
null
#Ya Hassan Mojtaba x,y=map(int,input().split()) i=1 while 1: if i%2==1: if x>=2 and y>=2: x-=2 y-=2 elif x==1 and y>=12: x-=1 y-=12 elif y>=22: y-=22 else: print('Hanako') exit() else: if ...
1100
79_A. Bus Game
1100_37
null
null
import sys n,m=map(int, input().split()) while True: if n*10+m<22 or m<2: print("Hanako") sys.exit() if n>=2: n-=2 m-=2 elif n==1: n-=1 m-=12 else: m-=22 if n*10+m<22 or m<2: print("Ciel") sys.exit() if m>=22: m...
1100
79_A. Bus Game
1100_38
O(nlogn)
O(1)
x, y = map(int, input().split()) c=2 while True: if c%2==0: if x>=2 and y>=2: c=c+1 x=x-2 y=y-2 continue elif x>=1 and y>=12: c=c+1 x=x-1 y=y-12 continue elif x>=0 and y>=22: c=c+1 ...
1100
79_A. Bus Game
1100_39
O(nlogn)
O(1)
x, y = map(int, input().split()) moves = 0 move = True if x == 1000 and y == 1000: move = False while move: if moves % 2 == 0: if x >= 2 and y >= 2: moves += 1 x -= 2 y -= 2 elif x == 1 and y >= 12: moves += 1 x -= 1 y -= 12 ...
1100
79_A. Bus Game
1100_40
O(n)
O(1)
def readln(): return tuple(map(int, input().split())) x, y = readln() x *= 100 y *= 10 _ = 0 while x + y >= 220: if _ == 0: if x >= 200: x -= 200 y -= 20 elif x == 100: x -= 100 y -= 120 else: y -= 220 else: if y >= 220...
1100
79_A. Bus Game
1100_41
O(nlogn)
O(1)
x, y = map(int , input().split()) a = 0 while 1: if a%2==0: if x>=2 and y>=2: x = x-2 y = y-2 elif x==1 and y>=12: x = x-1 y = y-12 elif x==0 and y>=22: x = 0 y = y-22 else: break else: i...
1100
79_A. Bus Game
1100_42
O(nlogn)
O(1)
import bisect from itertools import accumulate import os import sys import math from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in f...
1100
79_A. Bus Game
1100_43
null
null
x,y=map(int,input().split()) while True: # Client's turn if(x>=2 and y>=2): x-=2 y-=2 elif(x>=1 and y>=12): x-=1 y-=12 elif(x>=0 and y>=22): y-=22 else: print("Hanako") exit() # Hanako's turn if(x>=0 and y>=22): y-=22 elif(x...
1100
79_A. Bus Game
1100_44
O(n)
O(1)
x, y = map(int, input().split()) turn = 0 res = "" while 1: if turn == 0: if x >= 2 and y >= 2: x-=2 y-=2 elif x == 1 and y >= 12: x-=1 y-=12 elif x == 0 and y >= 22: y-=22 else: res = "Hanako" break else: if y >= 22: y-= 22 elif y >= 12 and x >= 1: x-=1 y-=12 elif y >= 2 a...
1100
79_A. Bus Game
1100_45
O(nlogn)
O(1)
x,y = map(int,input().split()) turns = 0 while True: if turns%2==0: if x>=2 and y>=2: x-=2 y-=2 turns+=1 elif x>=1 and y>=12: x-=1 y-=12 turns+=1 elif y>=22: y-=22 turns+=1 else: ...
1100
79_A. Bus Game
1100_46
null
null
def inp(): return map(int, input().split()) x, y = inp() ceil, hanako = 1, 0 while (True): if ceil: if x >= 2 and y >= 2: x -= 2 y -= 2 elif x == 1 and y >= 12: x -= 1 y -= 12 elif x == 0 and y >= 22: y -= 22 else: ...
1100
79_A. Bus Game
1100_47
O(nlogn)
O(1)
import math import os import random import re import sys t=1 for qq in range(t): x,y=(int(i) for i in input().split()) turn =0 while(True): if turn%2==0 : if x>=2 and y>=2: x-=2 y-=2 elif x>=1 and y>=12: x-=1 y-...
1100
79_A. Bus Game
1100_48
O(n)
O(1)
x, y = map(int, input().split()) while True: # Ciel prefers large coins. #print('available: %d * 10, %d * 1' % (x, y)) a = min(2, x) x -= a b = min(22 - 10 * a, y) y -= b #print('Ciel takes %d * 10, %d * 1' % (a, b)) if 10 * a + b < 22: print('Hanako') break # Hanako...
1100
79_A. Bus Game
1100_49
null
null
x,y=map(int,input().strip().split()) # -2, -2 # -0, -22 # total, -2, -24 a = min(x//2, y//24) x -= a*2 y -= a*24 while x and y: tot = 220 while x > 0 and tot >= 100: x -= 1 tot -= 100 while y > 0 and tot >= 10: y -= 1 tot -= 10 if tot: print("Hanako") exi...
1100
79_A. Bus Game
1100_50
O(1)
O(1)
def f(a, b): k = min(a, 2) return a - k, b - 22 + 10 * k def g(a, b): if b < 2: return -1, -1 b -= 2 k = min(b // 10, 2) return a - 2 + k, b - 10 * k def main(): a, b = map(int, input().split()) k = min(a // 2, b // 24) a -= k * 2 b -= 24 * k while a > 0: a, b ...
1100
79_A. Bus Game
1100_51
O(n)
O(1)
x,y=map(int,input().split()) mauka=0 while 1: if mauka==0: if x>=2 and y>=2: x=x-2 y=y-2 elif x>=1 and y>=12: x=x-1 y=y-12 elif x==0 and y>=22: y=y-22 else: culprit=0 break else: if y...
1100
79_A. Bus Game
1100_52
null
null
x,y=map(int,input().split()) Ceil=True while True: if Ceil: if x>=2: if y>=2: x-=2; y-=2; Ceil=False else: print("Hanako"); exit() elif x==1: if y>=12: x-=1; y-=12; Ceil=False else: print(...
1100
79_A. Bus Game
1100_53
O(nlogn)
O(1)
x, y = [int(x) for x in input().split()] def even_move(x, y): if x >= 2 and y >= 2: return [True, x - 2, y - 2] if x >= 1 and y >= 12: return [True, x - 1, y - 12] if y >= 22: return [True, x, y - 22] return [False, x, y] def odd_move(x, y): if y >= 22: return [True...
1100
79_A. Bus Game
1100_54
O(nlogn)
O(1)
x,y = map(int, input().split()) t=0 while (1): if t%2==0: if x >= 2 and y >= 2: x -= 2 y -= 2 elif x >= 1 and y >= 12: x -= 1 y -= 1 elif (x == 0 and y >= 22): y -= 22 else: print("Hanako") break else: ...
1100
79_A. Bus Game
1100_55
O(1)
O(1)
import math import queue from itertools import permutations def win(x,y): if x==0: k=y//22 if k%2==1: return 1 else: return 2 elif x==1: if y<12: return 2 k=1+(y-12)//22 if k%2==1: return 1 else: ...
1100
79_A. Bus Game
1100_56
null
null
import sys import math x, y = [int(x) for x in (sys.stdin.readline()).split()] while(1): if(x >= 2 and y >= 2): x -= 2 y -= 2 elif(x >= 1 and y >= 12): x -= 1 y -= 1 elif(x == 0 and y >= 22): y -= 22 else: print("Hanako") exit() if...
1100
79_A. Bus Game
1100_57
O(n)
O(1)
x, y = map(int, input().split()) m = 0 while True: if m: if y<2: b = 0 else: b = max(k for k in (2,12,22) if k<=y) a = min(x, (220-10*b)//100) else: a = min(2,x) b = min(y, (220-100*a)//10) if 100*a+10*b < 220: print('Ciel' if m el...
1100
79_A. Bus Game
1100_58
O(n)
O(1)
x,y=map(int,input().split()) t=1 o=1 while o: if t: if x>=2 and y>=2: x-=2 y-=2 elif x>=1 and y>=12: x-=1 y-=12 elif y>=22:y-=22 else:o=0 else: if y>=22:y-=22 elif x>=1 and y>=12: x-=1 y-=12 ...
1100
79_A. Bus Game
1100_59
null
null
import sys import string from collections import Counter, defaultdict from math import fsum, sqrt, gcd, ceil, factorial from operator import add from itertools import accumulate inf = float('inf') # input = sys.stdin.readline flush = lambda : sys.stdout.flush comb = lambda x , y : (factorial(x) // factorial(y)) // fa...
1101
867_A. Between the Offices
1101_0
O(1)
O(1)
print((lambda s: 'YES' if s[1][0] == 'S' and s[1][-1] == 'F' else 'NO')((input(), input().strip())))
1101
867_A. Between the Offices
1101_1
O(n)
O(1)
n = int(input()) shed = str(input()) ToS = 0 ToF= 0 for i in range(len(shed)-1): if(shed[i] == 'S' and shed[i+1] == 'F'): ToF += 1 if(shed[i] == 'F' and shed[i+1] == 'S'): ToS += 1 if(ToF > ToS): print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_2
O(n)
O(1)
n = int(input()) string = input() counter_s = 0 counter_f = 0 for i in range(1, len(string)): if string[i] == "S" and string[i - 1] == "F": counter_f += 1 elif string[i] == "F" and string[i - 1] == "S": counter_s += 1 print("YES" if counter_s > counter_f else "NO")
1101
867_A. Between the Offices
1101_3
O(n)
O(1)
n = int(input()) s = input() kf = 0 ks = 0 temp = s[0] for i in range(1, len(s)): if (temp != s[i]) and (s[i] == 'F'): temp = s[i] kf += 1 elif (temp != s[i]) and (s[i] == 'S'): temp = s[i] ks += 1 if kf > ks: print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_4
O(n)
O(1)
n=int(input()) s=input() s2f=f2s=0 for i in range(n-1): if s[i:i+2] == 'SF': s2f+=1 elif s[i:i+2] == 'FS': f2s+=1 print('YES' if s2f>f2s else 'NO')
1101
867_A. Between the Offices
1101_5
null
null
import itertools import math import sys import heapq from collections import Counter from collections import deque from fractions import gcd from functools import reduce sys.setrecursionlimit(4100000) INF = 1 << 60 MOD = 10 ** 9 + 7 # ここから書き始める n = int(input()) s = input() cnt1 = 0 cnt2 = 0 i = 1 while i < n: if ...
1101
867_A. Between the Offices
1101_6
O(n)
O(1)
n, str = int(input()), input() fs, sf = 0, 0 for i in range(str.__len__() - 1): if str[i: i + 2] == "FS": fs += 1 elif str[i: i + 2] == "SF": sf += 1 print("yes" if sf > fs else "no")
1101
867_A. Between the Offices
1101_7
O(n)
O(1)
n=int(input()) a=input() s=0 f=0 for i in range(n-1): if a[i]+a[i+1]=='SF': f+=1 if a[i]+a[i+1]=='FS': s+=1 if f>s: print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_8
O(n)
O(n)
#Wrong Substraction # n,k= input().split() # n= int(n) # k = int(k) # for i in range(k): # if(n%10==0): # n=n/10 # else: # n-=1 # n=int(n) # print(n) #Easy Question # n = int(input()) # h = 0 # for i in range(n): # k=int(input()) ...
1101
867_A. Between the Offices
1101_9
O(nlogn)
O(1)
read = lambda:map(int, input().split()) n = int(input()) f = input() rt = 0 for i in range(n - 1): if f[i] == "S" and f[i + 1] == "F": rt += 1 elif f[i] == "F" and f[i + 1] == "S": rt -= 1 if (rt > 0): print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_10
O(1)
O(1)
def main(): n = int(input().strip()) flights = input().strip() sfflights = 0 fsflights = 0 prev = flights[0] for i in range(1, n): curr = flights[i] if prev == 'F' and curr == 'S': fsflights += 1 elif prev == 'S' and curr == 'F': sfflights += 1 ...
1101
867_A. Between the Offices
1101_11
O(n)
O(1)
n=int(input()) string=input() san=string.count('SF') fran=string.count('FS') if(san>fran): print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_12
O(1)
O(1)
def flight(s): letter = '' countF = 0 countS = 0 locations = [i for i in s] for i in range(len(locations)): if i == 0: letter = locations[i] elif locations[i] == 'F' and letter != locations[i]: countS += 1 letter = locations[i] elif locati...
1101
867_A. Between the Offices
1101_13
O(n+m)
O(n)
n = int(input()) d = [i for i in input()] seattle_sanfran = 0 sanfran_seattle = 0 s = len(d) for j in range(n): if j == s - 1: break if d[j] == 'S': if d[j+1] == 'F': seattle_sanfran += 1 elif d[j] == 'F': if d[j+1] == 'S': sanfran_seattle += 1 if seattle_san...
1101
867_A. Between the Offices
1101_14
O(1)
O(1)
input() a=input() print('NYOE S'[a[0]=='S'and a[-1]=='F'::2])
1101
867_A. Between the Offices
1101_15
O(nlogn)
O(1)
sf = 0 fs = 0 n = int(input()) s = input() for x in range(n-1): if s[x] == "F" and s[x+1] == "S": fs += 1 elif s[x] == "S" and s[x+1] == "F": sf += 1 if sf > fs: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_16
O(n+m)
O(n)
n=int(input()) S=input() S=list(S) sf=0 fs=0 for i,s in enumerate(S): if i+1<n: if (S[i]=='s' or S[i]=='S')and(S[i+1]=='f' or S[i+1]=='F'): sf+=1 else: if i+1<n: if (S[i]=='f' or S[i]=='F')and(S[i+1]=='s'or S[i+1]=='S'): fs+=1 if (sf>fs): print('YES') else: print('NO'...
1101
867_A. Between the Offices
1101_17
O(n)
O(1)
input() s = input() print('YES' if s.count('SF') > s.count('FS') else 'NO')
1101
867_A. Between the Offices
1101_18
O(n)
O(1)
k=int(input()) a=input() c=a.count("SF") d=a.count("FS") if(c>d): print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_19
O(nlogn)
O(1)
n=int(input()) s=0 f=0 a=str(input()) for i in range (1,n) : if a[i-1]=="S" and a[i]=="F": s=s+1 if a[i-1]=="F" and a[i]=="S": f=f+1 if s>f: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_20
O(nlogn)
O(n)
n = int(input()) days = input() start = days[0] sf = 0 fs = 0 for i in range(1,n): if start != days[i]: if start == 'S': sf += 1 else: fs += 1 start = days[i] print('YES' if sf > fs else 'NO')
1101
867_A. Between the Offices
1101_21
O(n)
O(1)
n = int(input()) x = input() a = 0 b = 0 for i in range(len(x)): if i == len(x) - 1: break elif x[i] == "F" and x[i+1] == "S" : b += 1 elif x[i] == "S" and x[i+1] == "F" : a += 1 if a > b: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_22
O(n)
O(1)
n = int(input()) a = '' ans = count=0 a = str(input()) for j in range(1, len(a)): if a[j-1]=='S' and a[j]=='F' : ans+=1 if a[j-1]=='F' and a[j]=='S' : count+=1 if ans>count: print('YES') else: print('NO')
1101
867_A. Between the Offices
1101_23
O(n)
O(1)
n = int(input()) word = input() if word.count("SF") > word.count("FS"): print ("YES") else: print ("NO")
1101
867_A. Between the Offices
1101_24
O(n)
O(1)
a = 'SF' b = 'FS' df = int(input()) n = input() c = n.count(a) d = n.count(b) if c > d: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_25
O(nlogn)
O(n)
n=int(input()) a=list(input()) s=f=0 for i in range(n-1): if((a[i]=='S')and(a[i+1]=='F')): s+=1 if((a[i]=='F')and(a[i+1]=='S')): f+=1 if(s>f): print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_26
O(nlogn)
O(n)
n = int(input()) a = input() counter = 0 count = 0 for i in range(n - 1): if a[i] == "S" and a[i + 1] == "F": counter += 1 if a[i] == "F" and a[i + 1] == "S": count += 1 if counter > count: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_27
O(n)
O(1)
input() x = input() if (x.count('SF') > x.count('FS')): print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_28
O(n)
O(1)
d=int(input()) n=input() c=0 d=0 for i in range(len(n)-1) : if n[i]=="S" and n[i+1]=="F" : c=c+1 elif n[i]=="F" and n[i+1]=="S" : d=d+1 if c>d : print("YES") else : print("NO")
1101
867_A. Between the Offices
1101_29
O(nlogn)
O(1)
n=int(input()) s=input() count=0 num=0 for i in range(n-1): if s[i]=="S" and s[i+1]=="F": count+=1 elif s[i]=="F" and s[i+1]=="S": num+=1 if count>num: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_30
O(nlogn)
O(1)
n=int(input()) s=input() x=0 y=0 for i in range(n-1): if s[i]=='S' and s[i+1]=='F': x+=1 elif s[i]=='F' and s[i+1]=='S': y+=1 print('YES' if x>y else 'NO')
1101
867_A. Between the Offices
1101_31
O(n)
O(1)
input() a = input() print('YES' if a.count('SF') > a.count('FS') else 'NO')
1101
867_A. Between the Offices
1101_32
O(n)
O(n)
useless = int(input()) data = list(input().strip().upper()) seatle, francisco, count = 0, 0, 0 while count < useless - 1: if data[count] == "S" and data[count + 1] == "F": seatle += 1 elif data[count] == "F" and data[count + 1] == "S": francisco += 1 count += 1 if seatle > francisco: pri...
1101
867_A. Between the Offices
1101_33
O(nlogn)
O(n)
n = int(input());last="";f=s=0 l=list(input()) for i in range(n): x=l[i] if i==0: if x=="S": s-=1 else: f-=1 if x != last and x=="S": s+=1 elif x!=last and x=="F": f+=1 last=x print(["NO","YES"][f>s])
1101
867_A. Between the Offices
1101_34
O(nlogn)
O(1)
numOfDays=int(input()) travelD=input() counterSF=0 counterFS=0 for i in range(numOfDays-1): if travelD[i]=="S" and travelD[i+1]=="F": counterSF += 1 if travelD[i] == "F" and travelD[i + 1] == "S": counterFS += 1 if counterSF>counterFS: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_35
O(1)
O(1)
def solve(): n_days = input() cities = input() last_city = cities[0] out = 0 for city in cities[1:]: if city != last_city: if city == "F": out += 1 else: out -= 1 last_city = city if out > 0: print("YES") else: ...
1101
867_A. Between the Offices
1101_36
O(nlogn)
O(n)
n = int(input()) s = list(str(input())) fToS = 0 sToF = 0 for i in range(n-1): if s[i] == "F" and s[i+1] == "S": fToS+=1 elif s[i] == "S" and s[i+1] == "F": sToF+=1 if sToF > fToS: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_37
O(nlogn)
O(n)
a = int(input()) b = input() b = list(b) e = int() f = int() for x in range(a): if x < (a-1): if b[x] == b[x+1]: pass elif b[x] < b[x+1]: f = f + 1 elif b[x] > b[x+1]: e = e + 1 if e > f: print("Yes") else: print("No")
1101
867_A. Between the Offices
1101_38
O(nlogn)
O(1)
n = int(input()) s = input() good = 0 bad = 0 for i in range(1, n): if (s[i] == 'F') and (s[i - 1] == 'S'): good += 1 elif (s[i] == 'S') and (s[i - 1] == 'F'): bad += 1 if good > bad: print("YES") else: print("NO")
1101
867_A. Between the Offices
1101_39
O(n)
O(1)
numDays = int(input()) flightInfo = input() seattle_to_sf = 0 sf_to_seattle = 0 for i in range(1, len(flightInfo)): if flightInfo[i] == 'S' and flightInfo[i - 1] == 'F': sf_to_seattle += 1 elif flightInfo[i] == 'F' and flightInfo[i - 1] == 'S': seattle_to_sf += 1 if seattle_to_sf > sf_to_seattle...
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
24