Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03779 (python)

Fixed submission:
def main():
    x = int(input())
    k = int(x ** .5)

    i = 0
    while True:
        p = i * (i + 1) // 2
        if p >= x:
            print(i)
            break
        i += 1


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from itertools import accumulate
    x = int(input())
    l = list(range(0, x + 1))
    r = accumulate(l)

    for i, p in enumerate(r):
        if p == x:
            print(i)
            break
        if p + (i + 2) == x:
            print(i + 2)
            break


if __name__ == '__main__':
    main()
Problem p03796 (python)

Fixed submission:
ans=1
for i in range(1,int(input())+1):
  ans=ans*i%(10**9+7)
print(ans)

Buggy submission (verdict: Runtime Error):
ans=1
for i in range(int(iput())):
  ans*=i%(10**9+7)
print(ans)
Problem p03814 (python)

Fixed submission:
s=str(input())
a,b=s.find("A"),s.rfind("Z")
print(b-a+1)

Buggy submission (verdict: Runtime Error):
s=str(input())
a,b=s.find("A"),s,rfind("Z")
print(b-a+1)
Problem p03827 (python)

Fixed submission:
n,s=int(input()),str(input())
l=[0]
for i in s:
  x= -1 if i=="D" else 1
  l+=[l[-1]+x]
print(max(l))

Buggy submission (verdict: Runtime Error):
n,s=map(int,input().split())
l=[0]
for i in s:
  x= -1 if i=="D" else 1
  l+=[l[-1]+x]
print(max(l))
Problem p03837 (python)

Fixed submission:
def main():
    n, m, *abc = map(int, open(0).read().split())
    d = [[float("Inf")] * (n + 1) for _ in range(n + 1)]

    for i in range(1, n + 1):
        d[i][i] = 0

    for a, b, c in zip(*[iter(abc)] * 3):
        d[a][b] = c
        d[b][a] = c

    for k in range(1, n + 1):
        for i in range(1, n + 1):
            for j in range(1, n + 1):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])

    ans = 0
    for a, b, c in zip(*[iter(abc)] * 3):
        if d[a][b] < c:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import heapq


def dijkstra(n, s, g):
    h = [(0, s)]
    heapq.heapify(h)
    cost = [float("Inf")] * (n + 1)  # cost: i -> j
    cost[s] = 0

    while h:
        c, v = heapq.heappop(h)
        if c > cost[v]:
            continue
        for d, u in g[v]:
            d_s_u = d + cost[v]
            if d_s_u < cost[u]:
                cost[u] = d_s_u
                heapq.heappush(h, (d_s_u, u))

    return cost


def main():
    n, m, *abc = map(int, open(0).read().split())
    g = [[] for _ in range(n + 1)]

    for a, b, c in zip(*[iter(abc)] * 3):
        g[a].append([c, b])
        g[b].append([c, a])

    ans = 0
    checkd = [[False] * (n + 1) for _ in range(n + 1)]
    for i in range(1, n + 1):
        cost = dijkstra(n, i, g)
        for j, k in g[i]:
            if checkd[i][j]:
                continue
            if j > cost[k]:
                ans += 1
            checkd[i][j] = True
            checkd[j][i] = True
    
    print(ans)


if __name__ == '__main__':
    main()
Problem p03846 (python)

Fixed submission:
import collections
n=int(input())
l=list(input().split())
c=collections.Counter(l)
if n%2==0:
  f=all(x==2 for x in c.values())
else:
  g=c.pop("0")==1
  f=all(x==2 for x in c.values()) and g
