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

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

ans = 0
x = []

for i in [a,b,c,d,e]:
  if i % 10 != 0:
    ans += (i//10)*10 + 10
    x.append(i%10)
  else:
    ans += i

if x != []:
  ans -= 10-min(x)
print(ans)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

ans = 0
x = []

for i in [a,b,c,d,e]:
  if i % 10 != 0:
    ans += (i//10)*10 + 10
    x.append(i%10)
  else:
    ans += i

ans -= 10-min(x)
print(ans)
Problem p03240 (python)

Fixed submission:
import itertools
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
for cx, cy in itertools.product(range(0,101), repeat=2):
  flag = False
  hhh = []
  for i in range(n):
    if xyh[i][2] != 0:
      h = xyh[i][2] + abs(xyh[i][0]-cx) + abs(xyh[i][1]-cy)
      hhh.append(h)
  if len(set(hhh)) == 1:
    flag = True
    for i in range(n):
      if xyh[i][2] == 0:
         if hhh[0] - abs(xyh[i][0]-cx) - abs(xyh[i][1]-cy) > 0:
            flag = False
  if flag:
    print(cx, cy, hhh[0])

Buggy submission (verdict: Runtime Error):
import itertools
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
for cx, cy in itertools.product(range(0,101), repeat=2):
  hhh = []
  for i in xyh:
    xi, yi, hi = i[0], i[1], i[2]
    if hi==0:
      if (h-abs(xi-cx)-abs(yi-cy))<=0:
        continue
      else:
        break
    h = hi + abs(xi-cx) + abs(yi-cy)
    hhh.append(h)
  if len(set(hhh)) == 1:
    print(cx, cy, h)
    break
Problem p03244 (python)

Fixed submission:
import collections
n = int(input())
v = list(map(int, input().split()))
v1 = [v[i*2+1] for i in range(n//2)]
v2 = [v[i*2] for i in range(n//2)]
c1 = collections.Counter(v1).most_common()
c2 = collections.Counter(v2).most_common()

if len(set(v1)) == len(set(v2)) == 1:
  if c1[0][0] != c2[0][0]:
    print(0)
  else:
    print(min(len(v1), len(v2)))
elif len(set(v1))==1:
  if c1[0][0] != c2[0][0]:
    print(sum([i[1] for i in c2])-c2[0][1])
  else:
    print(sum([i[1] for i in c2])-c2[1][1])
elif len(set(v2))==1:
  if c1[0][0] != c2[0][0]:
    print(sum([i[1] for i in c1])-c1[0][1])
  else:
    print(sum([i[1] for i in c1])-c1[1][1])
else:
  if c1[0][0] != c2[0][0]:
    print((sum([i[1] for i in c1])-c1[0][1]) + (sum([i[1] for i in c2])-c2[0][1]))
  else:
    print(min((sum([i[1] for i in c1])-c1[0][1])+(sum([i[1] for i in c2])-c2[1][1]),
              (sum([i[1] for i in c1])-c1[1][1])+(sum([i[1] for i in c2])-c2[0][1])))

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
v = list(map(int, input().split()))
v1 = v[::2]
v2 = v[1::2]
c1 = collections.Counter(v1).most_common()
c2 = collections.Counter(v2).most_common()

if c1[0][0] != c2[0][0]:
  print(len(v1)-c1[0][1] + len(v2)-c2[0][1])
else:
  if len(set(v1)) == len(set(v2)) == 1:
    print(min(len(v1), len(v2)))
  elif len(set(v1))==1:
    print(len(v2)-c2[1][1])
  elif len(set(v2))==1:
    print(len(v1)-c1[1][1])
  else:
    print(min(len(v1)-c1[0][1]+len(v2)-c2[1][1]),
                len(v1)-c1[1][1]+len(v2)-c2[0][1])
Problem p03262 (python)

Fixed submission:
n, x = map(int, input().split())
xi = list(map(int, input().split()))
xi.append(x)
xi.sort()
d = [xi[i+1]-xi[i] for i in range(n)]

import fractions
from functools import reduce

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

print(gcd_list(d))

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
xi = list(map(int, input().split()))
xi.append(x)
xi.sort()
d = [xi[i+1]-xi[i] for i in range(n)]

import math
from functools import reduce

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

print(gcd_list(d))
Problem p03288 (python)

Fixed submission:
r = int(input())
if r < 1200:
  print("ABC")
elif r < 2800:
  print("ARC")
else:
  print("AGC")

Buggy submission (verdict: Runtime Error):
r = int(input())
if r < 1200:
  print("ABC")
else r < 2800:
  print("ARC")
else:
  print("AGC")
Problem p03293 (python)

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

ok = False
for i in range(len(s)):
  a = s[-1]
  s = s[:-1]
  s.insert(0, a)
  if s == t:
    ok = True
    break
if ok:
  print("Yes")
else:
  print("No")

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

ok = False
for i in range(len(s)):
  s = s[-1] + s[:-1]
  if s == t:
    ok = True
    break
if ok:
  print("Yes")
else:
  print("No")
Problem p03361 (python)

Fixed submission:
h, w = map(int, input().split())
s = [input() for i in range(h)]
flag = True

for i in range(h):
  for j in range(w):
    if s[i][j] == "#":
      top = max(0, i-1)
      bottom = min(h-1, i+1)
      right = min(w-1, j+1)
      left = max(0, j-1)
      if s[i][right] != "#" and s[i][left] != "#" and s[top][j] != "#" and s[bottom][j] != "#":
        flag = False
        break
  if flag == False:
    break

if flag:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = ["."+input()+"." for i in range(h)]
s = ["."*w] + s + ["."*w]

for i in range(1,h+1):
  for j in range(1,w+1):
    if s[i][j] == "#":
      if s[i][j+1] == s[i][j-1] == s[i+1][j] == s[i-1][j] == ".":
        print("No")
        exit()

print("Yes")

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = [["."]+input()+["."] for i in range(h)]
s = ["."*w] + s + ["."*w]

for i in range(1,h+1):
  for j in range(1,w+1):
    if s[i][j] == "#":
      if s[i][j+1] == s[i][j-1] == s[i+1][j] == s[i-1][j] == ".":
        print("No")
        exit()

print("Yes")
Problem p03416 (python)

Fixed submission:
a, b = map(int, input().split())
ans = 0
import itertools
for i,j,k in itertools.product(range(0,10), repeat=3):
  if i == 0:
    continue
  x = 10000*i + 1000*j + 100*k + 10*j + i
  if a <= x <= b:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
ans = 0
for i in range(1,10):
  for j in range(0,10):
    for k in range(0,10):
  x = 10000*i + 1000*j + 100*k + 10*j + i
  if a <= x <= b:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
ans = 0
for i in range(1,10):
  for j in range(0,10):
    for k in range(0.10):
  x = 10000*i + 1000*j + 100*k + 10*j + i
  if a <= x <= b:
    ans += 1
print(ans)
Problem p03502 (python)

Fixed submission:
n = int(input())
fx = sum([int(i) for i in list(str(n))])
if n % fx == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
fx = sum([int(i) for i in list(n)])
if n % fx == 0:
  print("Yes")
else:
  print("No")
Problem p03574 (python)

Fixed submission:
h, w = map(int, input().split())
s = ["a"*(w+2)] + ["a" + input() + "a" for i in range(h)] + ["a"*(w+2)]

ans = []
for i in range(1, h+1):
  for j in range(1, w+1):
    if s[i][j] == "#":
      ans.append("#")
    else:
      c = [s[i-1][j-1], s[i-1][j], s[i-1][j+1], s[i][j-1], s[i][j+1], s[i+1][j-1], s[i+1][j], s[i+1][j+1]]
      ans.append(c.count("#"))
      
for i in range(h):
  print("".join(list(map(str, ans[i*w:(i+1)*w]))))

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = ["a"*(w+2)] + ["a" + input() + "a" for i in range(h)] + ["a"*(w+2)]

for i in range(1, h+1):
  for j in range(1, w+1):
    if s[i][j] != "#":
      c = [s[i-1][j-1], s[i-1][j], s[i-1][j+1], s[i][j-1], s[i][j+1], s[i+1][j-1], s[i+1][j], s[i+1][j+1]]
      s[i][j] = str(c.count("#"))
      
for i in s:
  print(i)
Problem p02642 (python)

Fixed submission:
from collections import Counter
def D():
    N = int(input())
    A = list(map(int, input().split()))
    nums = Counter(A)
    if 1 in nums:
        if nums[1] > 1:
            print(0)
            return
        else:
            print(1)
            return
    n = max(A)
    dp = [True for i in range(n+1)]
    p = 2
    while (p <= n): 
        if (p in nums and dp[p] == True): 
            for i in range(p*2, n+1, p): 
                # print(i)
                dp[i] = False
        p += 1
    ans = 0
    for num in nums:
        if nums[num] == 1 and dp[num]:
            # print(num)
            ans += 1
    print(ans)

D()

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
n = max(A)
dp = [True for i in range(n+1)]
p = 2
while (p * p <= n): 
  # If prime[p] is not changed, then it is a prime 
  if (prime[p] == True): 
    # Update all multiples of p 
    for i in range(p * p, n+1, p): 
      prime[i] = False
      p += 1
ans = 0
for num in A:
  if dp[num]:
    ans += 1
print(ans)
Problem p02727 (python)

Fixed submission:
import heapq
def E():
    X, Y, A, B, C = map(int, input().split())
    reds = []
    heapq.heapify(reds)
    for n in input().split():
        heapq.heappush(reds, int(n))
    greens = []
    heapq.heapify(greens)
    for n in input().split():
        heapq.heappush(greens, int(n))
    colorless = []
    heapq.heapify(colorless)
    for n in input().split():
        heapq.heappush(colorless, -int(n))
    
    redx = heapq.nlargest(X, reds)
    greeny = heapq.nlargest(Y, greens)
    colorless_val = 0
    while True:
        if not colorless:
            break
        cur = abs(heapq.heappop(colorless))
        if redx and cur > redx[-1]:
            if greeny and redx[-1] > greeny[-1]:
                greeny.pop()
            else:
                redx.pop()
            colorless_val += cur
        elif greeny and cur > greeny[-1]:
            if redx and greeny[-1] > redx[-1]:
                redx.pop()
            else:
                greeny.pop()
            colorless_val += cur
        else:
            break
    print(sum(redx)+sum(greeny)+colorless_val)

E()

Buggy submission (verdict: Runtime Error):
import heapq
def E():
    X, Y, A, B, C = map(int, input().split())
    reds = []
    heapq.heapify(reds)
    for n in input().split():
        heapq.heappush(reds, int(n))
    greens = []
    heapq.heapify(greens)
    for n in input().split():
        heapq.heappush(greens, int(n))
    colorless = []
    heapq.heapify(colorless)
    for n in input().split():
        heapq.heappush(colorless, -int(n))
    
    redx = heapq.nlargest(X, reds)
    greeny = heapq.nlargest(Y, greens)
    colorless_val = 0
    while True:
        if not colorless:
            break
        cur = abs(heapq.heappop(colorless))
        if cur > redx[-1]:
            if redx[-1] > greeny[-1]:
                greeny.pop()
            else:
                redx.pop()
            colorless_val += cur
        elif cur > greeny[-1]:
            if greeny[-1] > redx[-1]:
                redx.pop()
            else:
                greeny.pop()
            colorless_val += cur
        else:
            break
    print(sum(redx)+sum(greeny)+colorless_val)

E()
Problem p02812 (python)

Fixed submission:
n = int(input())

s = input()

print(s.count('ABC'))

Buggy submission (verdict: Runtime Error):
n = int(intput())
str = input()
print(str.count('ABC'))
Problem p04030 (python)

Fixed submission:
a = input()
ans = ""
for i in a:
    if i == "0" or i == "1":
        ans += i
    
    elif len(ans) > 0 :
        ans = ans[:len(ans)-1]

print(ans)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

int main(int argc, char const* argv[])
{
	string s;
	cin >> s;
	
	deque<char> q;
	rep(i, s.length()){
		if(s[i] == 'B' && !q.empty()){
			q.pop_back();
		} else if(s[i] != 'B'){
			q.push_back(s[i]);
		}
	}
	
	rep(i, q.size()){
		cout << q[i];
	}
	
	cout << endl;
	return 0;
}
Problem p02583 (python)

Fixed submission:
from itertools import combinations
n = int(input())
l = list(map(int,input().split()))
c = combinations(l,3)
ans=0
for (a,b,c) in c:
  if a+b>c and b+c>a and c+a>b and a!=b and b!=c and a!=c:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import combinations
n = int(input())
l = list(map(int,input().split()))
c = combinations(l,3)
ans=0
for (a,b,c) in c:
	if a+b>c and b+c>a and c+a>b and a!=b and b!=c and a!=c:
		+=1
print(ans)
Problem p02657 (python)

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

print(a * b)

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

print(a * b)
Problem p02621 (python)

Fixed submission:
n=int(input())
print(n+n**2+n**3)

Buggy submission (verdict: Runtime Error):
n=input()
print(n+n**2+n**3)
Problem p02639 (python)

Fixed submission:
print(input().split().index('0')+1)

Buggy submission (verdict: Runtime Error):
print(input().split().find('0')+1)
Problem p02675 (python)

Fixed submission:
n = int(input())
if n%10 == 3:
  print('bon')
elif n%10 in [0, 1, 6, 8]:
  print('pon')
else:
  print('hon')

Buggy submission (verdict: Runtime Error):
n = input()
if n[-1] == '3':
  print('bon')
if n[-1] in ['0', '1', '6', '8']:
  print('pon'):
else:
  print('hon')
Problem p02681 (python)

Fixed submission:
s=input()
t=input()
print(["No","Yes"][t[:-1]==s])

Buggy submission (verdict: Runtime Error):
i=input()
s=i()
t=i()
print(["No","Yes"][t[:-1]==s])
Problem p02756 (python)

Fixed submission:

def main():
    s = input()
    q = int(input())
    bottom = ''
    top = ''
    swapped = 0
    for _ in range(q):
        query = input()
        if len(query) == 1:
            swapped = 1 - swapped
            continue
        _, f, c = query.split()
        if swapped:
            if f == '1':
                bottom += c
            else:
                top += c
        else:
            if f == '1':
                top += c
            else:
                bottom += c

    if swapped:
        print(bottom[::-1] + s[::-1] + top)
    else:
        print(top[::-1]+s+bottom)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
class DoblyLinkedList:
    class node:
        def __init__(self, pre, val, nex):
            self.val = val
            self.pre = pre
            self.nex = nex

    def __init__(self, num):
        self.elements = [None for _ in range(100001)]
        self.elements[0] = self.node(None, num, None)
        self.top = 0
        self.bottom = 0
        self.cnt = 0

    def push_top(self, val):
        self.cnt += 1
        self.elements[self.top].pre = self.cnt
        node = self.node(None, val, self.top)
        self.elements[self.cnt] = node
        self.top = self.cnt

    def push_bottom(self, val):
        self.cnt += 1
        self.elements[self.bottom].nex = self.cnt
        node = self.node(self.bottom, val, None)
        self.elements[self.cnt] = node
        self.bottom = self.cnt

    @staticmethod
    def from_str(s):
        ret = DoblyLinkedList(s[0])
        for v in s[1:]:
            ret.push_bottom(v)
        return ret

    def to_str(self):
        cur = self.top
        val = self.elements[self.top].val
        while self.elements[cur].nex is not None:
            val += self.elements[self.elements[cur].nex].val
            cur = self.elements[cur].nex
        return val


def main():
    s = input()
    d = DoblyLinkedList.from_str(s)
    q = int(input())
    swapped = 0
    for _ in range(q):
        query = input()
        if len(query) == 1:
            swapped = 1 - swapped
            continue
        _, f, c = query.split()
        if swapped:
            if f == '1':
                d.push_bottom(c)
            else:
                d.push_top(c)
        else:
            if f == '1':
                d.push_top(c)
            else:
                d.push_bottom(c)

    if swapped:
        print(d.to_str()[::-1])
    else:
        print(d.to_str())


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

Fixed submission:
def main():
    N = int(input())
    data = []
    for i in range(N):
        s, p = input().split()

        data.append((s, 100 - int(p), i+1))

    for s, p, i in sorted(data):
        print(i)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
package main

import (
	"fmt"
	"sort"
	"strconv"
)

type Restaurant struct {
	S string
	P int
	Idx int
}

func solve() {
	var ts string
	var N int
	fmt.Scan(&N)

	var restaurants []Restaurant
	for i := 0; i < N; i++ {
		var s string
		fmt.Scan(&s, &ts)
		p, _ := strconv.Atoi(s)
		restaurants = append(restaurants, Restaurant{s, p, i+1})
	}
	sort.SliceStable(restaurants, func(i, j int) bool {
		if restaurants[i].S != restaurants[j].S {
			return restaurants[i].S < restaurants[j].S
		}
		return restaurants[i].P > restaurants[j].P
	})
	for _, r := range restaurants {
		println(r.Idx)
	}
}

func main() {
	solve()
}
Problem p02582 (python)

Fixed submission:
s = input()

if s == "RRR":
  print(3)
elif s == "SRR" or s == "RRS":
  print(2)
elif s == "SSS":
  print(0)
else:
  print(1)

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

if s == "RRR":
  print(3)
elif s == "RRS" or s == "SRR":
  print(2)
elif s = "SSS":
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
s = intput()
if s == "RRR":
  print(3)

elif s == "SRR" or s == "RSS":
  print(2)
elif s = "SSS":
  print(0)
else:
  print(1)
Problem p02612 (python)

Fixed submission:
N = int(input())
if N % 1000 == 0:
  print(0)
else:
  print(1000-(N%1000))

Buggy submission (verdict: Runtime Error):
N = int.input()
if N % 1000 == 0:
  print(0)
else:
  print(1000-(N%1000))

Buggy submission (verdict: Runtime Error):
N = int.input()
oturi = 1000-(N%1000)
print(oturi)

Buggy submission (verdict: Runtime Error):
N = int.input()
oturi = N%1000
print(oturi)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
ab= int,input().split()
print(ab[0]*ab[1])

Buggy submission (verdict: Runtime Error):
a,b = int,input().split()
print(a*b)
Problem p02675 (python)

Fixed submission:
a = int(input())
a %= 10

if a==0 or a==1 or a==6 or a==8:
  print("pon")
elif a==3:
  print("bon")
else:
  print("hon")

Buggy submission (verdict: Runtime Error):
a = input()
if a[2]=="0" or a[2]=="1" or a[2]=="6" or a[2]=="8":
  print("pon")
elif a[2]=="3":
  print("bon")
else:
  print("hon")

Buggy submission (verdict: Runtime Error):
a = input()
if a[2]=="2" or a[2] =="4" or a[2] =="5" or a[2] =="7" or a[2] =="9":
  print("hon")
elif a[2] =="3":
  print("bon")
else:
  print("pon")
Problem p02677 (python)

Fixed submission:
import math
A,B,H,M=map(int,input().split())
thetaA=360/12*H+360/12*M/60
thetaB=360/60*M
theta=thetaA-thetaB
print(math.sqrt(A*A+B*B-2*A*B*math.cos(math.radians(theta))))

Buggy submission (verdict: Runtime Error):
import math
A,B,H,M=map(int,input().split())
thetaA=(360*H/12)%360
thetaB=(360*M/60)%360
if theraA-thetaB<=180:
  theta=theraA-thetaB
else:
  theta=360-theraA-thetaB
print(A*B*math.cos(math.radians(theta)))

Buggy submission (verdict: Runtime Error):
import math
A,B,H,M=map(float().split())
thetaA=(360*H/12)%360
thetaB=(360*M/60)%360
if theraA-thetaB<=180:
  theta=theraA-thetaB
else:
  theta=360-theraA-thetaB
print(A*B*math.cos(math.radians(theta)))

Buggy submission (verdict: Runtime Error):
import math
A,B,H,M=map(int().split())
thetaA=(2*360*H/12)%360
thetaB=(2*360*M/60)%360
if theraA-thetaB<=180:
  theta=theraA-thetaB
else:
  theta=360-theraA-thetaB
print(A*B*math.cos(math.radians(theta)))
Problem p02582 (python)

Fixed submission:
s=input().split('S')
if s.count('RRR'): print(3)
elif s.count('RR'): print(2)
elif s.count('R'): print(1)
else: print(0)

Buggy submission (verdict: Runtime Error):
s=input()
if s.count('R')==1: print(1)
elif s.count('R')==3: print(3)
else:
    if s="RSR": print(1)
    else: print(2)
Problem p02662 (python)

Fixed submission:
mod=998244353
n,s=map(int,input().split())
ar=list(map(int,input().split()))
dp=[0 for y in range(s+1)]
dp[0]=1
for i in range(n):
    for j in range(s,-1,-1):
        if j+ar[i]<=s:
            dp[j+ar[i]]=(dp[j]+dp[j+ar[i]])%mod
        dp[j]=(dp[j]*2)%mod
print(dp[s])

Buggy submission (verdict: Runtime Error):
ans=0
n,s=map(int,input().split())
ar=list(map(int,input().split()))
mod=998244353

def func(b,sel,pos):
    global ans
    if b==s:
        ans+=pow(2,(n-sel),mod)
    #print(b,sel,pos,ans)
    if pos<n-1:
        func(b+ar[pos+1],sel+1,pos+1)
        if b<s:
            func(b,sel,pos+1)
    

func(ar[0],1,0)
func(0,0,0)
print(ans%mod)

Buggy submission (verdict: Runtime Error):
ans=0
n,s=map(int,input().split())
ar=list(map(int,input().split()))

def func(b,sel,pos):
    global ans
    if b==s:
        ans+=1<<(n-sel)
    #print(b,sel,pos,ans)
    if pos<n-1:
        func(b+ar[pos+1],sel+1,pos+1)
        if b<s:
            func(b,sel,pos+1)
    

func(ar[0],1,0)
func(0,0,0)
print(ans)
Problem p02715 (python)

Fixed submission:
n,k=map(int,input().split())
dp=[0]*(k+1)
mod=int(1e9+7)
for i in range(k,0,-1):
    sm=0
    for j in range(2*i,k+1,i):
        sm=(sm+dp[j])%mod
    dp[i]=(pow(k//i,n,mod)-sm)%mod

ans=0
for i in range(1,k+1):
    ans+=(dp[i]%mod*i%mod)%mod
print(ans%mod)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
dp=[0]*(k+1)
mod=int(1e9+7)
for i in range(k,0,-1):
    sm=0
    for j in range(2*i,k+1,i):
        sm=(sm+dp[j])%mod
    dp[i]=pow(k//i,n,mod)-sm

ans=0
for i in range(1,n+1):
    ans+=(dp[i]%mod*i%mod)%mod
print(ans%mod)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
dp=[0]*(k+1)
mod=int(1e9+7)
for i in range(k,0,-1):
    sm=0
    for j in range(2*i,k+1,i):
        sm=(sm+dp[j])%mod
    dp[i]=pow(k//i,n,mod)-sm

ans=0
for i in range(1,n+1):
    ans+=(dp[i]%mod*i%mod)%mod
print(ans%mod)
Problem p02718 (python)

Fixed submission:
n,m = input().split()
N = int(n)
M = int(m)
a = [int(i) for i in input().split()]
a.sort(reverse=True)
k = sum(a)/(4*M)
if k > a[M-1]:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
val=4*m
c=0
for i in range(n):
  v=int(input())
  v=v/val
  if(v<m):
    c=c+0
  else:
    c=c+1
if(c>=m):
  print("YES")
else:
  print("NO")
Problem p02631 (python)

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

allh=alist[0]^alist[1]
for i in range(n-2):
    allh = allh ^ alist[i+2]

outlist=[]
for a in alist:
    outlist.append(str(allh ^ a))
    outlist.append(" ")
outlist.pop()
print("".join(outlist))

Buggy submission (verdict: Runtime Error):
n=int(input())
alist=list(map(int,input().split()))

allh=alist[0]^alist[1]
for i in range(n-1):
    allh = allh ^ alist[i+2]

outlist=[]
for a in alist:
    outlist.append(str(allh ^ a))
    outlist.append(" ")
outlist.pop()
print("".join(outlist))
Problem p02768 (python)

Fixed submission:
from operator import mul
from functools import reduce
import math

n,a,b=map(int,input().split())

so=10**9+7

large=(pow(2,n,so)-1)

def kumiawase(n,r):
    over=1
    for i in range(r):
        over *= n-i
        over %= so
    under = math.factorial(r)
    return over * pow(under,so-2,so)

ajogai = kumiawase(n,a) % so
bjogai = kumiawase(n,b) % so
print((large - ajogai - bjogai + 2*so) % so)

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

n,a,b=map(int,input().split())

so=10**9+7

large=(pow(2,n,so))

def kumiawase(n,r):
    return math.fractorial(n) / (math.fractorial(n-r) * math.fractorial(r)

ajogai = kumiawase(n,a) % so
bjogai = kumiawase(n,b) % so
print((large - ajogai - bjogai + 2*so) % so)