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

Fixed submission:
import heapq

"""
https://juppy.hatenablog.com/entry/2019/02/18/%E8%9F%BB%E6%9C%AC_python_%E3%83%97%E3%83%A9%E3%82%A4%E3%82%AA%E3%83%AA%E3%83%86%E3%82%A3%E3%82%AD%E3%83%A5%E3%83%BC%28heapq%29%E3%82%92%E7%94%A8%E3%81%84%E3%81%9F%E3%83%97%E3%83%AA%E3%83%A0%E6%B3%95
"""

def dijkstra_heap(s,edge):
    #始点sから各頂点への最短距離
    d = [10**10]*n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d
 
################################
N = int(input())
n = N
w = N
 
edge = tuple([] for i in range(n))
#edge[i] : iから出る道の[重み,行先]の配列
for i in range(w-1):
    a,b,c = map(int,input().split())
    edge[a-1].append([c,b-1])
    edge[b-1].append([c,a-1])


Q,K = map(int,input().split())
dist = dijkstra_heap(K-1,edge)
 
for i in range(Q):
    x,y = map(int,input().split())
    print(int(dist[x-1]+dist[y-1]))

Buggy submission (verdict: Runtime Error):
from scipy.sparse.csgraph import shortest_path
import sys
import numpy as np
def input():
    return sys.stdin.readline().strip()
 
N = int(input())
 
graph = [[0 for i in range(N)] for j in range(N)]
 
for i in range(N-1):
    a,b,c = map(int,input().split())
    graph[a-1][b-1] = c
    graph[b-1][a-1] = c

Q,K = map(int,input().split())
dist = shortest_path(np.array(graph),indices=K-1)

for i in range(Q):
    x,y = map(int,input().split())
    print(int(dist[x-1]+dist[y-1]))
Problem p03776 (python)

Fixed submission:
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

N,A,B = map(int,input().split())
v = sorted(list(map(int,input().split())),reverse=True)

if len(set(v)) == 1:
    print(1)
    print(1125899906842623)
    exit()

m = sum(v[:A])/A
print(m)

if len(set(v[:A]))==1:
    ans = 0
    c = v.count(v[0])
    for i in range(A,B+1):
        if i <= c:
            ans += cmb(c,i)
    print(ans)
    exit()

mi = min(v[:A])
n = v[:A].count(mi)
m = v.count(mi)
print(cmb(m,n))

Buggy submission (verdict: Runtime Error):
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

N,A,B = map(int,input().split())
v = sorted(list(map(int,input().split())),reverse=True)

if len(set(v)) == 1:
    print(xx)

m = sum(v[:A])/A
print(m)


n = v[:A].count(min(v[:A]))
m = v.count(min(v[:A]))
print(cmb(m,n))

Buggy submission (verdict: Runtime Error):
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

N,A,B = map(int,input().split())
v = sorted(list(map(int,input().split())),reverse=True)

if len(set(v)) == 1:
    print(xx)

m = sum(v[:A])/A
print(m)


n = v[:A].count(min(v[:A]))
m = v.count(min(v[:A]))
print(n,m)
print(cmb(m,n))
Problem p02701 (python)

Fixed submission:
 
t=int(input())
s=set()
for i in range(t):
    # n,m=map(int,input().split())
    n=input()
    s.add(n);
print(len(s));

Buggy submission (verdict: Runtime Error):
import sys 
sys.stdin = open('input.txt', 'r')  
sys.stdout = open('output.txt', 'w') 
t=int(input())
s=set()
for i in range(t):
    # n,m=map(int,input().split())
    n=input()
    s.add(n);
print(len(s));
Problem p02552 (python)

Fixed submission:
X=int(input())
if X==0:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if a>=0 and b>=0 and c>=0 and d>=0:
  print(b*d)
elif a<=0 and b>=0 and c>=0 and d>=0:
  print(b*d)
elif a<=0 and b<=0 and c>=0 and d>=0:
  print(b*c)
elif a<=0 and b>=0 and c<=0 and d>=0:
  print(b*d)
elif a<=0 and b<=0 and c<=0 and d>=0:
  print(a*c)
elif a<=0 and b>=0 and c<=0 and d<=0:
  print(a*c)