print(2**(n//2)%1000000007 if f==True else 0)

Buggy submission (verdict: Runtime Error):
def main():
    from collections import Counter
    n, *a = map(int, open(0).read().split())
    c = Counter(a)
    f = True
    if n % 2 == 0:
        f = all(x == 2 for x in c.values())
    else:
        g = c.pop("0") == 1
        f = all(x == 2 for x in c.values()) and g
    ans = 2 ** (n // 2) % 1000000007 if f is True else 0
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import collections
    n, *a = map(int, open(0).read().split())
    c = collections.Counter(a)
    if n % 2 == 0:
        f = all(x == 2 for x in c.values())
    else:
        g = c.pop("0") == 1
        f = all(x == 2 for x in c.values()) and g
    ans = 2 ** (n // 2) % 1000000007 if f is True else 0
    print(ans)


if __name__ == '__main__':
    main()
Problem p03964 (python)

Fixed submission:
def main():
    from math import ceil
    n = int(input())
    a, b = 1, 1
    for _ in range(n):
        i, j = map(int, input().split())
        x = max((a + i - 1) // i, (b + j - 1) // j)
        a, b = x * i, x * j
    print(a + b)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from math import ceil
    n = int(input())
    a, b = 1, 1
    for _ in range(n):
        i, j = map(int, input().split())
        x = max((a + s - 1) // s, (b + t - 1) // t)
        a, b = x * i, x * j
    print(a + b)


if __name__ == '__main__':
    main()
Problem p03993 (python)

Fixed submission:
n=int(input())
a=[0]+list(map(int,input().split()))
ans=0
for i in range(1,n+1):
  if a[a[i]]==i:
    ans+=1
print(ans//2)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  if a[a[i]]==i:
    ans+=1
print(ans)
Problem p03999 (python)

Fixed submission:
def main():
    s = input()
    n = len(s)
    ans = 0
    for i in range(n + 1):
        for j in range(i + 1, n + 1):
            x = int(s[i:j])
            p = 2 ** max(0, i - 1) * 2 ** max(0, n - j - 1)
            ans += x * p

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    s = input()
    n = len(s)
    ans = 0
    for i in range(n + 1):
        for j in range(i + 1, n + 1):
            x = int(s[i:j])
            p = 2 ** max(0, i - 1)
            q = 2 ** max(0, n - j - 1)
            ans += x * p * q

    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    s = input()
    n = len(s)
    ans = 0
    for i in range(n + 1):
        for j in range(i + 1, n + 1):
            x = int(s[i:j])
            p = 2 ** max(0, i - 1)
            q = 2 ** max(0, n - j - 1)
            ans += x * p * q

    print(ans)

if __name__ == '__main__':
    main()
Problem p04043 (python)

Fixed submission:
a = list(map(int,input().split()))
b = a.count(5)
c = a.count(7)
if b == 2 and c ==1:
            print('YES')
else:
            print('NO')

Buggy submission (verdict: Runtime Error):
a = list(map(int,input()))
b = a.count('5')
c = a.count('7')
if b == 2 and c ==1:
            print('YES')
else:
            print('NO')

Buggy submission (verdict: Runtime Error):
a = list(map(int,input()))
b = a.count(’5')
c = a.count(’7')
if b == 2 and c ==1:
            print('YES')
else:
            print('NO')

Buggy submission (verdict: Runtime Error):
a = list(map(int,input()))
b = a.count(’5')
c = a.count(’7')
if b == 2 and c ==1:
            pritn('YES')
else:
            print('NO')
Problem p04044 (python)

Fixed submission:
n,l=map(int,input().split())
s=sorted([input() for i in range(n)])
print(*s,sep="")

Buggy submission (verdict: Runtime Error):
n,l = map(int,input().split())
l = sorted([str(input()) for _ in range(l)])
print(l)
Problem p02574 (python)

Fixed submission:
from math import gcd

N = int(input())
A = list(map(int, input().split()))
sieve = [1] * (10**6+1)
for i in range(2, 10**6 + 1):
	if sieve[i] == 1:
		sieve[i] = i
		j = 2
		while(j * i <= 10**6):
			sieve[j * i] = i
			j += 1

g = A[0]
for i in range(1, N):
	g = gcd(g, A[i])
	
if g != 1:
	print("not coprime")
else:
	s = set()
	for i in range(N):
		st = set()
		while(A[i] > 1):
			d = sieve[A[i]]
			st.add(d)
			A[i] //= d
		for p in st:
			if p in s:
				print("setwise coprime")
				exit()
			s.add(p)
	print("pairwise coprime")

Buggy submission (verdict: Runtime Error):
from math import gcd

N = int(input())
A = list(map(int, input().split()))
sieve = [1] * (10**5*5+1)
for i in range(2, 10**3):
	if sieve[i] == 1:
		sieve[i] = i
		j = 2
		while(j * i <= 10**5*5):
			sieve[j * i] = i
			j += 1
sieve[1] = 0

g = A[0]
a = 0
for i in range(1, N):
	g = gcd(g, A[i])
	if A[i] == 1:
		a = 1
	
if g != 1:
	print("not coprime")
else:
	if a == 1:
		print("setwise coprime")
		exit()
	s = set()
	for i in range(N):
		st = set()
		while(A[i] > 1):
			d = sieve[A[i]]
			if not(d in st) and d in s:
				print("setwise coprime")
				exit()
			s.add(d)
			st.add(d)
			A[i] //= d
	print("pairwise coprime")
Problem p02576 (python)

Fixed submission:
from math import ceil

N, X, T = map(int,input().split())

print(ceil(N / X)* T)

Buggy submission (verdict: Runtime Error):
from math import ceil

N, X, T = map(int,input().split())

print(ceil(N / X)* T)from math import ceil

N, X, T = map(int,input().split())

print(ceil(N / X)* T)
Problem p02582 (python)

Fixed submission:
S=input().strip("¥n")

if S=="RRR":
	print(3)
elif "RR" in S:
	print(2)
elif "R" in S:
	print(1)
else:
	print(0)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
P=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=-10**10
for st in range(N):
  now = st+1
  temp=[0]
  while(P[now-1] != st+1):
    temp.append(temp[-1]+C[P[now-1]-1])
    now = P[now-1]
    temp.append(temp[-1]+C[P[now-1]-1])
  if len(temp)>=K+1:
    ans=max(ans, max(temp[1:K+1]))
    continue
  if temp[-1]<=0:
    ans = max(ans, (max(temp[1:])))
  else:
    t=temp[-1]*(K//(len(temp)-1))-temp[-1]
    t+=max(max(temp),max([temp[-1]+temp[i+1] for i in range(K%(len(temp)-1))]))
    ans=max(ans, t)
		
print(int(ans))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
P=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=-10**10
for st in range(N):
  now = st+1
  temp=[0]
  while(P[now-1] != st+1):
    temp.append(temp[-1]+C[P[now-1]-1])
    now = P[now-1]
    temp.append(temp[-1]+C[P[now-1]-1])
  if len(temp)>=K+1:
    ans=max(ans, max(temp[1:K+1]))
    continue
  if temp[-1]<=0:
    ans = max(ans, (max(temp[1:])))
  else:
    t=temp[-1]*(K//(len(temp)-1))-temp[-1]
    t+=max(temp+[temp[-1]+temp[i+1] for i in range(K%(len(temp)-1))])
    ans=max(ans, t)
		
print(int(ans))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
P=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=-10**10
for st in range(N):
  now = st+1
  temp=[0]
  while(P[now-1] != st+1):
    temp.append(temp[-1]+C[P[now-1]-1])
    now = P[now-1]
    temp.append(temp[-1]+C[P[now-1]-1])
  if len(temp)>=K+1:
    ans=max(ans, max(temp[1:K+1]))
    continue
  if temp[-1]<=0:
    ans = max(ans, (max(temp[1:])))
  else:
    t=temp[-1]*(K//(len(temp)-1))-temp[-1]
    t+=max(temp+[temp[-1]+temp[i+1] for i in range(K%(len(temp)-1)+1)])
    ans=max(ans, t)
		
print(int(ans))
Problem p02641 (python)

Fixed submission:
#

import sys
input=sys.stdin.readline

def main():
    X,N=map(int,input().split())
    p=list(map(int,input().split()))
    ans=[]
    for i in range(max(X,100-X)):
        if not X+i in p:
            ans+=[X+i]
        if not X-i in p:
            ans+=[X-i]
        if len(ans)>0:
            break
    if len(ans)==0:
        print(0)
    else:
        print(min(ans))
    
if __name__=="__main__":
    main()

Buggy submission (verdict: Runtime Error):
#

import sys
input=sys.stdin.readline

def main():
    X,N=map(int,input().split())
    p=list(map(int,input().split()))
    ans=[]
    for i in range(max(X,100-X)):
        if not X+i in p:
            ans+=[X+i]
        if not X-i in p:
            ans+=[X-i]
        if len(ans)>0:
            break
    print(min(ans))
    
if __name__=="__main__":
    main()

Buggy submission (verdict: Runtime Error):
#

import sys
input=sys.stdin.readline

def main():
    X,N=map(int,input().split())
    p=list(map(int,input().split()))
    p.sort()
    ans=[]
    for i in range(max(X,100-X)):
        if not X+i in p:
            ans+=[X+i]
        if not X-i in p:
            ans+=[X-i]
        if len(ans)>0:
            break
    print(min(ans))
    
if __name__=="__main__":
    main()
Problem p02657 (python)

Fixed submission:
a,b=map(int,input().split())
print(a*b)

Buggy submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=list(b)
b=[b[0],b[2],b[3]]
c=a*b[0]+a*b[1]//10+a*b[2]//100
print(c)

Buggy submission (verdict: Runtime Error):
N=int(input())
Nk=N
rootN=int(N**0.5)
p=[1]*(rootN+1)
p[0]=0
p[1]=0
for i in range(2,rootN+1):
    for j in range(i*2,rootN,i):
        p[j]=0
ps=[i for i in range(1,rootN+1) if p[i]==1]
pq=[]
for i in ps:
    d=i
    c=0
    for j in range(1,10):
        if (N/i).is_integer():
            c+=1
            N/=(i)
        else:
            break
        d*=i
    if c!=0:
        pq.append(c)

res=0
for j in pq:
    res+=int(((8*j+1)**0.5-1)/2)


if N > rootN:
    res+=1
if N==Nk:
    res+=1
    
print(res)
Problem p02660 (python)

Fixed submission:
#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    ps=[]
    for i in range(2,int((N**0.5))+1):
        if N%i==0:
            cnt=0
            for j in range(40):
                if N%i==0:
                    N//=i
                    cnt+=1
            ps.append([i,cnt])
    if N!=1:
        ps.append([N,1])
        
    ans=0
    for p in ps:
        ans+=int(((8*p[1]+1)**0.5-1)/2)
    print(ans)
    
    
if __name__=="__main__":
    main()

Buggy submission (verdict: Runtime Error):
if N > rootN:
    res*=2
Problem p02677 (python)

Fixed submission:
import cmath
a,b,h,m=map(int, input().split(" "))

print(abs(a*cmath.exp(1j*(h+m/60)*cmath.pi/6)-b*cmath.exp(1j*m*2*cmath.pi/60)))

Buggy submission (verdict: Runtime Error):
import cmath
a,b,h,m=map(int, input().split(" "))

print(abs(a*cmath.exp(j*(h+m/60)*cmath.pi/6)-b*cmath.exp(j*m*2*cmath.pi/60)))
Problem p02678 (python)

Fixed submission:
#

import sys
from collections import deque
input=sys.stdin.readline

def main():
    N,M=map(int,input().split())
    adj=[[] for i in range(N)]
    for i in range(M):
        A,B=map(int,input().split())
        adj[A-1]+=[B-1]
        adj[B-1]+=[A-1]
    parent=[-1]*N
    qu=deque([0])
    qup=qu.popleft
    qua=qu.append
    parent[0]=0
    while(len(qu)>0):
        v=qup()
        for nv in adj[v]:
            if parent[nv]!=-1:
                continue
            else:
                parent[nv]=v
                qua(nv)
    print("Yes")
    for i in range(1,N):
        print(parent[i]+1)
        
    
    
if __name__=="__main__":
    main()

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split(" "))
l=[]
for i in range(m):
  l.append(list(map(int,input().split(" "))))


d=[n+1 for i in range(n)]
d[0]=0

an,m=map(int, input().split(" "))
l=[]
for i in range(m):
  l.append(list(map(int,input().split(" "))))


d=[n+3 for i in range(n)]
d[0]=0

for i in range(n):
    for j in l:
        if j[0]-1==i:
            d[j[1]-1]=min(d[j[1]-1], d[i]+1)
            l.remove(j)
        elif j[1]-1==i:
            d[j[0]-1]=min(d[j[0]-1],d[i]+1)
            l.remove(j)
            
            
j="Yes"
for i in range(n):
    if d[i]==n+3:
        j="No"
print(j)
for i in range(1,n):
    print(d[i])
Problem p02683 (python)

Fixed submission:
N,M,X=map(int,input().split())
l=[list(map(int,input().split())) for i in range(N)]


cmin=12*10**5+1
for bit in range(2**N):
    A=[0]*M
    c=0
    for j in range(N):
        if (bit>>j)&1:
            c+=l[j][0]
            A=[x+y for (x,y) in zip(A, l[j][1:])]
    if min(A) >= X:
        cmin=min(cmin,c)

if cmin!=12*10**5+1:
    print(cmin)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N,M,X=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]


cmin=12*10**5+1
for bit in range(2**N):
    A=[0]*M
    c=0
    for j in range(N):
        if (bit>>j)&1:
            c+=l[j][0]
            A=[x+y for (x,y) in zip(A, l[j][1:])]
    if min(A) >= X:
        cmin=min(cmin,c)

if cmin!=12*10**5+1:
    print(cmin)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n,m,x=map(int,input().split(" "))
for i in range(n):
  A[i]=list(map(int,input().split(" ")))

minprice=[-1]
for i in range(m):
  for j in range(n):
    maxi = j
    for k in range(j,n):
      if A[maxi][i] < A[k][i]:
        maxi = k
    temp = A[maxi][i]
    A[maxi][i] = A[j][i]
    A[j][i] = temp
  x_m=0
  p_m
  for j in range(n):
    if x_m < x:
      x_m += A[j][i]
      p_m += A[j][0]
  minprice.append(p_m)
  
print(min(minprice))
Problem p02686 (python)

Fixed submission:
N = int(input())
lremain = []
rremain = []

for i in range(N):
	S = input()
	left = 0
	right = 0
	for c in S:
		if c == "(":
			left += 1
		else:
			if left == 0:
				right += 1
			else:
				left -= 1
	if left == 0 and right == 0:
		continue
	lremain.append(left)
	rremain.append(right)

N = len(lremain)

if sum(lremain) != sum(rremain):
	print("No")
	exit()

head = 0
tail = 0
removei = set()
for i in range(N):
	if rremain[i] == 0:
		head += lremain[i]
		removei.add(i)
	if lremain[i] == 0:
		tail += rremain[i]
		removei.add(i)

lnr = []
for i in range(N):
	if not i in removei:
		lnr.append((lremain[i], rremain[i]))

N = len(lnr)
lnr.sort(key = lambda x: (x[1]-x[0]))

for i in range(N):
	if head < lnr[i][1]:
		print("No")
		exit()
	head -= lnr[i][1]
	head += lnr[i][0]

if head == tail:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
lremain = []
rremain = []

for i in range(N):
	S = input()
	left = 0
	right = 0
	for c in S:
		if c == ".":
			left += 1
		else:
			if left == 0:
				right += 1
			else:
				left -= 1
	if left == 0 and right == 0:
		continue
	lremain.append(left)
	rremain.append(right)

N = len(lremain)

if sum(lremain) != sum(rremain):
	print("No")
	exit()

head = 0
tail = 0
removei = []
for i in range(N):
	if rremain[i] == 0:
		head += lremain[i]
		removei.append(i)
	if lremain[i] == 0:
		tail += rremain[i]
		removei.append(i)

lnr = []
for i in range(N):
	if not i in removei:
		lnr.append((lremain[i], rremain[i]))

N = len(lnr)
lnr.sort(key = lambda x: (x[1], -x[0]))

for i in range(N):
	if head < lnr[i][1]:
		print("No")
		exit()
	head -= lnr[i][1]
	head += lnr[i][0]

if head == tail:
	print("Yes")
else:
	print("No")
	
	
23, 31, 41, 43 wa
1, 2, 3, 4, tle
Problem p02691 (python)

Fixed submission:
from bisect import bisect_left, bisect_right

N = int(input())

A = list(map(int, input().split()))
Ap = [i - A[i] for i in range(N)]
Ap.sort()

ans = 0
for i in range(N):
	ans += bisect_right(Ap, i + A[i]) - bisect_left(Ap, i + A[i])

print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split(" ")))
c=0
for i in range(n):
  for j in range(i+1,n):
    if l[i]+l[j]=j-i:
      c+=1
      
print(c)
Problem p02702 (python)

Fixed submission:
S = input()
N = len(S)
A = [int(S[i]) for i in range(N)]
A = A[::-1]

MOD = 2019

p10 = [1] * N
for i in range(1, N):
	p10[i] = (p10[i - 1] * 10) % MOD

for i in range(N):
	A[i] = (A[i] * p10[i]) % MOD

cumsum = [A[0]] * N
for i in range(1, N):
	cumsum[i] = (cumsum[i - 1] + A[i]) % MOD

cnt = [0] * MOD
cnt[0] = 1
for i in range(N):
	cnt[cumsum[i]] += 1

ans = 0
for i in range(MOD):
	ans += cnt[i] * (cnt[i] - 1) // 2

print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
n=int(s)
c=0
for i in range(len(s)):
    for j in range(i,len(s)):
        z = s[i:j]
        if int(z)%2019 == 0:
            c += 1

print(c)

Buggy submission (verdict: Runtime Error):
s=input()
n=int(s)
c=0
for i in range(len(s)-3):
  for j in range(i+4,len(s)+1):
    m=int(int(n/(10**i))%(10**j))
    if m%2019==0 and m == 0:
      c+=1
print(c)

Buggy submission (verdict: Runtime Error):
s=input()
n=int(s)
c=0
for i in range(len(s)-3):
  for j in range(i,len(s)+1):
    m=int(int(n/(10**i))%(10**j))
    if m%2019==0 and m == 0:
      c+=1
print(c)

Buggy submission (verdict: Runtime Error):
s=input()
n=int(s)
c=0
for i in range(len(s)-3):
  for j in range(i,len(s)+1):
    m=int(int(n/(10**i))%(10**j))
    if m%2019==0 and :
      c+=1
print(c)

Buggy submission (verdict: Runtime Error):
s=input()
n=int(s)
c=0
for i in range(len(s)+1):
  for j in range(i,len(s)+1):
    m=int(int(n/(10**i))%(10**j))
    if m%2019==0:
      c+=1
print(c)

Buggy submission (verdict: Runtime Error):
s=input()
n=int(s)
c=0
for i in range(len(s)):
  for j in range(i,len(s)):
    m=(n/(10**i))%(10**j)
    if m%2019==0:
      c+=1
print(c)
Problem p02717 (python)

Fixed submission:
#

import sys
input=sys.stdin.readline

def main():
    x,y,z=map(int,input().split())
    print(z,x,y)
    
    
    
if __name__=="__main__":
    main()

Buggy submission (verdict: Runtime Error):
#

import sys
input=sys.stdin.readline

def main():
    x,y,z=map(int.input().split())
    print(z,x,y)
    
    
    
if __name__=="__main__":
    main()
Problem p02742 (python)

Fixed submission:
import math
H, W = map(int,input().split())
if H == 1 or W == 1:
    print(1)
else:
    print(int(math.ceil(H*W/2)))

Buggy submission (verdict: Runtime Error):
from math import ceil
H,W=map(int,input().split())

if H==1 and W==1:
  print(1)
else:
  print(int(ceil(h*w/2)))

Buggy submission (verdict: Runtime Error):
import decimal
H,W=input().split()
h=decimal.Decimal(H)
w=decimal.Decimal(W)

if h%2==0 or W%2==0:
  print(h*w/2)
else:
  print(h*w/2+1)

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
print(H*int(ceil(W/2)))

Buggy submission (verdict: Runtime Error):
H,W=map(int,input())
cnt=0
for i in range(H):
    for j in range(W):
        if i+j % 2 ==0:
            cnt+=1
print(cnt)
Problem p02760 (python)

Fixed submission:
A=[list(map(int,input().split())) for i in range(3)]
AB=[[0 for i in range(3)] for j in range(3)]
N=int(input())
for i in range(N):
    x=int(input())
    for j in range(3):
        for k in range(3):
            if A[j][k]==x:
                AB[j][k]=1
c=1
for i in range(3):
    if AB[i][0]*AB[i][1]*AB[i][2]==1:
        c=0
        break
    if AB[0][i]*AB[1][i]*AB[2][i]==1:
        c=0
        break
    if AB[0][0]*AB[1][1]*AB[2][2]==1:
        c=0
        break
    if AB[0][2]*AB[1][1]*AB[2][0]==1:
        c=0
        break
        

if c==1:
    print("No")
else:
  	print("Yes")

Buggy submission (verdict: Runtime Error):
A=[list(map(int,input().split())) for i in range(3)]
AB=[[0 for i in range(3)] for j in range(3)]
N=int(input())
for i in range(N):
    x=input()
    for j in range(3):
        for k in range(3):
            if A[i][j]==x:
                AB[i][j]=1
c=1
for i in range(3):
    if A[i][0]*A[i][1]*A[i][2]==1:
        c=0
        print("Yes")
        break
    if A[0][i]*A[1][i]*A[2][i]==1:
        c=0
        print("Yes")
        break
    if A[0][0]*A[1][1]*A[2][2]==1:
        c=0
        print("Yes")
        break
    if A[0][2]*A[1][1]*A[2][0]==1:
        c=0
        print("Yes")
        
if c==1:
    print("No")
Problem p02786 (python)

Fixed submission:
#

import sys
input=sys.stdin.readline

def main():
    H=int(input())
    cnt=0
    ans=0
    while(H>1):
        H=int(H//2)
        ans+=2**cnt
        cnt+=1
    ans+=2**cnt
    print(ans)
    
    
    
if __name__=="__main__":
    main()

Buggy submission (verdict: Runtime Error):

import sys
sys.setrecursionlimit(1000000000)
def times(h,kp):
    if h==1:
        return 1
    else:
        if h >= 10**9:
            return 1+2*times(int(h//2),kp)
        elif kp[h]==0:
            kp[h]=1+2*times(int(h//2),kp)
            return kp[h]
        else:
            return kp[h]
        
H=int(input())
kp=[0]*10**9
print(times(H,kp))

Buggy submission (verdict: Runtime Error):

import sys
sys.setrecursionlimit(1000000000)
def times(h,kp):
    if h==1:
        return 1
    else:
        if h >= 10**9:
            return 1+2*times(int(h//2),kp)
        elif kp[h]==0:
            kp[h]=1+2*times(int(h//2),kp)
            return kp[h]
        else:
            return kp[h]
        
H=int(input())
kp=[0]*10**9
print(times(H,kp))

Buggy submission (verdict: Runtime Error):

import sys
sys.setrecursionlimit(1000000)
def times(h,kp):
    if h==1:
        return 1
    else:
        if h >= 10**9:
            return 1+2*times(int(h//2),kp)
        elif kp[h]==0:
            kp[h]=1+2*times(int(h//2),kp)
            return kp[h]
        else:
            return kp[h]
        
H=int(input())
kp=[0]*10**9
print(times(H,kp))