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

Fixed submission:
N = int(input())
from collections import Counter as C
l = dict(C((int(x) for x in input().split())))
for x in range(1,N+1):
    print(l.get(x,0))

Buggy submission (verdict: Runtime Error):
N = int(input())
l = []
for _ in range(N):
    l.append(input())
from collections import Countor as C
l = dict(C(l))
for x in range(1,N+1):
    print(l.get(x))
Problem p02753 (python)

Fixed submission:
S = input()
print("Yes" if "AB" in S or "BA" in S else "No")

Buggy submission (verdict: Runtime Error):
S = input()
pritn("Yes" if "AB" in S or "BA" in S else "No")
Problem p02777 (python)

Fixed submission:
s,t=input().split();a,b=map(int,input().split());u=input();print("%d %d" %(a-1 if s==u else a,b-1 if s!=u else b))

Buggy submission (verdict: Runtime Error):
s,t=input().split();a,b=map(int,input().split());print(f"{a-1} {b}" if s==input()else f"{a} {b-1}")
Problem p03631 (python)

Fixed submission:
s=input();print("YNeos"[s!=s[::-1]::2])

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split());print(min(b,d)-max(a,c))
Problem p02594 (python)

Fixed submission:
x = int(input())
if x >= 30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
#include <stdio.h>

int main(){
  int x;
  scanf("%d", &x);
  
  if (x >= 30){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }
  
  return 0;
}
Problem p02623 (python)

Fixed submission:
n, m, k = map(int, input().split())
a = [int(x) for x in input().split()]
b = [0]+[int(x) for x in input().split()]

count = sum(a)
p = n-1
ans = 0
judge = True
for i in range(m+1):
  flag = False
  count += b[i]
  while count > k and judge:
    count -= a[p]
    p -= 1
    if p == -1:
      if count > k:
        flag = True
      else:
        judge = False
      break
  if count > k:
    break
  if flag:
    break
  sub = p+1+i
  if ans < sub:
    ans = sub
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = [int(x) for x in input().split()]
b = [0]+[int(x) for x in input().split()]

count = sum(a)
p = n-1
ans = 0
for i in range(m+1):
  flag = False
  count += b[i]
  while count > k:
    count -= a[p]
    p -= 1
    if p == -1:
      if count > k:
        flag = True
      break
  if flag:
    break
  sub = p+1+i
  if ans < sub:
    ans = sub
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

p, q = 0, 0
ans = 0
key = 0
while key <= k:
  if p == n and q == m:
    break
  elif p == n:
    if key+b[q] <= k:
      ans += 1
      key += b[q]
      q += 1
    else:
      break
  elif q == m:
    if key+a[p] <= k:
      ans += 1
      key += a[p]
      p += 1
    else:
      break
  else:
    if a[p] < b[q]:
      if key+a[p] <= k:
        ans += 1
        key += a[p]
        p += 1
      else:
        break
    elif a[p] > b[q]:
      if key+b[q] <= k:
        ans += 1
        key += b[q]
        q += 1
      else:
        break
    else:
      if a[p] + key > k:
        break
      if a[p+1] <= b[q+1]:
        ans += 1
        key += a[p]
        p += 1
      else:
        ans += 1
        key += b[q]
        q += 1

print(ans)
Problem p02726 (python)

Fixed submission:
n, x, y = map(int, input().split())
ans = [[n]*n for i in range(n)]
for i in range(n):
  for j in range(n):
    ans[i][j] = abs(i-j)

ans[x-1][y-1] = 1
ans[y-1][x-1] = 1
for i in range(n):
  for j in range(n):
    if ans[i][j] > ans[i][x-1]+ans[x-1][j]:
      ans[i][j] = ans[i][x-1]+ans[x-1][j]
    
for i in range(n):
  for j in range(n):
    if ans[i][j] > ans[i][y-1]+ans[y-1][j]:
      ans[i][j] = ans[i][y-1]+ans[y-1][j]

answer = [0]*(n-1)
for i in range(n):
  for j in range(n):
    if ans[i][j] == n or ans[i][j] == 0:
      continue
    answer[ans[i][j]-1] += 1