elif a<=0 and b<=0 and c<=0 and d<=0:
  print(a*c)
Problem p02659 (python)

Fixed submission:
import math
A,B=input().split()
A=int(A)
B,C=B.split('.')
B=int(B)
C=int(C)
print(A*(B*100+C)//100)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
print(int((A*B)//1))
Problem p02777 (python)

Fixed submission:
S,T=map(str,input().split())
A,B=map(int,input().split())
U=str(input())
if U==S:
  A=A-1
elif U==T:
  B=B-1
print("{} {}".format(A,B))

Buggy submission (verdict: Runtime Error):
S,T=map(str,input().split())
A,B=map(int,input().split())
U=str(input())
if U==S:
  A=A-1
elif U==T:
  B=B-1
print({} {}.format(A,B))
Problem p02779 (python)

Fixed submission:
import collections
N=int(input())
A=list(map(int,input().split()))
li=list(collections.Counter(A).values())
for i in range(len(li)):
  if li[i]>1:
    print('NO')
    exit()
print('YES')

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
A=list(map(int,input().split()))
li=list(collections.Counter(A).values())
for i in range(N):
  if li[i]<1:
    print('NO')
    exit()
print('YES')
Problem p02829 (python)

Fixed submission:
A=int(input())
B=int(input())
C=6-A-B
print(C)

Buggy submission (verdict: Runtime Error):
A＝int(input())
B=int(input())
C=6-A-B
print(C)
Problem p02832 (python)

Fixed submission:
N=int(input())
a=list(map(int, input().split()))
S=1
c=0
for j in range(N):
  if S==a[j]:
    S+=1
  elif S!=a[j]:
    c+=1
if c==N:
  print(-1)
  exit()
print(c)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=list(map(int, input().split()))
l = [i for i in range(1,N+1)]
c=0
for i in range(N):
  for j in range(N):
    if l[0]==a[j]:
      del l[0]
      c+=1
if len(l)==N:
  print(-1)
  exit()
print(c)
Problem p02915 (python)

Fixed submission:
print(int(input())**3)

Buggy submission (verdict: Runtime Error):
print=(input()**3)
Problem p02916 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
s=0
for i in range(N):
  s+=B[A[i]-1]
  if i!=0 and A[i-1]+1==A[i]:
    s+=C[A[i]-2]
print(s)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
s=0
for i in range(N):
  s+=B[A[i]-1]
  if i!=0 and A[i-1]+1==A[i]:
    s+=C[i]
print(s)
Problem p02557 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b = b[::-1]
s = 0
e = 0
for i in range(n):
    if s == 0 and a[i] == b[i]:
        s = i+1
    if s > 0 and a[i] != b[i]:
        e = i+1
        break
if s == 0:
    print("Yes")
    print(*b)
    quit()
cl = a[s-1]
k = e-s
j = 0
for i in range(n):
    if s-1 <= i < e-1:
        continue
    if cl != b[i] and cl != a[i]:
        b[s-1+j] = b[i]
        b[i] = cl
        j += 1
    if j == k:
        break
for i in range(n):
    if a[i] == b[i]:
        print("No")
        quit()
print("Yes")
print(*b)

Buggy submission (verdict: Runtime Error):
import copy
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
la = [0]*(n+1)
lb = [0]*(n+1)
for i in range(n):
    la[a[i]] += 1
    lb[b[i]] += 1
for i in range(1,n+1):
    if la[i] > n//2 and lb[i] > n//2:
        print("No")
        quit()
print("Yes")
b = b[::-1]
s = 0
for i in range(n):
    if s == 0 and a[i] == b[i]:
        s = i+1
    if s > 0 and a[i] != b[i]:
        e = i+1
        break
if s == 0:
    print(*b)
    quit()
cl = a[s-1]
k = e-s
j = 0
for i in range(n):
    if s-1 <= i < e-1:
        continue
    if cl != b[i] and cl != a[i]:
        b[s-1+j] = b[i]
        b[i] = cl
        j += 1
    if j == k:
        break
print(*b)
Problem p02693 (python)

Fixed submission:
k = int(input())
a,b = map(int,input().split())
if b//k-(a-1)//k >0:
  print("OK")
else:
  print("NG")

Buggy submission (verdict: Runtime Error):
n,m,q = map(int,input().split())
abcd = [list(map(int,input().split())) for _ in range(q)]
ans = 0
for a in range(1,11):
  for b in range(a,11):
    for c in range(b,11):
      for d in range(c,11):
        for e in range(d,11):
          for f in range(e,11):
            for g in range(f,11):
              for h in range(g,11):
                for i in range(h,11):
                  for j in range(i,11):
                    lst = [0,a,b,c,d,e,f,g,h,i,j]
                    print(lst)
                    s = 0
                    for l in range(q):
                      s += abcd[l][3]*(lst[abcd[l][1]]-lst[abcd[l][0]]==abcd[l][2])
                    ans = max(ans, s)
print(ans)
Problem p02699 (python)

Fixed submission:
s,w = map(int,input().split())
if w >= s:
  print("unsafe")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
from collections import Counter
s = input()
n = len(s)
dp = [0]*(n+1)
mod = 2019
for i in range(n-1,-1,-1):
    dp[i] = (dp[i+1]+int(s[i])*pow(10,n-i-1,mod))%mod
c = Counter(dp)
ans = 0
for i in c.values():
    ans += i*(i-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
if n < 4:
  quit()
l,r = 0,4
ans = [[[],[]] for _ in range(n+3)]
for i in range(4,8):
  l = 0
  while l+i <= n:
    if int(s[l:(l+i)])%2019 == 0:
      ans[l+1][0].append(l+i)
      ans[l+i+1][1].append(l+1)
    l += 1
final = 0
cnt = 1
for i in range(n+1):
  if ans[i][0] and ans[i][1]:
    cnt += 1
    final += cnt
  elif ans[i][0]:
    final += 1
    cnt = 1
print(final)
Problem p02723 (python)

Fixed submission:
s = input()
if s[2]==s[3] and s[4]==s[5]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x,y,a,b,c = map(int,input().split())
print(sum(sorted(sorted(list(map(int,input().split())),reverse=True)[:x]+sorted(list(map(int,input().split())),reverse=True)[:y]+list(map(int,input().split())),reverse=True)[:(x+y)]))
Problem p02771 (python)

Fixed submission:
a,b,c = map(int,input().split())
if (a==b) + (b==c) + (c==a) ==1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = str(input())
n = len(s)
dp = [[0]*2 for _ in range(n+1)]
dp[0][1] = 1
for i in range(n):
    p = int(s[i])
    dp[i+1][0] = min(dp[i][1]+10-p,dp[i][0]+p)
    dp[i+1][1] = min(dp[i][1]+10-p-1,dp[i][0]+p+1)
print(dp[-1][0])
Problem p02793 (python)

Fixed submission:
from fractions import gcd
def lcm(x,y):
  return (x*y) // gcd(x,y)
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
l = a[0]
for i in range(1,n):
  l = lcm(l,a[i])
ans = 0
for i in range(n):
  ans += l//a[i]
print(ans%mod)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
def lcm(x,y):
  return (x*y) // gcd(x,y)
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
l = a[0]
for i in range(1,n):
  l = lcm(l,a[i])
for i in range(n):
  ans += l//a[i]
print(ans%mod)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
def lcm(x,y):
  return (x*y) // gcd(x,y)
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
l = a[0]
for i in range(1,n):
  l = lcm(l,a[i])
for i in range(n):
  ans += (l//a[i])%mod
print(ans%mod)
Problem p02891 (python)

Fixed submission:
s = input()
k = int(input())
n = len(s)
a = []
cnt = 1
for i in range(n-1):
  if s[i] == s[i+1]:
    cnt += 1
  else:
    a.append(cnt)
    cnt = 1
if sum(a) != n:
  a.append(cnt)
m = len(a)
if m == 1:
  print((a[0]*k)//2)
  exit()
if m == 2:
  print((a[0]//2+a[1]//2)*k)
  exit()
cnt = 0
for i in range(1,m-1):
  cnt += a[i] // 2
cnt *= k
if s[0] == s[n-1]:
  cnt += (k-1)*((a[0]+a[m-1])//2)
else:
  cnt += (k-1)*(a[0]//2+a[m-1]//2)
cnt += a[0]//2 + a[m-1]//2
print(cnt)

Buggy submission (verdict: Runtime Error):
def warshall_floyd(g):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                g[i][j] = min(g[i][j], g[i][k] + g[k][j])

n = int(input())
s = [[int(i) for i in list(input())] for _ in range(n)]
graph = [[float("inf")]*n for _ in range(n)]
for i in range(n):
    for j in range(n):
        if s[i][j] == 1:
            graph[i][j] = 1
        if i == j:
            graph[i][j] = 0

warshall_floyd(graph)
d = 0
#print(graph)
for i in range(n-1):
    for j in range(i+1,n):
        if graph[i][j] != float("inf"):
            if d < graph[i][j]:
                start = i
                end = j
                d = graph[i][j]

v = [[] for _ in range(d+1)]
for i in range(n):
    l = graph[start]
    v[l[i]].append(i)
#print(v)
#print(start,end)

for l in v:
    m = len(l)
    for i in range(m-1):
        for j in range(i+1,m):
            if s[l[i]][l[j]] == 1:
                print(-1)
                quit()
print(d+1)
Problem p02933 (python)

Fixed submission:
if int(input()) < 3200:
  print("red")
else:
  print(input())

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
n,q = map(int,input().split())
tree = [[] for _ in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)
ans = [0]*n
for i in range(q):
    p,x = map(int,input().split())
    ans[p-1] += x
done = [0]*n
def dfs(now,m):
    done[now] = 1
    ans[now] += m
    for i in tree[now]:
        if not done[i]:
            dfs(i,ans[now])
dfs(0,0)
print(*ans)
Problem p03013 (python)

Fixed submission:
n,m = map(int,input().split())
mod = 10**9+7
a = [int(input()) for _ in range(m)]
s = [0]*(n+1)
s[0],s[1]=1,1
for i in range(2,n+1):
  s[i] = (s[i-1]+s[i-2])%mod
if m == 0:
  print(s[n])
  quit()
ans = s[a[0]-1]
for i in range(1,m):
  if a[i]-a[i-1] == 1:
    print(0)
    quit()
  ans = (ans*s[a[i]-a[i-1]-2])%mod
print((ans*s[n-a[m-1]-1])%mod)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
mod = 10**9+7
a = [int(input()) for _ in range(m)]
s = [0]*(n+1)
s[0],s[1]=1,1
for i in range(2,n+1):
  s[i] = (s[i-1]+s[i-2])%mod
ans = s[a[0]-1]
for i in range(1,m):
  if a[i]-a[i-1] == 1:
    print(0)
    quit()
  ans = (ans*s[a[i]-a[i-1]-2])%mod
print((ans*s[n-a[m-1]-1])%mod)
Problem p03201 (python)

Fixed submission:
from collections import Counter
from math import log2

def find(x):
    f = 2**(int(log2(x))+1)-x
    if f <= x:
        return f
    return 0

n = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
c = Counter(a)
ans = 0

for i in range(n):
    f = find(a[i])
    if f == a[i]:
        m = c[a[i]]//2
    else:
        m = min(c[a[i]],c[f])
    c[a[i]] -= m
    c[f] -= m
    ans += m
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
from math import log2

def find(x):
    return 2**(int(log2(x))+1)-x

n = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
c = Counter(a)
ans = 0

for i in range(n):
    f = find(a[i])
    if f == a[i]:
        if c[f] > 1:
            c[f] -= 2
            ans += 1
    elif c[f] > 0:
        c[f] -= 1
        c[a[i]] -= 1
        ans += 1
print(ans)
Problem p03221 (python)

Fixed submission:
n,m = map(int,input().split())
py = [list(map(int,input().split()))+[i] for i in range(m)]
py.sort(key=lambda x:(x[0],x[1]))
cnt = 1
ans = [""]*m
for i in range(m-1):
  ans[py[i][2]] = "0"*(6-len(str(py[i][0])))+str(py[i][0]) + "0"*(6-len(str(cnt)))+str(cnt)
  if py[i][0] == py[i+1][0]:
    cnt += 1
  else:
    cnt = 1
ans[py[m-1][2]]="0"*(6-len(str(py[m-1][0])))+str(py[m-1][0]) + "0"*(6-len(str(cnt)))+str(cnt)
for i in range(m):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
lst = [[] for _ in range(m+1)]
lst2 = []
for i in range(m):
  p,y = map(int,input().split())
  lst[p].append(y)
  lst2.append([p,y])
for i in range(1,m+1):
  lst[i].sort()
for l in lst2:
  num = lst[l[0]].index(l[1])+1
  print("0"*(6-len(str(l[0])))+str(l[0])+"0"*(6-len(str(num)))+str(num))
Problem p02676 (python)

Fixed submission:
K = int(input())
S = input()

if len(S) > K:
    for i in range(K):
        print(S[i],end="")
    print("...")
else:
    print(S)

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

for i in range(K):
    print(S[i],end="")
print("...")
Problem p02711 (python)

Fixed submission:
N = input()
n = 0
if N[0] =="7":
	n += 1
if N[1] == "7":
	n +=1
if N[2] == "7":
	n += 1
 
if n > 0:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
N = input()
n = 0
if N[0] =="7":
	n += 1
if N[1] == "7":
	n +=1
if N[2} == "7":
	n += 1
 
if n > 0:
	print("Yes")
else:
	print("No")
Problem p02831 (python)

Fixed submission:
import fractions

number = input().split(" ")
A = int(number[0])
B = int(number[1])

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

print(lcm(A, B))

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

number = input().split(" ")
A = int(number[0])
B = int(number[1])

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
import math

number = input().split(" ")
A = int(number[0])
B = int(number[1])

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(A, B))
Problem p02552 (python)

Fixed submission:
x= int(input())
if x==0:
  print("1")
else: 
  print("0")

Buggy submission (verdict: Runtime Error):
x = int(input()) if x==0:     print("1") else:     print("0")
Problem p02595 (python)

Fixed submission:
import math
N,D= map(int, input().split(" "))
count = 0
for i in range(0,N):
    X,Y= map(int, input().split(" "))
    d= math.sqrt(pow(X,2)+pow(Y,2))
    if d<= D:
        count = count+1
print(count)

Buggy submission (verdict: Runtime Error):
def lineFromPoints(P,Q): 
  
    a = Q[1] - P[1] 
    b = P[0] - Q[0]  
    c = a*(P[0]) + b*(P[1])  
  
    if(b<0):  
        print("The line passing through points P and Q is:", 
              a ,"x ",b ,"y = ",c ,"\n")  
    else: 
        print("The line passing through points P and Q is: ", 
              a ,"x + " ,b ,"y = ",c ,"\n")  
  
if __name__=='__main__': 
    n = int(input("Enter size of array:")) 
    P=[]
    Q=[]
    for i in range(n): 
        temp = int(input('Enter number to add to P:\n')) 
        P.append(temp)
    for i in range(n): 
        temp = int(input('Enter number to add to Q:\n')) 
        Q.append(temp)
     
    lineFromPoints(P,Q)
Problem p02552 (python)

Fixed submission:
x = int(input())
 
if x:
    print(0)
else:
    print(1)

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

if x:
    print 0
else:
    print 1

Buggy submission (verdict: Runtime Error):
if x:
    print 0
else:
    print 1

Buggy submission (verdict: Runtime Error):
if x:
    return 0
else:
    return 1
Problem p02701 (python)

Fixed submission:
N=int(input())
S=[]
for i in range(N):
    S.append(input())

S=set(S)
print(len(S))

Buggy submission (verdict: Runtime Error):
N=int(input())
S=[]
for i in range(N):
    S.append(input())

for i in range(N):
    for j in range(N):
        if S[i] == S[j]:
            pair += 1

pair=(pair-N)/2
print(pair)
Problem p02571 (python)

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

for i in range(len(s)-len(t)+1):
    n=0
    U = s[i:i + len(t)]
    for j in range(len(t)):
        if U[j] != t[j]:
            n+=1
    list.append(n)
print(min(list))

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

for i in range(len(s)-len(t)):
    n=0
    for j in range(len(t)):
        if s[i] == t[j]:
            n+=1
    list.append(n)
print(len(t)-max(list))
Problem p03011 (python)

Fixed submission:
p,q,r = map(int, input().split())
print(min(p + q,q + r,r+ p))

Buggy submission (verdict: Runtime Error):
p,q,r = int(x) for x in input().split()
print(min(p + q,q + r,r+ p))
Problem p02701 (python)

Fixed submission:
import collections
N=int(input())
a=[]
for i in range(N):
  a.append(input())
print(len(collections.Counter(a)))

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[input() for i in range(N)]
print(len(collections.Counter(a)))

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[input() for i in range(N)]
print(collections.Counter(a))

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[]
for i in range(N):
  a.append(input())
print(len(collections.Counter(a)))

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[]
for i in N:
  a.append(input())
print(len(collections.Counter(a)))

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[]
for i in N:
  a.append=input()
print(len(collections.Counter(a)))
Problem p02712 (python)

Fixed submission:
N=int(input())
a=[i for i in range(N+1)]
for i in range(N+1):
  if i%3==0 or i%5==0:
    a[i]=0
print(sum(a))

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[i for i in range(N+1)]
for i in range(N+1):
  if i%3==0 or i%5==0:
    del(a[i])
sum(a)
Problem p02725 (python)

Fixed submission:
k,n=map(int,input().split())
a=list(map(int,input().split()))
j=[int(k+a[0]-a[-1])]
for i in range(n-1):
    j.append(a[i+1]-a[i])
print(k-max(j))

Buggy submission (verdict: Runtime Error):
k,n=map(int,input().split())
a=list(map(int,input().split()))
j=[int(k+a[0]-a[-1])]
j.append(a[i+1]-a[i] for i in range(n-1))
print(k-max(j))

Buggy submission (verdict: Runtime Error):
k,n=map(int,input().split())
a=[map(int,input().split()]
j=[k-a[n-1]]
for i in range(n-1):
    j.append(a[i+1]-a[i])
print(k-max(j))
Problem p02773 (python)

Fixed submission:
import collections
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
s=Counter(s)
p=[]
k=s.most_common()
p.append(k[0][0])
for i in range(len(collections.Counter(s))-1):
    if k[i][1]==k[i+1][1]:
        p.append(k[i+1][0])
    else:
        break
p=sorted(p)
for i in range(len(p)):
    print(p[i])

Buggy submission (verdict: Runtime Error):
import collections
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
s=Counter(s)
p=[]
k=s.most_common()
p.append(k[0][0])
for i in range(len(collections.Counter(s))-1):
    if k[i][1]==k[i+1][1]:
        p.append(k[i+2][0])
    else:
        break
p=sorted(p)
for i in range(len(p)):
    print(p[i])

Buggy submission (verdict: Runtime Error):
import collections
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
s=Counter(s)
p=[]
k=s.most_common()
p.append(s.most_common()[0][0])
for i in range(len(collections.Counter(s))-1):
    if k[i+1][1]==k[i+2][1]:
        p.append(k[i+2][1])
    else:
        break
p=sorted(p)
for i in range(len(p)):
    print(p[i])

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
s=Counter(s)
p=[]
p.append(s.most_common()[0][0])
for i in range(n-2):
    if s.most_common(i+1)[i][1]==s.most_common(i+2)[i+1][1]:
        p.append(s.most_common(i+2)[i+1][0])
    else:
        break
p=sorted(p)
for i in range(len(p)):
    print(p[i])

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
s=Counter(s)
p=[]
p.append(s.most_common()[0][0])
for i in range(n):
    if s.most_common(i+1)[i][1]==s.most_common(i+2)[i+1][1]:
        p.append(s.most_common(i+2)[i+1][0])
    else:
        break
p=sorted(p)
for i in range(len(p)):
    print(p[i])

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
s=Counter(s)
p=[]
p.append(s.most_common()[0][0])
for i in range(n):
    if s.most_common(i+1)[i][1]==s.most_common(i+2)[i+1][1]:
        p.append(s.most_common(i+2)[i+1][0])
    else:
        break
p=sorted(p)
for i in range(len(p)):
    print(p[i])