Problem:


Score : 100 points

Problem Statement

We have A apples and P pieces of apple.

We can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.

Find the maximum number of apple pies we can make with what we have now.

Constraints

All values in input are integers.

0 \leq A, P \leq 100

Input

Input is given from Standard Input in the following format:

A P

Output

Print the maximum number of apple pies we can make with what we have.

Sample Input 1

1 3

Sample Output 1

3

We can first make one apple pie by simmering two of the three pieces of apple. Then, we can make two more by simmering the remaining piece and three more pieces obtained by cutting the whole apple.

Sample Input 2

0 1

Sample Output 2

0

We cannot make an apple pie in this case, unfortunately.

Sample Input 3

32 21

Sample Output 3

58



Sample input:
1 3


Sample output:
3

Submission status: Runtime Error

Solution code:
import sys
class SegTree:
    def __init__(self, n, ide_ele, seg_func):
        self.segfunc = seg_func
        self.num = 2**(n-1).bit_length()
        self.ide_ele = ide_ele
        self.seg=[self.ide_ele]*2*self.num 
        
    def update(self, k, x):
        k += self.num-1
        self.seg[k] = x
        while k+1:
            k = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[k*2+1],self.seg[k*2+2])
        
    def query(self, p, q):
        p += self.num-1
        q += self.num-2
        res=self.ide_ele
        while q-p>1:
            if p&1 == 0:
                res = self.segfunc(res,self.seg[p])
            if q&1 == 1:
                res = self.segfunc(res,self.seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = self.segfunc(res,self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res,self.seg[p]),self.seg[q])
        return res

input = sys.stdin.readline

n,Q=map(int,input().split())
xs = []
qs = []
for i in range(n):
    s,t,x=map(int,input().split())
    xs += [(s-x-0.4,True,x,i), (t-x-0.5,False,x,i)]
for _ in range(Q):
    xs.append((int(input()), 2, 0,0))
xs.sort(key=lambda x:x[0])

mx,XN = 10**9,n
st = SegTree(XN, mx, min)
for t,r,x,i in xs:
    if r == 2:
        c = st.query(0,XN)
        print(c if c!= mx else -1)
    else:
        st.update(i, x if r else mx)

Submission status: Runtime Error

Solution code:
import sys
#from bisect import bisect_left as bl
input = sys.stdin.readline

n,Q=map(int,input().split())
xs,qs = [],[]
for _ in range(n):
    s,t,x=map(int,input().split())
    s,t,x=s-x,t-x,x
    xs += [(s,1,x), (t,0,x)]
for _ in range(Q):
    qs.append(int(input()))

xs.sort(key=lambda x:x[0])

Submission status: Runtime Error

Solution code:
import sys
#from bisect import bisect_left as bl
input = sys.stdin.readline

n,Q=map(int,input().split())
xs,qs = [],[]
for _ in range(n):
    s,t,x=map(int,input().split())
    s,t,x=s-x-0.5,t-x-0.5,x
    xs += [(s,1,x), (t,0,x)]
for _ in range(Q):
    qs.append(int(input()))

xs.sort()

h=set()
qi = 0
q = qs[qi]
for t,r,x in xs:
    if q < t:
        if h:
            c = -1
        else:
            c = -1
        while True:
            if q < t:
                print(c)
                Q-=1
                if Q:
                    qi += 1
                    q = qs[qi]
                    continue
                sys.exit()
            break
    if r:
        h.add(x)
    else:
        h.remove(x)
print("-1\n"*Q)

Submission status: Runtime Error

