Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for i in range(N):
    temp = input()
    val = [0 for k in range(26)]
    for j in range(10):
        val[ord(temp[j])-97] += 1
    S.append(val)

kind = [S[0]]
cnt = [1]
lenkind = 1
for i in range(1, N):
    flg = 0
    for j in range(lenkind):
        if S[i] == kind[j]:
            cnt[j] += 1
            flg = 1
            break
    if flg == 0:
        kind.append(S[i])
        cnt.append(1)
        lenkind += 1

ans = 0
for i in range(lenkind):
    temp = cnt[i]
    ans += (temp*(temp-1) // 2)
print(str(ans))


Fixed submission:
N = int(input())
S = []
for i in range(N):
    temp = input()
    S.append(''.join(sorted(temp)))
S.sort()
row = 1
ans = 0
for i in range(N-1):
    if S[i] == S[i+1]:
        row += 1
    else:
        ans += (row*(row-1) // 2)
        row = 1
if row > 1:
    ans += (row*(row-1) // 2)
print(str(ans))
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
N = a[0]
Q = a[1]
numofac = [0 for i in range(N)]
S = input()
appear = 0
index = 1
while index < N:
    if S[index-1] == "A" and S[index] == "C":
        appear += 1
        numofac[index] = appear
        numofac[index+1] = appear
        index += 2
    else:
        numofac[index] = appear
        index += 1
for i in range(Q):
    q = list(map(int,input().split()))
    print(str(numofac[q[1]-1] - numofac[q[0]-1]))

Fixed submission:
a = list(map(int,input().split()))
N = a[0]
Q = a[1]
numofac = [0 for i in range(N)]
S = input()
appear = 0
index = 1
while index < N:
    if S[index-1] == "A" and S[index] == "C":
        appear += 1
        numofac[index] = appear
        if index != N-1:
            numofac[index+1] = appear
        index += 2
    else:
        numofac[index] = appear
        index += 1
for i in range(Q):
    q = list(map(int,input().split()))
    print(str(numofac[q[1]-1] - numofac[q[0]-1]))
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
N = a[0]
M = a[1]
dct = {}
for i in range(N):
    temp = list(map(int,input().split()))
    if temp[0] in dct:
        val = dct[temp[0]] + temp[1]
        dct[temp[0]] = val
    else:
        dct[temp[0]] = temp[1]

dct = sorted(dct.items())
ruiseki = 0
loop = 0

cost = []
nums = []
ans = 0
for i in range(N):
    cost.append(dct[i][0])
    nums.append(dct[i][1])
if nums[0] >= M:
    print(str(cost[0]*M))
else:
    ans += cost[0]*nums[0]
    for i in range(1, 100001):
        nums[i] += nums[i-1]
        if nums[i] >= M:
            print(str(ans + cost[i]*(M - nums[i-1])))
            break
        ans += cost[i]*(nums[i]-nums[i-1])


Fixed submission:
a = list(map(int,input().split()))
N = a[0]
M = a[1]
dct = {}
for i in range(N):
    temp = list(map(int,input().split()))
    if temp[0] in dct:
        val = dct[temp[0]] + temp[1]
        dct[temp[0]] = val
    else:
        dct[temp[0]] = temp[1]

dct = sorted(dct.items())
ruiseki = 0
loop = 0

cost = []
nums = []
ans = 0
lendct = len(dct)
for i in range(lendct):
    cost.append(dct[i][0])
    nums.append(dct[i][1])
if nums[0] >= M:
    print(str(cost[0]*M))
else:
    ans += cost[0]*nums[0]
    for i in range(1, 100001):
        nums[i] += nums[i-1]
        if nums[i] >= M:
            print(str(ans + cost[i]*(M - nums[i-1])))
            break
        ans += cost[i]*(nums[i]-nums[i-1])
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n = int(input())
A = list(map(int, input().split()))
ans = gcd(*A)
print(str(ans))

Fixed submission:
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
A = list(map(int, input().split()))
ans = gcd(*A)
print(str(ans))

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, (numbers))

n = int(input())
A = list(map(int, input().split()))
ans = gcd(*A)
print(str(ans))

Fixed submission:
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
A = list(map(int, input().split()))
ans = gcd(*A)
print(str(ans))
Buggy python submission (verdict: Runtime Error):
D=int(input())
if D==25:
    print("Christmas")
else if D==24:
    print("Christmas Eve")
else if D==23:
    print("Christmas Eve Eve")
else if D==22:
    print("Christmas Eve Eve Eve")

Fixed submission:
D=int(input())
if D==25:
    print("Christmas")
elif D==24:
    print("Christmas Eve")
elif D==23:
    print("Christmas Eve Eve")
elif D==22:
    print("Christmas Eve Eve Eve")
Buggy python submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline
write = sys.stdout.write

N, M = map(int,input().split())
cities = []
for i in range(M):
    p, y = map(int,readline().split())
    temp = [p, y, i]
    cities.append(temp)
id = [1 for i in range(M)]
sortedcities = sorted(cities, key=lambda x:x[1])
for i in range(M):
    sortedcities[i].append(id[sortedcities[i][0]-1])
    id[sortedcities[i][0]-1] += 1
originalcities = sorted(sortedcities, key=lambda x:x[2])
for i in range(M):
    write(str(originalcities[i][0]).zfill(6) + str(originalcities[i][3]).zfill(6) + "\n")

Fixed submission:
import sys
readline = sys.stdin.readline
write = sys.stdout.write

N, M = map(int,input().split())
cities = []
for i in range(M):
    p, y = map(int,readline().split())
    temp = [p, y, i]
    cities.append(temp)
id = [1 for i in range(N)] #国i+1の都市に対して次に割り振るべきID
sortedcities = sorted(cities, key=lambda x:x[1])
for i in range(M):
    sortedcities[i].append(id[sortedcities[i][0]-1])
    id[sortedcities[i][0]-1] += 1
originalcities = sorted(sortedcities, key=lambda x:x[2])
for i in range(M):
    write(str(originalcities[i][0]).zfill(6) + str(originalcities[i][3]).zfill(6) + "\n")
Buggy python submission (verdict: Runtime Error):
A, B = map(int,input().split())
print(str(max(A+B, A-B., A*B)))

Fixed submission:
A, B = map(int,input().split())
print(str(max(A+B, A-B, A*B)))
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    if b == 0:
        return a
    if a <= b:
        temp = a
        a = b
        b = temp
    r = a % b
    if r == 0:
        return b
    else:
        return gcd(b, r)


N, K = map(int,input().split())
A = list(map(int,input().split()))
#Aの最大公約数を作ることが出来る

A.sort()
if K > A[-1]:
    print("IMPOSSIBLE")
else:
    g = gcd(A[0], A[1])
    for i in range(2, N):
        g = gcd(g, A[2])
    if K % g == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

Fixed submission:
def gcd(a, b):
    if b == 0:
        return a
    if a <= b:
        temp = a
        a = b
        b = temp
    r = a % b
    if r == 0:
        return b
    else:
        return gcd(b, r)


N, K = map(int,input().split())
A = list(map(int,input().split()))
#Aの最大公約数を作ることが出来る

A.sort()
if K > A[-1]:
    print("IMPOSSIBLE")
elif N == 1:
    if K != A[0]:
        print("IMPOSSIBLE")
    else:
        print("POSSIBLE")
else:
    g = gcd(A[0], A[1])
    for i in range(2, N):
        g = gcd(g, A[i])
    if K % g == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
#数列の値を重複無く昇順に並べたものとその個数を別々に保存する
#配列のどこに挿入等の操作をするかは二分探索で調べる

def bs(A, key, B, keynum):
    sizeA = len(A)
    # 0なら挿入確定
    if sizeA == 0:
        A.append(key)
        B.append(keynum)
        return

    l = 0
    r = sizeA - 1
    mid = (l+r) // 2

    while r - l >= 1:
        if A[mid] == key:
            break
        elif key < A[mid]:
            r = mid
        else:
            l = mid + 1
        mid = (l+r) // 2
    #この時点で,A[mid]はkeyと等しいかkeyより大きい最小の値である(ただしkeyがAのどの要素よりも大きい時を除く)
    if A[mid] == key:
        B[mid] += keynum
    elif A[mid] < key:
        A.append(key)
        B.append(keynum)
    else:
        A.insert(mid, key)
        B.insert(mid, keynum)

a = list(map(int,input().split()))
N = a[0]
K = a[1]

syurui = []
kousuu = []
for i in range(N):
    temp = list(map(int,input().split()))
    bs(syurui, temp[0], kousuu, temp[1])

size = len(kousuu)
sum = [0 for i in range(size)]
sum[0] = kousuu[0]
for i in range(size):
    if i > 0:
        sum[i] = sum[i-1] + kousuu[i]
    if K <= sum[i]:
        print(str(syurui[i]))
        break

Fixed submission:
a = list(map(int,input().split()))
N = a[0]
K = a[1]
bucket = [0 for i in range(100001)]
for i in range(N):
    temp = list(map(int,input().split()))
    bucket[temp[0]] += temp[1]
sum = 0
for i in range(100001):
    sum += bucket[i]
    if K <= sum:
        print(str(i))
        break

Buggy python submission (verdict: Time Limit Exceeded):
#数列の値を重複無く昇順に並べたものとその個数を別々に保存する
#配列のどこに挿入等の操作をするかは二分探索で調べる

def bs(A, key, B, keynum):
    sizeA = len(A)
    # 0なら挿入確定
    if sizeA == 0:
        A.append(key)
        B.append(keynum)
        return

    l = 0
    r = sizeA - 1
    mid = (l+r) // 2

    while r - l >= 1:
        if A[mid] == key:
            break
        elif key < A[mid]:
            r = mid
        else:
            l = mid + 1
        mid = (l+r) // 2
    #この時点で,A[mid]はkeyと等しいかkeyより大きい最小の値である(ただしkeyがAのどの要素よりも大きい時を除く)
    if A[mid] == key:
        B[mid] += keynum
    elif A[mid] < key:
        A.append(key)
        B.append(keynum)
    else:
        A.insert(mid, key)
        B.insert(mid, keynum)

a = list(map(int,input().split()))
N = a[0]
K = a[1]

syurui = []
kousuu = []
for i in range(N):
    temp = list(map(int,input().split()))
    bs(syurui, temp[0], kousuu, temp[1])

size = len(kousuu)
sum = [0 for i in range(size)]
sum[0] = kousuu[0]
for i in range(size):
    if i > 0:
        sum[i] = sum[i-1] + kousuu[i]
    if K <= sum[i]:
        print(str(syurui[i]))
        break

Fixed submission:
a = list(map(int,input().split()))
N = a[0]
K = a[1]
bucket = [0 for i in range(100001)]
for i in range(N):
    temp = list(map(int,input().split()))
    bucket[temp[0]] += temp[1]
sum = 0
for i in range(100001):
    sum += bucket[i]
    if K <= sum:
        print(str(i))
        break
Buggy python submission (verdict: Runtime Error):
x=int(input())
mod=x%11
div=int(x/11)
if mod > 6:
    print(div*2+2)
elif: mod == 0:
    print(div*2)
else:
    print(div*2+1)

Fixed submission:
x=int(input())
mod=x%11
div=int(x/11)
if mod > 6:
    print(div*2+2)
elif mod == 0:
    print(div*2)
else:
    print(div*2+1)
Buggy python submission (verdict: Time Limit Exceeded):
a=list(map(int,input().split()))
ans=0
for i in range(a[0]+1):
    for j in range(a[0]+1):
        if a[1]-i-j < a[0]+1 and a[1]-i-j > -1:
            ans+=1
print(str(ans))

Fixed submission:
a=list(map(int,input().split()))
ans=0
for i in range(a[0]+1):
    for j in range(a[0]+1):
        if a[1]-i-j <= a[0] and a[1]-i-j >= 0:
            ans+=1
print(str(ans))

Buggy python submission (verdict: Time Limit Exceeded):
a=list(map(int,input().split()))
ans=0
for i in range(a[0]+1):
    for j in range(a[0]+1):
        if a[0]*2<a[1]-i:
            break
        if a[1]-i-j <= a[0] and a[1]-i-j >= 0:
            ans+=1
print(str(ans))

Fixed submission:
a=list(map(int,input().split()))
ans=0
for i in range(a[0]+1):
    for j in range(a[0]+1):
        if a[1]-i-j <= a[0] and a[1]-i-j >= 0:
            ans+=1
print(str(ans))

Buggy python submission (verdict: Time Limit Exceeded):
a=list(map(int,input().split()))
ans=0
for i in range(a[0]+1):
    for j in range(a[0]+1):
        if a[1]-i-j <= a[0] and a[1]-i-j >= 0:
            ans+=1
print(str(ans))

Fixed submission:
a=list(map(int,input().split()))
ans=0
for i in range(a[0]+1):
    for j in range(a[0]+1):
        if a[1]-i-j <= a[0] and a[1]-i-j >= 0:
            ans+=1
print(str(ans))

Buggy python submission (verdict: Time Limit Exceeded):
a=list(map(int,input().split()))
ans=0
for i in range(a[0]+1):
    for j in range(a[0]+1):
        for k in range(a[0]+1):
            if i+j+k==a[1]:
                ans+=1
print(str(ans))

Fixed submission:
a=list(map(int,input().split()))
ans=0
for i in range(a[0]+1):
    for j in range(a[0]+1):
        if a[1]-i-j <= a[0] and a[1]-i-j >= 0:
            ans+=1
print(str(ans))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
lenS = len(S)
index = 0
ans = lenS
while index < lenS-1:
    if S[index:index+2] == "ST":
        S = S[:index] + S[index+2:]
        ans -= 2
        index -= 1
    else:
        index += 1
print(str(ans))

Fixed submission:
from collections import deque

S = input()
lenS = len(S)
pops = 0
ans = lenS
stack = deque()
for i in range(lenS):
    if stack and S[i] == "T":
        a = stack.pop()
        if a == "S":
            ans -= 2
    else:
        stack.append(S[i])
print(str(ans))
Buggy python submission (verdict: Runtime Error):
import sys

N, K = map(int,input().split())
D = list(input().split())
flg = 1
for i in range(N, 10001):
    flg = 1
    cost = str(i)
    digit = len(cost)
    for j in range(digit):
        if cost[j] in D:
            flg = 0
            break
    if flg == 1:
        print(cost)
        sys.exit()
print("error")
sys.exit(1)

Fixed submission:
import sys

N, K = map(int,input().split())
D = list(input().split())
for i in range(N, 100001):
    flg = 1
    cost = str(i)
    digit = len(cost)
    for j in range(digit):
        if cost[j] in D:
            flg = 0
            break
    if flg == 1:
        print(cost)
        sys.exit()
print("error")
Buggy python submission (verdict: Runtime Error):
opt=input()
sum=700
if opt[0] == o:
  sum+=100
if opt[1] == o:
  sum+=100
if opt[2] == o:
  sum+=100
print(sum)

Fixed submission:
opt=input()
sum=700
if opt[0] == 'o':
  sum+=100
if opt[1] == 'o':
  sum+=100
if opt[2] == 'o':
  sum+=100
print(sum)
Buggy python submission (verdict: Runtime Error):
def popcount(x):
    '''xの立っているビット数をカウントする関数
    (xは64bit整数)'''

    # 2bitごとの組に分け、立っているビット数を2bitで表現する
    x = x - ((x >> 1) & 0x5555555555555555)

    # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f # 8bitごと
    x = x + (x >> 8) # 16bitごと
    x = x + (x >> 16) # 32bitごと
    x = x + (x >> 32) # 64bitごと = 全部の合計
    return x & 0x0000007f

n = int(input())
data = input()
c = 0
countR = 0
mask = 0
for i in range(len(data)):
  #print(i)
  #print(data[i])
  if i != 0:
    c = c << 1
  ci = data[i]
  if ci == 'R':
    countR += 1
  else:
    c += 1
for i in range(n - countR):
  mask += 1
  mask = mask << 1
mask = mask << countR - 1
#print(bin(c))
#print(bin(mask))
#print(countR)
print(popcount(c & mask))

Fixed submission:
N = int(input())
s = input()
r = s.count("R")
print(s[:r].count("W"))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = 1
for i in a:
  ans *= i

if ans > 1000000000000000000:
  ans = -1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = 1
if 0 in a:
  ans = 0
else:
  for i in a:
    ans *= i
    if ans > 1000000000000000000:
      ans = -1
      break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def nPr(n, r):
  ans = 1
  for i in range(n,n-r,-1):
    ans *= i
  return ans

def nCr(n, r):
  tmp = 1
  for i in range(r,1,-1):
    tmp *= i
  return int(nPr(n, r) / tmp)

n = int(input())
a = list(map(int,input().split()))
count = len(a)
d = {}
x = {}

for i in a:
  if i not in d:
    d[i] = 1
  else:
    d[i] += 1

for i in d:
  x[i] = nCr(d[i], 2)

for i in a:
  ans = 0
  for j in d:
    if i == j:
      if d[j] > 2:
        ans += nCr(d[j]-1, 2)
    else:
      if d[j] > 1:
        ans += x[j]
  print(ans)
      

Fixed submission:
def nPr(n, r):
  ans = 1
  for i in range(n,n-r,-1):
    ans *= i
  return ans

def nCr(n, r):
  tmp = 1
  for i in range(r,1,-1):
    tmp *= i
  return int(nPr(n, r) / tmp)

n = int(input())
a = list(map(int,input().split()))
count = len(a)
d = {}
x = 0

for i in a:
  if i not in d:
    d[i] = 1
  else:
    d[i] += 1

for i in d:
  x += nCr(d[i], 2)

for i in a:
  ans = x - d[i] + 1
  print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def nPr(n, r):
  ans = 1
  for i in range(n,n-r,-1):
    ans *= i
  return ans

def nCr(n, r):
  tmp = 1
  for i in range(r,1,-1):
    tmp *= i
  return int(nPr(n, r) / tmp)

n = int(input())
a = list(map(int,input().split()))
count = len(a)
d = {}

for i in a:
  if i not in d:
    d[i] = 1
  else:
    d[i] += 1
#print(d)

for i in a:
  ans = 0
  for j in d:
    if i == j:
      if d[j] > 2:
        ans += nCr(d[j]-1, 2)
    else:
      if d[j] > 1:
        ans += nCr(d[j], 2)
  print(ans)
      

Fixed submission:
def nPr(n, r):
  ans = 1
  for i in range(n,n-r,-1):
    ans *= i
  return ans

def nCr(n, r):
  tmp = 1
  for i in range(r,1,-1):
    tmp *= i
  return int(nPr(n, r) / tmp)

n = int(input())
a = list(map(int,input().split()))
count = len(a)
d = {}
x = 0

for i in a:
  if i not in d:
    d[i] = 1
  else:
    d[i] += 1

for i in d:
  x += nCr(d[i], 2)

for i in a:
  ans = x - d[i] + 1
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
rev = False
for i in range(Q):
  query = input().split()
  if query[0] == '1':
    rev = not rev
  elif query[0] == '2':
    if query[1] == '1':
      if rev == False:
        S = query[2] + S
      else:
        S = S + query[2]
    elif query[1] == '2':
      if rev == False:
        S = S + query[2]
      else:
        S = query[2] + S
  #print('S='+S)
if rev == True:
  S = S[::-1]
print(S)

Fixed submission:
s = input()
top = ''
n = int(input())
isReverse = False
for i in range(n):
    Q = input().split()
    if(Q[0] == '1'):
        isReverse = not isReverse
    else:
        if Q[1] == '1':
            if isReverse: s += Q[2]
            else: top += Q[2]
        else:
            if isReverse: top += Q[2]
            else: s += Q[2]
if isReverse: s = s[::-1] + top
else: s = top[::-1] + s
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
def func1(S):
  tmp = ''
  for i in range(len(S)):
    tmp = tmp + S[len(S)-1-i]
  return tmp
S = input()
Q = int(input())
rev = False
for i in range(Q):
  query = input().split()
  if query[0] == '1':
    rev = not rev
  elif query[0] == '2':
    if query[1] == '1':
      if rev == False:
        S = query[2] + S
      else:
        S = S + query[2]
    elif query[1] == '2':
      if rev == False:
        S = S + query[2]
      else:
        S = query[2] + S
  #print('S='+S)
if rev == True:
  S = func1(S)
print(S)

Fixed submission:
s = input()
top = ''
n = int(input())
isReverse = False
for i in range(n):
    Q = input().split()
    if(Q[0] == '1'):
        isReverse = not isReverse
    else:
        if Q[1] == '1':
            if isReverse: s += Q[2]
            else: top += Q[2]
        else:
            if isReverse: top += Q[2]
            else: s += Q[2]
if isReverse: s = s[::-1] + top
else: s = top[::-1] + s
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
def rev(S):
  tmp = ''
  for i in range(len(S)):
    tmp = tmp + S[len(S)-1-i]
  return tmp

S = input()
Q = int(input())
tmp = S
for i in range(Q):
  query = input().split()
  if query[0] == '1':
    tmp = rev(tmp)
  elif query[0] == '2':
    if query[1] == '1':
      tmp = query[2] + tmp
    elif query[1] == '2':
      tmp = tmp + query[2]
print(tmp)

Fixed submission:
s = input()
top = ''
n = int(input())
isReverse = False
for i in range(n):
    Q = input().split()
    if(Q[0] == '1'):
        isReverse = not isReverse
    else:
        if Q[1] == '1':
            if isReverse: s += Q[2]
            else: top += Q[2]
        else:
            if isReverse: top += Q[2]
            else: s += Q[2]
if isReverse: s = s[::-1] + top
else: s = top[::-1] + s
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
word = []
for i in range(n):#文字列毎
  inp = input()
  for j in range(len(word)):#word配列の長さ毎
    if inp in word[j]:#word[j]に含まれる場合
      if j + 1 == len(word):
        word.append([inp])
        break
    else:
      word[j].append(inp)
      break
  if i == 0:
    word.append([inp])
tmp1 = word[len(word)-1]
tmp2 = []
for i in tmp1:
  if i not in tmp2:
    tmp2.append(i)
tmp2.sort()
for i in tmp2:
  print(i)

Fixed submission:
d = {}
r = []
max = 0

n = int(input())

for i in range(n):
  k = input()
  if k in d:
    d[k] += 1
    if max < d[k]:
      max = d[k]
  else:
    d[k] = 1
    if max == 0:
      max += 1

for i in d:
  if d[i] == max:
    r.append(i)

r.sort()

for i in r:
  print(i)
Buggy python submission (verdict: Runtime Error):
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    arr=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    println(arr[parseInt(readline())])
end
main()

Fixed submission:
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input())-1])
Buggy python submission (verdict: Runtime Error):
h,w=[int(i) for i in input().split()]
print(ceil(h/2)*ceil(w/2)+floor(h/2)*floor(w/2))

