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

Fixed submission:
import bisect
n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()

data = [None] * m
for i in range(m):
    data[i] = list(map(int, input().split()))
data.sort(key = lambda x : x[1])
data.reverse()


ans = 0
count = 0
pre_index = 0
#print(data)
#print(a)
#data[][1] = value, data[][0] = card_num
for i in range(m):
    insert_index = bisect.bisect_left(a, data[i][1])
    count = min(data[i][0], insert_index - pre_index)
    for j in range(pre_index, pre_index + count):
        if j >= n:
            break
        a[j] = 0
    ans += count * data[i][1]
    pre_index = pre_index + count
print(ans + sum(a))

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
card = list(map(int, input().split()))
data = []
for i in range(m):
    data.append(list(map(int, input().split())))
data.sort(key=lambda x:x[1])
data.reverse()
card.sort()
total = 0
k = 0
for i in range(m):
    s = min(data[i][0] - 1,len(card) - 1)
    if card[s] < data[i][1]:
        total += (s + 1)* data[i][1]
        card = card[s+1:]
    else:
        for j in range(min(data[i][0] ,len(card))):
            if card[j] < data[i][1]:
                total += data[i][1]
                k = j
            else:
                k = j - 1
                break
        card = card[k+1:]
total += sum(card)
print(total)
Problem p03041 (python)

Fixed submission:
n, k = list(map(int, input().split()))
s = list(input())
s[k - 1] = s[k - 1].lower()
print(*s, sep = "")

Buggy submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
s = input()
s[k - 1] = (s[k - 1]).lower()
print(s)

Buggy submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
s = input()
s[k - 1] =　lower(s[k - 1])
print(s)
Problem p03042 (python)

Fixed submission:
data = int(input())
up = data/100
down = data % 100
if(1 <= up and up <= 12):
    if(1 <= down and down <= 12):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if(1 <= down and down <= 12):
        print("YYMM")
    else:
        print("NA")

Buggy submission (verdict: Runtime Error):
data = int(input())
up = data/100
down = data % 100
if(1 <= up and up <= 12):
    if(1 <= down and down <= 12):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if(1 <= down and down <= 12):
        print("YYMM")
    else:
        print(NA)
Problem p03045 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
n, m = map(int, input().split())
adjacent_list = [[] for i in range(n + 1)]
for i in range(m):
    x, y, z = map(int,input().split())
    adjacent_list[x].append(y)
    adjacent_list[y].append(x)
##結局、グラフが何個あるか数える
finished = set()
ans = 0
def dfs(node):
    global finished
    finished.add(node)
    for i in adjacent_list[node]:
        if i not in finished:
            dfs(i)

while len(finished) != n:
    for i in range(1,n+1):
        if i not in finished:
            dfs(i)
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**5)
n, m = map(int, input().split())
adjacent_list = [[] for i in range(n + 1)]
for i in range(m):
    x, y, z = map(int,input().split())
    adjacent_list[x].append(y)
    adjacent_list[y].append(x)
##結局、グラフが何個あるか数える
finished = set()
ans = 0
def dfs(node):
    global finished
    finished.add(node)
    for i in adjacent_list[node]:
        if i not in finished:
            dfs(i)

while len(finished) != n:
    for i in range(1,n+1):
        if i not in finished:
            dfs(i)
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
adjacent_list = [[] for i in range(n + 1)]
for i in range(m):
    x, y, z = map(int,input().split())
    adjacent_list[x].append(y)
    adjacent_list[y].append(x)
##結局、グラフが何個あるか数える
finished = set()
ans = 0
def dfs(node):
    global finished
    finished.add(node)
    for i in adjacent_list[node]:
        if i not in finished:
            dfs(i)

while len(finished) != n:
    for i in range(1,n+1):
        if i not in finished:
            dfs(i)
            ans += 1
        
print(ans)
Problem p03072 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
count = 0
for i in range(n):
    if max(h[0:i + 1]) <= h[i]:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
count = 0
for i in range(n):
    if max(h[0:i]) =< h[i]:
        count += 1
