Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
M,A,B=(int(x) for x in input().split())
if B//M-A//M>=1:
  print("OK")
elif A%M=0:
  print("OK")
else:
  print("NG")

Fixed submission:
import sys
N=int(input())
a,b=map(int,input().split())
for i in range(a,b+1):
  if i%N==0:
    print("OK")
    sys.exit()
print("NG")

Buggy python submission (verdict: Runtime Error):
M,A,B=(int(x) for x in input().split())
if B//M-A//M>=1:
  print("OK")
elif A%M=0:
  print("OK")
else:
  print("NO")

Fixed submission:
import sys
N=int(input())
a,b=map(int,input().split())
for i in range(a,b+1):
  if i%N==0:
    print("OK")
    sys.exit()
print("NG")
Buggy python submission (verdict: Time Limit Exceeded):
maxa=-(10**10)
a,b,n=map(int,input().split())
for i in range(1,min(n+1,b+1)):
  maxa=max(((a*i)//b)-a*(i//b),maxa)
print(maxa)

Fixed submission:
maxa=-(10**10)
a,b,n=map(int,input().split())
i=min(n,b-1)
maxa=max(((a*i)//b)-a*(i//b),maxa)
print(maxa)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
S=0
N=int(input())
L=list(map(int,input().split()))
for i in range(1,N+1):
  print(L.count(i))
  S+=L.count(i)
  if S==N:
    for j in range(N-i):
      print(0)
      sys.exit()

Fixed submission:
import collections
S=0
N=int(input())
L=list(map(int,input().split()))
c = collections.Counter(L)
for i in range(1,N+1):
  print(c[i])

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))
for i in range(1,N+1):
  print(L.count(i))

Fixed submission:
import collections
S=0
N=int(input())
L=list(map(int,input().split()))
c = collections.Counter(L)
for i in range(1,N+1):
  print(c[i])
Buggy python submission (verdict: Time Limit Exceeded):
def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)
a=0
N=int(input())
for i in range(1,N+1):
  for j in range(1,N+1):
    for k in range(1,N+1):
      c=euclid(i, j)
      a+=euclid(c, k)
print(a)

Fixed submission:
def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)
a=0
N=int(input())
for i in range(1,N+1):
  for j in range(i,N+1):
    for k in range(j,N+1):
      if i==j==k:
        a+=i
      elif i==j or j==k or i==k:
        c=euclid(i, j)
        c=euclid(c, k)
        a+=3*c
      else:
        c=euclid(i, j)
        c=euclid(c, k)
        a+=6*c
print(a)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
a=0
N=int(input())
for i in range(1,N+1):
  for j in range(1,N+1):
    for k in range(1,N+1):
      c=fractions.gcd(i,j)
      a+=fractions.gcd(c,k)
print(a)

Fixed submission:
def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)
a=0
N=int(input())
for i in range(1,N+1):
  for j in range(i,N+1):
    for k in range(j,N+1):
      if i==j==k:
        a+=i
      elif i==j or j==k or i==k:
        c=euclid(i, j)
        c=euclid(c, k)
        a+=3*c
      else:
        c=euclid(i, j)
        c=euclid(c, k)
        a+=6*c
print(a)
Buggy python submission (verdict: Runtime Error):
import sys
b=int(input())
if b==100000:
  print(3234566667)
  sys.exit()
L=[1,2,3,4,5,6,7,8,9,10,11,12,21,22,23]
for i in range(30,10**5*5):
  a=0
  c=str(i)
  t=list(c)
  for j in range(len(c)-1):
    if abs(int(t[j+1])-int(t[j]))<=1:
      a+=1
  if a==len(c)-1:
    L.append(i)
  if len(L)>=b:
    break
print(L[b-1])

Fixed submission:
def lu(n):
  L.append(n)
  a=n%10
  if len(str(n))>11:
    return 1
  if a==0:
    lu(n*10+1)
    lu(n*10)
  elif a==9:
    lu(n*10+9)
    lu(n*10+8)
  else:
    lu(n*10+1+a)
    lu(n*10+a-1)
    lu(n*10+a)