Fixed submission:
from math import ceil,floor
h,w=[int(i) for i in input().split()]
if h==1 or w==1:
    print(1)
else:
    print(ceil(h*w/4)+floor(h*w/4))
Buggy python submission (verdict: Runtime Error):
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseFloat(x::SubString{String}) = parse(Float64, x)
parseFloat(x::Char) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    a,b,c=split(readline())
    if sqrt(parseFloat(a))+sqrt(parseFloat(b))<sqrt(parseFloat(c))
        println("Yes")
    else
        println("No")
    end
end
main()

Fixed submission:
from math import ceil,floor,sqrt
from collections import deque,Counter
from decimal import Decimal
a,b,c=[int(i) for i in input().split()]
print("Yes" if Decimal(a).sqrt()+Decimal(b).sqrt()<Decimal(c).sqrt() else "No")
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
muki=True
a=[[_ for _ in input().split()] for i in range(q)]
for i in a:
    if i[0]=="1":
        muki=not muki
        continue
    if (i[1]=="1" and muki) or (i[1]=="2" and not muki):
        s=i[2]+s
    else:
        s+=i[2]
if muki:
    print(s)
else:
    print(s[::-1])

Fixed submission:
s=input()
q=int(input())
muki=True
a=[[_ for _ in input().split()] for i in range(q)]
front=""
back=""
for i in a:
    if i[0]=="1":
        muki=not muki
        continue
    if (i[1]=="1" and muki) or (i[1]=="2" and not muki):
        front=i[2]+front
    else:
        back+=i[2]