for i in range(n-1):
  print(answer[i]//2)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main(){
  int n, x, y;
  cin >> n >> x >> y;
  vector<vector<int>> distance(n, vector<int>(n, n));
  for (int i = 0; i < n; i++){
    for (int j = 0; j < n; j++){
      distance[i][j] = abs(i-j);
    }
  }
  
  distance[x-1][y-1] = 1;
  distance[y-1][x-1] = 1;
  
  for (int i = 0; i < n; i++){
    for (int j = 0; j < n; j++){
      if (distance[i][j] > distance[i][x-1]+distance[x-1][j]){
        distance[i][j] = distance[i][x-1]+distance[x-1][j];
      }
    }
  }
  
  
  for (int i = 0; i < n; i++){
    for (int j = 0; j < n; j++){
      if (distance[i][j] > distance[i][y-1]+distance[y-1][j]){
        distance[i][j] = distance[i][y-1]+distance[y-1][j];
      }
    }
  }
  
  vector<int> ans(n-1, 0);
  int key;
  for (int i = 0; i < n; i++){
    for (int j = 0; j < n; j++){
      if (distance[i][j] == n){
        continue;
      }
      key = distance[i][j];
      ans[key-1]++;
    }
  }
  for (int i = 0; i < n-1; i++){
    cout << ans[i]/2 << endl;
  }
  
}
Problem p02736 (python)

Fixed submission:
import sys
import random
input = sys.stdin.readline


def solve(n, s):
    sub = [int(s[i])-1 for i in range(n)]
    
    table = [0]*(n+1)
    p = 2
    for i in range(len(bin(n))-1):
        for j in range(p, n+1, p):
            table[j] += 1
        p *= 2
    
    for i in range(n):
        table[i+1] += table[i]
    
    ans = 0
    for i in range(n):
        if sub[i]%2:
            judge = table[n-1]-table[n-1-i]-table[i]
            if not judge:
                ans += 1
    
    
    if ans%2:
        res = 1
    else:
        if 1 in sub:
            res = 0
        else:
            res = 0
            for i in range(n):
                if sub[i]:
                    judge = table[n-1]-table[n-1-i]-table[i]
                    if not judge:
                        res += 1
            return res%2*2
    
    return res
    
    
def main():
    n = int(input())
    s = input()
    
    ans = solve(n, s)
    print(ans)
    
    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
a = input()
if n == 2:
  print(abs(int(a[0]-int(a[1]))))
  sys.exit()

key = [0]*(n-1)
judge = False
for i in range(n-1):
  key[i] = abs(int(a[i])-int(a[i+1]))
  if key[i] == 1:
    judge = True

comb = 1
ans = 0
for i in range(n-1):
  ans += comb*key[i]
  ans %= 2
  comb *= (n-3-i)
  comb *= pow(i+1, 7, 2)
if ans == 0 and judge == False:
  ans = 2
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
a = input()
if n == 2:
  print(abs(int(a[0]-int(a[1]))))
  sys.exit()

key = [0]*(n-1)
for i in range(n-1):
  key[i] = abs(int(a[i])-int(a[i+1]))
key2 = [0]*(n-2)
for i in range(n-2):
  key2[i] = abs(key[i]-key[i+1])

comb = 1
ans = 0
for i in range(n-2):
  ans += comb*key2[i]
  ans %= 2
  comb *= (n-3-i)
  comb *= pow(i+1, 7, 2)
print(ans)
Problem p02954 (python)

Fixed submission:
s = input()
key = 1
change = []
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        key += 1
    else:
        change.append(key)
        key = 1