L=list()
lu(1)
lu(2)
lu(3)
lu(4)
lu(5)
lu(6)
lu(7)
lu(8)
lu(9)
L=sorted(set(L))
k=int(input())
print(L[k-1])
Buggy python submission (verdict: Runtime Error):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N,M=map(int,input().split())
if N==0:
  a=0
else:
  a = comb(N,2)
if M==0:
  b=0
else:
  b = comb(M,2)
print(a+b)

Fixed submission:
N,M=map(int,input().split())
print((N*(N-1)+M*(M-1))//2)
Buggy python submission (verdict: Runtime Error):
s=input()
A=list(s)
N=len(A)
M=N-1
k=0
while k<M/2:
  if A[k]!=A[M-k]:
    print("No")
  if A[k]!=A[(M-2)/2-k]:
    print("No")
  if A[k+M/2+1]!=A[M-k]:
    print("No")
  else:
    print("Yes")
  k=k+1

Fixed submission:
import sys
L=list(input())
N=len(L)
R=N//2
for i in range(R):
  if L[i]!=L[N-1-i]:
    print("No")
    sys.exit()
  elif L[i]!=L[R-1-i]:
    print("No")
    sys.exit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
L=[-1]*n
for i in range(m):
  a,b=map(int,input().split())
  if L[a-1]!=-1:
    if L[a-1]!=b:
      print(-1)
      exit()
  else:
    L[a-1]=b
  if a==1 and b==0:
    print(-1)
    exit()
for i in range(len(L)):
  if L[i]==-1:
    L[i]=0
L=list(map(int,L))
print("".join(L))

Fixed submission:
A=list()
B=list()
n,m=map(int,input().split())
if m==0:
  print([0, 10, 100][n - 1])
  exit()
for i in range(m):
  a,b=map(int,input().split())
  A.append(a)
  B.append(b)
  if a==1 and b==0 and n!=1:
    print(-1)
    exit()
for i in range(1000):
  c=str(i)
  if len(c)==n:
    for j in range(m):
      if c[A[j]-1]!=str(B[j]):
        break
      if j==m-1:
        print(i)
        exit()
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
  K=list()
  L=list()
  N=int(input())
  R=[0]*N
  t=set()
  for i in range(N):
    A=input()
    if A in t:
      R[L.index(A)]+=1
      L.append(A)
    else:
      R[i]=1
      L.append(A)
    t=set(L)
  c=max(R)
  for i in range(N):
    if R[i]==c:
      K.append(L[i])
  K=sorted(K)
  for i in range(len(K)):
    print(K[i])
if __name__ == '__main__':
    main()

Fixed submission:
c={}
N=int(input())
for i in range(N):
  s=input()
  if s not in c:
    c[s]=1
  else:
    c[s]+=1
n=max(c.values())
L=list()
for i in c:
  if c[i]==n:
    L.append(i)
L=sorted(L)
for i in L:
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
K=list()
L=list()
N=int(input())
R=[0]*N
for i in range(N):
  A=input()
  if A in L:
    R[L.index(A)]+=1
    L.append(A)
  else:
    R[i]+=1
    L.append(A)
c=max(R)
for i in range(N):
  if R[i]==c:
    K.append(L[i])
K=sorted(K)
for i in range(len(K)):
  print(K[i])

Fixed submission:
c={}
N=int(input())
for i in range(N):
  s=input()
  if s not in c:
    c[s]=1
  else:
    c[s]+=1
n=max(c.values())
L=list()
for i in c:
  if c[i]==n:
    L.append(i)
L=sorted(L)
for i in L:
  print(i)
Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
L=list(map(int,input().split()))
maxa=10**10*(-1)
for i in range(a-b+1):
  if sum(L[i:i+b])>maxa:
    maxa=sum(L[i:i+b])
print((maxa+b)/2)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
N,M=MAP()
L=LIST()
maxa=-(10**10)
sums=sum(L[:M])
maxa=max(maxa,sums)
for i in range(N-M):
  sums=sums-L[i]+L[i+M]
  maxa=max(maxa,sums)
print((maxa+M)/2)

Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
L=list(map(int,input().split()))
maxa=10**10*(-1)
for i in range(a-b+1):
  if sum(L[i:i+b])>maxa:
    maxa=sum(L[i:i+b])
print((maxa+b)/2)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
N,M=MAP()
L=LIST()
maxa=-(10**10)
sums=sum(L[:M])
maxa=max(maxa,sums)
for i in range(N-M):
  sums=sums-L[i]+L[i+M]
  maxa=max(maxa,sums)
print((maxa+M)/2)

Buggy python submission (verdict: Time Limit Exceeded):
def kitai(n):
  return (n+1)/2
a,b=map(int,input().split())
L=list(map(int,input().split()))
maxa=10**10*(-1)
L=list(map(kitai,L))
for i in range(a-b+1):
  maxa=max(maxa,sum(L[i:i+b]))
print(maxa)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
N,M=MAP()
L=LIST()
maxa=-(10**10)
sums=sum(L[:M])
maxa=max(maxa,sums)
for i in range(N-M):
  sums=sums-L[i]+L[i+M]
  maxa=max(maxa,sums)
print((maxa+M)/2)
Buggy python submission (verdict: Runtime Error):
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*(10**6)
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
a,b,c,d=map(int,input().split())
print(cmb(c+d+2,c+1,mod)-cmb(d+1+a,a,mod)-cmb(b+c+1,c+1,mod)+cmb(a+b,a,mod))

Fixed submission:
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = (2*(10**6))+5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
a,b,c,d=map(int,input().split())
print((cmb(c+d+2,c+1,mod)-cmb(d+1+a,a,mod)-cmb(b+c+1,c+1,mod)+cmb(a+b,a,mod))%mod)
Buggy python submission (verdict: Time Limit Exceeded):
c=0
N=int(input())
L=list(map(int,input().split()))
R=list()
for i in range(N):
  R.append(L[i])
  if min(R)==L[i]:
    c=c+1
print(c)

Fixed submission:
mina=10**11
c=0
N=int(input())
L=list(map(int,input().split()))
for i in range(N):
  mina=min(mina,L[i])
  if mina==L[i]:
    c=c+1
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
c=0
N=int(input())
L=list(map(int,input().split()))
a=L[0]
for i in range(1,N):
  a=(L[i]*a)//fractions.gcd(L[i], a)
for i in range(N):
  c=(c+(a//L[i]))%(10**9+7)
print(c)

Fixed submission:
import fractions
c=0
N=int(input())
L=list(map(int,input().split()))
a=L[0]
for i in range(1,N):
  a=(L[i]*a)//fractions.gcd(L[i], a)
for i in range(N):
  c+=(a//L[i])
print(c%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
c=0
N=int(input())
L=list(map(int,input().split()))
a=L[0]
for i in range(N):
  a=(L[i]*a)//fractions.gcd(L[i], a)
for i in range(N):
  c=(c+(a//L[i]))%(10**9+7)
print(c)

Fixed submission:
import fractions
c=0
N=int(input())
L=list(map(int,input().split()))
a=L[0]
for i in range(1,N):
  a=(L[i]*a)//fractions.gcd(L[i], a)
for i in range(N):
  c+=(a//L[i])
print(c%(10**9+7))
Buggy python submission (verdict: Runtime Error):
N=input()
L=[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]
print(L[L.index(N)+1])

Fixed submission:
N=input()
L=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
print(L[L.index(N)+1])
Buggy python submission (verdict: Time Limit Exceeded):
L=list()
R=list()
a,b=map(int,input().split())
for i in range(b):
  c,d=input().split()
  c=int(c)
  if d=="AC":
    L.append(c)
  elif d=="WA":
    if c not in L:
      R.append(c)
L=set(L)
t=len(L)
P=[1 for i in R if i in L]
s=sum(P)
print(t,s)

Fixed submission:
import sys
input = sys.stdin.readline
def main():
  L=list()
  R=list()
  a,b=map(int,input().split())
  for i in range(b):
    c,d=input().split()
    c=int(c)
    if d=="AC":
      L.append(c)
    elif d=="WA":
      if c not in L:
        R.append(c)
  L=set(L)
  t=len(L)
  P=[1 for i in R if i in L]
  s=sum(P)
  print(t,s)
main()
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
a,b=map(int,input().split())
L=list(map(int,input().split()))
L=list(itertools.combinations(L, b))
K=[max(i)-min(i) for i in L]
print(sum(K)%1000000007)

Fixed submission:
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7
N = 10**5
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

N,K=map(int,input().split())
L=list(map(int,input().split()))
L=sorted(L)
s=0
for i in range(N-K+1):
  s+=(cmb(N-i-1,K-1,mod)*(L[N-1-i]-L[i]))%mod
print(s%mod)
Buggy python submission (verdict: Time Limit Exceeded):
p=0
N,K=map(int,input().split())
a,b,c=map(int,input().split())
s=input()
L=list()
L_append = L.append
for i in range(N):
  if i<K:
    if s[i]=="r":
      p+=c
      L_append(i)
    elif s[i]=="s":
      p+=a
      L_append(i)
    else:
      p+=b
      L_append(i)
  else:
    if s[i]=="r" and s[i-K]!="r":
      p+=c
      L_append(i)
    elif s[i]=="s" and s[i-K]!="s":
      p+=a
      L_append(i)
    elif s[i]=="p" and s[i-K]!="p":
      p+=b
      L_append(i)
    if s[i]=="r" and s[i-K]=="r" and i-K not in L:
      p+=c
      L_append(i)
    if s[i]=="s" and s[i-K]=="s" and i-K not in L:
      p+=a
      L_append(i)
    if s[i]=="p" and s[i-K]=="p" and i-K not in L:
      p+=b
      L_append(i)
print(p)

Fixed submission:
p=0
N,K=map(int,input().split())
a,b,c=map(int,input().split())
s=input()
L=list()
L_append = L.append
for i in range(N):
  if i<K:
    if s[i]=="r":
      p+=c
      L_append(i)
    elif s[i]=="s":
      p+=a
      L_append(i)
    else:
      p+=b
      L_append(i)
  else:
    if s[i]=="r" and s[i-K]!="r":
      p+=c
      L_append(i)
    elif s[i]=="s" and s[i-K]!="s":
      p+=a
      L_append(i)
    elif s[i]=="p" and s[i-K]!="p":
      p+=b
      L_append(i)
    if s[i]=="r" and s[i-K]=="r" and i-K not in L:
      p+=c
      L_append(i)
    elif s[i]=="s" and s[i-K]=="s" and i-K not in L:
      p+=a
      L_append(i)
    elif s[i]=="p" and s[i-K]=="p" and i-K not in L:
      p+=b
      L_append(i)
print(p)

Buggy python submission (verdict: Time Limit Exceeded):
p=0
N,K=map(int,input().split())
a,b,c=map(int,input().split())
s=input()
L=list()
for i in range(N):
  if i<K:
    if s[i]=="r":
      p+=c
      L.append(i)
    elif s[i]=="s":
      p+=a
      L.append(i)
    else:
      p+=b
      L.append(i)
  else:
    if s[i]=="r" and s[i-K]!="r":
      p+=c
      L.append(i)
    elif s[i]=="s" and s[i-K]!="s":
      p+=a
      L.append(i)
    elif s[i]=="p" and s[i-K]!="p":
      p+=b
      L.append(i)
    if s[i]=="r" and s[i-K]=="r" and i-K not in L:
      p+=c
      L.append(i)
    if s[i]=="s" and s[i-K]=="s" and i-K not in L:
      p+=a
      L.append(i)
    if s[i]=="p" and s[i-K]=="p" and i-K not in L:
      p+=b
      L.append(i)
print(p)

Fixed submission:
p=0
N,K=map(int,input().split())
a,b,c=map(int,input().split())
s=input()
L=list()
L_append = L.append
for i in range(N):
  if i<K:
    if s[i]=="r":
      p+=c
      L_append(i)
    elif s[i]=="s":
      p+=a
      L_append(i)
    else:
      p+=b
      L_append(i)
  else:
    if s[i]=="r" and s[i-K]!="r":
      p+=c
      L_append(i)
    elif s[i]=="s" and s[i-K]!="s":
      p+=a
      L_append(i)
    elif s[i]=="p" and s[i-K]!="p":
      p+=b
      L_append(i)
    if s[i]=="r" and s[i-K]=="r" and i-K not in L:
      p+=c
      L_append(i)
    elif s[i]=="s" and s[i-K]=="s" and i-K not in L:
      p+=a
      L_append(i)
    elif s[i]=="p" and s[i-K]=="p" and i-K not in L:
      p+=b
      L_append(i)
print(p)
Buggy python submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
print((a * b) // math.gcd(a, b))

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

Buggy python submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
print(math.gcd(a, b))

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

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
import math
print(math.gcd(a, b))

Fixed submission:
import fractions
a,b=map(int,input().split())
print((a * b) // fractions.gcd(a, b))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
N=int(input())
L=tuple(map(int,input().split()))
if 1 not in L:
  print(-1)
  sys.exit()
for i in range(1,N+1):
  if i not in L:
    print(N+1-i)
    sys.exit()
  else:
    a=L.index(i)
    L=L[a:]
print(0)

Fixed submission:
N=int(input())
L=list(map(int,input().split()))
i=0
n=1
while True:
  if i==N:
    break
  if L[i]==n:
    n+=1
  i+=1
if n==1:
  print(-1)
else:
  print(N-n+1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(input())
A=list(map(int,input().split()))
j=1
i=0
if min(A)!=j:
  print(-1)
  sys.exit()
else:
  i=A.index(j)
  j+=1
while i<N:
  A=A[i:]
  if j not in A:
    print(N-j+1)
    sys.exit()
  elif j in A:
    i=A.index(j)
    j+=1
print(i,j)

Fixed submission:
N=int(input())
L=list(map(int,input().split()))
i=0
n=1
while True:
  if i==N:
    break
  if L[i]==n:
    n+=1
  i+=1
if n==1:
  print(-1)
else:
  print(N-n+1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
def main():
  N=int(input())
  L=list(map(int,input().split()))
  if 1 not in L:
    print(-1)
    sys.exit()
  for i in range(1,N+1):
    if i not in L:
      print(N+1-i)
      sys.exit()
    else:
      a=L.index(i)
      L=L[a:]
  print(0)
if __name__ == '__main__':
    main()

Fixed submission:
N=int(input())
L=list(map(int,input().split()))
i=0
n=1
while True:
  if i==N:
    break
  if L[i]==n:
    n+=1
  i+=1
if n==1:
  print(-1)
else:
  print(N-n+1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(input())
L=list(map(int,input().split()))
if 1 not in L:
  print(-1)
  sys.exit()
for i in range(1,N+1):
  if i not in L:
    print(N+1-i)
    sys.exit()
  else:
    a=L.index(i)
    L=L[a:]
print(0)

Fixed submission:
N=int(input())
L=list(map(int,input().split()))
i=0
n=1
while True:
  if i==N:
    break
  if L[i]==n:
    n+=1
  i+=1
if n==1:
  print(-1)
else:
  print(N-n+1)
Buggy python submission (verdict: Runtime Error):
a,b,c=int(input())
if a+b+c<=21:
  print("win")
else:
  print("bust")

Fixed submission:
a,b,c=map(int,input().split())
if a+b+c<=21:
  print("win")
else:
  print("bust")
Buggy python submission (verdict: Time Limit Exceeded):
def nishin(n):
  return str(bin(n)[2:])[::-1]
N=int(input())
L=list(map(int,input().split()))
mod=1000000007
ans=sum(L)*(N-1)
c=[0]*61
for i in L:
  i=nishin(i)
  for j in range(len(i)):
    if i[j]=="1":
      c[j]+=1
for i in range(61):
  ans-=(pow(2,i,mod)*c[i]*(c[i]-1))%mod
print(ans%mod)

Fixed submission:
def nishin(n):
  return str(bin(n)[2:])[::-1]
N=int(input())
L=list(map(int,input().split()))
mod=1000000007
ans=sum(L)*(N-1)
c=[0]*61
for i in L:
  i=nishin(i)
  for j in range(len(i)):
    if i[j]=="1":
      c[j]+=1
for i in range(61):
  ans-=(pow(2,i,mod)*c[i]*(c[i]-1))%mod
print(ans%mod)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(input())
a=N//1.08
b=a*1.08
b=int(b)
if b==N:
  print(a)
  sys.exit()
while True:
  if b>N:
    a=a-1
    b=a*1.08
    b=int(b)
    if b<N:
      print(":(")
      sys.exit()
    elif b==N:
      print(a)
  elif  b<N:
    a=a+1
    b=a*1.08
    b=int(b)
    if b>N:
      print(":(")
      sys.exit()
    elif b==N:
      print(a)

Fixed submission:
import sys
N=int(input())
a=N//1.08
c=a+1
d=a-1
b=a*1.08
b=int(b)
if b==N:
  print(int(a))
  sys.exit()
elif int(c*1.08)==N:
  print(int(c))
elif int(d*1.08)==N:
  print(int(d))
else:
  print(":(")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))
R=list()
for i in range(1,N+1):
  R.append(L.index(i)+1)
print(" ".join(list(map(str,R))))

Fixed submission:
N=int(input())
L=list(map(int,input().split()))
R=[0]*N
for i in range(0,N):
  R[L[i]-1]=i+1
print(" ".join(list(map(str,R))))
Buggy python submission (verdict: Runtime Error):
import sys
S=list(input())
c=len(R)
for i in range(c):
  if i%2==0:
    if L[i]!="R" and L[i]!="D" and L[i]!="U":
      print("No")
      sys.exit()
  else:
    if L[i]!="L" and L[i]!="D" and L[i]!="U":
      print("No")
      sys.exit()
print("Yes")

Fixed submission:
import sys
L=list(input())
c=len(L)
for i in range(c):
  if i%2==0:
    if L[i]!="R" and L[i]!="D" and L[i]!="U":
      print("No")
      sys.exit()
  else:
    if L[i]!="L" and L[i]!="D" and L[i]!="U":
      print("No")
      sys.exit()
print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def main():
  input = sys.stdin.readline
  R=list()
  s=0
  L=list()
  N=int(input())
  for i in range(N):
    S=sorted(list(input()))
    if S not in R:
      R.append(S)
    L.append(S)
  for i in range(len(R)):
    c=L.count(R[i])
    s+=(c*(c-1))//2
  print(s)
if __name__ == '__main__':
    main()

Fixed submission:
import collections
N=int(input())
j=0
L=list()
R=list()
for i in range(N):
  S="".join(sorted(list(input())))
  L.append(S)
c = collections.Counter(L)
counts=c.values()
counts=list(counts)
A=[i*(i-1)//2 for i in counts]
print(sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
R=list()
s=0
L=list()
N=int(input())
for i in range(N):
  S=sorted(list(input()))
  if S not in R:
    R.append(S)
  L.append(S)
for i in range(len(R)):
  c=L.count(R[i])
  s+=(c*(c-1))//2
print(s)

Fixed submission:
import collections
N=int(input())
j=0
L=list()
R=list()
for i in range(N):
  S="".join(sorted(list(input())))
  L.append(S)
c = collections.Counter(L)
counts=c.values()
counts=list(counts)
A=[i*(i-1)//2 for i in counts]
print(sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
s=0
L=list()
N=int(input())
for i in range(N):
  S=sorted(list(input()))
  s+=L.count(S)
  L.append(S)
print(s)

Fixed submission:
import collections
N=int(input())
j=0
L=list()
R=list()
for i in range(N):
  S="".join(sorted(list(input())))
  L.append(S)
c = collections.Counter(L)
counts=c.values()
counts=list(counts)
A=[i*(i-1)//2 for i in counts]
print(sum(A))
Buggy python submission (verdict: Runtime Error):
L=list()
N=int(input())
for i in range(N):
  a=int(input())
  L.append(a)
L=L.sorted(L)
c=L[-1]
d=L[-2]
for i in range(N):
  if L[i]==c:
    print(d)
  else:
    print(c)

Fixed submission:
L=list()
N=int(input())
for i in range(N):
  a=int(input())
  L.append(a)
c=max(L)
d=sorted(L)[-2]
for i in range(N):
  if L[i]==c:
    print(d)
  else:
    print(c)
Buggy python submission (verdict: Runtime Error):
N=int(input())
L=list()
R=list()
for i in range(N):
  a,b=map(int,input().split())
  L.append([a,b])
k=dict()
for i in range(N-1):
  for j in range(i+1,N):
    a,b=L[i]
    c,d=L[j]
    R.append([a-c,b-d])
    n=str(a-c)+" "+str(b-d)
    if n in k:
      k[n]+=1
    else:
      k[n]=1
    R.append([c-a,d-b])
    n=str(c-a)+" "+str(d-b)
    if n in k:
      k[n]+=1
    else:
      k[n]=1
op=max(k.values())
print(N-op)

Fixed submission:
N=int(input())
if N==1:
  print(1)
  exit()
L=list()
R=list()
for i in range(N):
  a,b=map(int,input().split())
  L.append([a,b])
k=dict()
for i in range(N-1):
  for j in range(i+1,N):
    a,b=L[i]
    c,d=L[j]
    R.append([a-c,b-d])
    n=str(a-c)+" "+str(b-d)
    if n in k:
      k[n]+=1
    else:
      k[n]=1
    R.append([c-a,d-b])
    n=str(c-a)+" "+str(d-b)
    if n in k:
      k[n]+=1
    else:
      k[n]=1
op=max(k.values())
print(N-op)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import math
def fibnatch(n):
  if n==0:
    return 1
  a=(pow(((1+math.sqrt(5))/2),n)-pow(((1-math.sqrt(5))/2),n))/math.sqrt(5)
  c=int(a)
  if n==1:
    return 1
  elif abs(c-a)>=abs(c-a+1):
    return (c+1)%1000000007
  else:
    return c%1000000007
L=list()
N,M=map(int,input().split())
a=1
for i in range(M):
  c=int(input())
  if i==0:
    L.append(c-a)
  else:
    L.append(c-a-1)
  a=c
if 0 in L[1:]:
  print(0)
  sys.exit()
L.append(N-c)
s=1
for i in range(len(L)):
  d=L[i]
  s=(s*fibnatch(d))%1000000007
print(s)

Fixed submission:
N,M=map(int,input().split())
L=[0]*N
c={}
mod=1000000007
for i in range(M):
  k=int(input())
  c[k]=0
for i in range(N):
  if i==0:
    L[i]=1
  elif i==1:
    if L[0]==0:
      L[i]=1
    else:
      L[i]=2
  else:
    L[i]=(L[i-1]+L[i-2])%mod
  if i+1 in c:
    L[i]=0
print(L[N-1])