if muki:
    print(front+s+back)
else:
    print((front+s+back)[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
muki=True
a=[[_ for _ in input().split()] for i in range(q)]
for i in a:
    if i[0]=="1":
        muki=not muki
        continue
    if (i[1]=="1" and muki) or (i[1]=="2" and not muki):
        s=i[2]+s
    else:
        s+=i[2]
if muki:
    print(s)
else:
    print(s[::-1])

Fixed submission:
s=input()
q=int(input())
muki=True
a=[[_ for _ in input().split()] for i in range(q)]
front=""
back=""
for i in a:
    if i[0]=="1":
        muki=not muki
        continue
    if (i[1]=="1" and muki) or (i[1]=="2" and not muki):
        front=i[2]+front
    else:
        back+=i[2]
if muki:
    print(front+s+back)
else:
    print((front+s+back)[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
for i in range(q):
    a=[_ for _ in input().split()]
    if a[0]=="1":
        s=s[::-1]
    elif a[1]=="1":
        s=a[2]+s
    else:
        s+=a[2]
print(s)

Fixed submission:
s=input()
q=int(input())
muki=True
a=[[_ for _ in input().split()] for i in range(q)]
front=""
back=""
for i in a:
    if i[0]=="1":
        muki=not muki
        continue
    if (i[1]=="1" and muki) or (i[1]=="2" and not muki):
        front=i[2]+front
    else:
        back+=i[2]
if muki:
    print(front+s+back)
else:
    print((front+s+back)[::-1])