change.append(key)
anslist = []
for i in range(len(change)//2):
    p, q = change[2*i], change[2*i+1]
    for j in range(p-1):
        anslist.append(0)
    t = p+q
    a = t//2
    b = t-a
    if t % 2 == 0:
        anslist.append(a)
        anslist.append(b)
    else:
        if p % 2 == 0:
            anslist.append(a)
            anslist.append(b)
        else:
            anslist.append(b)
            anslist.append(a)  
    for j in range(q-1):
        anslist.append(0)
for i in anslist:
    print(i, end=" ")

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

N = len(S)
judge = "R"
Key = []
k = 0

for i in range(N):
    if judge == "R":
        if S[i] == "R":
            k += 1
            continue
        else:
            judge = "L"
            Key.append(k)
            k = 1
            continue
    elif judge == "L":
        if S[i] == "L":
            k += 1
            continue
        else:
            judge = "R"
            Key.append(k)
            k = 1
            continue
Key.append(k)
print(Key)

L = len(Key)
L = L // 2

for i in range(L-1):
    i = 2 * i
    j = 2 * i + 1
    s1 = Key[i]
    s2 = Key[j]
    B = s1 + s2
    ans1 = B//2
    ans2 = B-ans1
    if B%2 == 0:
        s1,s2 = ans1,ans1
    elif s1%2 == 0:
        s1,s2 = ans1,ans2
    else:
        s1,s2 = ans2,ans1

    
    for a in range(B):
        if a == s1 -1:
            print(s1, end=" ")
        elif a == s1:
            print(s2, end=" ")
        else:
            print(0, end=" ")
Problem p03013 (python)

Fixed submission:
N,M = map(int, input().split())
a = []
for _ in range(M):
    a.append(int(input()))
    
def fibonacci(n):
    listf = [0]+[1]*n
    a, b = 1, 0
    for i in range(n-1):
        a, b = (a+b)%1000000007 , a
        listf[i+2] = a
    return listf 

fib = fibonacci(N+1)
if a:
    ans = [a[0]]
    
    for i in range(M-1):
        ans.append(a[i+1]-a[i]-1)
            

    result = 1
    for j in range(len(ans)):
        result = result * fib[ans[j]] % 1000000007
    
    result = result * fib[(N - a[-1])] % 1000000007
    
    print(result)
else:
    ans = fib[-1]
    print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
a = []
for _ in range(M):
    a.append(int(input()))

ans = [a[0]]

for i in range(M-1):
    ans.append(a[i+1]-a[i]-1)
        
def fibonacci(n):
    listf = [0]+[1]*n
    a, b = 1, 0
    for i in range(n-1):
        a, b = (a+b)%1000000007 , a
        listf[i+2] = a
    return listf

fib = fibonacci(N)

result = 1
for j in range(len(ans)):
    result = result * fib[ans[j]] % 1000000007

result = result * fib[(N - a[-1])] % 1000000007
    
print(result)
Problem p03042 (python)

Fixed submission:
s = int(input())
a, b = s//100, s%100
p = bool(1 <= a <= 12)
q = bool(1 <= b <= 12)
if p & q:
    print("AMBIGUOUS")
elif p:
    print("MMYY")
elif q:
    print("YYMM")
else:
    print("NA")

Buggy submission (verdict: Runtime Error):
s = int(input())
a, b = s//100, s%100
boos = int(input())
a, b = s//100, s%100
p = bool(1 <= a <= 12)
q = bool(1 <= b <= 12)
if p & q:
    print("AMBIGUOUS")
elif p:
    print("MMYY")
elif q:
    print("YYMM")
else:
    print("NA")
Problem p03075 (python)

Fixed submission:
antena = []
for _ in range(5):
    antena.append(int(input()))
    
k = int(input())

if k >= antena[-1]-antena[0]:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
x, y, z, k = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
ans_list = []
for i in a:
    for j in b:
        ans_list.append(i+j)
ans_list.sort(reverse=True)
ans_list = ans_list[:min(3001, x*y*z+1)]
ans_list_2 = []
for i in ans_list:
    for j in c:
        ans_list_2.append(i+j)
ans_list_2.sort(reverse=True)
for i in range(k):
    print(ans_list_2[i])
Problem p03208 (python)

Fixed submission:
n, k = map(int, input().split())
h = []
for _ in range(n):
    h.append(int(input()))

h.sort()
ans = []
for i in range(n-k+1):
    ans.append(h[i+k-1]-h[i])
print(min(ans))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = [0]*n
for i in range(n):
  a[i] = int(input())

a.sort()

ans = a[-1]-a[0]
for i in range(n-k+1):
  if ans > a[i+k-1]-a[i]:
    ans = a[i+k]-a[i]

print(ans)
Problem p03209 (python)

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

def dp(a, b):
    if a == 1:
        if 1 <= b <= 4:
            return b-1
        else:
            return 3
    elif b == 1:
        return 0
    elif 1 < b < 2**(a+1)-1:
        return dp(a-1, b-1)
    elif b == 2**(a+1)-1:
        return dp(a-1, 2**(a+1)-3) + 1
    elif 2**(a+1)-1 < b < 2**(a+2)-3:
        return dp(a-1, 2**(a+1)-3) + 1 + dp(a-1, b+1-2**(a+1))
    elif b == 2**(a+2)-3:
        return dp(a-1, 2**(a+1)-3) * 2 + 1
    
print(dp(n, x))

Buggy submission (verdict: Runtime Error):
def dp(a, b):
    if a == 1:
        if 1 <= b <= 4:
            return b-1
        else:
            return 3
    elif b == 1:
        return 0
    elif 1 < b < 2**(a+1)-1:
        return dp(a-1, b-1)
    elif b == 2**(a+1)-1:
        return dp(a-1, 2**(a+1)-3) + 1
    elif 2**(a+1)-1 < b < a:
        return dp(a-1, 2**(a+1)-3) + 1 + dp(a-1, b+1-2**(a+1))
    elif b == 2**(a+2)-3:
        return dp(a-1, 2**(a+1)-3) * 2 + 1
    
print(dp(n, x))
Problem p03286 (python)

Fixed submission:
n = int(input())
key = []
if n%2:
  key.append("1")
  n -= 1
else:
  key.append("0")

bef_p, bef_q = 0, 0
n //= 2
while n:
  k_p, k_q = (n//2)%2, n%2
  if k_p == 0:
    if k_q == 0:
      key.append("0")
      key.append("0")
      bef_p, bef_q = 0, 0
    else:       
      key.append("1")
      key.append("1")
      bef_p, bef_q = 0, 0      
  else:
    if k_q == 0:
      key.append("0")
      key.append("1")
      bef_p, bef_q = 0, 0
    else:
      key.append("1")
      key.append("0")
      bef_p, bef_q = 1, 1
  n //= 4
  n = n + bef_p*2-bef_q
key.reverse()
print(int("".join(key)))

Buggy submission (verdict: Runtime Error):
from collections import deque
n = int(input())
ans = deque([])
while n > 0:
    if n % 2 == 0:
        ans.appendleft(0)
    else:
        ans.appendleft(1)
    n = n // 2
print("".join(ans))
Problem p02633 (python)

Fixed submission:
from math import gcd
print(360//gcd(360,int(input())))

Buggy submission (verdict: Runtime Error):
from math import gcd
print(360//gcd(360,int(input()))
Problem p02659 (python)

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b.replace('.',''))
print((a*b)//100)

Buggy submission (verdict: Runtime Error):
#input()
ans=1
for i in map(int,input().split()):ans*=i
print(int(ans))
Problem p02547 (python)

Fixed submission:
n = int(input())
lis = [list(map(int,input().split())) for i in range(n)]
ans = 0
for i in range(n):
  if lis[i][0] == lis[i][1]:
    ans += 1
  else:
    ans = 0
  if ans == 3:
    print("Yes")
    exit()
print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int,input().split()))
ans = 0
for i in range(n):
  if lis[i][0] == lis[i][1]:
    ans += 1
  else:
    ans = 0
  if ans == 3:
    print("Yes")
    exit()
print("No")
Problem p02550 (python)

Fixed submission:
n,x,m = map(int,input().split())
exist = [0] * (m+1)
ans = 0
imamade = []
cnt = 0
for i in range(1,n+1):
    if exist[x] == 1:
        break
    else:
        ans += x
        exist[x] = 1
        imamade.append(x)
        x *= x
        x %= m
        cnt += 1
    if i == n:
        print(ans)
        exit()
num = imamade.index(x)
print(sum(imamade[:num]) + sum(imamade[num:]) * ((n-num) // (cnt-num)) + sum(imamade[num:num+((n-num) % (cnt-num))]))

Buggy submission (verdict: Runtime Error):
n,x,m = map(int,input().split())
exist = [0] * (m+1)
ans = 0
imamade = []
cnt = 0
for i in range(1,n+1):
    if exist[x] == 1:
        break
    else:
        ans += x
        exist[x] = 1
        imamade.append(x)
        x *= x
        x %= m
        cnt += 1
    if i == n-1:
        print(ans)
        exit()
num = imamade.index(x)
print(sum(imamade[:num]) + sum(imamade[num:]) * ((n-num) // (cnt-num)) + sum(imamade[num:num+((n-num) % (cnt-num))]))
Problem p02571 (python)

Fixed submission:
s = str(input())
t = str(input())
ans = 10000
for i in range(len(s)-len(t)+1):
  num = 0
  for j in range(len(t)):

    if s[i+j] != t[j]:
      num += 1
  ans = min(ans,num)
print(ans)

Buggy submission (verdict: Runtime Error):
s = str(input())
t = str(input())
ans = 10000
for i in range(len(s)-len(t)+1):
  num = 0
  for j in range(len(t)):
    if s[i+j] != t[i]:
      num += 1
  ans = min(ans,num)
print(ans)
Problem p02624 (python)

Fixed submission:
n = int(input())
ans = 0
for i in range(1,n+1):
    ans += ((i + i * (n//i))*(n//i))//2
print(ans)

Buggy submission (verdict: Runtime Error):
import math
k = int(input())
an = 0
for i in range(1,k+1):
    li = []
    cnt = 1
    num = i
    if i == 1:
        lis.append(1)
    else:
        for j in range(2,math.ceil(math.sqrt(i))+1):
            while num % j == 0:
                cnt += 1
                num //= j
            if cnt != 1:
                li.append(cnt)
                cnt = 1
        if num != 1:
            li.append(2)
        ans = 1
        for nu in li:
            ans *= nu
        an += ans
print(an)

Buggy submission (verdict: Runtime Error):
import sympy
n = int(input())
ans = 0
for i in range(1,n+1):
    ans += i * sympy.divisors(i)
print(ans)
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
a,b = input().split()
print(int(Decimal(a)*Decimal(b)))

Buggy submission (verdict: Runtime Error):
import decimal
a,b = map(float,input().split())
print(Decimal(a)*Decimal(b))

Buggy submission (verdict: Runtime Error):
import decimal
a,b = map(float,input().split())
print(decimal(a)*decimal(b))

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

Fixed submission:
n = int(input())
s = str(input())
if len(s) <= n:
  print(s)
else:
  print(s[:n]+"...")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = str(input())
if len(s) <= n:
  print(s)
else:
  print(s[:k+1]+"...")
Problem p02726 (python)

Fixed submission:
n,x,y=map(int,input().split())
ans=[0 for i in range(n)]
for start in range(n):
  gone=[0 for i in range(n)]
  gone[start]=1
  now ={start}
  for i in range(1,n):
    go=set()
    for s in now:
      if s!=0 and gone[s-1]==0:
        go.add(s-1)
        gone[s-1]=1
        ans[i]+=1
      if s!=n-1 and gone[s+1]==0:
        go.add(s+1)
        gone[s+1]=1
        ans[i]+=1
      if s==x-1 and gone[y-1]==0:
        go.add(y-1)
        gone[y-1]=1
        ans[i]+=1
      if s==y-1 and gone[x-1]==0:
        go.add(x-1)
        gone[x-1]=1
        ans[i]+=1
    now=go
for i in range(1,n):
  print(ans[i]//2)

Buggy submission (verdict: Runtime Error):
n,x,y=map(int,input().split())
ans=[0 for i in range(n-1)]
for start in range(n):
  gone=[0 for i in range(n)]
  gone[start]=1
  now ={start}
  for i in range(1,n):
    go=set()
    for s in now:
      if s!=0 and gone[s-1]==0:
        go.add(s-1)
        gone[s-1]=1
        ans[i]+=1
      if s!=n-1 and gone[s+1]==0:
        go.add(s+1)
        gone[s+1]=1
        ans[i]+=1
      if s==x-1 and gone[y-1]==0:
        go.add(y-1)
        gone[y-1]=1
        ans[i]+=1
      if s==y-1 and gone[x-1]==0:
        go.add(x-1)
        gone[x-1]=1
        ans[i]+=1
    now=go
for i in range(1,n):
  print(ans[i]//2)
Problem p02729 (python)

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

Buggy submission (verdict: Runtime Error):
import math

h,w,k = map(int,input().split())
s = [str(input()) for i in range(h)]
ans = h * w

if h == 1:
    onecnt = 0
    for i in range(w):
        if s[0][i] == "1":
            onecnt += 1
    print(math.ceil(onecnt/k))
    exit()

for i in range(2 ** (h-1)):
    ss = str(format(i,"b").zfill(h-1))
    cnt = 0
    zerocnt = 0
    for j in range(len(ss)):
        if ss[j] == "0":
            zerocnt += 1
    now = [0 for i in range(zerocnt+1)]
    for j in range(w):
        next = []
        num = 0
        for n in range(h):
            if s[n][j] == "1":
                num += 1
            if num > k:
                break
            if n < h-1 and ss[n] == "0":
                next.append(num)
                num = 0
        next.append(num)
  #        print(next,now)
        for n in range(zerocnt+1):
            if now[n] + next[n] > k:
                now = next
                cnt += 1
                break
            else:
                now[n] += next[n]
  #    print(now)
  #    print(ans,cnt,zerocnt)
    ans = min(ans,cnt+zerocnt)
print(ans)
Problem p02753 (python)

Fixed submission:
s =str(input())
if "A" not in s or "B" not in s:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
s=str(input())
q=int(input())
now = 0
mae,usiro="",""
for _ in range(q):
  lis = list(map(str,input().split()))
  if int(lis[0]) == 1:
    now = (now+1)%2
  else:
    if (int(lis[1])+now)%2 == 1:
      mae = lis[2]+mae
    else:
      usiro= usiro +lis[2]
s = mae+s+usiro
if now ==0:
  print(s)
else:
  print(s[::-1])

Buggy submission (verdict: Runtime Error):
s=list(str(input()))
q=int(input())
now = 0
for _ in range(q):
  lis = list(map(str,input().split()))
  if int(lis[0]) == 1:
    now = (now+1)%2
  else:
    if (int(lis[1])+now)%2 == 1:
      s.insert(0,lis[2])
    else:
      s.append(lis[2])
if now ==0:
  for i in range(len(s)):
    print(s[i],end="")
else:
  for i in range(len(s)):
    print(s[-i-1],end="")
Problem p02777 (python)

Fixed submission:
s,t = map(str,input().split())
a,b = map(int,input().split())
u = str(input())
if u == s:
    a -= 1
else:
    b -= 1
print(a,b)

Buggy submission (verdict: Runtime Error):
s,t = map(int,input().split())
a,b = map(int,input().split())
u = str(input())
if u == s:
    a -= 1
else:
    b -= 1
print(a,b)
Problem p02847 (python)

Fixed submission:
lis = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
s = str(input())
print((7-lis.index(s)))

Buggy submission (verdict: Runtime Error):
lis = ["SUN","MON","TUE","WEN","THU","FRI","SAT"]
s = str(input())
print((7-lis.index(s))%7)
Problem p02948 (python)

Fixed submission:
from heapq import heappush,heappop,heapify

n,m = map(int,input().split())
lis = [[] for i in range(m+1)]

for _ in range(n):
    a,b = map(int,input().split())
    if a <= m:
        lis[a].append(-b)

ans = 0
num = []
heapify(num)

for j in range(1,m+1):
    for nu in lis[j]:
        heappush(num,nu)
    if len(num) > 0:
        work = heappop(num)
        ans += -work
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
lis = [[] for _ in range(10)]
for _ in range(n):
    a,b = map(int,input().split())
    lis[a-1].append(b)
ans = 0
li = []
for i in range(m):
    li += lis[i]
    li.sort(reverse=True)
    try:
        p = li.pop(0)
        ans += p
    except:
        continue
print(ans)
Problem p02951 (python)

Fixed submission:
a,b,c = map(int,input().split())
print(max(0,c-(a-b)))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(max(0,c-(a-b))
Problem p02990 (python)

Fixed submission:
n,blue = map(int,input().split())
red = n-blue
mod = 10 ** 9 + 7

now = [1]
get = [1]
for i in range(1,red+2):
    next = []
    for j in range(min(i+1,blue+1)):
        if j == 0 or j == i:
            next.append(1)
        else:
            next.append((now[j-1]+now[j])%mod)
    now = next
for i in range(1,blue):
    next = []
    for j in range(i+1):
        if j == 0 or j == i:
            next.append(1)
        else:
            next.append((get[j-1]+get[j])%mod)
    get = next

  # print(now)
for i in range(1,blue+1):
    try:
  #        print(now[i],get[i-1])
        print((now[i] * get[i-1])%mod)
    except:
        print(0)

Buggy submission (verdict: Runtime Error):
n,blue = map(int,input().split())
red = n-blue
mod = 10 ** 9 + 7

now = [1]
for i in range(1,red+2):
    next = []
    for j in range(min(i+1,blue+1)):
        if j == 0 or j == i:
            next.append(1)
        else:
            next.append((now[j-1]+now[j])%mod)
    now = next

  # print(now)
for i in range(1,blue+1):
    print((now[i] * pow(i,blue-i,mod))%mod)

Buggy submission (verdict: Runtime Error):
n,blue = map(int,input().split())
red = n-blue
mod = 10 ** 9 + 7

now = [1]
for i in range(1,red+2):
    next = []
    for j in range(min(i+1,blue+1)):
        if j == 0 or j == i:
            next.append(1)
        else:
            next.append((now[j-1]+now[j])%mod)
    now = next

  # print(now)
for i in range(1,blue+1):
    print((now[i] * pow(i,blue-i,mod))%mod)