s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s901008286 | p03798 | u815878613 | 1574772111 | Python | Python (3.4.3) | py | Runtime Error | 45 | 4752 | 919 | import sys
readline = sys.stdin.buffer.readline
def main():
N = int(input())
s = readline()
s = list(s.decode('UTF-8').rstrip("\n"))
s.append(s[0])
s.insert(0, s[-2])
init = ((1, 1), (0, 1), (1, 0), (0, 0))
# init = ((0, 0), (0, 1), (1, 0), (1, 1))
for i in init:
p = [0] * (N... |
s366775737 | p03798 | u091051505 | 1568250858 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 1177 | n = int(input())
s = input()
pattern = ["SS", "SW", "WS", "WW"]
dict_s = {"S":"W", "W":"S"}
not_clear = True
for p in pattern:
ans = p
for i in range(1, n - 1):
if s[i] == "o":
if ans[i] == "W":
ans += dict_s[ans[i-1]]
else:
ans += ans[i-1]
... |
s422829837 | p03798 | u903082918 | 1565723668 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 291 | """ abc055_a """
import sys
H = pow(10, 9) + 7
def _main():
n_s, n_c = map(int, sys.stdin.readline().split(' '))
if 2 * n_s <= n_c:
result = n_s + int((n_c - n_s * 2) / 4)
else:
result = int(n_c / 2)
print(result)
if __name__ == '__main__':
_main()
|
s331470676 | p03798 | u483645888 | 1559683685 | Python | Python (3.4.3) | py | Runtime Error | 1797 | 3836 | 272 | n = int(input())
s = input()
l = ['SS','WS','SW','WW']
for i in range(n):
for j in range(len(l)):
l[j] += 'SW'[::-1 if s[i]=='o' else 1][l[j][i]==l[j][i+1]]
for i in range(n):
if l[i][1]==l[i][n+1] and l[i][0]==l[i][n]:
print(l[i][1:n+1])
exit()
print(-1) |
s318174315 | p03798 | u059210959 | 1558653932 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 810 | n = int(input())
s = [1 if si == 'o' else 0 for si in list(input())]
t0 = [[1, 1], [1, 0], [0, 1], [0, 0]]
for ti in t0:
flag = True
for i in range(1, n - 1):
if ti[i] * (1 - s[i]) or (1 - ti[i]) * s[i]:
ti.append(1 - ti[i - 1])
else:
... |
s683694809 | p03798 | u059210959 | 1558653898 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 705 | s = [1 if si == 'o' else 0 for si in list(input())]
t0 = [[1, 1], [1, 0], [0, 1], [0, 0]]
for ti in t0:
flag = True
for i in range(1, n - 1):
if ti[i] * (1 - s[i]) or (1 - ti[i]) * s[i]:
ti.append(1 - ti[i - 1])
else:
ti.append(ti[i - 1])
for i in range(2):
if... |
s962212607 | p03798 | u573272932 | 1558063627 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 336 | inputa = int(input())
inputb = input()
flag = 0
res = ""
for c in inputb:
if c == "o":
if flag % 2 == 0:
res += "S"
else:
res += "W"
else:
res += "S"
flag += 1
if inputb[0] == "o":
if flag % 2 != 0:
print(-1)
return
if inputb[0] == "x":
if flag % 2 != 1:
print(-1)
r... |
s409862959 | p03798 | u318861481 | 1537322474 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 510 | from itertools import product
N = int(input())
S = [0 if i == 'o' else 1 for i in input()]
for i, j in product(range(2), repeat=2):
pattern = [i, j] + [0] * (N - 2)
for k in range(2, N):
pattern[k] = ( S[k-1] - (pattern[k - 1] + pattern[k - 2] )) % 2
if S[-1] != (pattern[-2] + pattern[-1] + pattern[0]) % 2 :
... |
s087287677 | p03798 | u318861481 | 1537322424 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 510 | from itertools import product
N = int(input())
S = [0 if i == 'o' else 1 for i in input()]
for i, j in product(range(2), repeat=2):
pattern = [i, j] + [0] * (N - 2)
for k in range(2, N):
pattern[k] = ( S[k-1] - (pattern[k - 1] + pattern[k - 2] )) % 2
if S[-1] != (pattern[-2] + pattern[-1] + pattern[0]) % 2 :
... |
s174342321 | p03798 | u318861481 | 1537322132 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 590 | !/usr/bin/python3
from itertools import product
def solve():
N = int(input())
S = [0 if i == 'o' else 1 for i in input()]
for i, j in product(range(2), repeat=2):
pattern = [i, j] + [0] * (N - 2)
for k in range(2, N):
pattern[k] = (pattern[k - 1] + pattern[k - 2] + S[k] ) % 2
if S[-1] != (pattern[-2] +... |
s392044133 | p03798 | u318861481 | 1537322039 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 589 | !/usr/bin/python3
from itertools import product
def solve():
N = int(input())
S = [0 if i == 'o' else 1 for i in input()]
for i, j in product(range(2), repeat=2):
pattern = [i, j] + [0] * (N - 2)
for k in range(2, N):
pattern[k] = (pattern[k - 1] + pattern[k - 2] + S[k] ) % 2
if S[-1] != (pattern[-2] + p... |
s222567144 | p03798 | u318861481 | 1537321960 | Python | Python (3.4.3) | py | Runtime Error | 23 | 4092 | 575 | def solve():
N = int(input())
S = [0 if i == 'o' else 1 for i in input()]
for i, j in product(range(2), repeat=2):
pat = [i, j] + [0]*(N - 2)
for k in range(2, N):
pat[k] = (S[k - 1] - (pat[k - 1] + pat[k - 2])) % 2
if S[-1] != (pat[0] + pat[-1] + pat[-2]) % 2:
... |
s379464328 | p03798 | u318861481 | 1537321887 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3996 | 575 | def solve():
N = int(input())
S = [0 if i == 'o' else 1 for i in input()]
for i, j in product(range(2), repeat=2):
pat = [i, j] + [0]*(N - 2)
for k in range(2, N):
pat[k] = (S[k - 1] - (pat[k - 1] + pat[k - 2])) % 2
if S[-1] != (pat[0] + pat[-1] + pat[-2]) % 2:
... |
s303883115 | p03798 | u648901783 | 1536175197 | Python | Python (3.4.3) | py | Runtime Error | 92 | 5016 | 2511 | n = int(input())
s = input()
animal = [0]*n #0が羊、1が狼
f = [False]
def dfs(v,animal):
if f[0]== True:
return
if v == n-1:
if s[v]=='o':
if animal[v]==0:
if ((animal[v-1]==0)and(animal[0]==0))or((animal[v-1]==1)and(animal[0]==1)):
# print("True!"... |
s601507782 | p03798 | u648901783 | 1536174430 | Python | Python (3.4.3) | py | Runtime Error | 97 | 5008 | 2296 | n = int(input())
s = input()
animal = [0]*n #0が羊、1が狼
f = [False]
def dfs(v,animal):
if v == 0:
dfs(1,animal)
animal[0]+=1
dfs(1,animal)
if f[0]== True:
return
if v == n-1:
if s[v]=='o':
if animal[v]==0:
if ((animal[v-1]==... |
s890462209 | p03798 | u648901783 | 1536174360 | Python | Python (3.4.3) | py | Runtime Error | 93 | 5000 | 2302 | n = int(input())
s = input()
animal = [0]*n #0が羊、1が狼
f = [False]
def dfs(v,animal):
if v == 0:
dfs(1,animal)
animal[0]+=1
dfs(1,animal)
if f[0]== True:
return animal
if v == n-1:
if s[v]=='o':
if animal[v]==0:
if ((animal[... |
s279809302 | p03798 | u648901783 | 1536174246 | Python | Python (3.4.3) | py | Runtime Error | 94 | 5008 | 2327 | n = int(input())
s = input()
animal = [0]*n #0が羊、1が狼
f = [False]
def dfs(v,animal):
if v == 0:
dfs(1,animal)
animal[0]+=1
dfs(1,animal)
if f[0]== True:
return animal
if v == n-1:
if s[v]=='o':
if animal[v]==0:
if ((animal[... |
s486899241 | p03798 | u648901783 | 1536173784 | Python | Python (3.4.3) | py | Runtime Error | 97 | 5008 | 2229 | n = int(input())
s = input()
animal = [0]*n #0が羊、1が狼
f = [False]
def dfs(v,animal):
if f[0]== True:
return animal
if v == n-1:
if s[v]=='o':
if animal[v]==0:
if ((animal[v-1]==0)and(animal[0]==0))or((animal[v-1]==1)and(animal[0]==1)):
# print("True... |
s423820750 | p03798 | u334712262 | 1534329900 | Python | Python (3.4.3) | py | Runtime Error | 136 | 7368 | 4198 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... |
s087759703 | p03798 | u118642796 | 1526378890 | Python | Python (3.4.3) | py | Runtime Error | 76 | 4528 | 452 | N = int(input())
s = input()
def DFS(ans):
if len(ans) == N+2:
return ans
if (ans[-1] == "S") ^ (s[len(ans)-2] == "o") ^ (ans[-2] == "W"):
ans += "W"
else:
ans += "S"
return DFS(ans)
for initial in ["SS","SW","WS","WW"]:
ans = D... |
s264790444 | p03798 | u952708174 | 1524601105 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3188 | 1070 | def d_menagerie(N, S):
s = S + S[0:2] # 円環状に並んでいることを考慮
for ans in ['SS', 'SW', 'WS', 'WW']: # Sは羊、Wは狼。1番と2番の種類を仮定する
for i in range(1, N + 1):
if (ans[-1] == 'S' and s[i] == 'o') or (ans[-1] == 'W' and s[i] == 'x'):
# この場合、今注目している動物の両隣は同じ種類。
# よって、今注目している動物の右... |
s326010474 | p03798 | u391475811 | 1523042240 | Python | Python (3.4.3) | py | Runtime Error | 2438 | 2053012 | 753 | import sys
sys.setrecursionlimit(100001)
N=int(input())
S=input()
def solve(n,str):
if n==N:
if str[-2]==str[0] and str[-1]==str[1]:
str=str[1:-1]
else:
str=""
return str
else:
if (S[n]=="o" and str[-1]=="S") or (S[n]=="x" and str[-1]=="W"):
str=str+str[-2]
else:
if st... |
s728553178 | p03798 | u391475811 | 1523041920 | Python | Python (3.4.3) | py | Runtime Error | 79 | 4728 | 710 | N=int(input())
S=input()
def solve(n,str):
if n==N:
if str[-2]==str[0] and str[-1]==str[1]:
str=str[1:-1]
else:
str=""
return str
else:
if (S[n]=="o" and str[-1]=="S") or (S[n]=="x" and str[-1]=="W"):
str=str+str[-2]
else:
if str[-2]=="W":
str=str+"S"
else:... |
s144758103 | p03798 | u018679195 | 1512598576 | Python | Python (3.4.3) | py | Runtime Error | 376 | 7020 | 2700 | #!/usr/bin/env python3
n = int(input())
s = input()
t1 = ["S","S"]
l1 = ["W","W"]
t2 = ["S","W"]
l2 = ["W","S"]
for i in range(n-2):
t1.append("S")
for i in range(n):
if i+1 <= n-1 and i != 0:
if (s[i] == "x" and t1[i] == "S") or (s[i] == "o" and t1[i] == "W"):
if t1[i-1] == "S":
... |
s915140558 | p03798 | u806201407 | 1493868577 | Python | Python (3.4.3) | py | Runtime Error | 205 | 6260 | 826 |
def check(s, ans, i) :
return s[i-1] ^ ans[i-2] ^ ans[i]
def solve(first, second, s) :
n = len(s)
ans = [0] * (n)
ans[-2] = first;
ans[-1] = second;
for i in range(0, n-2) :
nsame = 0
nsame ^= s[i-1]
nsame ^= ans[i-1]
ans[i] = ans[i-2] ^ nsame
if check( s... |
s039586610 | p03798 | u132360211 | 1490028335 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 751 | io = STDIN
$n=io.gets.chomp.to_i
$s=io.gets.chomp
$ans=' '*$n
def check2(i)
return true if $ans[i]==' '
nxt = i==$n-1 ? 0 : i+1
return true if $ans[i-1]==' ' || $ans[nxt]==' '
rslt=case $s[i]
when "o"
if $ans[i]=="S"
$ans[i-1]==$ans[nxt]
else
$ans[i-1]!=$ans[nxt]
end
else
if $a... |
s398898237 | p03798 | u117629640 | 1488559429 | Python | Python (3.4.3) | py | Runtime Error | 49 | 6184 | 457 | # coding: utf-8
def main():
n = int(input())
data = list(input())
result = []
for i in range(n):
if len(result) == i-1:
if data[i] == 'o' and data[i+1] == 'o':
result.append('W')
result.append('W')
else:
result.append('S'... |
s190615540 | p03798 | u762603420 | 1487898231 | Python | Python (3.4.3) | py | Runtime Error | 112 | 6636 | 2620 | # -*- coding: utf-8 -*-
def check(s, ans):
if len(s) != len(ans):
return False;
for i in range(0, len(s)):
pre = i - 1
next = i + 1
if i == 0:
pre = len(s) - 1
if i == len(s) - 1:
next = 0
if ans[i] == "S":
if s... |
s964438322 | p03798 | u762603420 | 1487897741 | Python | Python (3.4.3) | py | Runtime Error | 116 | 6564 | 2569 | # -*- coding: utf-8 -*-
def check(s, ans):
for i in range(0, len(s)):
pre = i - 1
next = i + 1
if i == 0:
pre = len(s) - 1
if i == len(s) - 1:
next = 0
if ans[i] == "S":
if s[i] == "o":
if ans[pre] != ans[ne... |
s384449652 | p03798 | u898690911 | 1487771257 | Python | Python (3.4.3) | py | Runtime Error | 216 | 6384 | 2713 | import sys
def point(main_animal,main_animal_answer,previous_animal):
next_animal=''
if main_animal=='S':
if main_animal_answer=='o':
next_animal=previous_animal
else:
if previous_animal=='W':
next_animal='S'
else:
next_animal='... |
s819974756 | p03798 | u581309643 | 1487476389 | Python | Python (3.4.3) | py | Runtime Error | 209 | 134260 | 582 | N = int(input())
s = input()
r = {'S' : 'W', 'W': 'S'}
a = 'SS'
ans = -1
for a in ('SS', 'SW', 'WS', 'WW'):
for i in range(1,N):
print(a)
if s[i] == 'o':
if a[i] == 'S':
a += a[i-1]
else:
a += r[a[i-1]]
else:
if a[i] == 'S... |
s822130698 | p03798 | u314057689 | 1487476040 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 816 | from test import set_stdin_sandbox
set_stdin_sandbox()
import itertools
N = int(input())
s = list(map(lambda x: True if x == "o" else False, list(input())))
f = lambda x,y: not(x^y)
def hantei(N,s):
for onetwo in itertools.product((True, False), (True, False)):
res = {}
for n in range(N):
... |
s257955649 | p03798 | u314057689 | 1487475307 | Python | Python (3.4.3) | py | Runtime Error | 30 | 4900 | 834 | import itertools
N = int(input())
s = list(map(lambda x: True if x == "o" else False, list(input())))
# N = 6
# s = "ooxoox"
# N = 3
# s = "oox"
s = [True, True, False]
def hantei(N,s):
f = lambda x,y: not(x^y)
for onetwo in itertools.product((True, False), (True, False)):
res = {}
for n in ra... |
s235747546 | p03798 | u583826716 | 1487474342 | Python | Python (3.4.3) | py | Runtime Error | 92 | 6408 | 1447 | SHEEP = True
WOLF = False
def print_tree(tree):
print(''.join(['S' if e else 'W' for e in tree]))
def calc_next_animal(tree, cur_pos):
if answer[cur_pos]:
if tree[cur_pos] == SHEEP:
return tree[cur_pos - 1]
else:
return not tree[cur_pos - 1]
else:
if tree[... |
s797378759 | p03798 | u583826716 | 1487474285 | Python | Python (3.4.3) | py | Runtime Error | 92 | 6416 | 1455 | SHEEP = True
WOLF = False
def print_tree(tree):
print(''.join(['S' if e else 'W' for e in tree]))
def calc_next_animal(tree, cur_pos):
if answer[cur_pos]:
if tree[cur_pos] == SHEEP:
return tree[cur_pos - 1]
else:
return not tree[cur_pos - 1]
else:
if tree[... |
s558187105 | p03798 | u583826716 | 1487474230 | Python | Python (3.4.3) | py | Runtime Error | 88 | 5632 | 1455 | SHEEP = True
WOLF = False
def print_tree(tree):
print(''.join(['S' if e else 'W' for e in tree]))
def calc_next_animal(tree, cur_pos):
if answer[cur_pos]:
if tree[cur_pos] == SHEEP:
return tree[cur_pos - 1]
else:
return not tree[cur_pos - 1]
else:
if tree[... |
s153461949 | p03798 | u314057689 | 1487473809 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3192 | 1642 | import itertools
N = int(input(l))
s = list(input())
# N = 6
# s = "ooxoox"
N = 3
s = "oox"
def hantei(N,s):
for onetwo in itertools.product((0, 1), (0, 1)):
res = {}
for n in range(N):
if n == 0:
res[n] = onetwo[0]
elif n == 1:
res[n] = onet... |
s485420600 | p03798 | u277343138 | 1487473523 | Python | Python (3.4.3) | py | Runtime Error | 78 | 4632 | 672 | n = int(input())
s = input()
flag = False
def rec(t, i, s, n):
global flag
if flag:
return
l = len(t)
if 2 < l:
if t[i%l] == 'S' and (t[(i-1)%l] == t[(i+1)%l] and s[i%l] == 'x' or t[(i-1)%l] != t[(i+1)%l] and s[i%l] == 'o'):
return
elif t[i%l] == 'W' and (t[(i-1)%l... |
s869840713 | p03798 | u583826716 | 1487473451 | Python | Python (3.4.3) | py | Runtime Error | 86 | 4944 | 1354 | SHEEP = True
WOLF = False
def print_tree(tree):
print(''.join(['S' if e else 'W' for e in tree]))
def calc_next_animal(tree, cur_pos):
if answer[cur_pos]:
if tree[cur_pos] == SHEEP:
return tree[cur_pos - 1]
else:
return not tree[cur_pos - 1]
else:
if tree[... |
s650263593 | p03798 | u583826716 | 1487473425 | Python | Python (3.4.3) | py | Runtime Error | 89 | 4852 | 1354 | SHEEP = True
WOLF = False
def print_tree(tree):
print(''.join(['S' if e else 'W' for e in tree]))
def calc_next_animal(tree, cur_pos):
if answer[cur_pos]:
if tree[cur_pos] == SHEEP:
return tree[cur_pos - 1]
else:
return not tree[cur_pos - 1]
else:
if tree[... |
s126151127 | p03799 | u143051858 | 1594052584 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8992 | 162 | s,c = map(int,input().split())
if s*2 <= c:
res = s
c -= s*2
s = 0
else:
res += c//2
c = 0
#print(res,s,c)
if c:
res += c//4
print(res) |
s971180134 | p03799 | u143051858 | 1594052551 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9152 | 162 | s,c = map(int,input().split())
if s*2 <= c:
res = s
c -= s*2
s = 0
else:
res += c//2
m = 0
#print(res,s,c)
if c:
res += c//4
print(res) |
s909983794 | p03799 | u143051858 | 1594052163 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9136 | 157 | s,c = map(int,input().split())
res = 0
if s*2 <= c:
res += s
c -= s*2
res+= c
else:
res += c//2
c //= 2
if c:
res += m//4
print(res) |
s015264516 | p03799 | u179169725 | 1593352984 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9096 | 67 | N,M=map(int,input().split())
n1=min(N,M//2)
print(ans+(M-2*n1)//4)
|
s779741326 | p03799 | u179169725 | 1593352891 | Python | Python (3.8.2) | py | Runtime Error | 20 | 9120 | 81 | N,M=map(int,input().split())
n1=min(N,M//2)
N-=n1
M-=2*n1
print(ans+(M-2*n1)//4)
|
s837428495 | p03799 | u179169725 | 1593352828 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9092 | 134 | N,M=map(int,input().split())
n1=min(N,M//2)
N-=n1
M-=2*n1
if N==0:
ans=n1+M//4
else:
ans=n1+N//2
raise ValueError()
print(ans)
|
s477863973 | p03799 | u514118270 | 1592961508 | Python | Python (3.8.2) | py | Runtime Error | 29 | 10024 | 2224 | import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): retur... |
s002775365 | p03799 | u593567568 | 1591217797 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 166 | N,M = map(int,inpu().split())
def solve(N,M):
# 今あるもの
if M < N * 2:
return N
M -= N * 2
ans = N + M // 3
return ans
print(solve(N,M))
|
s112085728 | p03799 | u810356688 | 1590933414 | Python | PyPy3 (2.4.0) | py | Runtime Error | 171 | 38384 | 519 | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
n=int(input())
s=input()
for ans in ("SS","SW","WS","WW"):
for c in s[1:]:
if ans[-1]=="S":
ans+="W" if (ans[-2]=="W")^(c=="x") else "S"
else:
ans+="S" if (ans[-2]=="W")^(... |
s033869511 | p03799 | u535171899 | 1588904884 | Python | Python (3.4.3) | py | Runtime Error | 2128 | 1407348 | 432 | import sys
N, M = map(int, input().split())
S = [0] * M
C = [0] * M
for i in range(M):
S[i], C[i] = map(int, input().split())
for i in range(1000):
string = str(i)
if len(string) != N:
continue
flag = True
for j in range(M):
if string[S[j] - 1] == str(C[j]):
None
... |
s861398287 | p03799 | u995062424 | 1586016834 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 101 | N, M = map(int, input().split())
if(2*N <= M):
m = M-2*N
print(N+m//4)
else:
print(m//2) |
s083943727 | p03799 | u994521204 | 1583828297 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 106 | n,m=map(int, input().split())
p1=n
p2=m//2
if p1>p2:
print(p2)
else:
delta=p2-p1
print(delta//2+p1) |
s383436807 | p03799 | u994521204 | 1583828231 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 105 | n,m=map(int,input().split())
p1=n
p2=m//2
if p1>p2:
print(p2)
else:
delta=p2-p1
print(delta//2+p1) |
s418282455 | p03799 | u994521204 | 1583828191 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 106 | n,m=map(int,input().split())
p1=n
p2=m//2
if p1>p2:
print(p2)
else:
delta=p2-p1
print(delta//2+p1)
|
s289803883 | p03799 | u984276646 | 1580338129 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 166 | N, M = map(int, input().split())
if 2 * N > M:
print(M // 2)
else:
C = M // 2
n = (C - N) // 2
print(max(min(S+n-1, C-n+1), min(S+n, C-n), min(S+n+1, C-n-1))) |
s083561281 | p03799 | u495415554 | 1576986750 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38256 | 98 | N, M = map(int, input().split())
if N >= 2 * M:
print(M // 2)
else:
print(N + ((M - 2 * N) // 4)) |
s445746416 | p03799 | u495415554 | 1576986720 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38384 | 105 | N, M = map(int, input().split())
if N >= 2 * M:
print(M // 2)
else:
print(N + ((M - 2 * N) // 4) |
s257149266 | p03799 | u936985471 | 1574024136 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 76 | n,m=map(int,input().split())
c=m//2
if n>c:
print(c)
else:
print(s+c//2) |
s812252560 | p03799 | u503111914 | 1569716359 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 86 | N,M = map(int()input().split())
if N <= M//2+1:
print(N)
else:
print(N+(M-N*2)//4) |
s770115038 | p03799 | u850491413 | 1569183673 | Python | PyPy3 (2.4.0) | py | Runtime Error | 303 | 65644 | 1243 |
import sys
from collections import deque, defaultdict
import copy
import bisect
sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations
import fractions
import sys
def input():
return sys.stdin.readline().strip()
N = int(input())
a = list(map(int, input().spl... |
s610770009 | p03799 | u637824361 | 1565237114 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 104 | N, M = map(int, input().split())
ans = 0
if N > M//2:
print(M//2)
else:
p = M - 2*N
print(N + p//4 |
s654128883 | p03799 | u426108351 | 1559234840 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 354 | N = int(input())
a = list(map(int, input().split()))
b = []
for i in range(N):
b.append([a[i], i+1])
b.sort(reverse = True)
ans = [0]*(N+1)
mini = N+1
for i in range(N-1):
mini = min(mini, b[i][1])
if b[i+1][0] - b[i][0] < 0:
ans[mini] += (b[i][0] - b[i+1][0])*(i+1)
ans[1] += N*min(b[-1][0])
for i... |
s189944502 | p03799 | u426108351 | 1559234819 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 354 | N = int(input())
a = list(map(int, input().split()))
b = []
for i in range(N):
b.append([a[i], i+1])
b.sort(reverse = True)
ans = [0]*(N+1)
mini = N+1
for i in range(N-1):
mini = min(mini, b[i][1])
if b[i+1][0] - b[i][0] < 0:
ans[mini] += (b[i][0] - b[i+1][0])*(i+1)
ans[1] += N*min(b[-1][0])
for i... |
s590546724 | p03799 | u724742135 | 1556402104 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 148 | from sys import exit, stdin
N, M = [int(_) for _ in stdin.readline().rstrip().split()]
r = M-2*N
if r <= 0:
print(N//2)
else:
pritnt(N+r//4) |
s349522232 | p03799 | u271469978 | 1555939322 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 97 | n, m = map(int, input().split())
c = m - 2*n
if c <= 0:
pirnt(m//2)
else:
print(n + c//4) |
s148334189 | p03799 | u271469978 | 1555939101 | Python | Python (3.4.3) | py | Runtime Error | 19 | 2940 | 94 | n, m = map(int, input().split())
c = m - 2*n
if c <= 0:
pirnt(n)
else:
print(n + c//4) |
s828378128 | p03799 | u692782635 | 1531642638 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 536 | from functools import cmp_to_key
n = int(input())
a = list(map(int, input().split()))
def group(a):
d = {}
for i, x in enumerate(a):
d.setdefault(x, []).append(i)
s = sorted(d.items(), key=cmp_to_key(lambda x, y: x[0] - y[0]),
reverse=True)
return list(map(lambda x: [x[... |
s591442952 | p03799 | u711574130 | 1488565497 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2692 | 421 | # -*- coding:utf-8 -*-
from operator import itemgetter
n = int(raw_input())
a = [[int(k),i+1] for i,k in enumerate(raw_input().split())]
a.sort(key=itemgetter(0),reverse=True)
s = []
b = []
a.append([0,0])
for i,p in enumerate(a[:-1]):
if not p[0] == a[i+1][0]:
q = a[i][0] - a[i+1][0]
y = [z[1] for ... |
s535884120 | p03799 | u848877025 | 1488475627 | Python | Python (2.7.6) | py | Runtime Error | 3496 | 23428 | 331 | def main():
s, c = map(int, raw_input().split())
count = 0
for i in range(s):
if(c >= 2):
count += 1
c -= 2
else:
break
for i in range(c):
if(c >= 4):
count += 1
c -= 4
else:
break
return count
p... |
s392532575 | p03799 | u848877025 | 1488475426 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 331 | def main():
s, c = map(int, input.row().split())
count = 0
for i in range(s):
if(c >= 2):
count += 1
c -= 2
else:
break
for i in range(c):
if(c >= 4):
count += 1
c -= 4
else:
break
return count
p... |
s770478167 | p03799 | u663230781 | 1488384874 | Python | Python (2.7.6) | py | Runtime Error | 12 | 2696 | 194 | n, m = map(int, raw_input().rstrip("\n").split(" "))
answer = 0
if (n * 2) >= m:
answer = m / 2
else:
answer = n + ( m - (n *2) ) / 3)
print answer
print calc_scc(12345,678901), 175897
|
s625728963 | p03799 | u886545507 | 1487692593 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 95 | #ARC069A
n,m=map(int,raw_input().split())
if n>m*2:
res=c/2
else:
res=n+(m-2*n)/4
print res
|
s621566889 | p03799 | u886545507 | 1487691913 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 93 | #ARC069A
n,m=map(int,raw_input().split())
if n>m*2:
res=c/2
else:
res=(n*2+m)/4
print res
|
s708906623 | p03799 | u749912909 | 1487571463 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 208 | # -*- coding: utf-8 -*-
N, M = map(int, raw_input().split())
if M == 2*N:
print("%d"%M)
elif M < 2*M:
print("%d"%M + (N - 2*M - (N - 2*M)%4) / 4)
else:
print("%d"%N + (M - 2*N - (M - 2*N) %4) / 4) |
s241421586 | p03799 | u749912909 | 1487571348 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 186 |
N, M = map(int, raw_input().split())
if M == 2*N:
print("%d"%M)
elif M < 2*M:
print("%d"%M + (N - 2*M - (N - 2*M)%4) / 4)
else:
print("%d"%N + (M - 2*N - (M - 2*N) %4) / 4)
|
s849995107 | p03799 | u749912909 | 1487571228 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 234 | def solve(M, N):
if M == 2*N:
return M
elif M < 2*M:
return M + (N - 2*M - (N - 2*M)%4) / 4
else:
return N + (M - 2*N - (M - 2*N) %4) / 4
M, N = map(int, raw_input().split())
print("%d"%solve(M, N)) |
s845370791 | p03799 | u749912909 | 1487570951 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 210 | def solve(M, N):
if M == 2*N:
return M
elif M < 2*M:
return M + int((N - 2*M) / 4)
else:
return N + int((M - 2*N) / 4)
M, N = map(int, raw_input().split())
print(solve(M, N)) |
s820827028 | p03799 | u749912909 | 1487570721 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 196 | M, N = raw_input().split(" ")
def solve(M, N):
if M == 2*N:
return M
elif M < 2*M:
return M + int((N - 2*M) / 4)
else:
return N + int((M - 2*N) / 4)
solve(M, N) |
s108955010 | p03799 | u749912909 | 1487570489 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 222 | import math
def solve(M, N):
if M == 2*N:
return M
elif M < 2*M:
return M + math.floor((N - 2*M) / 4)
else:
return N + math.floor((M - 2*N) / 4)
M, N = raw_input().split(" ")
solve(M, N) |
s326157049 | p03799 | u622011073 | 1487488261 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 250 | n=int(input());s=input();a=['SS','WS','SW','WW']
for i in range(n):
for j in range(4):a[j]+='SW'[::-1 if s[i]=='o' else 1][a[j][i]==a[j][i+1]]
for i in range(4):
if a[i][1]==a[i][n+1] and a[i][0] == a[i][n]:print(a[i][1:n+1]);exit()
print(-1) |
s598303928 | p03799 | u369752439 | 1487483209 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2824 | 2192 | def findNextAnimal(oxList, swList, index):
nextAns = oxList[index]
before = swList[index-1]
animal = swList[index]
nextAnimal = ""
if(nextAns == "o" and before == "S" and animal == "S"):
nextAnimal = "S"
elif(nextAns == "o" and before == "S" and animal == "W"):
nextAnimal = "W"
... |
s687644152 | p03799 | u880644800 | 1487475214 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 798 | def solve(s, c):
"""rv = min(Sr, Cr//2), where
Sr = S + a
Cr = C - 2a # a>=0, a is number of (2c->S) conversions
thus
rv = max(min(S + a, C//2 - a) for a in range(0, C//2))
if a >=0, optimum is Sr == Cr//2, thus
S + a == Cr//2 - a
... |
s282792722 | p03799 | u866746776 | 1487470308 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 182 | n, m = input().split()
num_s = int(n)
num_c = int(m)
if num_c <= num_s * 2:
print(num_c // c)
else:
scc = num_s
num_s = 0
num_c -= 2 * scc
scc += num_c // 4
print(scc)
|
s579547290 | p03799 | u755962107 | 1487470015 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 69 | u, v = map(int, input().split())
print(min(u//2, (2*u+v)//4)) |
s656391621 | p03799 | u755962107 | 1487469977 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 60 | u, v = map(int, input().split())
print(min(u//2, (2*u+v)//4) |
s269560906 | p03800 | u222668979 | 1600034109 | Python | PyPy3 (7.3.0) | py | Runtime Error | 165 | 68628 | 503 | from itertools import product
for bfo2, bfo1 in product(['S', 'W'], repeat=2):
ans = [bfo2, bfo1]
for i in s:
if ((bfo1 == 'S' and i == 'o')
or (bfo1 == 'W' and i == 'x')):
ans.append(bfo2)
elif ((bfo1 == 'S' and i == 'x')
or (bfo1 == 'W' and i == 'o... |
s269498164 | p03800 | u223646582 | 1591779351 | Python | PyPy3 (2.4.0) | py | Runtime Error | 208 | 48964 | 703 | N = int(input())
S = input()
C = ('SS', 'SW', 'WS', 'WW')
for i in range(4):
ans = list(C[i])
for j in range(1, N):
if (ans[-1] == 'S' and S[j] == 'o') or(ans[-1] == 'W' and S[j] == 'x'):
ans.append(ans[-2])
else:
ans.append('S' if ans[-2] == 'W' else 'W')
if ans[0] ... |
s960272077 | p03800 | u706159977 | 1585700159 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3444 | 1247 | Menagerien = int(input())
s = input()
a = "SS"
ct=1
while ct<7:
for i in range(n-1):
p=a[i]
q="A"
if a[i]=="S":
q="W"
else:
q="S"
if a[i+1]=="S":
if s[i+1] == "o":
a=a+a[i]
else:
a=a+q
... |
s109443694 | p03800 | u644907318 | 1578841192 | Python | Python (3.4.3) | py | Runtime Error | 196 | 4340 | 760 | def f(x,y,z):
if x=="S" and y=="o":
return z
if x=="S" and y=="x":
return g(z)
if x=="W" and y=="o":
return g(z)
if x=="W" and y=="x":
return z
def g(x):
if x=="S":
return "W"
if x=="W":
return "S"
def check(x,y):
t[0]=x
t[1]=y
for j in... |
s199001146 | p03800 | u644907318 | 1578840845 | Python | PyPy3 (2.4.0) | py | Runtime Error | 214 | 47856 | 760 | def f(x,y,z):
if x=="S" and y=="o":
return z
if x=="S" and y=="x":
return g(z)
if x=="W" and y=="o":
return g(z)
if x=="W" and y=="x":
return z
def g(x):
if x=="S":
return "W"
if x=="W":
return "S"
def check(x,y):
t[0]=x
t[1]=y
for j in... |
s949282473 | p03800 | u644907318 | 1578840132 | Python | PyPy3 (2.4.0) | py | Runtime Error | 220 | 47856 | 1051 | def f(x,y,z):
if x=="S" and y=="o":
return z
if x=="S" and y=="x":
return g(z)
if x=="W" and y=="o":
return g(z)
if x=="W" and y=="x":
return z
def g(x):
if x=="S":
return "W"
if x=="W":
return "S"
def check(x,y):
t[0]=x
t[1]=y
for j in... |
s529909752 | p03800 | u520276780 | 1578275898 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 532 | import sys
n = int(input())
s = input()
L = ["SS","SW","WS","WW"]
l= len(s)
##0,1に置き換えたりしない
##条件分岐注意する
##ずらす必要はない、Lが固定するのはindexで-2,-1
for t in L:
tmp = t###
for i in range(l):
if (s[i]=="x") ^ (tmp[-1] == "W"):
if tmp[-2]=="S":
tmp+= "W"
else:
tmp ... |
s429406261 | p03800 | u518042385 | 1574227078 | Python | Python (3.4.3) | py | Runtime Error | 193 | 7336 | 904 | n=int(input())
w1=list(input())
s="S"
w="W"
o="o"
x="x"
l=[[s,s],[s,w],[w,w],[w,s]]
for j in range(4):
for i in range(1,n):
if w1[i]==o:
if l[j][-1]==s:
if l[j][-2]==s:
l[j].append(s)
else:
l[j].append(w)
else:
... |
s159494874 | p03800 | u854831509 | 1571197580 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 782 | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
int main() {
int N; string s;
cin>>N>>s;
for (int i = 0; i < 4; ++i) {
vector<bool> sheep(N+1,false);
sheep[0]=(i&10);
sheep[1]=(i&1);
for (int i = 2; i <= N; ++i) {
if(s[i... |
s358671926 | p03800 | u413165887 | 1570591271 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 694 | n = int(input())
s = str(input())
s += s[0]
candidate = [[1,-1],[1,1],[-1,-1],[-1,1]]
result = []
checker = 0
while checker < 4:
result = candidate[checker]
for i in range(1, n):
if s[i] == 'o' and result[i] == 1:
result.append(result[-2])
elif s[i] == 'x' and result[i] == 1:
... |
s115056303 | p03800 | u780962115 | 1570334644 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3552 | 2566 | n=int(input())
s=input()
flag=True
lists=["WWW","SWS","WSS","SSW","SWW","WWS","SSS","WSW"]
strings=""
if s[0]=="x":
j==0
while j<4:
strings=lists[j]
for i in range(n-1):
if strings[-2]=="W" and strings[-1]=="W" and s[i+1]=="o":
strings+="S"
elif strings[... |
s848372402 | p03800 | u780962115 | 1570334410 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3552 | 2486 | n=int(input())
s=input()
flag=True
lists=["WWW","SWS","WSS","SSW","SWW","WWS","SSS","WSW"]
strings=""
if s[0]=="x":
j==0
while j<4:
strings+=lists[j]
for i in range(n-1):
if strings[-2]=="W" and strings[-1]=="W" and s[i+1]=="o":
strings+="S"
elif strings[-... |
s208960194 | p03800 | u780962115 | 1570334239 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3560 | 2461 | n=int(input())
s=input()
flag=True
lists=["WWW","SWS","WSS","SSW","SWW","WWS","SSS","WSW"]
strings=""
if s[0]=="x":
j==0
while j<4:
strings+=lists[j]
for i in range(n-1):
if strings[-2]=="W" and strings[-1]=="W" and s[i+1]=="o":
strings+="S"
elif strings[-... |
s971162391 | p03800 | u350997995 | 1569041652 | Python | Python (3.4.3) | py | Runtime Error | 78 | 4608 | 1226 | N = int(input())
s = input()
ans = ""
def solve(n, S):
global N,s,ans
if n<1:
solve(n+1, S+"S")
solve(n+1, S+"W")
elif n<N-1:
if S[n]=="S":
if s[n]=="o": solve(n+1, S+S[n-1])
elif S[n-1]=="S": solve(n+1, S+"W")
else: solve(n+1, S+"S")
else:... |
s220585360 | p03800 | u480138356 | 1567116843 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1843 | def main():
N = int(input())
s = input()
# c = ["WS", "SW", "SS", "WW"]
c = ["SW", "WS", "SS", "WW"]
ok = False
for tmp in c:
ans = tmp
if
for i in range(1, N):
if s[i] == "o":# oの時
if ans[i-1] == "S" and ans[i] == "S":
ans... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.