print(count)
Problem p03107 (python)

Fixed submission:
s = input()
data = []
for i in s:
    data.append(int(i))
one = 0
zero = 0
for i in range(len(data)):
    if data[i] == 0:
        zero += 1
    else:
        one += 1

print(min(zero, one) * 2)

Buggy submission (verdict: Runtime Error):
s = input()
data = []
for i in s:
    data.append(int(i))
one = 0
zero = 0
for i in range(len(data))
    if i == 0:
        zero += 1
    else:
        one += 1
print(min(zero, one))
Problem p03208 (python)

Fixed submission:
n , k = list(map(int, input().split()))
h = []
for i in range(n):
    h.append(int(input()))
h.sort()
min = h[-1]
for i in range(n - k + 1):
    if min > h[i + k - 1] - h[i]:
        min = h[i + k - 1] - h[i]
print(min)

Buggy submission (verdict: Runtime Error):
n , k = list(map(input().split()))
h = []
for i in range(n):
    h.append(int(input()))
h.sort()
min = h[-1]
for i in range(n - k):
    if min > h[i + k] - h[i]:
        min = h[i + k] - h[i]
print(min)
Problem p03209 (python)

Fixed submission:
n, x = list(map(int, input().split()))

a = [1]
p = [1]
for i in range(1,n):
    a.append(a[i - 1] * 2 + 3)
    p.append(2 * p[i - 1] + 1)

def f(n, x):
    if n == 0:
        return 0 if x <= 0 else 1
    elif x <= 1 + a[n-1]:
        return f(n-1, x-1)
    else:
        return p[n-1] + 1 + f(n-1, x-2-a[n-1])
print(f(n,x))

Buggy submission (verdict: Runtime Error):
dp = ["" for i in range(51)]
dp[0] = "P"

def solve(n, dp):
    if n == 0:
        return dp[0]
    else:
        if dp[n] == "":
            k = solve(n - 1,dp)
            return 'B' + k + 'P' + k + 'B'
        else:
            return dp[n]
n, x = list(map(int, input().split()))
dp = solve(n,dp)
print(dp[-x:].count('P'))
Problem p03221 (python)

Fixed submission:
n, m = list(map(int, input().split()))
data = []
for i in range(m):
    data.append([i + 1] + list(map(int, input().split())))
    #data[0::] = cityNumber,
    #data[:0:] = prefect,
    #data[::0] = year
data = sorted(data, key = lambda x: (x[1], x[2]))
#prefect => year
ans = [[0,0,0] for i in range(m)]
#ans[::0] = city Number
#ans[0::] = prefect
#ans[:0:] = ID

pre = data[0][1]
num = 0
for i in range(m):
    ans[i][0] = data[i][1] # prefect
    ans[i][2] = data[i][0] #cityNumber
    if pre == data[i][1]:
        num += 1
    else:
        num = 1
    ans[i][1] = num
    pre = data[i][1]
ans = sorted(ans, key = lambda x:x[2])
for i in range(m):
    print("{:0=6}{:0=6}".format(ans[i][0],ans[i][1]))

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
data = []
for i in range(m):
    data.append([i + 1] + list(map(int, input().split())))
data = sorted(data, key = lambda x: (x[1], x[2]))
print(data)
ans = [[0,0,0,0,0,0], [0,0,0,0,0,0] for i in range(m)]
print(ans)
for i in range(m):
Problem p03242 (python)

Fixed submission:
n = list(input())
for i in range(len(n)):
  if n[i] == '1':
    n[i] = '9'
  elif n[i] == '9':
    n[i] = '1'
print("".join(n))

Buggy submission (verdict: Runtime Error):
n = input()
for i in range(len(n)):
  if n[i] == '1':
    n[i] = '9'
  elif n[i] == '9':
    n[i] = '1'
print(n)

Buggy submission (verdict: Runtime Error):
n = input()
for i in range(len(n)):
  if n[i] == '1':
    n[i] = '9'
   elif n[i] == '9':
    n[i] = '1'
print(n)