Solution code:
A, P = map(int, input().input())
print((A * 3 + P)//2)

Submission status: Runtime Error

Solution code:
a, p = map(int, input().split())
print(int((a*3 + p)/2)

Submission status: Runtime Error

Solution code:
a,p = [int(_) for _ in input()]
print((a*3+p)//2)

Submission status: Runtime Error

Solution code:
A ,P = int(input()).split()

P = P + 3 * A
k = P//2
print(k)

Submission status: Runtime Error

Solution code:
A = int(input('A'))
P = int(input('P'))

P = P + 3 * A
k = P//2
print(k)

Submission status: Runtime Error

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a,p=map(int,input().split())

print((a*3+b)//2)

Submission status: Runtime Error

Solution code:
#17:09
n,k = map(int,input().split())
v = list(map(int,input().split()))
'''
左からa個
右からb個
k-a-b個以内捨てて良し
'''
can = []
nk = min(n,k)
for a in range(nk+1):
  if a != 0:
    x.append(v[a-1])
  else:
    x = []
  for b in range(nk+1-a):
    if b != 0:
      y.append(v[-b])
    else:
      y = []
    z = x + y
    z.sort()
    r = k - a - b
    tmp = 0
    if r < a+b:
      if z[r] < 0:
        for i in range(r,a+b):
          tmp += z[i]
      else:
        for i in range(a+b):
          if z[i] >= 0:
            tmp += z[i]
    else:
      for i in range(a+b):
        if z[i] >= 0:
          tmp += z[i]
    can.append(tmp)
print(max(can))

Submission status: Runtime Error

Solution code:
a, p = map(int, input().split())
print(sum(3 * a + p)//2)

Submission status: Runtime Error

Solution code:
a,p=map(int,input().split())
m=(3*A+P)//2
print(m)

Submission status: Runtime Error

Solution code:
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#include <bits/stdc++.h>
using namespace std;






int main() {
  int a,b;cin>>a>>b;
  int x=3*a+b;
  cout<<x/2<<endl;
}

Submission status: Runtime Error

Solution code:
N = int(input())
B = []
for i in range(N):
    s,p = map(str,input().split())
    tmp = [i+1,s,int(p)]
    B.append(tmp)
B.sort(key=lambda x:x[2],reverse=True)
B.sort(key=lambda x:x[1])
for x in B:
    print(x[0])

Submission status: Runtime Error

Solution code:
n = int(input())
r = []
for i in range(n):
    city, score = map(str, input().split())
    score = int(score)
    r.append((city, score, i+1))

r.sort(key=lambda x: x[1], reverse=True)
r.sort(key=lambda x: x[0])

for x in r:
    print(x[2])

Submission status: Runtime Error

Solution code:
from collections import deque
import copy

N,K = map(int,input().split(" "))

V = deque(map(int,input().split(" ")))

def search(N,K,V,score,a,b):
    if a+b < min(N,K):
        Vb = copy.copy(V)
        scoreA = copy.copy(score)
        scoreB=copy.copy(score)
        scoreA.append(V.popleft())
        A = search(N,K,V,scoreA,a+1,b)
        scoreB.append(Vb.pop())
        B = search(N,K,Vb,scoreB,a,b+1)
    score = sorted(score)
    counter = 0
    while(counter < K-a-b):
        if len(score)== 0:
            break;
        if score[0]<0:
            score.pop(0)
            counter +=1
        else:
            break;
    ans = sum(score)
    if a+b < min(N,K):
        return max(0,ans,A,B)
    else:
        return max(0,ans)

score = []
a = 0
b= 0
ans = search(N,K,V,score,a,b)
print(ans)

Submission status: Runtime Error

Solution code:
a,p=map(int,input().split())
print((3*a+p)//2))

Submission status: Runtime Error

Solution code:
A,P = map(int,input.split())

P += 3*A
print(P//2)

Submission status: Runtime Error

Solution code:
A,B map(int,input().split())
goukei=3*A+B
print(int(goukei/2))

Submission status: Runtime Error

Solution code:
a,p=map(int,inqut().sprit())
print((3*a+p)//2)

Submission status: Runtime Error

Solution code:
n,ki=map(int,input().split())
v=list(map(int,input().split()))

m=min(n,ki)
ans=0

for i in range(m+1):
    for j in range(i+1):
        q=[]
        tmp=0
        for k in range(j):
            if len(v)>0:
                q.append(v[k])
        for kz in range(i-j):
            if len(v)>0:
                q.append(v[n-1-kz])
        tmp=sum(q)
        q.sort()
        for l in range(ki-i):
            if l<len(q) and q[l]<0:
                tmp-=q[l]
        ans=max(ans,tmp)
        
print(ans)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
s = []
for i in range(M):
    s.append(list(map(int, input().split())))
p = list(map(int, input().split()))

switch = [['0'], ['1']]

for i in range(N-1):
    tmp = []
    for j in switch:
        tmp.append(j+['0'])
        tmp.append(j+['1'])
    switch = tmp #スイッチのonoffのマップ化

ans = 0

for i in switch:
    false = 0
    for j in range(M):
        cnt = 0 #onの個数
        for k in range(s[j][0]):
            if i[s[j][1+k]-1] == '1':
                cnt += 1
            if cnt%2 != p[j]:
                false += 1 #条件に合っていなかったらfalseに加算する
        if false == 0:
            ans += 1 #全て条件を満たしていたらansに加算する
print(ans)

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
a=list(map(int,input().split()))
g=0
for i in range(0,min(n,k)):
    for j in range(0,min(k-i,n-i)):
        s=sorted(a[:i]+a[n-j:])
        p=sum(s)
        t=i+j
        c=0
        while len(s)>=c+1 and t+1<=k:
            if s[c]<0:
                p-=s[c]
                c+=1
                t+=1
            else:
                break
        g=max(g,p)
print(g)

Submission status: Runtime Error

Solution code:
a = int(input().split()[0])
p = int(input().split()[1])

s = a * 3 + p
print(s // 2)

Submission status: Runtime Error

Solution code:
A, P = map(int, input())

print(round((P+3*A)/2))

Submission status: Runtime Error

Solution code:
A, P = map(int, input().split())

print(A * 3 // P)

Submission status: Runtime Error

Solution code:
from collections import deque
a=deque()
b=a.copy()

Submission status: Runtime Error

Solution code:
A, P = map(int, input().split())
D = 3*A + P
if D % 2 == 0:
    print(int(D/2))
else:
    print(round(int((D/2))

Submission status: Runtime Error

Solution code:
A,P= map(int, input().split())
print((3*A+P)%2))

Submission status: Runtime Error

Solution code:
A,P=map(int,input().split())
print(((A*3)//2 + b//2) + (((A**3)%2 + b%2)//2))

Submission status: Runtime Error

Solution code:
a, p = map(int, input().split())

pis = (3a + p)//2
print(pis)

Submission status: Runtime Error

Solution code:
n=int(input())
list=[]
for i in range(n):
  s,p=input().split()
  list.append((s, -int(p), i+1))
list.sort()
for s,p,i in list:
  print(i)

Submission status: Runtime Error

Solution code:
A, P = map(int, input().split())

Apple = 3*A + P

if Apple % 2 == 0:
  ans = APPLE/2
else:
  ans = (Apple-1)/2

print(int(ans))

Submission status: Runtime Error

Solution code:
A, P = map(int, input().split())

APPLE = 3*A + P

if APPLE % 2 = 0:
  ans = APPLE/2
else:
  ans = (Apple-1)/2

print(ans)

Submission status: Runtime Error

Solution code:
A, P = map(int, input().split())

APPLE = 3*A + P

if APPLE % 2 = 0:
  ans = APPLE/2
else:
  ans = (Apple-1)/2

Submission status: Runtime Error

Solution code:
import sys
from collections import deque, defaultdict
import copy
import bisect
#input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

N, Q = map(int, input().split())
 
STX = [list(map(int, input().split())) for _ in range(N)]
# xの昇順に工事の区間をsort
STX = sorted(STX, key=lambda x: x[2])
 
D = [int(input()) for _ in range(Q)]
ans = [-1] * Q
index = [-1] * Q
for s, t, x in STX:
    left = bisect.bisect_left(D, s - x - 0.5)
    right = bisect.bisect_left(D, t - x - 0.5)
    now = left
    while now < right:
        if index[now] == -1:  # まだansが更新されていない場合
            ans[now] = x
            index[now] = right
            now += 1
        else:
            now = index[now]
            
 
for a in ans:
    print(a)

Submission status: Runtime Error

Solution code:
import sys
from collections import deque, defaultdict
import copy
import bisect
#input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)


N, Q = list(map(int, input().split()))
STX=[]
D=[]
for i in range(N):
    S, T, X = list(map(int, input().split()))
    bisect.insort(STX, (X, S, T))
for i in range(Q):
    D.append(int(input()))

skip = [-1 for i in range(Q)]

dist = [10000000000000 for i in range(Q)]

for (X, S, T) in STX:
    s = S - X
    t = T - X - 1
    a = bisect.bisect_left(D, s)
    b = bisect.bisect_right(D, t)
    #print(D)
    j = a
    while j < b:
        if skip[j] == -1:
            skip[j] = b
            dist[j] = X
            j+=1
        else:
            j=skip[j]



for i in range(Q):
    if dist[i] > 100000000000:
        print(-1)
    else:
        print(dist[i])

Submission status: Runtime Error

Solution code:
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x, y):
    flag = "Yes"
    for i in range(x-1 ,y-2):
        if S[i] ==  S[i+1] == "#":
            flag = "No"
    return flag

def judgeJumpOver(S, x , y):
    flag = "No"
    for i in range(x-1 ,y):
        if S[i-1] ==  S[i] ==  S[i+1] == ".":
            flag = "Yes"
            break
    return flag
 
result = "Yes"
if(C > D):
    result = judgeJumpOver(S, B, D)
if(result == "Yes"):
    result = judgeArrive(S, B, D)
if(result == "Yes"):
    result = judgeArrive(S, A, C)
print(result)

Submission status: Runtime Error

Solution code:
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()

def judgeArrive(S, x, y):
    flag = "Yes"
    for i in range(x-1 ,y-2):
        if S[i] ==  S[i+1] == "#":
            flag = "No"
    return flag

def judgeJumpOver(S, x ,y):
    flag = "No"
    for i in range(x-1 ,y):
        if S[i-1] ==  S[i] ==  S[i+1] == ".":
            flag = "Yes"
            break
    return flag

result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Submission status: Runtime Error

Solution code:
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()

def judgeArrive(S, x, y):
  flag = "Yes"
  for i in range(x-1 ,y-2):
    if S[i] ==  S[i+1] == "#":
        flag = "No"
  return flag

def judgeJumpOver(S, x ,y):
  flag = "No"
  for i in range(x-1 ,y):
    if S[i-1] ==  S[i] ==  S[i+1] == ".":
      flag = "Yes"
      break

  return flag

result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Submission status: Runtime Error

Solution code:
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x, y):
  flag = "Yes"
  for i in range(x-1 ,y-2):
    if S[i] ==  S[i+1] == "#":
        flag = "No"
  return flag

def judgeJumpOver(S, x , y):
  flag = "No"
  for i in range(x-1 ,y-1):
    if S[i-1] ==  S[i] ==  S[i+1] == ".":
      flag = "Yes"
      break
 
  return flag
 
result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Submission status: Runtime Error

Solution code:
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x, y):
  flag = "Yes"
  for i in range(x-1 ,y-1):
    if S[i] ==  S[i+1] == "#":
        flag = "No"
  return flag
        
def judgeJumpOver(S, x , y):
  flag = "No"
  for i in range(x ,y-1):
    if S[i-1] ==  S[i] ==  S[i+1] == ".":
      flag = "Yes"
      break
 
  return flag
 
result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Submission status: Runtime Error

Solution code:
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x, y):
  flag = "Yes"
  for i in range(x-1 ,y-2):
    if S[i] ==  S[i+1] == "#":
        flag = "No"
  return flag
        
def judgeJumpOver(S, x , y):
  flag = "No"
  for i in range(x-1 ,y- 1):
    if S[i-1] ==  S[i] ==  S[i+1] == ".":
      flag = "Yes"
      break
 
  return flag
 
result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Submission status: Runtime Error

Solution code:
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x , y):
  flag = "Yes"
  for i in range(x-1 ,y-2):
    if S[i:i+2] == "##":
        flag = "No"
  return flag
        
def judgeJumpOver(S, x , y):
  flag = "No"
  for i in range(x-1 ,y):
    if S[i-2:i+1] == "...":
      flag = "Yes"
      break
 
  return flag
 
result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Submission status: Runtime Error

Solution code:
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x , y):
  flag = "Yes"
  for i in range(x-1 ,y-2):
    if S[i:i+2] == "##":
        flag = "No"
  return flag
        
def judgeJumpOver(S, x , y):
  flag = "No"
  for i in range(x-1 ,y):
    if S[i-1:i+2] == "...":
      flag = "Yes"
      break
 
  return flag
 
result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Submission status: Runtime Error

Solution code:
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x , y):
  flag = "Yes"
  for i in range(x-1 ,y-1):
    if S[i:i+2] == "##":
        flag = "No"
  return flag
        
def judgeJumpOver(S, x , y):
  flag = "No"
  for i in range(x-1 ,y):
    if S[i-1:i+2] == "...":
      flag = "Yes"
      break
 
  return flag
 
result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Submission status: Runtime Error

Solution code:
N = int(input())
l = []
for i in range(N):
    a,b = input().split()
    l.append((a,-int(b),i+1))
    print(l)
l.sort()
for a,b,k in l:
    print(k)

Submission status: Runtime Error

Solution code:
N = int(input())
l = []
for i in range(N):
    a,b = input().split()
    l.append((a,int(b),i+1))
    print(l)
l.reverse()
for a,b,k in l:
    print(k)

Submission status: Runtime Error

Solution code:
n = int(input())
l = []
for i in range(n):
    s, p = input().split()
    l.appen([s, -int(p), i + 1])

l.sort()
for i in l:
    print(i[2])

Submission status: Runtime Error

Solution code:
A, P = map(int, input(' '))
print((3*A+P)//2)

Submission status: Runtime Error

Solution code:

A = int(input())
P = int(input())

ans = (A*3+P)//2

print(ans)

Submission status: Runtime Error

Solution code:
a=list(map(int,input().split()))

print((3*a_1+a_2)%2)

Submission status: Runtime Error

Solution code:
a, b = list(map(int, input().split()))
print((a*3+p)//2)

Submission status: Runtime Error

Solution code:
n = int(input())
dic = {}
for x in range(n):
  dic[x+1] = input().split()
ls = sorted(dic.items(), key=lambda x:x[1][0])

for y in range(1,n-1):
  
  if ls[y][1][0] == ls[y+1][1][0]:
    
    if ls[y][1][1] < ls[y+1][1][1]:
      
      ls[y+1],ls[y] = ls[y],ls[y+1]
    
    
for b in range(len(ls)):
  print(ls[b][0])

Submission status: Runtime Error

Solution code:
a=input()
b=input()
c=(a*3+b)/2
print(c)

Submission status: Runtime Error

Solution code:
a=input()
b=input()
c=(a*3+b)/3
print(c)

Submission status: Runtime Error

Solution code:
a=input()
b=input()
print((a*3+b)/2)

Submission status: Runtime Error

Solution code:
#include<stdio.h>
int main(){
  int A,P;
  scanf("%d %d",&A,&P);
  printf("%d",(3*A+P)/2);
  
  return 0;
}

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(x)    (x).begin(),(x).end()
typedef long long ll;
const int MOD = (int)1e9 + 7;

int main(){
  int a,p;
  cin >>a>>p;
  cout<<(a*3+p)/2<<endl;
}

Submission status: Runtime Error

Solution code:
n = int(input())
book=[]
for i in range(n):
    a,b=input().split()
    temp=[a,int(b),i+1]
    book.append(temp)

book.sort(key=lambda x:x[0])
book.sort(key=lambda x:x[1])

for j in range[len(book)]:
    print(book[j][3])

Submission status: Runtime Error

Solution code:
print((3*int(input())+int(input()))//2)

Submission status: Runtime Error

Solution code:
A, P = map(int, input().split())
print((3*A+P)//2)Ｖ

Submission status: Runtime Error

Solution code:
N = int(input())
a = []
for i in range(N):
    s, p = input().split()
    p = -int(p)
    a.append(s, p , i + 1)
    
a.sort()

print('\n'.join(str(ai[2]) for ai in a))

Submission status: Runtime Error

Solution code:
a = []
n = int(input())
for i in range(n):
    key,value = input().split()
    a.append((key,value,int(i+1)))
a.sort(key=lambda x:(x[0],reverse = not x[1]))
for i in range(n):
    print(a[i][2])

Submission status: Runtime Error

Solution code:
        n=int(input())
        q=[input().split()+[i]for i in range(n)]
            for i in range(n):
                q[i][1]=int(q[i][1])
              
            p =  sorted(q,key=lambda x:x[1],reverse=True)
        for s,t,r in p:
        	print(r+1)

Submission status: Runtime Error

Solution code:
    n=int(input())
    q=[input().split()+[i]for i in range(n)]
        for i in range(n):
            q[i][1]=int(q[i][1])
          
        p =  sorted(q,key=lambda x:x[1],reverse=True))
    for s,t,r in p:
      print(r+1)

Submission status: Runtime Error

Solution code:
n=int(input())
q=[input().split()+[i]for i in range(n)]
    for i in range(n):
        q[i][1]=int(q[i][1])
      
    print(sorted(q,key=lambda x:x[1],reverse=True))

Submission status: Runtime Error

Solution code:
A, P = [int(i) for i in input().split()]
print((A * 3 + P) // ￼2)

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
S=[list(map(int,input().split()))[1:] for _ in range(M)]
P=list(map(int,input().split()))
a=0
for n in range(2**N):
    s_count=0
    for j,s in enumerate(S):
        count=0
        for t in s:
            if n &(1<<t):
               count|=1<<t
        s_count^=count
        if bin(s_count).count("1")%2!=P[j]:
            break
        else:
            a+=1
print(a)

Submission status: Runtime Error

Solution code:
a = input()
p = input()

print((a*3+p)/2)

Submission status: Runtime Error

Solution code:
a,p = map(int,input().split())
z = a*3+p
if z % 2 = 0:
  print(int(z/2))
else:
  print(int((z-1)/2))

Submission status: Runtime Error

Solution code:
a,p = map(int,input().split())
z = a*3+p
if z % 2 = 0:
  print(z/2)
else:
  print((z-1)/2)

Submission status: Runtime Error

Solution code:
[print(i[2]+1) for i in sorted([[int(j) if j.isdecimal() else j for j in input().split()]+[i] for i in range(int(input()))], key=lambda x:x[1], reverse=True)]

Submission status: Runtime Error

Solution code:
int A = input()
int B = input()

print(int((3*A+B)/2))

Submission status: Runtime Error

Solution code:
a, p = input().split()
print((3 * a + p) / 2)

Submission status: Runtime Error

Solution code:
N=int(input())
book=[]
for i in range(N):
    s,p =input().split()
    book.append((s,int(p),i))
    
s=sorted(book, key=lambda x: ( x[0],-x[1]))
for i in range(N):
    print(s[i][2]+1)

Submission status: Runtime Error

Solution code:
import numpy as np
import matplotlib.pyplot as plt

def main():
	a = int(input())
	p = int(input())

	tips = a * 3 + p
	pie = int(tips / 2)

	print(pie)

if __name__ == '__main__':
	main()

Submission status: Runtime Error

Solution code:
import numpy as np
import matplotlib.pyplot as plt

def main():
	print('Input A')
	a = int(input())
	print('Input P')
	p = int(input())

	tips = a * 3 + p
	pie = int(tips / 2)

	print("output\n"+str(pie))


if __name__ == '__main__':
	main()

Submission status: Runtime Error

Solution code:
def main():

    N = int(input())
    if 0 > N or N > 100:
        print("input N error")
        exit()
        
    a = []
    for i in range(N):
        b = input().split()
        if len(b[0]) > 10 or len(b[0]) < 1:
            print("input S error")
            exit()

        if int(b[1]) < 0 or int(b[1]) > 100:
            print("input P error")
            exit()

        b.append(i + 1)
        a.append(b)
        
    a.sort()
    print(a)
    c = []
    answer = []
    
    for i in range(len(a)):
        c.append(a[i])

        if len(a) == 1:
         answer += c   
        
        elif a[i][0] != a[i+1][0] and i != len(a) - 2:
            c.sort(key=lambda x: int(x[1]), reverse=True)
            answer += c
            c = []

        elif a[i][0] != a[i+1][0] and i == len(a) - 2:
            c.sort(key=lambda x: int(x[1]), reverse=True)
            answer += c
            c = []
            c.append(a[i+1])
            answer += c
            break

        elif a[i][0] == a[i+1][0] and i == len(a) - 2:
            c.append(a[i+1])
            c.sort(key=lambda x: int(x[1]), reverse=True)
            answer += c
            break

    print(answer)
    for i in range(len(answer)):
        print(answer[i][2])
        
        
if __name__ == '__main__':

    main()

Submission status: Runtime Error

Solution code:
def main():

    N = int(input())
    if 0 > N or N > 100:
        print("input N error")
        exit()
        
    a = []
    for i in range(N):
        b = input().split()
        if len(b[0]) > 10 or len(b[0]) < 1:
            print("input S error")
            exit()

        if int(b[1]) < 0 or int(b[1]) > 100:
            print("input P error")
            exit()

        b.append(i + 1)
        a.append(b)
        
    a.sort()
    c = []
    answer = []
    
    for i in range(len(a) - 1):
        c.append(a[i])

        if i == len(a) - 2:
            elif a[i][0] != a[i+1][0]:
                c.sort(key=lambda x: int(x[1]), reverse=True)
                answer += c
                answer.append(a[i+1])

            else:
                c.append(a[i+1])
                c.sort(key=lambda x: int(x[1]), reverse=True)
                answer += c
                
        elif a[i][0] != a[i+1][0]:
            c.sort(key=lambda x: int(x[1]), reverse=True)
            answer += c
            c = []

            
    for i in range(len(answer)):
        print(answer[i][2])
        
        
if __name__ == '__main__':

    main()

Submission status: Runtime Error

Solution code:
# N,M = 2, 2
N, M = map(int, input().split())

# kの値は特に必要ないので最初から取得しない
# S = [[1, 2], [2]]
# p = [0, 1]
S = [list(map(int,input().split()))[1:] for i in range(M)]
p = list(map(int, input().split()))

ans = 0

for i in range(1<<N): #スイッチのオンオフ状態(0, 1, 2, 3)
    count_2 = -1
    bit = list(str(bin(i))) # 0b0, 0b1, 0b10...
    fail = 0
    
    # 桁埋め処理
    ketaume = (1<<N) // 2 + 2 - len(bit) 
    if ketaume > 0:
        for i in range(ketaume):
            bit.insert(2, "0")
    # print("search target={}".format(bit))
    for s in S: #[1, 2], [2]の階層
        count_2 += 1 # 何番目のSかを数えたい
        count = 0
        for t in s: # 1, 2の階層
            # print("bit = {}".format(bit[-t]))
            if int(bit[-t]) == 1:
                count += 1 # ついているスイッチの数を数える
                
        # print("{}-> number of switch is {}".format(s, count))
                
        # ついているスイッチが偶数か奇数かを判定
        # print("if mod is {}, OK".format(p[count_2]))
        # print("")
        if not count % 2 == p[count_2]:
            fail = 1 # 望ましくなければ，失敗フラグを立ててブレイク
            break
    if fail == 0:
        # print("ans += 1")
        ans += 1
        
print(ans)

Submission status: Runtime Error

Solution code:
A,P=map(input().split())
answer = int((A*3+P)/2)
print(answer)

Submission status: Runtime Error

Solution code:
N = int(input())
lst = []
for i in range(N):
  s, p = input().split()
  lst.append([s, p, i])
  lst_2 = sorted(lst, key = lambda x : (x[0], -1 * int(x[1])))
  
for i in lst_2:
  print(i[2] + 1)

Submission status: Runtime Error

Solution code:
A, P = list(map(int, input()))
print((3 * A + P) // 2)

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())

lamp=[]
switches=[]
temp=[]

for i in range(m):
    temp=list(map(int,input().split()))
    lamp.append(temp.pop(0))
    switches.append(temp)
    temp=[]

modul=list(map(int,input().split()))

bit_list=[]

for i in range(2**(n)):
    bit_list.append(bin(i)[2:].zfill(n))

ans = 0

for b in bit_list:
    flag = 0
    sum  = 0
    for s,p in zip(switches,modul):
        for k in range(len(s)):
            sum=sum+int(b[s[k]-1])
        if sum%2 != p:
            flag = 1
            break
    if flag == 0:
        ans=ans+1

print(ans)

Submission status: Runtime Error

Solution code:
A,P = map(int,input(),split())
print((A*3+P)//2)

Submission status: Runtime Error

Solution code:
a,p = map(int,input().split()
print(int((a*3+p)/2))

Submission status: Runtime Error

Solution code:
a,p = map(int,input().split()
print((a*3+p)/2

Submission status: Runtime Error

Solution code:
a, p = map(int(), input().split())
print(int((3*a+p)/2))

Submission status: Runtime Error

Solution code:
a, p = map(int(), input().split())

print(int((a * 3 + p) / 2))

Submission status: Runtime Error

Solution code:
a, p = map(int(), input())

print((a*3 + p) // 2)

Submission status: Runtime Error

Solution code:
a, p = map(int(), input().split())

ans = (a * 3 + p) // 2

print("{}".format(ans))

Submission status: Runtime Error

Solution code:
import sys
import math


def main():
    a = int(sys.argv[1])
    p = int(sys.argv[2])
    return math.floor((a * 3 + p) / 2)


if __name__ == '__main__':
    print(main())

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
s = []
k = []
p = []
for i in range(m):
    q = input().split()
    k.append(int(q[0]))
    q.remove(q[0])
    s.append(q)
    #print(q)
    for j in range(k[i]):
        s[i][j] = int(q[j])
        #print(s)
    
q = input().split()
for j in range(m):
        p.append(int(q[j]))
count = 0
for i in range(pow(2,n)):
    list = []
    for o in range(n):
        list.append(i%pow(2,o+1))
        i = i // pow(2,o+1)
    #print(list)
    for j in range(m):
        wa = 0
        for l in range(k[j] ):
            wa += list[s[j][l]-1]
        if wa == p[j]*2:
            count += 1

print(count)

Submission status: Runtime Error

Solution code:
M=(P+3A)/2
M

Submission status: Runtime Error

Solution code:
a,p =map(int,input().split())
b = (3*a + P) // 2
print(b)

Submission status: Runtime Error

Solution code:
A,P = map(int,input.split())

N = A*3+P
M = int(N/2)

print(M)

Submission status: Runtime Error

Solution code:

import copy

class MyClass():

    maxSum = 0

    def do(self, baseList, _temochi, leftIndex, rightIndex, nokoriSousaCount):
        if nokoriSousaCount < 0:
            return

        sum = 0
        for each in _temochi:
            sum += each

        if self.maxSum < sum:
            self.maxSum = sum

        if leftIndex <= rightIndex:
            temochi = copy.copy(_temochi)
            temochi.append(baseList[leftIndex])
            self.do(baseList, temochi, leftIndex + 1, rightIndex, nokoriSousaCount - 1)

            temochi = copy.copy(_temochi)
            temochi.append(baseList[rightIndex])
            self.do(baseList, temochi, leftIndex, rightIndex - 1, nokoriSousaCount - 1)
            
        self.removeMin(_temochi, leftIndex, rightIndex, nokoriSousaCount - 1)

    def removeMin(self, _temochi, leftIndex, rightIndex, nokoriSousaCount):
        if len(_temochi) > 0 and nokoriSousaCount > 0:
            minNum = min(_temochi)
            if minNum < 0:
                temochi = copy.copy(_temochi)
                temochi.remove(minNum)
                self.do(baseList, temochi, leftIndex, rightIndex, nokoriSousaCount)


count, opeCount = map(int, input().split())
baseList = list(map(int, input().split()))

doClass = MyClass()
doClass.do(baseList, [], 0, count - 1, opeCount)

print(doClass.maxSum)

Submission status: Runtime Error

Solution code:
    apple, frag = map(int, input().split())
     
    pie = ((apple*3) + frag) / 2
     
    print(pie)

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
print((a*3 + b) // 2)

Submission status: Runtime Error

Solution code:
a, p = map(int, input().split())
 (a*3+p)//2