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
s502759917
p00424
u110278902
1456570791
Python
Python
py
Runtime Error
0
0
362
while(1): table = {} output = '' table_number = int(input()) if table_number == 0: break for i in range(table_number): a, b = raw_input().split() table[a] = b string_number = int(input()) for i in (string_number): string = input() if string in table: output += table[string] else: output += string print output
s635538424
p00424
u110278902
1456570855
Python
Python
py
Runtime Error
0
0
369
while(1): table = {} output = '' table_number = int(input()) if table_number == 0: break for i in range(table_number): a, b = raw_input().split() table[a] = b string_number = int(input()) for i in (string_number): string = raw_input()[0] if string in table: output += table[string] else: output += string print output
s462716440
p00424
u820929609
1468202918
Python
Python3
py
Runtime Error
0
0
391
# -*- encoding:utf-8 -*- convert_list = {} result = [] n = int(raw_input()) for i in range(n): raw, converted = raw_input().rstrip().split(' ') convert_list[raw] = converted n = int(raw_input()) for i in range(n): key = raw_input().rstrip() if (key in convert_list.keys()): result.append(convert_list[key]) else: result.append(key) print(''.join(result))
s847655057
p00424
u820929609
1468202958
Python
Python3
py
Runtime Error
0
0
365
convert_list = {} result = [] n = int(raw_input()) for i in range(n): raw, converted = raw_input().rstrip().split(' ') convert_list[raw] = converted n = int(raw_input()) for i in range(n): key = raw_input().rstrip() if (key in convert_list.keys()): result.append(convert_list[key]) else: result.append(key) print(''.join(result))
s653044600
p00424
u820929609
1468203305
Python
Python3
py
Runtime Error
0
0
321
# -*- encoding:utf-8 -*- convert_list = {} result = [] n = int(raw_input()) for i in range(n): raw, converted = raw_input().rstrip().split(' ') convert_list[raw] = converted n = int(raw_input()) for i in range(n): key = raw_input().rstrip() result.append(convert_list.pop(key, key) print(''.join(result))
s901931305
p00424
u545973195
1475303925
Python
Python3
py
Runtime Error
0
0
282
answer="" while True: try: N=int(input()) except: break if answer!="": answer+="\n" b={} for i in range(N): a=input().split() b[a[0]]=a[1] M=int(input()) ans="" for i in range(M): c=input() if c in b: ans+=b[c] else: ans+=c answer+=ans print(answer)
s953934797
p00424
u813534019
1476351955
Python
Python3
py
Runtime Error
0
0
367
conv_map = {} str_result = "" while True: conv_map = {} str_result = "" n=input() if n==0: break for idx in range(0, n): lst = raw_input().split() conv_map[lst[0]] = lst[1] m=input() tmp="" for idx in range(0, m): tmp=raw_input() str_result += conv_map.get(tmp, tmp) print str_result
s981377076
p00424
u681787924
1476710144
Python
Python3
py
Runtime Error
0
0
985
#!/usr/bin/env python import sys class Converter: """????????????????????????????????????""" def __init__(self): self.table = {} for c in list("abcdefghijklmnopqrstuvwxyz"): self.table[c] = c for c in list("ABCDEFGHIJKLMNOPQRSTUVWXYZ"): self.table[c] = c for i in range(0, 10): self.table[str(i)] = str(i) def replace(self, before, after): self.table[before] = after def convert(self, key): return self.table[key] def debug_print(self): for v in self.table.values(): print(v) if __name__ == '__main__': rep_num = int(input()) while rep_num !=0 : converter = Converter() for count in range(0, rep_num): data = input().split() converter.replace(data[0], data[1]) for count in range(0, int(input())): print(converter.convert(input()), end="") print() rep_num = int(input())
s895050242
p00424
u681787924
1476710473
Python
Python3
py
Runtime Error
0
0
904
class Converter: def __init__(self): self.table = {} for c in list("abcdefghijklmnopqrstuvwxyz"): self.table[c] = c for c in list("ABCDEFGHIJKLMNOPQRSTUVWXYZ"): self.table[c] = c for i in range(0, 10): self.table[str(i)] = str(i) def replace(self, before, after): self.table[before] = after def convert(self, key): return self.table[key] def debug_print(self): for v in self.table.values(): print(v) if __name__ == '__main__': rep_num = int(input()) while rep_num !=0 : converter = Converter() for count in range(0, rep_num): data = input().split() converter.replace(data[0], data[1]) for count in range(0, int(input())): print(converter.convert(input()), end="") print() rep_num = int(input())
s254000767
p00424
u681787924
1476711071
Python
Python3
py
Runtime Error
0
0
925
class Converter: def __init__(self): self.table = {} for c in list("abcdefghijklmnopqrstuvwxyz"): self.table[c] = c for c in list("ABCDEFGHIJKLMNOPQRSTUVWXYZ"): self.table[c] = c for i in range(0, 10): self.table[str(i)] = str(i) def replace(self, before, after): self.table[before] = after def convert(self, key): return self.table[key] def debug_print(self): for v in self.table.values(): print(v) if __name__ == '__main__': rep_num = int(input()) while rep_num !=0 : converter = Converter() for count in range(0, rep_num): data = input().split() converter.replace(data[0], data[1]) output = "" for count in range(0, int(input())): output += converter.convert(input()) print(output) rep_num = int(input())
s777116653
p00424
u681787924
1476711272
Python
Python3
py
Runtime Error
0
0
991
class Converter: def __init__(self): self.table = {} self.reset() def reset(self): for c in list("abcdefghijklmnopqrstuvwxyz"): self.table[c] = c for c in list("ABCDEFGHIJKLMNOPQRSTUVWXYZ"): self.table[c] = c for i in range(0, 10): self.table[str(i)] = str(i) def replace(self, before, after): self.table[before] = after def convert(self, key): return self.table[key] def debug_print(self): for v in self.table.values(): print(v) if __name__ == '__main__': converter = Converter() rep_num = int(input()) while rep_num !=0 : for count in range(0, rep_num): data = input().split() converter.replace(data[0], data[1]) output = "" for count in range(0, int(input())): output += converter.convert(input()) print(output) rep_num = int(input()) converter.reset()
s843172593
p00424
u546285759
1478665416
Python
Python3
py
Runtime Error
0
0
376
while True: x = int(input()) if x == 0: break dcl = dict() for i in range(x): inp = list(map(str, input().split())) dcl[inp[0]] = inp[1] ans = "" x = int(input()) y = str(input()) for i in range(x): y = str(input()) if y in dcl: ans += dcl[y] else: ans += y print(ans)
s263199980
p00424
u801346721
1479985444
Python
Python3
py
Runtime Error
0
0
253
n1 = int(input()) A = [] B = [] for i in range(n): a, b = input().split() A.append(a) B.append(b) n2 = int(input()) for i in range(n): x = input() if x in A: if type(x) is int: x = int(B[i]) else: x = B[i] print("{0}".format(x)) print()
s718213305
p00424
u801346721
1479985591
Python
Python3
py
Runtime Error
0
0
255
n1 = int(input()) A = [] B = [] for i in range(n1): a, b = input().split() A.append(a) B.append(b) n2 = int(input()) for i in range(n2): x = input() if x in A: if type(x) is int: x = int(B[i]) else: x = B[i] print("{0}".format(x)) print()
s342782174
p00424
u801346721
1479985887
Python
Python3
py
Runtime Error
0
0
215
n = int(input()) A = [] B = [] for i in range(n): a, b = input().split() A.append(a) B.append(b) n = int(input()) s = 0 for i in range(n): x = input() if x in A: ind = A.index(x) x = B[ind] s += x print(s)
s099384458
p00424
u589276934
1496647672
Python
Python3
py
Runtime Error
0
0
966
# coding: utf-8 def registerDictionaryFromTheNumberOf(counts): dictionary = {} for i in range(counts): key, value = input().split(" ") dictionary[key] = value return dictionary def readCharacterBeforeConversionAsManyAs(counts): readString = "" for i in range(counts): readString += input() return readString def convertCharactersByThe(dictionary, target): converted = "" for index in range(len(list(target))): if target[index] in dictionary: converted += dictionary[target[index]] else: converted += target[index] return converted while True: dictionaryCounts = int(input()) if dictionaryCounts == 0: break dictionary = registerDictionaryFromTheNumberOf(dictionaryCounts)gg original = readCharacterBeforeConversionAsManyAs(int(input())) converted = convertCharactersByThe(dictionary, original) print(converted)
s150163785
p00424
u503263570
1499160302
Python
Python3
py
Runtime Error
0
0
371
import sys while True: try: n????????¨=int(input()) d????????¨ = [input().split() for i in range(n????????¨)] mData = int(input()) dData = [input() for i in range(mData)] except EOFError: exit() dt={} for i in d????????¨: i1=i[0] i2=i[1] dt[i1]=i2 for i in dData: if i in dt: sys.stdout.write(dt[i]) else: sys.stdout.write(i) print()
s303290648
p00424
u503263570
1499160382
Python
Python3
py
Runtime Error
0
0
302
import sys n????????¨=int(input()) d????????¨=[input().split() for i in range(n????????¨)] mData=int(input()) dData=[input() for i in range(mData)] dt={} for i in d????????¨: i1=i[0] i2=i[1] dt[i1]=i2 for i in dData: if i in dt: sys.stdout.write(dt[i]) else: sys.stdout.write(i) print()
s867693560
p00424
u503263570
1499160921
Python
Python3
py
Runtime Error
0
0
377
import sys while True: try: n????????¨=int(input()) d????????¨ = [input().split() for i in range(n????????¨)] mData = int(input()) dData = [input().strip() for i in range(mData)] except EOFError: exit() dt={} for i in d????????¨: i1,i2=i.split() dt[i1]=i2 for i in dData: if i in dt: sys.stdout.write(dt[i]) else: sys.stdout.write(i) print()
s754208513
p00424
u503263570
1499161235
Python
Python3
py
Runtime Error
0
0
369
import sys while True: try: n????????¨=int(input()) d????????¨ = [input().split() for i in range(n????????¨)] mData = int(input()) dData = [input().strip() for i in range(mData)] except EOFError: exit() dt={} for i in d????????¨: i1,i2=i dt[i1]=i2 for i in dData: if i in dt: sys.stdout.write(dt[i]) else: sys.stdout.write(i) print()
s434610210
p00424
u503263570
1499161521
Python
Python3
py
Runtime Error
0
0
413
import sys cin = sys.stdin while True: try: n????????¨=int(cin.readline()) d????????¨ = [cin.readline().split() for i in range(n????????¨)] mData = int(cin.readline()) dData = [cin.readline().strip() for i in range(mData)] except EOFError: exit() dt={} for i in d????????¨: i1,i2=i dt[i1]=i2 for i in dData: if i in dt: sys.stdout.write(dt[i]) else: sys.stdout.write(i) print()
s093413562
p00424
u354053070
1501995388
Python
Python3
py
Runtime Error
0
0
324
while True: n = int(input()) if n == 0: break pre = "" post = "" for _ in range(n): l = map(str, input().split()) pre += l[0] post += l[1] m = int(input()) data = "" for _ in range(m): data += input() print(data.translate(str.maketrans(pre, post)))
s033821574
p00424
u264972437
1503655399
Python
Python3
py
Runtime Error
0
0
250
while True: n = int(input()) if n == 0: break change = dict() for i in range(n): f,t = input() change[f] = t ans = '' m = int(input()) for j in range(m): s = input() if s in change: ans += change[s] else: ans += s print(ans)
s331493576
p00424
u256256172
1508152133
Python
Python3
py
Runtime Error
0
0
375
while True: n = int(input()) if n == 0: break x = {} for _ in range(n): a = input().split() x.update({a[0]: a[1]}) m = int(input()) y = [] for _ in range(m): b = input() if x[b] : y.append(x[b]) else: y.append(b) for i in range(m): print(y[i], end="") print()
s952520504
p00424
u256256172
1508153971
Python
Python3
py
Runtime Error
0
0
425
import sys while True: n = int(sys.stdin.readline().rstrip()) if n == 0: break; x = {} for _ in range(n): k,v = sys.stdin.readline().rstrip().split() dic[k] = v n = int(sys.stdin.readline().rstrip()) y = [] for _ in range(n): c = sys.stdin.readline().rstrip() if c in x: y.append(x[c]) else: y.append(c) print(''.join(y))
s243689004
p00424
u256256172
1508154022
Python
Python3
py
Runtime Error
0
0
426
import sys while True: n = int(sys.stdin.readline().rstrip()) if n == 0: break; x = {} for _ in range(n): k,v = sys.stdin.readline().rstrip().split() dic[k] = v n = int(sys.stdin.readline().rstrip()) y = [] for _ in range(n): c = sys.stdin.readline().rstrip() if c in x: y.append(x[c]) else: y.append(c) print(''.join(y))
s705776179
p00424
u256256172
1508154637
Python
Python3
py
Runtime Error
0
0
369
import sys while True: n = int(input()) if n == 0: break; x = {} for i in range(n): k,v = sys.stdin.readline().rstrip().split() x[k] = v y = [] for i in range(int(input()): a = sys.stdin.readline().rstrip() if a in x: y.append(x[a]) else: y.append(a) print(''.join(y))
s482366385
p00424
u546285759
1508905357
Python
Python3
py
Runtime Error
0
0
299
while True: n = int(input()) if n == 0: break d = {} for _ in range(n): a, b = input().split() d[a] = b m = int(input()) tmp = [input().strip() for _ in range(int(input()))] ans = [d[a] if a in d.keys() else a for a in tmp] print("".join(ans))
s100570298
p00424
u264972437
1516077922
Python
Python3
py
Runtime Error
0
0
412
inp = deque(input().replace('\t', '').split('\n')) input = inp.popleft while True: n = int(input()) if n == 0: break table = dict() for i in range(n): f,t = input().split(' ') table[f] = t m = int(input()) data = '' for j in range(m): s = input() if s in table: data += table[s] else: data += s print(data)
s816558948
p00424
u150984829
1517042033
Python
Python3
py
Runtime Error
0
0
219
import sys s=sys.stdin r=readline() while 1: n=int(s.r) if n==0:break d={} for _ in[0]*n: k,v=s.r.strip().split() d[k]=v a='' for _ in[0]*int(s.readline()): e=s.r.strip() a+=d[e]if e in d else e print(a)
s057591181
p00424
u150984829
1524984545
Python
Python3
py
Runtime Error
0
0
169
import sys s=sys.stdin.readline for n in iter(s,'0\n'): d={} for _ in[0]*int(n): k,v=s()[:-1].split() d[k]=v print(d.get(*[s()[0]]*2)for _ in[0]*int(s()),sep='')
s675523989
p00424
u158037864
1348753833
Python
Python
py
Runtime Error
0
18000
175
d = dict() n = int(input()) for i in range(n): a = input().split() d[a[0]] = d[a[1]] m = int(input()) for i in range(m): c = input() c = d.get(c,c) print(c,) print()
s940721877
p00424
u158037864
1348753923
Python
Python
py
Runtime Error
0
18000
172
d = dict() n = int(input()) for i in range(n): a = input().split() d[a[0]] = a[1] m = int(input()) for i in range(m): c = input() c = d.get(c,c) print(c,) print()
s274248916
p00424
u158037864
1348754548
Python
Python
py
Runtime Error
0
18000
176
d = dict() n = int(input()) for i in range(n): a = raw_input().split() d[a[0]] = a[1] m = int(input()) for i in range(m): c = input() c = d.get(c,c) print(c,) print()
s998983781
p00424
u158037864
1348754597
Python
Python
py
Runtime Error
0
18000
179
d = dict() n = int(input()) for i in range(n): a = input().split() d[a[0]] = d[a[1]] m = int(input()) for i in range(m): c = raw_input() c = d.get(c,c) print(c,) print()
s036829160
p00424
u158037864
1348754628
Python
Python
py
Runtime Error
0
18000
183
d = dict() n = int(input()) for i in range(n): a = raw_input().split() d[a[0]] = d[a[1]] m = int(input()) for i in range(m): c = raw_input() c = d.get(c,c) print(c,) print()
s616327349
p00424
u504990413
1354120148
Python
Python
py
Runtime Error
0
5036
874
while True: n = input() if n != 0: table = [['',''] for i in range(n)] for i in xrange(n): table[i][0],table[i][1] = map(str, raw_input().split(' ')) table0 = [table[i][0] for i in range(n)] table1 = [table[i][1] for i in range(n)] m = input() array = [] for i in xrange(m): array.append(raw_input()) array2 = [ '' for i in range(len(array))] for i in xrange(len(array)): if array[i] in table0: array2[i] = table1[table0.index(array[i])] else : array2[i] = array[i] for i in xrange(len(array2)-1): array2[i+1] = array2[i] + array2[i+1] print array2[-1] elif n == 0: break
s870954625
p00424
u093607836
1382953993
Python
Python
py
Runtime Error
0
0
324
import string n = int(raw_input()) while n != 0: from = [] to = [] for i in xrange(n): l = raw_input().split() from.append(l[0]) to.append(l[1]) a = string.maketrans(''.join(from), ''.join(to)) s = [] for i in xrange(int(raw_input())): s.append(raw_input().strip()) print s.translate(a) n = int(raw_input())
s998992052
p00424
u611853667
1383742444
Python
Python
py
Runtime Error
0
0
233
while True: dict = {} n = input() if n == 0:break for x in xrange(n): a, b = raw_input().split() dict[a] = b res = "" for x in xrange(input()): a = raw_input() if a in dict: res += dict[a] else res += a print a
s768062822
p00424
u858885710
1393768396
Python
Python
py
Runtime Error
0
0
390
out = [] append = out.append cnt = int(raw_input()) while cnt > 0: trans = {} while cnt > 0: k,v = raw_input().split(' ') trans[k] = v cnt -= 1 cnt = int(raw_input()) ans = '' while cnt > 0: load = raw_input() if load in trans.keys(): load = trans[load] ans += load cnt -= 1 print ans cnt = int(raw_iput())
s441829454
p00424
u858885710
1393768912
Python
Python
py
Runtime Error
0
0
369
out = [] append = out.append cnt = int(raw_input()) while cnt > 0: trans = {} for i in range(cnt): k,v = raw_input().split() trans[k] = v.rsplit() leng = int(raw_input()) ans = '' for i in range(leng): load = raw_input().rsplit() ans += (load in trans and trans[load]) or load print ans cnt = int(raw_input())
s645768337
p00424
u858885710
1393777753
Python
Python
py
Runtime Error
0
0
321
out = [] while True: n = int(raw_input()) if n == 0: break trans = {} for i in range(n): k,v = raw_input().split() trans[k] = v.rstrip() cnt = int(raw_input()) res = "" for j in range(n): a = raw_input().rstrip() if a in trans: a = trans[a] res += a out.append(a) for o in out: print o
s442810447
p00425
u150414576
1408111537
Python
Python
py
Runtime Error
0
0
871
def input_n(infile,outfile): while True: n = int(infile.readline()) if n == 0: break dice(infile,outfile,n) def dice(infile,outfile,n): point = 1 spot = 1 east = 3 south = 2 for i in range(n): buff = spot command = infile.readline() if command == "North": point += south spot = south south = (7 - buff) elif command == "South": point += (7 - south) spot = (7 - south) south = buff elif command == "East": point += (7 - east) spot = (7 - east) east = buff elif command == "West": point += east spot = east east = (7 - buff) elif command == "Right": remember = south south = east east = (7 - remember) elif command == "Left": remember = east east = south south = (7 - remember) else: break print >> outfile,point if __name__ == "__main__" import sys input_n(sys.stdin, sys.stdout)
s475331167
p00425
u150414576
1408111878
Python
Python
py
Runtime Error
0
0
868
def input_n(infile,outfile): while True: n = int(infile.readline()) if n == 0: break dice(infile,outfile,n) def dice(infile,outfile,n): point = 1 top = 1 east = 3 south = 2 for i in range(n): buff = top command = infile.readline() if command == "North": point += south top = south south = (7 - buff) elif command == "South": point += (7 - south) top = (7 - south) south = buff elif command == "East": point += (7 - east) top = (7 - east) east = buff elif command == "West": point += east top = east east = (7 - buff) elif command == "Right": remember = south south = east east = (7 - remember) elif command == "Left": remember = east east = south south = (7 - remember) else: break print >> outfile,point if __name__ == "__main__": import sys input_n(sys.stdin, sys.stdout)
s025244865
p00425
u879226672
1423748323
Python
Python
py
Runtime Error
0
0
1087
def North(ls): ls[1-1],ls[2-1],ls[5-1],ls[6-1] = ls[2-1],ls[6-1],ls[1-1],ls[5-1] def East(ls): ls[1-1],ls[3-1],ls[4-1],ls[6-1] = ls[4-1],ls[1-1],ls[6-1],ls[3-1] def West(ls): ls[1-1],ls[3-1],ls[4-1],ls[6-1] = ls[3-1],ls[6-1],ls[1-1],ls[4-1] def South(ls): ls[1-1],ls[2-1],ls[5-1],ls[6-1] = ls[5-1],ls[1-1],ls[6-1],ls[2-1] def Right(ls): ls[2-1],ls[3-1],ls[4-1],ls[5-1] = ls[3-1],ls[5-1],ls[2-1],ls[4-1] def Left(ls): ls[2-1],ls[3-1],ls[4-1],ls[5-1] = ls[4-1],ls[2-1],ls[5-1],ls[3-1] while True: n = int(raw_input()) dice = [1,2,3,4,5,6] # top, south, east, west, north, bottom direction = "" total = 1 for k in range(n): direction = str(raw_input()) if direction=="North": North(dice) elif direction=="East": East(dice) elif direction=="West": West(dice) elif direction=="South": South(dice) elif direction=="Right": Right(dice) elif direction=="Left": Left(dice) total += dice[0] print total
s788212797
p00425
u879226672
1423748412
Python
Python
py
Runtime Error
0
0
742
while True: try: n = int(raw_input()) if n==0: break dice = [1,2,3,4,5,6] # top, south, east, west, north, bottom direction = "" total = 1 for k in range(n): direction = str(raw_input()) if direction=="North": North(dice) elif direction=="East": East(dice) elif direction=="West": West(dice) elif direction=="South": South(dice) elif direction=="Right": Right(dice) elif direction=="Left": Left(dice) total += dice[0] print total except EOFError: break
s256643614
p00425
u355726239
1426603742
Python
Python
py
Runtime Error
0
0
1264
#!/usr/bin/env python import copy x = ['Front', 'Right', 'Back', 'Left'] y = ['Top', 'Front', 'Bottom', 'Back'] z = ['Top', 'Left', 'Bottom', 'Right'] def turn(dice, direction): turned_dice = copy.deepcopy(dice) # x????????? if direction == 'Right': for i in range(4): turned_dice[x[i]] = dice[x[(i+1)%4]] if direction == 'Left': for i in range(4): turned_dice[x[i]] = dice[x[(i-1)%4]] # y????????? if direction == 'North': for i in range(4): turned_dice[y[i]] = dice[y[(i+1)%4]] if direction == 'South': for i in range(4): turned_dice[y[i]] = dice[y[(i-1)%4]] # z????????? if direction == 'East': for i in range(4): turned_dice[z[i]] = dice[z[(i+1)%4]] if direction == 'West': for i in range(4): turned_dice[z[i]] = dice[z[(i-1)%4]] return turned_dice if __name__ == '__main__': while True: n = int(input()) if n == 0: break dice = {'Top': 1, 'Front': 2, 'Right': 3, 'Left': 4, 'Back': 5, 'Bottom': 6} ret = 1 for i in range(n): dice = turn(dice, input()) ret += dice['Top'] print(ret)
s189186075
p00425
u355726239
1426603806
Python
Python
py
Runtime Error
0
0
1288
#!/usr/bin/env python # -*- coding: utf-8 -*- import copy x = ['Front', 'Right', 'Back', 'Left'] y = ['Top', 'Front', 'Bottom', 'Back'] z = ['Top', 'Left', 'Bottom', 'Right'] def turn(dice, direction): turned_dice = copy.deepcopy(dice) # x????????? if direction == 'Right': for i in range(4): turned_dice[x[i]] = dice[x[(i+1)%4]] if direction == 'Left': for i in range(4): turned_dice[x[i]] = dice[x[(i-1)%4]] # y????????? if direction == 'North': for i in range(4): turned_dice[y[i]] = dice[y[(i+1)%4]] if direction == 'South': for i in range(4): turned_dice[y[i]] = dice[y[(i-1)%4]] # z????????? if direction == 'East': for i in range(4): turned_dice[z[i]] = dice[z[(i+1)%4]] if direction == 'West': for i in range(4): turned_dice[z[i]] = dice[z[(i-1)%4]] return turned_dice if __name__ == '__main__': while True: n = int(input()) if n == 0: break dice = {'Top': 1, 'Front': 2, 'Right': 3, 'Left': 4, 'Back': 5, 'Bottom': 6} ret = 1 for i in range(n): dice = turn(dice, input()) ret += dice['Top'] print(ret)
s096959899
p00425
u976860528
1431703039
Python
Python3
py
Runtime Error
0
0
1070
# -*- coding:shift-jis -*- class Dice: def __init__(self): self.top = 1 self.south = 2 self.north = 5 self.east = 3 self.west = 4 self.bottom = 6 def rotate(self,operation): if operation == "North": self.top,self.north,self.bottom,self.south = self.south,self.top,self.north,self.bottom elif operation == "East": self.top,self.east,self.bottom,self.west = self.west,self.top,self.east,self.bottom elif operation == "West": self.top,self.east,self.bottom,self.west = self.east,self.bottom,self.west,self.top elif operation == "South": self.top,self.north,self.bottom,self.south = self.north,self.bottom,self.south,self.top elif operation == "Right": self.north,self.east,self.south,self.west = self.west,self.north,self.east,self.south elif operation == "Left": self.north,self.east,self.south,self.west = self.east,self.south,self.west,self.north, n = int(input()[0]) while n!=0: inputs = [input() for _ in range(n)] value = 1 d = Dice() for i in inputs: d.rotate(i) value += d.top print(value) n = int(input())
s203561814
p00425
u520870854
1445802462
Python
Python
py
Runtime Error
0
0
572
# -*- coding: utf-8 -*- n = raw_input() while N != 0: a, b, c, d, e, f = 1, 2, 3, 4, 5, 6 s = 0 for i in range(n): op = raw_input() if op = "North": a, b, f, d = b, f, d, a elif op = "East": a, c, f, e = e, a, c, f elif op = "West": a, e, f, c = c, a, e, f elif op = "South": a, b, f, d = d, a, b, f elif op = "Right": b, c, d, e = c, d, e, b elif op = "Left": b, c, d, e = e, b, c, d s += a print s n = raw_input()
s264240394
p00425
u520870854
1445802591
Python
Python
py
Runtime Error
0
0
572
# -*- coding: utf-8 -*- n = raw_input() while n != 0: a, b, c, d, e, f = 1, 2, 3, 4, 5, 6 s = 0 for i in range(n): op = raw_input() if op = "North": a, b, f, d = b, f, d, a elif op = "East": a, c, f, e = e, a, c, f elif op = "West": a, e, f, c = c, a, e, f elif op = "South": a, b, f, d = d, a, b, f elif op = "Right": b, c, d, e = c, d, e, b elif op = "Left": b, c, d, e = e, b, c, d s += a print s n = raw_input()
s794098772
p00425
u520870854
1445802929
Python
Python
py
Runtime Error
0
0
578
# -*- coding: utf-8 -*- n = raw_input() while n != 0: a, b, c, d, e, f = 1, 2, 3, 4, 5, 6 s = 0 for i in range(n): op = raw_input() if op == "North": a, b, f, d = b, f, d, a elif op == "East": a, c, f, e = e, a, c, f elif op == "West": a, e, f, c = c, a, e, f elif op == "South": a, b, f, d = d, a, b, f elif op == "Right": b, c, d, e = c, d, e, b elif op == "Left": b, c, d, e = e, b, c, d s += a print s n = raw_input()
s425039675
p00425
u520870854
1445803308
Python
Python
py
Runtime Error
0
0
578
# -*- coding: utf-8 -*- n = raw_input() while n != 0: a, b, c, d, e, f = 1, 2, 3, 4, 5, 6 s = 0 for i in range(n): op = raw_input() if op == "North": a, b, f, d = b, f, d, a elif op == "East": a, c, f, e = e, a, c, f elif op == "West": a, e, f, c = c, a, e, f elif op == "South": a, b, f, d = d, a, b, f elif op == "Right": b, c, d, e = c, d, e, b elif op == "Left": b, c, d, e = e, b, c, d s += a print s n = raw_input()
s886460381
p00425
u520870854
1445803443
Python
Python
py
Runtime Error
0
0
582
# -*- coding: utf-8 -*- while True: n = raw_input() if n == 0: break a, b, c, d, e, f = 1, 2, 3, 4, 5, 6 s = 0 for i in range(n): op = raw_input() if op == "North": a, b, f, d = b, f, d, a elif op == "East": a, c, f, e = e, a, c, f elif op == "West": a, e, f, c = c, a, e, f elif op == "South": a, b, f, d = d, a, b, f elif op == "Right": b, c, d, e = c, d, e, b elif op == "Left": b, c, d, e = e, b, c, d s += a print s
s750862608
p00425
u520870854
1445803529
Python
Python
py
Runtime Error
0
0
557
while True: n = raw_input() if n == 0: break a, b, c, d, e, f = 1, 2, 3, 4, 5, 6 s = 0 for i in range(n): op = raw_input() if op == "North": a, b, f, d = b, f, d, a elif op == "East": a, c, f, e = e, a, c, f elif op == "West": a, e, f, c = c, a, e, f elif op == "South": a, b, f, d = d, a, b, f elif op == "Right": b, c, d, e = c, d, e, b elif op == "Left": b, c, d, e = e, b, c, d s += a print s
s286913638
p00425
u520870854
1445803775
Python
Python
py
Runtime Error
0
0
562
while True: n = str(raw_input()) if n == 0: break a, b, c, d, e, f = 1, 2, 3, 4, 5, 6 s = 0 for i in range(n): op = raw_input() if op == "North": a, b, f, d = b, f, d, a elif op == "East": a, c, f, e = e, a, c, f elif op == "West": a, e, f, c = c, a, e, f elif op == "South": a, b, f, d = d, a, b, f elif op == "Right": b, c, d, e = c, d, e, b elif op == "Left": b, c, d, e = e, b, c, d s += a print s
s847982574
p00425
u520870854
1445804279
Python
Python
py
Runtime Error
0
0
582
# -*- coding: utf-8 -*- while True: n = raw_input() if n == 0: break a, b, c, d, e, f = 1, 2, 3, 4, 5, 6 s = 0 for i in range(n): op = raw_input() if op == "North": a, b, f, d = b, f, d, a elif op == "East": a, c, f, e = e, a, c, f elif op == "West": a, e, f, c = c, a, e, f elif op == "South": a, b, f, d = d, a, b, f elif op == "Right": b, c, d, e = c, d, e, b elif op == "Left": b, c, d, e = e, b, c, d s += a print s
s810313993
p00425
u520870854
1445804552
Python
Python
py
Runtime Error
0
0
557
while True: n = raw_input() if n == 0: break a, b, c, d, e, f = 1, 2, 3, 4, 5, 6 s = 0 for i in range(n): op = raw_input() if op == "North": a, b, f, d = b, f, d, a elif op == "East": a, c, f, e = e, a, c, f elif op == "West": a, e, f, c = c, a, e, f elif op == "South": a, b, f, d = d, a, b, f elif op == "Right": b, c, d, e = c, d, e, b elif op == "Left": b, c, d, e = e, b, c, d s += a print s
s838723341
p00425
u520870854
1445805727
Python
Python
py
Runtime Error
0
0
558
while 1: T,U,N,E,W,S=1,6,5,3,4,2 n=int(raw_input()) if n==0: break ans=T for i in range(n): di=raw_input() if di=="North": N,T,S,U=T,S,U,N elif di=="East": E,U,W,T=T,E,U,W elif di=="South": T,S,U,N=N,T,S,U elif di=="West": T,E,U,W=E,U,W,T elif di=="Left": E,S,W,N=S,W,N,E elif di=="Right": S,W,N,E=E,S,W,N else: print '[*] Error ->',di raise IOError ans+=T print ans
s798473162
p00425
u520870854
1445805888
Python
Python
py
Runtime Error
0
0
566
while 1: T,U,N,E,W,S=1,6,5,3,4,2 n=int(raw_input()) if n==0: break ans=T for i in range(n): di=raw_input() if di=="North": N,T,S,U=T,S,U,N elif di=="East": E,U,W,T=T,E,U,W elif di=="South": T,S,U,N=N,T,S,U elif di=="West": T,E,U,W=E,U,W,T elif di=="Left": E,S,W,N=S,W,N,E elif di=="Right": S,W,N,E=E,S,W,N else: print '[*] Error ->',di raise IOError ans+=T ????????????print ans
s077915019
p00425
u280308796
1454390188
Python
Python3
py
Runtime Error
0
0
1008
# coding: utf-8 # Here your code ! Dice = [1,2,3] # top,front,right def North(d): d = [d[1]] + [7 -d[0]] + [d[2]] return d def East(d): d = [7-d[2]] + [d[1]] + [d[0]] return d def South(d): d = [7-d[1]] + [d[0]] + [d[2]] return d def West(d): d = [d[2]] + [d[1]] + [7-d[0]] return d def Right(d): d = [d[0]] + [d[2]] + [7-d[1]] return d def Left(d): d = [d[0]] + [7-d[2]] + [d[1]] return d while True: n = int(input()) if n == 0: break dice = [1,2,3] result = 1 for _ in range(n): direction = input() # if direction == 'North': # dice = North(dice) # if direction == 'East': # dice = East(dice) # if direction == 'South': # dice = South(dice) # if direction == 'West': # dice = West(dice) dice = eval(direction+"(dice)") #print(dice) result += dice[0] print(result)
s827085776
p00425
u280308796
1454390212
Python
Python3
py
Runtime Error
0
0
740
# coding: utf-8 # Here your code ! Dice = [1,2,3] # top,front,right def North(d): d = [d[1]] + [7 -d[0]] + [d[2]] return d def East(d): d = [7-d[2]] + [d[1]] + [d[0]] return d def South(d): d = [7-d[1]] + [d[0]] + [d[2]] return d def West(d): d = [d[2]] + [d[1]] + [7-d[0]] return d def Right(d): d = [d[0]] + [d[2]] + [7-d[1]] return d def Left(d): d = [d[0]] + [7-d[2]] + [d[1]] return d while True: n = int(input()) if n == 0: break dice = [1,2,3] result = 1 for _ in range(n): direction = input() dice = eval(direction+"(dice)") #print(dice) result += dice[0] print(result)
s442413939
p00425
u280308796
1454390816
Python
Python3
py
Runtime Error
0
0
878
import sys operator = sys.stdin.read().split() top = 1 bottom = 6 south = 2 north = 5 east = 3 west = 4 sum = 1 for var in operator[1:]: if var == "North": north,top,south,bottom = top,south,bottom,north sum += top elif var == "South": south,top,north,bottom = top,north,bottom,south sum += top elif var == "West": west,top,east,bottom = top,east,bottom,west sum += top elif var == "East": east,top,west,bottom = top,west,bottom,east sum += top elif var == "Right": south,east,north,west = east,north,west,south sum += top elif var == "Left": south,west,north,east = west,north,east,south sum += top else: print sum top = 1 bottom = 6 south = 2 north = 5 east = 3 west = 4 sum = 1
s909938301
p00425
u110278902
1456575641
Python
Python
py
Runtime Error
0
0
449
while(1): count = input() if count == 0: break original_cube = [1, 2, 3, 4, 5, 6] operation{'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left[1, 4, 2, 5, 3, 6]} new_cube = [] for i in xrange(count): for e in operation[input()]: new_cube.append(previous_cube[e]) sum += new_cube[0] previous_cube = new_ccube new_cube = []
s686785142
p00425
u110278902
1456575666
Python
Python
py
Runtime Error
0
0
471
while(1): count = input() if count == 0: break original_cube = [1, 2, 3, 4, 5, 6] operation{'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left[1, 4, 2, 5, 3, 6]} new_cube = [] sum = 0 for i in xrange(count): for e in operation[input()]: new_cube.append(previous_cube[e]) sum += new_cube[0] previous_cube = new_ccube new_cube = [] print sum
s294695587
p00425
u110278902
1456575724
Python
Python
py
Runtime Error
0
0
455
while(1): count = input() if count == 0: break original_cube = [1, 2, 3, 4, 5, 6] operation{'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left[1, 4, 2, 5, 3, 6]} sum = 0 for i in xrange(count): new_cube = [] for e in operation[input()]: new_cube.append(previous_cube[e]) sum += new_cube[0] previous_cube = new_ccube print sum
s333190320
p00425
u110278902
1456575758
Python
Python
py
Runtime Error
0
0
455
while(1): count = input() if count == 0: break original_cube = [1, 2, 3, 4, 5, 6] operation{'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for e in operation[input()]: new_cube.append(previous_cube[e]) sum += new_cube[0] previous_cube = new_ccube print sum
s026746431
p00425
u110278902
1456575762
Python
Python
py
Runtime Error
0
0
455
while(1): count = input() if count == 0: break original_cube = [1, 2, 3, 4, 5, 6] operation{'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for e in operation[input()]: new_cube.append(previous_cube[e]) sum += new_cube[0] previous_cube = new_ccube print sum
s019619025
p00425
u110278902
1456575948
Python
Python
py
Runtime Error
0
0
459
while(1): count = input() if count == 0: break original_cube = [1, 2, 3, 4, 5, 6] operation{'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for e in operation[raw_input()]: new_cube.append(previous_cube[e]) sum += new_cube[0] previous_cube = new_ccube print sum
s593148191
p00425
u110278902
1456576067
Python
Python
py
Runtime Error
0
0
444
while(1): count = input() if count == 0: break original_cube = [1, 2, 3, 4, 5, 6] operation{'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] new_cube.append(previous_cube[operation[raw_input()][0]]) sum += new_cube[0] previous_cube = new_ccube print sum
s924056280
p00425
u110278902
1456576100
Python
Python
py
Runtime Error
0
0
444
while(1): count = input() if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation{'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] new_cube.append(previous_cube[operation[raw_input()][0]]) sum += new_cube[0] previous_cube = new_ccube print sum
s709137076
p00425
u110278902
1456576152
Python
Python
py
Runtime Error
0
0
470
while(1): count = input() if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation{'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for i in xrange(6): new_cube.append(previous_cube[operation[raw_input()][e]]) sum += new_cube[0] previous_cube = new_ccube print sum
s320615427
p00425
u110278902
1456576158
Python
Python
py
Runtime Error
0
0
470
while(1): count = input() if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation{'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for i in xrange(6): new_cube.append(previous_cube[operation[raw_input()][i]]) sum += new_cube[0] previous_cube = new_ccube print sum
s744929375
p00425
u110278902
1456578176
Python
Python
py
Runtime Error
0
0
469
while(1): count = input() if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation{'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for i in xrange(6): new_cube.append(previous_cube[operation[raw_input()][i]]) sum += new_cube[0] previous_cube = new_cube print sum
s457346904
p00425
u110278902
1456578246
Python
Python
py
Runtime Error
0
0
474
while(1): count = int(input()) if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation{'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for i in xrange(6): new_cube.append(previous_cube[operation[raw_input()][i]]) sum += new_cube[0] previous_cube = new_cube print sum
s280375708
p00425
u110278902
1456578885
Python
Python
py
Runtime Error
0
0
478
while(1): count = int(raw_input()) if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation{'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for i in xrange(6): new_cube.append(previous_cube[operation[raw_input()][i]]) sum += new_cube[0] previous_cube = new_cube print sum
s998370593
p00425
u110278902
1456578898
Python
Python
py
Runtime Error
0
0
479
while(1): count = int(raw_input()) if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation{'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left'[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for i in xrange(6): new_cube.append(previous_cube[operation[raw_input()][i]]) sum += new_cube[0] previous_cube = new_cube print sum
s837389341
p00425
u110278902
1456578907
Python
Python
py
Runtime Error
0
0
480
while(1): count = int(raw_input()) if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation{'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left':[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for i in xrange(6): new_cube.append(previous_cube[operation[raw_input()][i]]) sum += new_cube[0] previous_cube = new_cube print sum
s427959977
p00425
u110278902
1456579024
Python
Python
py
Runtime Error
0
0
483
while(1): count = int(raw_input()) if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation = {'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left':[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for i in xrange(6): new_cube.append(previous_cube[operation[raw_input()][i]]) sum += new_cube[0] previous_cube = new_cube print sum
s228090872
p00425
u110278902
1456579042
Python
Python
py
Runtime Error
0
0
483
while(1): count = int(raw_input()) if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation = {'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left':[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for e in xrange(6): new_cube.append(previous_cube[operation[raw_input()][e]]) sum += new_cube[0] previous_cube = new_cube print sum
s194145888
p00425
u110278902
1456579153
Python
Python
py
Runtime Error
0
0
488
while(1): count = int(raw_input()) if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation = {'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left':[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for e in xrange(6): new_cube.append(previous_cube[operation[str(raw_input())][e]]) sum += new_cube[0] previous_cube = new_cube print sum
s794131558
p00425
u110278902
1456579177
Python
Python
py
Runtime Error
0
0
488
while(1): count = int(raw_input()) if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation = {'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left':[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for e in xrange(5): new_cube.append(previous_cube[operation[str(raw_input())][e]]) sum += new_cube[0] previous_cube = new_cube print sum
s617938355
p00425
u110278902
1456579345
Python
Python
py
Runtime Error
0
0
490
while(1): count = int(raw_input()) if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation = {'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left':[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count-1): new_cube = [] for e in xrange(5): new_cube.append(previous_cube[operation[str(raw_input())][e]]) sum += new_cube[0] previous_cube = new_cube print sum
s999390250
p00425
u110278902
1456579899
Python
Python
py
Runtime Error
0
0
494
while(1): count = int(raw_input()) if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation = {'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left':[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for e in xrange(5): new_cube.append(previous_cube[operation[str(raw_input().strip)][e]]) sum += new_cube[0] previous_cube = new_cube print sum
s603676441
p00425
u110278902
1456579902
Python
Python
py
Runtime Error
0
0
494
while(1): count = int(raw_input()) if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation = {'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left':[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for e in xrange(5): new_cube.append(previous_cube[operation[str(raw_input().strip)][e]]) sum += new_cube[0] previous_cube = new_cube print sum
s591671608
p00425
u110278902
1456579916
Python
Python
py
Runtime Error
0
0
495
while(1): count = int(raw_input()) if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation = {'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left':[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for e in xrange(5): new_cube.append(previous_cube[operation[str(raw_input().strip()][e]]) sum += new_cube[0] previous_cube = new_cube print sum
s671554451
p00425
u110278902
1456579924
Python
Python
py
Runtime Error
0
0
491
while(1): count = int(raw_input()) if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation = {'North':[2, 6, 3, 4, 1, 5], 'East':[4, 2, 1, 6, 5, 3], 'West': [3, 2, 6, 1, 5, 4], 'South':[5, 1, 3, 4, 6, 2], 'Right':[1, 3, 5, 2, 4, 6], 'Left':[1, 4, 2, 5, 3, 6]} sum = 1 for i in xrange(count): new_cube = [] for e in xrange(5): new_cube.append(previous_cube[operation[raw_input().strip()][e]]) sum += new_cube[0] previous_cube = new_cube print sum
s847103575
p00425
u110278902
1456580591
Python
Python
py
Runtime Error
0
0
491
while(1): count = int(raw_input()) if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation = {'North':[1, 5, 2, 3, 0, 4], 'East':[3, 1, 0, 5, 4, 2], 'West': [2, 1, 5, 0, 4, 3], 'South':[4, 0, 2, 3, 5, 1], 'Right':[0, 2, 4, 1, 3, 5], 'Left':[0, 3, 1, 4, 2, 5]} sum = 1 for i in xrange(count): new_cube = [] for e in xrange(5): new_cube.append(previous_cube[operation[raw_input().strip()][e]]) sum += new_cube[0] previous_cube = new_cube print sum
s633987697
p00425
u110278902
1456581675
Python
Python
py
Runtime Error
0
0
493
while True: count = int(raw_input()) if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation = {'North':[1, 5, 2, 3, 0, 4], 'East':[3, 1, 0, 5, 4, 2], 'West': [2, 1, 5, 0, 4, 3], 'South':[4, 0, 2, 3, 5, 1], 'Right':[0, 2, 4, 1, 3, 5], 'Left':[0, 3, 1, 4, 2, 5]} sum = 1 for i in xrange(count): new_cube = [] for e in xrange(5): new_cube.append(previous_cube[operation[raw_input().strip()][e]]) sum += new_cube[0] previous_cube = new_cube print sum
s408418993
p00425
u110278902
1456581685
Python
Python
py
Runtime Error
0
0
484
while True: count = input() if count == 0: break previous_cube = [1, 2, 3, 4, 5, 6] operation = {'North':[1, 5, 2, 3, 0, 4], 'East':[3, 1, 0, 5, 4, 2], 'West': [2, 1, 5, 0, 4, 3], 'South':[4, 0, 2, 3, 5, 1], 'Right':[0, 2, 4, 1, 3, 5], 'Left':[0, 3, 1, 4, 2, 5]} sum = 1 for i in xrange(count): new_cube = [] for e in xrange(5): new_cube.append(previous_cube[operation[raw_input().strip()][e]]) sum += new_cube[0] previous_cube = new_cube print sum
s872694750
p00425
u797673668
1456678440
Python
Python3
py
Runtime Error
0
0
459
orders = { 'North': (2, 6, 3, 4, 1, 5), 'East': (4, 2, 1, 6, 5, 3), 'West': (3, 2, 6, 1, 5, 4), 'South': (5, 1, 3, 4, 6, 2), 'Right': (1, 3, 5, 2, 4, 6), 'Left': (1, 4, 2, 5, 3, 6), } while True: n = int(input()) if not n: break dice = list(range(1, 7)) top = 1 while n: new_dice = [dice[s - 1] for s in orders[input()]] dice = new_dice top += dice[0] n -= 1 print(top)
s979814835
p00425
u797673668
1456678891
Python
Python3
py
Runtime Error
0
0
458
orders = { 'North': (2, 6, 3, 4, 1, 5), 'East': (4, 2, 1, 6, 5, 3), 'West': (3, 2, 6, 1, 5, 4), 'South': (5, 1, 3, 4, 6, 2), 'Right': (1, 3, 5, 2, 4, 6), 'Left': (1, 4, 2, 5, 3, 6) } while True: n = int(input()) if not n: break dice = list(range(1, 7)) top = 1 while n: new_dice = [dice[s - 1] for s in orders[input()]] dice = new_dice top += dice[0] n -= 1 print(top)
s783911258
p00425
u797673668
1456678969
Python
Python3
py
Runtime Error
0
0
430
orders = { 'North': (2, 6, 3, 4, 1, 5), 'East': (4, 2, 1, 6, 5, 3), 'West': (3, 2, 6, 1, 5, 4), 'South': (5, 1, 3, 4, 6, 2), 'Right': (1, 3, 5, 2, 4, 6), 'Left': (1, 4, 2, 5, 3, 6) } while True: n = int(input()) if not n: break dice = list(range(1, 7)) top = 1 while n: dice = [dice[s - 1] for s in orders[input()]] top += dice[0] n -= 1 print(top)
s631574091
p00425
u797673668
1456679023
Python
Python3
py
Runtime Error
0
0
446
print('dummy') orders = { 'North': (2, 6, 3, 4, 1, 5), 'East': (4, 2, 1, 6, 5, 3), 'West': (3, 2, 6, 1, 5, 4), 'South': (5, 1, 3, 4, 6, 2), 'Right': (1, 3, 5, 2, 4, 6), 'Left': (1, 4, 2, 5, 3, 6) } while True: n = int(input()) if not n: break dice = list(range(1, 7)) top = 1 while n: dice = [dice[s - 1] for s in orders[input()]] top += dice[0] n -= 1 print(top)
s084851978
p00425
u797673668
1456679119
Python
Python3
py
Runtime Error
0
0
437
orders = { 'North': (2, 6, 3, 4, 1, 5), 'East': (4, 2, 1, 6, 5, 3), 'West': (3, 2, 6, 1, 5, 4), 'South': (5, 1, 3, 4, 6, 2), 'Right': (1, 3, 5, 2, 4, 6), 'Left': (1, 4, 2, 5, 3, 6) } while True: n = int(input()) if not n: break dice = list(range(1, 7)) top = 1 while n: dice = [dice[s - 1] for s in orders[input()]] top += dice[0] n -= 1 print(top) exit()
s146862119
p00425
u797673668
1456679192
Python
Python3
py
Runtime Error
0
0
445
orders = { 'North': (2, 6, 3, 4, 1, 5), 'East': (4, 2, 1, 6, 5, 3), 'West': (3, 2, 6, 1, 5, 4), 'South': (5, 1, 3, 4, 6, 2), 'Right': (1, 3, 5, 2, 4, 6), 'Left': (1, 4, 2, 5, 3, 6) } while True: n = int(input()) if not n: exit() break dice = list(range(1, 7)) top = 1 while n: dice = [dice[s - 1] for s in orders[input()]] top += dice[0] n -= 1 print(top)
s830887158
p00425
u110278902
1457119390
Python
Python
py
Runtime Error
0
0
484
while True: count = input() if count == 0: break previous_cube = [0, 1, 2, 3, 4, 5] operation = {'North':[1, 5, 2, 3, 0, 4], 'East':[3, 1, 0, 5, 4, 2], 'West': [2, 1, 5, 0, 4, 3], 'South':[4, 0, 2, 3, 5, 1], 'Right':[0, 2, 4, 1, 3, 5], 'Left':[0, 3, 1, 4, 2, 5]} sum = 1 for i in xrange(count): new_cube = [] for e in xrange(5): new_cube.append(previous_cube[operation[raw_input().strip()][e]]) sum += new_cube[0] previous_cube = new_cube print sum
s886788857
p00425
u110278902
1457119568
Python
Python
py
Runtime Error
0
0
485
while True: count = input() if count == 0: break previous_cube = [ 1, 2, 3, 4, 5, 6] operation = {'North':[1, 5, 2, 3, 0, 4], 'East':[3, 1, 0, 5, 4, 2], 'West': [2, 1, 5, 0, 4, 3], 'South':[4, 0, 2, 3, 5, 1], 'Right':[0, 2, 4, 1, 3, 5], 'Left':[0, 3, 1, 4, 2, 5]} sum = 1 for i in xrange(count): new_cube = [] for e in xrange(5): new_cube.append(previous_cube[operation[raw_input().split()][e]]) sum += new_cube[0] previous_cube = new_cube print sum
s194660433
p00425
u110278902
1457119613
Python
Python
py
Runtime Error
0
0
477
while True: count = input() if count == 0: break previous_cube = [ 1, 2, 3, 4, 5, 6] operation = {'North':[1, 5, 2, 3, 0, 4], 'East':[3, 1, 0, 5, 4, 2], 'West': [2, 1, 5, 0, 4, 3], 'South':[4, 0, 2, 3, 5, 1], 'Right':[0, 2, 4, 1, 3, 5], 'Left':[0, 3, 1, 4, 2, 5]} sum = 1 for i in xrange(count): new_cube = [] for e in xrange(5): new_cube.append(previous_cube[operation[raw_input()][e]]) sum += new_cube[0] previous_cube = new_cube print sum
s530169465
p00425
u110278902
1457119625
Python
Python
py
Runtime Error
0
0
482
while True: count = input() if count == 0: break previous_cube = [ 1, 2, 3, 4, 5, 6] operation = {'North':[1, 5, 2, 3, 0, 4], 'East':[3, 1, 0, 5, 4, 2], 'West': [2, 1, 5, 0, 4, 3], 'South':[4, 0, 2, 3, 5, 1], 'Right':[0, 2, 4, 1, 3, 5], 'Left':[0, 3, 1, 4, 2, 5]} sum = 1 for i in xrange(count): new_cube = [] for e in xrange(5): new_cube.append(previous_cube[operation[str(raw_input())][e]]) sum += new_cube[0] previous_cube = new_cube print sum