Buggy submission (verdict: Runtime Error):
n = input
for i in range(len(n)):
  if n[i] == '1':
    n[i] = '9'
   elif n[i] == '9':
    n[i] = '1'
print(n)
Problem p03426 (python)

Fixed submission:
import math
h, w, d = list(map(int, input().split()))
grid = []
num = [[] for i in range(h*w+1)]
for i in range(h):
    grid.append(list(map(int, input().split())))
for i in range(h):
    for j in range(w):
        num[grid[i][j]]=[j+1, i+1]
k = math.ceil((h*w+1) / d)
#initialize
cost = [[0 for i in range(k)] for j in range(d)]
for i in range(d + 1,h*w+1):
    x, y = num[i]
    prex, prey = num[i - d]
    cost[i % d][i//d] = abs(prex - x) + abs(prey - y)
    cost[i % d][i//d] += cost[i % d][(i - d)// d]
q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    print(cost[r%d][r//d] - cost[l%d][l//d])

Buggy submission (verdict: Runtime Error):
import math
h, w, d = list(map(int, input().split()))
grid = []
num = [[] for i in range(h*w+1)]
graph = [[0 for i in range(w+1)] for j in range(h+1)]
for i in range(h):
    grid.append(list(map(int, input().split())))
for i in range(h):
    for j in range(w):
        num[grid[i][j]]=[j+1, i+1]
k = math.ceil((h*w) / d)
#initialize
cost = [[0 for i in range(k)] for j in range(d)]
for i in range(d):
    cost[i][0] = 0
for i in range(d + 1,h*w+1):
    x, y = num[i]
    prex, prey = num[i - d]
    cost[i % d][i//d] = abs(prex - x) + abs(prey - y)
    cost[i % d][i//d] += cost[i % d][(i - d)// d]  
q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    print(cost[r%d][r//d] - cost[l%d][l//d])
Problem p03634 (python)

Fixed submission:
import sys
sys.setrecursionlimit(200000)
n = int(input())
#値の初期化
path = [None]*(n + 1)
adjacent_list = [[] for i in range(n+1)]

for i in range(n - 1):
    a, b, c = list(map(int,input().split()))
    adjacent_list[a].append([b,c])
    adjacent_list[b].append([a,c])
#ノード番号、そこまでの距離,検索済みの要素を受け取る。
def dfs(node_n ,distance,finished):
    #検索済みに追加
    finished.add(node_n)
    #そこまでの距離を代入。値の更新などは特にない（はず）
    path[node_n] = distance
    #対象ノードに対する隣接リストをforで回す
    for i in adjacent_list[node_n]:
        next = i[0]
        if next not in finished:
            #検索済みでなかった場合、そこまでのコストを追加し再帰
            dfs(next, distance + i[1],finished)

q,k = list(map(int, input().split()))
dfs(k, 0, set())
#各クエリへの返答
for i in range(q):
    s, g = list(map(int, input().split()))
    print(path[s] + path[g])

Buggy submission (verdict: Runtime Error):
n = int(input())
#値の初期化
path = [None]*(n + 1)
adjacent_list = [[] for i in range(n+1)]

for i in range(n - 1):
    a, b, c = list(map(int,input().split()))
    adjacent_list[a].append([b,c])
    adjacent_list[b].append([a,c])
#ノード番号、そこまでの距離,検索済みの要素を受け取る。
def dfs(node_n ,distance,finished):
    #検索済みに追加
    finished.add(node_n)
    #そこまでの距離を代入。値の更新などは特にない（はず）
    path[node_n] = distance
    #対象ノードに対する隣接リストをforで回す
    for i in adjacent_list[node_n]:
        next = i[0]
        if next not in finished:
            #検索済みでなかった場合、そこまでのコストを追加し再帰
            dfs(next, distance + i[1],finished)

q,k = list(map(int, input().split()))
dfs(k, 0, set())
#各クエリへの返答
for i in range(q):
    s, g = list(map(int, input().split()))
    print(path[s] + path[g])

Buggy submission (verdict: Runtime Error):
n = int(input())
path = [None]*(n + 1)
adjacent_list = [[] for i in range(n+1)]
for i in range(n - 1):
    a, b, c = list(map(int,input().split()))
    adjacent_list[a].append([b,c])
    adjacent_list[b].append([a,c])
#ノード番号、そこまでの距離,検索済みの要素を受け取る。
def dfs(node_n ,distance,finished):
    finished.add(node_n)
    path[node_n] = distance
    for i in adjacent_list[node_n]:
        next = i[0]
        if next not in finished:
            dfs(next, distance + i[1],finished)
q,k = list(map(int, input().split()))
dfs(k,0,set())
for i in range(q):
    s, g = list(map(int, input().split()))
    print(path[s]+path[g])
Problem p03745 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
if n <= 2:
    print(1)
    exit()
pre = a[1] - a[0]
i = 2
while i < n:
    if pre * (a[i] - a[i-1]) < 0:
        ans += 1
        pre = 0
        i += 1
        if i == n:
            break
    if a[i] != a[i-1]:
        pre = a[i] - a[i-1]
    i += 1
print(ans + 1)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 0
pre = a[1] - a[0]
i = 2
while i < n:
    if pre * (a[i] - a[i-1]) < 0:
        ans += 1
        i += 1
        if i == n:
            break
    pre = a[i] - a[i-1]
    i += 1
print(ans+1)
Problem p02688 (python)

Fixed submission:
N,K=map(int,input().split())
l=[False for x in range(N)]
for i in range(K):
    d=int(input())
    A=list(map(int,input().split()))
    for j in A:
        l[j-1]=True
print(l.count(False))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
l=[False for _ in range(N)]
for i in range(K):
    d=int(input())
    A=list(map(int,input().split()))
    for j in range(N):
        if l[j]==A[j]:
            l[j]=True
print(list.count(False))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
l=[False for _ in range(N)]
for i in range(K):
    d=int(input())
    A=list(map(int,input().split()))
    for j in range(N):
        if l[i]==A[i]:
            l[i]=True
print(list.count(False))
Problem p02725 (python)

Fixed submission:
K,N=map(int,input().split())
A=list(map(int,input().split()))
l=[]
A.append(A[0]+K)
for i in range(N):
    l.append(A[i+1]-A[i])
print(K-max(l))

Buggy submission (verdict: Runtime Error):
K,N=map(int,input().split())
A=list(map(int,input().split()))
l=[]
A+=A[0]+K
for i in range(N):
    l.append(A[i+1]-A[i])
print(K-max(l))
Problem p02754 (python)

Fixed submission:
N,A,B=map(int,input().split())
s=0
a=N//(A+B)
s+=A*a
b=N-a*(A+B)
if b>=A:
    s+=A
else:
    s+=b
print(s)

Buggy submission (verdict: Runtime Error):
H,A,B=map(int,input().split())
l=[]
s=0
while True:
    for i in range(A):
        if s==H:
            print(l.count('b'))
            exit()
        s+=1
        list.append('b')
    for j in range(B):
        if s==H:
            print(l.count('b'))
            exit()
        s+=1
        list.append('a')
Problem p02777 (python)

Fixed submission:
S,T=map(str,input().split())
A,B=map(int,input().split())
U=input()
if U==S:
    A=A-1
else:
    B=B-1
print(A,B)

Buggy submission (verdict: Runtime Error):
S,T=map(input().split())
A,B=map(int,input().split())
U=input()
if U==S:
    A=A-1
else:
    B=B-1
print(A,B)
Problem p02860 (python)

Fixed submission:
N=int(input())
S=input()
if N%2!=0:
    print('No')
    exit()
for i in range(int(N/2)):
    if S[i]!=S[int(N/2)+i]:
        print('No')
        exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
if N%2!=0:
    print('No')
for i in range(N/2):
    if S[i]!=S[N/2+i]:
        print('No')
        exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
if N%2==0:
    print('No')
for i in range(N/2):
    if S[i]!=S[N/2+i]:
        print('No')
        exit()
print('Yes')
Problem p02881 (python)

Fixed submission:
N=int(input())
l=[]
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        l.append([i,N/i])
L=len(l)
s=[0]*L
for j in range(L):
    s[j]=l[j][0]+l[j][1]
print(int(min(s))-2)

Buggy submission (verdict: Runtime Error):
import sympy

N=int(input())
l=[]
for i in sympy.divisors(N):
    l.append([i,N/i])
L=len(l)
s=[0]*L
for j in range(L):
    s[j]=l[j][0]+l[j][1]
print(int(min(s))-2)

Buggy submission (verdict: Runtime Error):
import sympy

N=int(input())
l=[]
for i in sympy.divisors(N):
    l.append([i,N/i])
L=len(l)
s=[0]*L
for j in range(L):
    s[j]=l[j][0]+l[j][1]
print(int(min(s))-2)

Buggy submission (verdict: Runtime Error):
import sympy

N=int(input())
l=[]
for i in sympy.divisors(N):
    l.append([i,N/i])
L=len(l)
s=[0]*L
for j in range(L):
    s[j]=l[j][0]+l[j][1]
print(int(min(s))-2)
Problem p02897 (python)

Fixed submission:
N=int(input())
if N%2==0:
    print(1/2)
else:
     print(((N + 1)/2)/N)

Buggy submission (verdict: Runtime Error):
N=input()
if N%2==0:
  print(N/2)
else:
  print(int(N/2))
Problem p02595 (python)

Fixed submission:
n,d = map(int,input().split())
d *= d
p = 0
for i in range(n):
    x,y = map(int,input().split())
    if(d >= x**2 + y**2):
        p += 1
print(p)

Buggy submission (verdict: Runtime Error):
n,d = map(int,input().split())
d *= d
p = 0
for i in range(n):
    if(d <= x**2 + y**2):
        p += 1
print(p)
Problem p02623 (python)

Fixed submission:
n,m,k = map(int,input().split())
a = [0]+list(map(int,input().split()))
b = [0]+list(map(int,input().split()))
s = [0]*(n+1)
t = [0]*(m+1)
x = 0
for i in range(n+1):
    s[i] += x + a[i]
    x = s[i]
if(s[-1] <= k):
    p = n
else:
    for i in range(n+1):
        if(s[i] >= k):
            p = i
            break
x = 0
for i in range(m+1):
    t[i] += x + b[i]
    x = t[i]
if(t[-1] <= k):
    p = min(p,m)
else:
    for i in range(m+1):
        if(t[i] >= k):
            p = max(p,i)
            break
#print(s,t)
while(1):
    f = 0
    for j in range(p-min(p,m),min(p,n)+1):
        #print(j,p-j)
        if(s[j]+t[p-j] <= k):
            #print(j,x-j)
                f = 1
                break
    if(f == 0):
        break
    p += 1
print(p-1)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
a = [0]+list(map(int,input().split()))
b = [0]+list(map(int,input().split()))
s = [0]*(n+1)
t = [0]*(m+1)
x = 0
for i in range(n+1):
    s[i] += x + a[i]
    x = s[i]
for i in range(n+1):
    if(s[i] >= k):
        p = i
        break
x = 0
for i in range(m+1):
    t[i] += x + b[i]
    x = t[i]
for i in range(m+1):
    if(t[i] >= k):
        p = max(p,i)
        break
#print(s,t)
while(1):
    f = 0
    for j in range(p-min(p,m),min(p,n)+1):
        #print(j,p-j)
        if(s[j]+t[p-j] <= k):
            #print(j,x-j)
                f = 1
                break
    if(f == 0):
        break
    p += 1
print(p-1)
Problem p02712 (python)

Fixed submission:
n = int(input())
m = n//15
l = n%15
x = 60*(m**2)
y = [0,1,2,0,4,0,0,7,8,0,0,11,0,13,14,0]
for i in range(1,l+1):
    if(y[i] != 0):
        x += y[i]+m*15
print(x)

Buggy submission (verdict: Runtime Error):
n = int(input())
m = n//15
l = n%15
x = 60*(m**2)
y = [0,1,2,0,4,0,0,7,8,0,0,11,0,13,14,0]
for i in range(1,l+1):
    if(y[i] != 0):
        x += y[i]+m*15
print(x)a
Problem p02729 (python)

Fixed submission:
m,n=map(int,input().split())
print(m*(m-1)//2+n*(n-1)//2)

Buggy submission (verdict: Runtime Error):
m,n=map(int,input())
print(m*(m-1)+n*(n-1))
Problem p02571 (python)

Fixed submission:
s = input()
t = input()

s = list(s)
s.append("0")
t = list(t)
roop = len(s)-len(t)
cc = []
for i in range(roop):
  c = 0
  tmp = []
  tmp = s[i:len(t)+1+i]
  for i in range(len(t)):
    if tmp[i] == t[i]:
      c += 1
  cc.append(c)

ma = max(cc)
a = cc.index(ma)
tmp = s[a:a+1+len(t)]
ans = 0

for i in range(len(t)):
  if tmp[i] != t[i]:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()

s = list(s)
s.append("0")
t = list(t)
roop = len(s)-len(t)
cc = []
for i in range(roop):
  c = 0
  tmp = []
  tmp = s[i:len(t)+1+i]
  for i in range(len(t)):
    if tmp[i] == t[i]:
      c += 1
  cc.append(c)

ma = max(cc)
a = cc.index(ma)
tmp = s[a:1+len(t)]
ans = 0
for i in range(len(t)):
  if tmp[i] != t[i]:
    ans += 1
print(ans)
Problem p02659 (python)

Fixed submission:
a,b = map(str,input().split())
b = list(b)
del b[-3]
b = ''.join(b)
b = int(b)
#print(b)
#b = int(b*10000)
ans = int(a)*b//100
print(int(ans))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())

b = b*100
ans = int((a*b)/100)
Problem p02682 (python)

Fixed submission:
x = input().split()

a = int(x[0])
b = int(x[1])
c = int(x[2])
k = int(x[3])

if(a > k): # a > k
  print(k)
  exit()
elif(a == k):
  print(a)
  exit()
elif(a+ b > k):  # k > a 
  print(a)
  exit()
elif(k-a == b):
  print(a)
  exit()
else:
  x = k - a - b
  print(a-x)
  exit()

Buggy submission (verdict: Runtime Error):
x = input().split()

a = int(x[0])
b = int(x[1])
c = int(x[2])
k = int(x[3])

if(a > k): # a > k
  print(a-k)
  exit()
elif(a == k):
  print(a)
  exit()
elif(k-a < b):  # k > a 
  print(a)
  exit()
elif(k-a == b):
  print(a)
  exit()
elif(k-a-b != 0)
  x = k - a - b
  print(a-x)
  exit()
Problem p02701 (python)

Fixed submission:
n = int(input())
s = [0]*n

for i in range(n):
  s[i] = input()
ans = 0
s.sort()
for i in range(n-1):
  if s[i] != s[i+1]:
    ans += 1
    
print(ans+1)

Buggy submission (verdict: Runtime Error):
n = input()

n = int(n)
s = [0]*n
sm = []

for i in range(0,n):
  s[i] = input()

for i in range(0,n):
  c = 1
  sm.insert(0,s[i])
  for j in range(1,len(sm)):
    if(s[i] == sm[j]):
      del sm[0]

print(len(sm))
Problem p02711 (python)

Fixed submission:
a = input()

if(a.count("7")!=0):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a = input().split()

for i in range(0,2):
  if(a[i]=="7"):
    print("yes")
  elif(i==2 and a[2] != "7"):
    print("No")
Problem p02729 (python)

Fixed submission:
a = input().split()

m = int(a[0])
o = int(a[1])

t = (m*(m-1))/2
s = (o*(o-1))/2

print(int(t+s))

Buggy submission (verdict: Runtime Error):
a = input().split()

odd = int(a[0])
mean = int(a[1])
arr[0]*odd+mean
t = 0
c = 0

for i in range(0,odd+mean):
  if(i%2==0):
    arr[i] = i
  else:
    arr[i] = i
    
for i in range(0,odd+mean):
  for j in range(0,odd+mean):
    t = 0
    t = arr[i] + arr[j]
    if(t%2==0):
      c = c + 1
    else:
      continue
print(c)
Problem p02753 (python)

Fixed submission:
s = input()

if(s == "AAA" or s == "BBB"):
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()
n = input()
q = [0]*int(n)
 
for i in range(0,int(n)):
  q[i] = input().split()
  
for i in range(0,int(n)):
  if(q[i][0] == "1"):
    s = s[::-1]
  elif(q[i][0] == "2"):
    if(q[i][1] == "1"):
      s = q[i][2] + s
    else:
      s = s + q[i][2]
 
print(s)
Problem p02754 (python)

Fixed submission:
n,a,b = map(int,input().split())
x = 0
y = 0
if(n%(a+b) == 0):
  x=int(n/(a+b))*a
else:
  y = n%(a+b)
  x = int(n/(a+b))*a + min(a,y)
print(x)

Buggy submission (verdict: Runtime Error):
s = input().split()

n = int(s[0])
blue = int(s[1])
red = int(s[2])
br = ["b"]*blue
rr = ["r"]*red
arr = []

f = int(n/(blue + red)) + 1

for i in range(0,f):
  arr.extend(br)
  arr.extend(rr)
  
c = arr[0:n]
print(c)
print(c.count('b'))

Buggy submission (verdict: Runtime Error):
s = input().split()

n = int(s[0])
blue = int(s[1])
red = int(s[2])
br = ["b"]*blue
rr = ["r"]*red
arr = []

for i in range(0,n):
  arr.extend(br)
  arr.extend(rr)
  
c = arr[0:n]

print(c.count('b'))
Problem p02785 (python)

Fixed submission:
n,k = input().split()
mon = input().split()
mon = list(map(int,mon))

if(int(n)<=int(k)):
    print(0)
elif(int(k)==0):
    print(sum(mon))
else:    
    mon.sort(reverse=True)
    for i in range(0,int(k)):
        mon[i] = 0
        
    print(sum(mon))

Buggy submission (verdict: Runtime Error):
h,n = input().split()
w = input().split()

for i in range(0,int(n)):
    h = int(h) - int(w[i])

if(h<=0):
    print("Yes")
else:
    print("No")
Problem p02790 (python)

Fixed submission:
a, b = input().split()

list_a = [0]*int(b)
list_b = [0]*int(a)

for i in range(0,int(b)):
    list_a[i] = int(a)*10**i

for i in range(0,int(a)):
    list_b[i] = int(b)*10**i
    
a_r = sum(list_a) 
b_r =sum(list_b)

if(a<b):
    print(str(a_r))
elif(a>b):
    print(str(b_r))
else:
    print(str(a_r))

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

list_a = [0]*int(b)
list_b = [0]*int(a)

for i in range(0,int(b)):
    list_a[i] = int(a)*10**i

for i in range(0,int(a)):
    list_b[i] = int(b)*10**i
    
a_r = sum(list_a) 
b_r =sum(list_b)

if(int(a_r)<int(b_r)):
    print(str(a_r))
elif(int(a_r)>int(b_r)):
    print(str(b_r))
else:
    print(str(a_r))

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

list_a = [0]*int(b)
list_b = [0]*int(a)

for i in range(0,int(b)):
    list_a[i] = int(a)*10**i

for i in range(0,int(a)):
    list_b[i] = int(b)*10**i
    
a_r = sum(list_a) 
b_r =sum(list_b)

if(a<b):
    print(str(a_r))
elif(a>b):
    print(str(b_r))
else:
    print(str(a_r))

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

list_a = [0]*int(b)
list_b = [0]*int(a)

for i in range(0,int(b)):
    list_a[i] = int(a)*10**i

for i in range(0,int(a)):
    list_b[i] = int(b)*10**i
    
a_r = sum(list_a) 
b_r =sum(list_b)

if(a<b):
    print(a_r)
elif(a>b):
    print(b_r)
else:
    print(a_r)