TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
N,X,M = map(int,input().split())

ans = X
A = X
TF = True
srt = 1000000
retu = dict()
retu[X] = 1
loop = X
for i in range(N-1):
    if TF:
        A = A**2 % M
        if retu.get(A) != None:
          srt = j
          goal = i
          TF = False
          break   
        if TF:
          retu[A] = 1
          loop += A
    else:
      break
      
if N-1 > srt:
    n = (N-srt)//(goal-srt+1)
    saisyo = sum(retu[:srt])
    loop -= saisyo
    print(saisyo + loop*n + sum(retu[srt:N-n*(goal-srt+1)]))
    
else:
    print(sum(retu[:N]))


N, X, M = map(int, input().split())

candicate = [pow(i, 2, M) for i in range(M)]
ans = 0
now = X
A = [0]
X2 = pow(X, 2, M)

d = dict()

flag = True
for i in range(1, N):
    if i == 1:
        A.append(X)
    
    else:
        nxt = candicate[A[i-1]]

        if d.get(nxt) == None:
            if nxt == 0:
                A.append(nxt)
                break
            else:
                A.append(nxt)
                d[nxt] = i

        else:
            flag = False
            break


if flag:
    print(sum(A))
else:
    l = d[nxt]
    r = i - 1
    circle_total = 0
    for j in range(l, r+1):
        circle_total += A[j]
    
    for j in range(1, l):
        ans += A[j]

    width = r - l + 1
    N -= (l - 1)
    ans += circle_total * (N // width)

    for j in range(l, l + N % width):
        ans += A[j]

    print(ans)


N,X,M = map(int,input().split())

ans = X
A = X
TF = True
srt = 1000000
retu = [X]
d = dict()
d[X] = 0
loop = X
flag = False
for i in range(N-1):
    if TF:
        A = A**2 % M
        if d.get(A) != None:
          srt = d[A]
          goal = i
          TF = False
          
        if TF:
          retu.append(A)
          d[A] = i + 1
          loop += A
    else:
      flag = True
      break
      
if flag:
    n = (N-srt)//(goal-srt+1)
    saisyo = sum(retu[:srt])
    loop -= saisyo
    print(saisyo + loop*n + sum(retu[srt:N-n*(goal-srt+1)]))
    
else:
    print(sum(retu[:N]))


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
N, X, M = map(int, input().split())
ls = [False]*M
ls_mod = []
x = X
for m in range(M+1):
  if ls[x] == False:
    ls_mod.append(x)
    ls[x] = m
    x = (x**2)%M
  else:
    last = m
    fast = ls[x]
    diff = last - fast
    break
if last >= N:
  print(sum(ls_mod[:N]))
else:
  shou = (N-fast) // diff
  amari = (N-fast) % diff
  print(sum(ls_mod[:fast])+sum([fast:])*shou+sum([fast:fast+amari]))

N, X, M = map(int, input().split())
ls = [False]*M
ls_mod = []
x = X
for m in range(M+1):
  if ls[x] == False:
    ls_mod.append(x)
    ls[x] = m
    x = (x**2)%M
  else:
    last = m
    fast = ls[x]
    diff = last - fast
    break
print(last)
"""if last >= N:
  print(sum(ls_mod[:N]))
else:
  shou = (N-fast) // diff
  amari = (N-fast) % diff
  print(sum(ls_mod[:fast])+sum(ls_mod[fast:])*shou+sum(ls_mod[fast:fast+amari]))
"""


N, X, M = map(int, input().split())
ls = [False]*M
ls_mod = []
x = X
for m in range(M+1):
  if ls[x] == False:
    ls_mod.append(x)
    ls[x] = m
    x = (x**2)%M
  else:
    last = m
    fast = ls[x]
    diff = last - fast
    break
"""if last >= N:
  print(sum(ls_mod[:N]))
else:
  shou = (N-fast) // diff
  amari = (N-fast) % diff
  print(sum(ls_mod[:fast])+sum(ls_mod[fast:])*shou+sum(ls_mod[fast:fast+amari]))

"""

N, X, M = map(int, input().split())
ls = [False]*M
ls_mod = []
x = X
for m in range(M+1):
  if ls[x] == False:
    ls_mod.append(x)
    ls[x] = m
    x = (x**2)%M
  else:
    last = m
    fast = ls[x]
    diff = last - fast
    break
if M == 1:
  print(0)
else:
  if last > N:
    print(sum(ls_mod[:N]))
  else:
    shou = (N-fast) // diff
    amari = (N-fast) % diff
    print(sum(ls_mod[:fast])+sum(ls_mod[fast:])*shou+sum(ls_mod[fast:fast+amari]))



Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
N, X, M = map(int, input().split())

ans = 0
chck = 0
flag = [0]*(10**5 +1)
lst = [X]

for i in range(N):
    X = (X**2)%M

    if flag[X] == 1:
        break

    flag[X] = 1
    lst.append(X)

preindex = lst.index(X)

preloop = lst[:index]
loop = lst[index:]

loopnum = (N - len(preloop))//len(loop)
loopafternum = (N - len(preloop))%len(loop)

ans = sum(preloop) + sum(loop)*loopnum + sum(loop[:loopafternum])
print(ans)

N, X, M = map(int, input().split())

ans = 0
flag = [0]*(10**5 + 2)
lst = [X]

for i in range(N):
    X = (X**2)%M

    if flag[X] == 1:
        break

    flag[X] = 1
    lst.append(X)

preindex = lst.index(X)

preloop = lst[:preindex]
loop = lst[preindex:]

loopnum = (N - len(preloop))//len(loop)
loopafternum = (N - len(preloop))%len(loop)

ans = sum(preloop) + sum(loop)*loopnum + sum(loop[:loopafternum])
print(ans)

Verdicts: Runtime Error

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
n, x, m = map(int,input().split())
lst = [0 for i in range(m)]
lst2 = [x]
i = 2
lst[x] = 1
while True:
    if (i > n):
        break
    x = x**2%m
    if (lst[x] == 0):
        lst[x] = i
        lst2.append(lst2[i - 2] + x)
        i = i + 1
    else:
        lst2.append(lst2[i - 2] + x)
        break
a = i - lst[x]
b = lst2[i - 1] - lst2[i - 1 - a]
i = i - 1
c = (n - i)//a
d = (n - i)%a
ans = lst2[i - 1] + b*c + lst2[i - 1 - a + d] - lst2[i - 1 - a]
print(ans)


n, x, m = map(int,input().split())
lst = [0 for i in range(m)]
lst2 = [x]
i = 2
lst[x] = 1
c = 0
while True:
    if (i > n):
        break
    x = x**2%m
    if (lst[x] == 0):
        lst[x] = i
        lst2.append(lst2[i - 2] + x)
        i = i + 1
    else:
        lst2.append(lst2[i - 2] + x)
        c = 1
        break
if (c == 1):
    a = i - lst[x]
    b = lst2[i - 1] - lst2[i - 1 - a]

    c = (n - i)//a
    d = (n - i)%a
    ans = lst2[i - 1] + b*c + lst2[i - 1 - a + d] - lst2[i - 1 - a]
    print(ans)

else:
    print(lst2[n - 1])


Verdicts: Runtime Error

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 19 22:03:19 2020

@author: liang
"""

N, X, M = map(int,input().split())
mod_set = {X}
mod_lis = [X]
A = [0]*(10**6+1)
A[0] = X
flag = False

for i in range(1,min(10**6,N)):
    tmp = A[i-1]**2%M
    if tmp in mod_set:
        flag = True
        break
    A[i] = tmp
    mod_set.add(tmp)
    mod_lis.append(tmp)

if flag:
    j = mod_lis.index(tmp)
else:
    j = i
T = i - j
ans = 0
if T != -1:  
    ans += sum(mod_lis[:j])
    T_sum = sum(mod_lis[j:])
    
    ans += T_sum * ((N-j)//T)
    #print((N-j)//T, T_sum)
    T_lis = mod_lis[j:i]   
    ans += sum(T_lis[:(N-j)%T])
else:
    ans = sum(mod_lis)
#print(T_lis)
#print((N-j)%T)
#print(T_lis[:10])
print(ans)
#print(T_sum)
#print(sum(T_lis))

# -*- coding: utf-8 -*-
"""
Created on Sat Sep 19 22:03:19 2020

@author: liang
"""

N, X, M = map(int,input().split())
mod_set = {X}
mod_lis = [X]
A = [0]*(10**6+1)
A[0] = X
flag = False


l = 1
for i in range(1,min(10**6,N)):
    l = i
    tmp = A[i-1]**2%M
    if tmp in mod_set:
        flag = True
        break
    A[i] = tmp
    mod_set.add(tmp)
    mod_lis.append(tmp)

if flag:
    j = mod_lis.index(tmp)
else:
    j = l
T = l - j
ans = 0
if T != 0:  
    #print("A")
    ans += sum(mod_lis[:j])
    T_sum = sum(mod_lis[j:])
    q, r = divmod(N-j,T)
    ans += T_sum * q
    #print((N-j)//T, T_sum)
    T_lis = mod_lis[j:]   
    ans += sum(T_lis[:r])
else:
    #print("B")
    ans = sum(mod_lis)
   # print(mod_lis)
#print(T_lis)
#print((N-j)%T)
#print(T_lis[:10])
print(ans)
#print(T_sum)
#print(sum(T_lis))

Verdicts: Runtime Error

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
import math
n,x,m=map(int, input().split())
a = x
ans = a
l=[a]
flg=[0]*m

for i in range(1,m):
    tmp=(a*a)%m
    a=tmp 
    ans+=tmp
    if flg[a]==1:
        lp = l.index(a)
        break
    else:
        l.append(a)
        flg[a]=1

if lp != 0:
    l2 = l[lp:]
    tmp = sum(l2)
    b=math.floor((n-len(l))/len(l2))
    c=(n-len(l))%len(l2)
    if c==0:
        ans+=b*tmp
    else:
        ans+=b*tmp+sum(l2[:c])-l2[0]

print(ans)

n,x,m=map(int, input().split())
a = x
ans = a
l=[a]

for i in range(1,n):
    tmp=(a*a)%m
    a=tmp  
    ans+=tmp
    if a in l:
        lp = l.index(a)
        break
    else:
        l.append(a)

l2 = l[lp:]
tmp = sum(l2)

b=int((n-len(l))/len(l2))
c=(n-len(l))%len(l2)

ans+=b*tmp+sum(l2[:c])
print(ans)

n,x,m=map(int, input().split())
a=x
ans=a
flg=[0]*m
flg[a]=1
l=[a]
lp=-1

for i in range(1,n):
    tmp=(a*a)%m
    a=tmp
    if flg[a]==1:
        lp = l.index(a)
        break
    else:    
        ans+=tmp
        l.append(a)
        flg[a]=1

if lp != -1:
    l2 = l[lp:]
    tmp = sum(l2)
    b=(n-len(l))//len(l2)
    c=n-len(l)-b*len(l2)
    ans=ans+(b*tmp)+sum(l2[:c])

print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
N, X, M = map(int, input().split())

lim = 10**5+1

f = [0]*(lim)
a = [0]*(lim)

x = X
f[x] = 1
a[1] = x

ans = x

i = 1
l = N
while i < l:
    i += 1

    x **= 2
    x %= M
    if not x:
        break

    if f[x]:
        lp_len = (i-f[x])
        z = (l-i+1)//lp_len
        if z:
            ls = ans - a[f[x]-1]
            ans += ls * z
            i += z*lp_len

    if i < l:
        ans += x
    
    f[x] = i
    if i < lim:
        a[i] = ans

print(ans)

N, X, M = map(int, input().split())

lim = 10**5*2+1

f = [0]*(lim)
a = [0]*(lim)

x = X
f[x] = 1
a[1] = x

ans = x

i = 1
l = N
while i < l:
    i += 1

    x **= 2
    x %= M
    if not x:
        break

    if f[x]:
        lp_len = (i-f[x])
        z = (l-i+1)//lp_len
        if z:
            ls = ans - a[f[x]-1]
            ans += ls * z
            i += z*lp_len

    if i <= l:
        ans += x
    
    f[x] = i
    if i < lim:
        a[i] = ans

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
n, x, m =  map(int, input().split())
ans = 0
loop_list = [0] * m
loop_list[x] = 1
order_list = [x]

for i in range(1, m + 1):
    x = pow(x, 2, m)
    if loop_list[x] != 1:
        loop_list[x] = 1
        order_list.append(x)
    else:
        break

index = order_list.index(x)
time = (n - index) // (len(order_list) - index)
mod = (n - index) % (len(order_list) - index)

ans += sum(order_list[:index - 1])
ans += sum(order_list[index:]) * time
ans += sum(order_list[index:index + mod - 1])

print(ans)


n, x, m =  map(int, input().split())
ans = 0
loop_list = [0] * m
loop_list[x] = 1
order_list = [x]

for i in range(1, m + 1):
    x = pow(x, 2, m)
    if loop_list[x] != 1:
        loop_list[x] = 1
        order_list.append(x)
    else:
        break

index = order_list.index(x)
time = (n - index) // (len(order_list) - index)
mod = (n - index) % (len(order_list) - index)

ans += sum(order_list[:index])
ans += sum(order_list[index:]) * time
ans += sum(order_list[index:index + mod])

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):


def main():
    n, x, m = map(int, input().split())
    l = [x]
    ltot = [x]

    flg = 0
    tot = x
    a = x
    for i in range(n):
        a = a ** 2 % m
        if a in set(l):
            for j in range(len(l)):
                if l[j] == a:
                    l2 = l[j:]
                    z = (n - j) // len(l2) - 1
                    y = (n - j) % len(l2)
                    tot += (ltot[y-1] - ltot[j-1]) + (ltot[-1] - ltot[j-1]) * z
                    
                    flg = 1
                    break
        if flg:
            break
        tot += a
        l.append(a)
        ltot.append(tot)

    print(tot)


main()





def main():
    n, x, m = map(int, input().split())
    mflg = [-1] * m
    mflg[x] = 0
    ltot = [x]

    tot = x
    a = x
    for i in range(1, n):
        a = a ** 2 % m

        if mflg[a] >= 0:
            b = mflg[a]
            z = (n - i) // (i - b)
            y = (n - i) % (i - b)
            if b == 0 and y == 0:
                tot += ltot[i - 1] * z
            elif b == 0:
                tot += ltot[b - 1 + y] + ltot[i - 1] * z
            else:
                tot += (ltot[b - 1 + y] - ltot[b - 1]) + (ltot[i - 1] - ltot[b - 1]) * z
            break

        mflg[a] = i
        tot += a
        ltot.append(tot)

    print(tot)


main()



Verdicts: Wrong Answer

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
N,X,M = map(int,input().split())
rt = 0
for i in range(2,N+1):
  dps[i] = (dps[i-1]**2)%M
  rt+=dps[i]
print(rt)

N,X,M = map(int,input().split())
dps = [0,X%M]+[0 for i in range(N)]
rt = 0
for i in range(2,N+1):
  dps[i] = (dps[i-1]**2)%M
  rt+= dps[i]
print(rt)

n, x, m = map(int, input().split())
mn = min(n, m)
P = []
sum_p = 0
X = [-1] * m
for i in range(mn):
    if X[x] > -1:
        cyc_len = len(P) - X[x]
        remain = P[X[x]]
        cyc = (sum_p - remain) * ((n - X[x]) // cyc_len)
        remain += P[X[x] + (n - X[x]) % cyc_len] - P[X[x]]
        print(cyc + remain)
        exit()
    P.append(sum_p)
    sum_p += x
    X[x] = i
    x = x*x % m
print(sum_p)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
n, x, m = map(int, input().split())
a = x
mod = [a]
loop = []
cnt = 0
while cnt < n:
    a = a**2 % m
    if a in mod:
        i = mod.index(a)
        before = mod[:i]
        loop = mod[i:]
        break
    mod.append(a)
    cnt += 1

length = len(loop)
if length == 0:
    print(sum(mod[:n]))
else:
    print(loop)
    t = (n-i)//length
    amari = (n-i) % length
    print("t, amari:",t,",",amari)
    ans = sum(before) + t * sum(loop) + sum(loop[:amari])
    print(ans)


n, x, m = map(int, input().split())
a = x
mod = [a]
loop = []
cnt = 0
while cnt < n:
    a = a**2 % m
    if a in mod:
        i = mod.index(a)
        before = mod[:i]
        loop = mod[i:]
        break
    mod.append(a)
    cnt += 1

length = len(loop)
if length == 0:
    print(sum(mod[:n]))
else:
    print(loop)
    t = (n-i)//length
    amari = (n-i) % length
    ans = sum(before) + t * sum(loop) + sum(loop[:amari])
    print(ans)


n, x, m = map(int, input().split())
a = x
dup = [0]*(10**5+10)
mod = [a]
loop = []
cnt = 0
while cnt < n:
    a = a**2 % m
    if dup[a]==1:
        i = mod.index(a)
        before = mod[:i]
        loop = mod[i:]
        break
    mod.append(a)
    dup[a] = 1
    cnt += 1

length = len(loop)
if length == 0:
    print(sum(mod[:n]))
else:
    t = (n-i)//length
    amari = (n-i) % length
    ans = sum(before) + t * sum(loop) + sum(loop[:amari])
    print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
N,X,M=map(int, input().split())
import time
from math import log, ceil



ini=[0]*M
mod=[0]*M
ini[0]=sum(list(range(1,M)))
Counter=[0]*M
Counter[0]=M-1

for i in range(1,M):
    now=i+1
    temp=now
    count=1
    while now**2<M:
        now=now**2
        temp+=now
        count+=1
    m=(now**2)%M
    ini[i]=temp
    mod[i]=m
    Counter[i]=count
#print(ini[:5])
#print("ok")
#print(Counter[:100])
ans=0
count=0
now=X
done=[-1]*M
ok=False
while True:
    if now==0:
        print(ans)
        exit()
    if count+Counter[now-1]>N:
        break
    if done[now-1]==-1 or ok is True:
        done[now-1]=(ans, count)
        ans+=ini[now-1]
        #print(ini[now-1])
        count+=Counter[now-1]
        now=mod[now-1]
    else:
        pans, pcount=done[now-1]
        #print(count, pcount)
        #print("break")
        ans+=(ans-pans)*((N-count)//(count-pcount))
        count+=(count-pcount)*((N-count)//(count-pcount))+1
        #print(count)
        ok=True


print(ans, count, now, )



while True:
    if count==N:
        break

    ans+=now%M
    now=(now**2)%M
    count+=1

    

print(ans)






#print(ini)
#print(mod)
#print(Counter)

N,X,M=map(int, input().split())

ans=0
count=0
now=X
done=[-1]*(M-1)
L=[]
if now==0:
    print(ans)
    exit()
j=False
while True:
    if count==N:
        break

    if now==0:
        print(ans)
        exit()
    else:
        if done[now-1]==-1:
            done[now-1]=1
            L.append(now)
        else:
            for i in range(len(L)):
                if L[i]==now:
                    j=i
            break
    ans+=now
    count+=1
    now=(now**2)%M

if j:
    L=L[j:]

total=sum(L)
length=len(L)

ans+=((N-count)//length)*total
ans+=sum(L[:(N-count)%length])
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
# -*- coding: utf-8 -*-
N, X, M = map(int, input().split())

mod_check_list = [False for _ in range(M)]
mod_list = [(X ** 2) % M]
counter = 1
mod_sum = (X ** 2) % M
last_mod = 0
for i in range(M):
    now_mod = (mod_list[-1] ** 2) % M
    if mod_check_list[now_mod]:
        last_mod = now_mod
        break
    mod_check_list[now_mod] = True
    mod_list.append(now_mod)
    counter += 1
    mod_sum += now_mod

loop_start_idx = 0
for i in range(counter):
    if last_mod == mod_list[i]:
        loop_start_idx = i
        break

loop_list = mod_list[loop_start_idx:]
loop_num = counter - loop_start_idx
ans = 0
if mod_list[-1] == 0:
    ans = X + sum(mod_list[:min(counter, N - 1)])
else:
    if (N - 1) <= counter:
        ans = X + sum(mod_list[:counter])
        print(aa)
    else:
        ans += X + mod_sum
        N -= (counter + 1)
        ans += sum(loop_list) * (N // loop_num) + sum(loop_list[:N % loop_num])
print(ans)

n,x,m=map(int,input().split())
a=[]
mod_check_list = [False for _ in range(M)]
a.append(x*x%m)
ind=0
s=0
for i in range(m):
    t=a[i]*a[i]%m
    if mod_check_list[t]:
        ind=a.index(t)
        break
    mod_check_list[t] = True
    a.append(t)
s=sum(a[ind:])
l=len(a)-ind
loop_times = (n-1-ind)//l
answer=loop_times*s
for i in range((n-1-ind)%l):
    answer+=a[i+ind]
print(answer+x+sum(a[:ind]))

n,x,m=map(int,input().split())
a=[]
mod_check_list = [False for _ in range(m)]
a.append(x*x%m)
ind=0
s=0
for i in range(m):
    t=a[i]*a[i]%m
    if mod_check_list[t]:
        ind=a.index(t)
        break
    mod_check_list[t] = True
    a.append(t)
s=sum(a[ind:])
l=len(a)-ind
loop_times = (n-1-ind)//l
answer=loop_times*s
for i in range((n-1-ind)%l):
    answer+=a[i+ind]
print(answer+x+sum(a[:ind]))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
N, X, M = map(int, input().split())
x = X
nums = []
isSearched = [False] * (M+1)
isSearchedNums = [-1] * (M+1)
n = 0
looped = 0
while True:
    x = (x*x) % M
    if isSearched[x]:
        looped = isSearchedNums[x]
        break
    isSearched[x] = True
    isSearchedNums[x] = n
    nums.append(x)
    n+=1
if (isSearched[0]):
    ans = X
    for i in range(min((N-1), len(nums))):
        ans += nums[i]

    print(ans)
else:
    ans = X
    al = 0
    d = len(nums) - looped
    for i in range(looped, len(nums)):
        al += nums[i]

    if N - 1 > len(nums):
        N -= len(nums)
        ans += sum(nums)
        ans += al * ((N-1) // d)
        for i in range(looped, ((N-1) % d) + looped):
            ans += nums[i]
    else:
        for i in range(i, N - 1):
            ans += nums[i]

    print(ans)



N, X, M = map(int, input().split())
x = X
nums = []
isSearched = [False] * (M+1)
isSearchedNums = [-1] * (M+1)
n = 0
looped = 0
while True:
    x = (x*x) % M
    if isSearched[x]:
        looped = isSearchedNums[x]
        break
    isSearched[x] = True
    isSearchedNums[x] = n
    nums.append(x)
    n+=1
if (isSearched[0]):
    ans = X
    for i in range(min((N-1), len(nums))):
        ans += nums[i]

    print(ans)
else:
    ans = X
    al = 0
    d = len(nums) - looped
    for i in range(looped, len(nums)):
        al += nums[i]
    if N - 1 > len(nums):
        N -= len(nums)
        ans += sum(nums)
        ans += al * ((N-1) // d)
        for i in range(looped, ((N-1) % d) + looped):
            ans += nums[i]
    else:
        for i in range(N - 1):
            ans += nums[i]

    print(ans)



Verdicts: Wrong Answer

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
N, X, M = map(int, input().split())
A = [X]
A_dict = {X}
a = X
s = X
r = 0
r0 = 0
l = 0
amari = 0

for i in range(M+1):
  a = a ** 2 % M
  if a in A_dict:
    r0 = A.index(a)
    l = len(A[r0:])
    r = (N - i - 1) // l
    amari = (N - i - 1) % l
    s = sum(A[:r0]) + sum(A[r0:])*r + sum(A[r0:r0+amari])
    break
  A.append(a)
  A_dict.add(a)
  s += A[-1]

print(s)

N, X, M = map(int, input().split())
A = [X]
A_dict = {X}
a = X
s = X
r = 0
r0 = 0
l = 0
amari = 0

for i in range(M+1):
  a = a ** 2 % M
  if a in A_dict:
    r0 = A.index(a)
    l = len(A[r0:])
    r = (N - i - 1) // l
    amari = (N - i - 1) % l
    s = sum(A[:r0]) + sum(A[r0:])*r + sum(A[r0:r0+amari])
    break
  A.append(a)
  A_dict.add(a)

print(s)

N, X, M = map(int, input().split())
A = []
a = X
s = X
r = 0
r0 = 0
l = 0
amari = 0

A.append(X)
for i in range(N-1):
  a = a ** 2 % M
  if A.count(a) >= 1:
    if a == 0:
      s = sum(A)
      break
    else:
      r0 = A.index(a)
      l = len(A[r0:])
      r = (N - i - 1) // l
      amari = (N - i - 1) % l
      s = sum(A) + sum(A[r0:])*r + sum(A[r0:r0+amari])
      break
  A.append(a)

print(s)

N, X, M = map(int, input().split())
A = [X]
a = X
s = X
r = 0
r0 = 0
l = 0
amari = 0

for i in range(N-1):
  if A.count(a ** 2 % M) >= 1:
    if a == 0:
      s = sum(A)
      break
    else:
      r0 = A.index(a)
      l = len(A[r0:])
      r = (N - i - 1) // l
      amari = (N - i - 1) % l
      s = s + sum(A[r0:])*r + sum(A[r0:r0+amari])
      break
  A.append(a**2 % M)
  s += A[-1]

print(s)

N, X, M = map(int, input().split())
A = [X]
A_dict = {X}
a = X
s = X
r = 0
r0 = 0
l = 0
amari = 0

for i in range(M+1):
  a = a ** 2 % M
  if a in A_dict:
    r0 = A.index(a)
    l = len(A[r0:])
    r = (N - i - 1) // l
    amari = (N - i - 1) % l
    s = s + sum(A[r0:])*r + sum(A[r0:r0+amari])
    break
  A.append(a)
  A_dict.add(a)
  s += A[-1]

print(s)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
n, x, m = map(int,input().split())
ans = x
num = 0
l = [0]*min(m,10**4)
lis = [-1]*min(m,10**4)
l[0] = x
lis[x] = num
for i in range(1,n):
    x = (x*x)%m
    num += 1
    if lis[x]!=-1:
        a = (n-i)//(i-lis[x])
        b = (n-i)%(i-lis[x])
        ans += a * sum(l[lis[x]:i])
        break
    l[i] = x
    lis[x] = i
    ans += x
for i in range(lis[x],lis[x]+b):
    ans += l[i]
print(ans)

n, x, m = map(int,input().split())
ans = x
num = 0
l = [0]*n
lis = [-1]*n
l[0] = x
lis[x] = num
for i in range(1,n):
    x = (x*x)%m
    num += 1
    if lis[x]!=-1:
        a = (n-i)//(i-lis[x])
        b = (n-i)%(i-lis[x])
        ans += a * sum(l[lis[x]:i])
        break
    l[i] = x
    lis[x] = i
    ans += x
for i in range(lis[x],lis[x]+b):
    ans += l[i]
print(ans)

n, x, m = map(int,input().split())
ans = x
num = 0
l = [0]*1000
lis = [-1]*1000
l[0] = x
lis[x] = num
for i in range(1,n):
    x = (x*x)%m
    num += 1
    if lis[x]!=-1:
        a = (n-i)//(i-lis[x])
        b = (n-i)%(i-lis[x])
        ans += a * sum(l[lis[x]:i])
        break
    l[i] = x
    lis[x] = i
    ans += x
for i in range(lis[x],lis[x]+b):
    ans += l[i]
print(ans)

n, x, m = map(int,input().split())
ans = x
num = 0
l = [0]*m
lis = [-1]*m
l[0] = x
lis[x] = num
for i in range(1,n):
    x = (x*x)%m
    num += 1
    if lis[x]!=-1:
        a = (n-i)//(i-lis[x])
        b = (n-i)%(i-lis[x])
        ans += a * sum(l[lis[x]:i])
        break
    l[i] = x
    lis[x] = i
    ans += x
for i in range(lis[x],lis[x]+b):
    ans += l[i]
print(ans)

n, x, m = map(int,input().split())
ans = x
num = 0
l = [0]*m
lis = [-1]*m
l[0] = x
lis[x] = num
for i in range(1,n):
    x = (x*x)%m
    num += 1
    if lis[x]!=-1:
        a = (n-i)//(i-lis[x])
        b = (n-i)%(i-lis[x])
        ans += a * sum(l[lis[x]:i])
        for j in range(lis[x],lis[x]+b):
            ans += l[j]
        break
    l[i] = x
    lis[x] = i
    ans += x
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
#import sys
#print(sys.maxsize)
N,X,M=map(int,input().split())
table=list(range(M))
for i in range(M):
    table[i]=((table[i]%M)**2)%M
print(table[471])
start=X%M
rireki=list()
rireki.append(start)
ss=0
for j in range(1,N):
    if table[start] in rireki:
        ss=rireki.index(table[start])
        break
    else:
        rireki.append(table[start])
        start=table[start]
nn=len(rireki)
rep=(N-ss)//(nn-ss)
nokori=N-ss-rep*(nn-ss)
loop=rireki[ss:]
#print(nn)
#print(rep)
#print(sum(loop))
#print(ss)

if 0 in rireki:
    goukei=sum(rireki)
else:
    goukei=rep*sum(loop)+sum(rireki[:ss])+sum(loop[:nokori])
print(goukei)

#import sys
#print(sys.maxsize)
N,X,M=map(int,input().split())
#table=list(range(M))

 #   table[i]=((table[i]%M)**2)%M
#print(table[471])
start=X%M
rset=set()
rireki=list()
rset.add(start)
rireki.append(start)
ss=0
for j in range(1,M+1):
    start=(start**2)%M
    if start in rset:
        ss=rireki.index(start)
        break
    else:
        rireki.append(start)
        rset.add(start)
nn=len(rireki)
rep=(N-ss)//(nn-ss)
nokori=N-ss-rep*(nn-ss)
loop=rireki[ss:]
#print(nn)
#print(rep)
#print(sum(loop))
#print(ss)

if 0 in rireki:
    goukei=sum(rireki)
else:
    goukei=rep*sum(loop)+sum(rireki[:ss])+sum(loop[:nokori])
print(goukei)

Verdicts: Runtime Error

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
import sys
readline=sys.stdin.readline

N,X,M = map(int,readline().split())
route = [X]
dic = {}
first = []
loop = []
for i in range(1, N):
  X = (X ** 2) % M
  if X in dic:
    first = route[:dic[X]]
    loop = route[dic[X]:]
    break
  route.append(X)
  dic[X] = i

if N == len(first):
  print(sum(first))
elif N < len(first):
  print(sum(first[:N]))
else:
  ans = sum(first)
  one_loop = sum(loop)
  N -= len(first)
  loop_cnt = N // len(loop)
  rest = N % len(loop)
  ans += loop_cnt * (sum(loop))
  ans += sum(loop[:rest])

  print(ans)


import sys
readline = sys.stdin.readline

N,X,M = map(int,readline().split())

nex = [(i ** 2) % M for i in range(M)]
cum = [i for i in range(M)]

ans = 0
while N:
  if N & 1:
    ans += cum[X]
    X = nex[X]
  cum = [cum[i] + cum[nex[i]] for i in range(M)]
  nex = [nex[nex[i]] for i in range(M)]
  N >>= 1

print(ans)

Verdicts: Runtime Error

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
N,X,M = map(int,input().split())
A = X%M
Ans = A
Modset = set()
Modset.add(A)
sig = 0
N -= 1
for i in range(10**7):
    A = pow(A,2,M)
    Ans += A
    if A ==0:
        break
    if A not in Modset:
        Modset.add(A)
        N -= 1
    else:
        Ans -= A
        sig = 1
        break
print(N,Ans)
if sig == 1:
    S = A
    B = A
    rep = 0
    for i in range(10**6):
        B = pow(B,2,M)
        rep += 1
        if A== B:
            break
        else:
            S += B
    Rep = N//rep
    Ans += Rep*S
    N -= Rep*rep
    if N != 0:
        Ans += A
        N -= 1
        for i in range(10**6):
            if N == 0:
                break
            Ans += pow(A,2,M)
print(Ans)

N,X,M = map(int,input().split())
A = X%M
Ans = A
Modset = set()
Modset.add(A)
i = 1
for _ in range(10**6):
    A = pow(A,2,M)
    if A not in Modset:
        Modset.add(A)
        Ans += A
        i += 1
    else:
        break
if 0 in Modset:
    print(Ans)
else:
    S = A
    B = A
    j = 1
    for _ in range(10**6):
        B = pow(B,2,M)
        if A != B:
            S += B
            j += 1
        else:
            break
    rep = (N-i)//j
    Ans += S*rep
    i += j*rep
    if i < N:
        i += 1
        Ans += A
        for _ in range(10**10):
            if i == N:
                break
            else:
                i += 1
                A = pow(A,2,M)
                Ans += A
    print(Ans)

Verdicts: Wrong Answer

Accepted
Problem: Let us denote by f(x, m) the remainder of the Euclidean division of x by m.  Let A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M). Find \displaystyle{\sum_{i=1}^N A_i}.

Submission attempts (in order):
N, X, M = map(int, input().split())

rec = []
s = set()
rec.append(X)
s.add(X)
r = X
idx == -1
idx1 = -1
for i in range(N+1):
    r = (r**2)%M
    if(r not in s):
        rec.append(r)
        s.add(r)
    else:
        rec.append(r)
        idx = i+1
        break
    
for i in range(len(rec)):
    if(rec[i] == rec[idx]):
        idx1 = i
        break

if(idx == -1 and idx1 == -1):
    print(sum(rec))
elif(idx1 != idx):       
    ans = sum(rec[:idx1])
    ans += sum(rec[idx1:idx])*((N-idx1)//(idx-idx1))+sum(rec[idx1:(idx1+(N-idx1)%(idx-idx1))])
    print(ans)
else:
    ans = sum(rec[:idx1])
    ans += rec[idx]*(N-idx1)
    print(ans)

N, X, M = map(int, input().split())

rec = []
s = set()
rec.append(X)
s.add(X)
r = X
idx = -1
idx1 = -1
for i in range(N+1):
    r = (r**2)%M
    if(r not in s):
        rec.append(r)
        s.add(r)
    else:
        rec.append(r)
        idx = i+1
        break
    
for i in range(len(rec)):
    if(rec[i] == rec[idx]):
        idx1 = i
        break

if(idx == -1 or idx1 == -1):
    print(sum(rec[:N]))
elif(idx1 != idx):       
    ans = sum(rec[:idx1])
    ans += sum(rec[idx1:idx])*((N-idx1)//(idx-idx1))+sum(rec[idx1:(idx1+(N-idx1)%(idx-idx1))])
    print(ans)
else:
    ans = sum(rec[:idx1])
    ans += rec[idx]*(N-idx1)
    print(ans)

Verdicts: Runtime Error

Accepted
Problem: There is a grid with N rows and N columns of squares. Let (i, j) be the square at the i-th row from the top and the j-th column from the left.  Each of the central (N-2) \times (N-2) squares in the grid has a black stone on it. Each of the 2N - 1 squares on the bottom side and the right side has a white stone on it.  Q queries are given. We ask you to process them in order. There are two kinds of queries. Their input format and description are as follows:    * `1 x`: Place a white stone on (1, x). After that, for each black stone between (1, x) and the first white stone you hit if you go down from (1, x), replace it with a white stone.   * `2 x`: Place a white stone on (x, 1). After that, for each black stone between (x, 1) and the first white stone you hit if you go right from (x, 1), replace it with a white stone.  How many black stones are there on the grid after processing all Q queries?

Submission attempts (in order):
n, q = map(int, input().split())
l = [0]*n; u = [0]*n; lmin = n-2; umin = n-2; lgoal = n; ugoal = n
for _ in range(q):
    s, t = map(int, input().split())
    if s == 1:
        if t > ugoal+1: u[t-1] = 0
        else:
            for i in range(t, ugoal-1):u[i] = umin
            lmin = t-2; ugoal = t
    else:
        if t > lgoal+1: l[t-1] = 0
        else:
            for i in range(t, lgoal-1):l[i] = lmin
            umin = t-2; lgoal = t
print(sum(l)+sum(u)+lmin*umin)

n, q = map(int, input().split())
l = [0]*n; u = [0]*n; lmin = n-2; umin = n-2; lgoal = n; ugoal = n
for _ in range(q):
    s, t = map(int, input().split())
    if s == 1:
        if t > ugoal: u[t-1] = 0
        else:
            for i in range(t, ugoal-1):u[i] = umin
            lmin = t-2; ugoal = t
    else:
        if t > lgoal: l[t-1] = 0
        else:
            for i in range(t, lgoal-1):l[i] = lmin
            umin = t-2; lgoal = t
print(sum(l)+sum(u)+lmin*umin)

Verdicts: Wrong Answer

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
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)

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

Verdicts: Runtime Error

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
x = 0

if x == 0:
    print("1")
if x == 1:
    print("0")

x = int(input())

if x == 0:
    print("1")
if x == 1:
    print("0")

Verdicts: Wrong Answer

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
print("O" if input()=="1" else "1")

import sys
print(int(sys.stdin.readline())^1)

Verdicts: Wrong Answer

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
#!/usr/bin/env python3
import sys


def solve(x: int):

    if x == 1:
        return print('0')

    elif x == 0:
        return print('1')1


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    x = int(next(tokens))  # type: int
    solve(x)

if __name__ == '__main__':
    main()


#!/usr/bin/env python3
import sys


def solve(x: int):

    if x == 1:
        return print('0')

    elif x == 0:
        return print('1')


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    x = int(next(tokens))  # type: int
    solve(x)

if __name__ == '__main__':
    main()


Verdicts: Runtime Error

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
def big(x):
  if x==0:
    return 1
  elif x==1:
    return 0

x=int(input())
if x==0:
  print 1
elif x==1:
  print 0

x=int(input())
if x==1:
  print(0)
elif x==0:
  print(1)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
print(1-input())

print(1-int(input()))

Verdicts: Runtime Error

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
print(int(not int(input()))

print(int(not int(input())))

Verdicts: Runtime Error

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
a,b,c,d=map(int,input().split())
print(max(a*c,a*d,b*c,b*d))

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

Verdicts: Runtime Error

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
x = int(x)
# OUTPUTS
# Print 1 if input is equal to 0
if x == 0:
    print(1)
    exit()

# Print 0 if input is equal to 1
if x == 1:
    print(0)
    exit()



VAR = input('Please enter an integer: ')
VAR = int(VAR)
# OUTPUTS
# Print 1 if input is equal to 0
if VAR == 0:
    print(1)
    exit()
#    sys.exit('1')

# Print 0 if input is equal to 1
if VAR == 1:
    print(0)
    exit()
#   sys.exit('0')


var = input('Please enter an integer: ')
var = int(var)
# OUTPUTS 
# Print 1 if input is equal to 0 
if var == 0:
	exit()
#    sys.exit('1') 
    
# Print 0 if input is equal to 1
if var == 1:
	exit()
#   sys.exit('0')


import sys


var = input("Please enter an integer: ")

# Error check 1: Is the input an integer?
try:
    val = int(var)
except ValueError:
    sys.exit('Input is not an integer') 

# Convert input to integer
var = int(var)

# Error check 2: Is the input within bounds?
if var > 1 or var < 0:
    sys.exit('Input is not within accepted bounds')

# OUTPUTS 
# Print 1 if input is equal to 0 
if var == 0:
    sys.exit('1') 
    
# Print 0 if input is equal to 1
if var == 1:
    sys.exit('0')


x = input()
x = int(x)
# OUTPUTS
# Print 1 if input is equal to 0
if x == 0:
    print(1)
    exit()

# Print 0 if input is equal to 1
if x == 1:
    print(0)
    exit()
 

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
n = input()
if n == 0:
  print(1)
elif n ==1:
  print(0)

n = int(input())
print(1^n)

Verdicts: Wrong Answer

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
if __name__ == "__main__":
    a = input()
    a = int(a)
    if a==0:
        print(0)
    if a==1:
        print(1)

if __name__ == "__main__":
    a = input()
    a = int(a)
    if a==0:
        print(1)
    if a==1:
        print(0)

Verdicts: Wrong Answer

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
if input(int()):
    print(0)
else:
    print(1)

if int(input()):
    print(0)
else:
    print(1)

Verdicts: Wrong Answer

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
x = int(input())
if x==1:
  print(0)
else if x==0:
  print(1)

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

Verdicts: Runtime Error

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
princt(int(input()) ^ 1)

print(int(input()) ^ 1)

Verdicts: Runtime Error

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
x = int(input())
print(1 if x == 0 else 1)

x = int(input())
if x == 0:
    print(1)
elif x == 1:
    print(0)

Verdicts: Wrong Answer

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
x = int(input())

print(1 if x == 1 else 0)

x = int(input())
 
print(1 if x == 0 else 1)

x = int(input())

if x == 1:
  print(0)
  
elif x == 0:
  print(1)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
print(~int(input()))

print(~input())

print(1^int(input()))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
x = int(input())
if x != 1:
    print(0)
else:
    print(1)

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

Verdicts: Wrong Answer

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
if x == 0:
 print(1)
else:
 print(0)


if x == 0:
 print(1)
else:
 print(0)


x=0

if x == 0:
 print(1)
else:
 print(0)

n=int(input())
if (n==1):
    print("0")
else:
    print("1")

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
a=input()
if a==1:
  print('0')
else:
  print('1')

a=input()
if a=='1':
  print('0')
else:
  print('1')

Verdicts: Wrong Answer

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
x = input()
print("1" if x == "0" else "1")

x = input()
print("1" if x == "0" else "0")

Verdicts: Wrong Answer

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
x=int(input())
if x=0:
    print(1)
else:
    print(0)

a,b,c,d=list(map(int,input().split()))
if a>=0 and c>=0:
    one=b
    two=d

elif a<0 and c<0:
    one=a
    two=c

elif a>=0 and c<0:
    one=a
    two=d
else:
    one=b
    two=c


print(one*two)

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
x = int(input())
if x == 0:
	print(x^1)

#include<bits/stdc++.h>
using namespace std;



int mod = 1000000007;

// #include "debug.cpp"

int dp[1000010][4];

int32_t main(){
	int n;
	cin >> n;

	if(n == 1){
		cout << "0\n";
		return 0;
	}

	dp[2][0] = 64;
	dp[2][1] = 17;
	dp[2][2] = 17;
	dp[2][3] = 2;

	for(int i=3; i<=n; i++){
		dp[i][0] = dp[i-1][0]*8;
		dp[i][1] = dp[i-1][0] + dp[i-1][1]*9;
		dp[i][2] = dp[i-1][0] + dp[i-1][2]*9;
		dp[i][3] = dp[i-1][1] + dp[i-1][2] + dp[i-1][3]*10;

		dp[i][0] %= mod;
		dp[i][1] %= mod;
		dp[i][2] %= mod;
		dp[i][3] %= mod;
	}

	cout << dp[n][3] << "\n";
}

x = int(input())
print(x^1)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
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(a*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*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*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:
    x=a*c
    y=b*d
    print(x,y)
    if x>=y:
        print(x)
    else:
        print(y)

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(a*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*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*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:
    x=a*c
    y=b*d
    #print(x,y)
    if x>=y:
        print(x)
    else:
        print(y)

x= int(input())

if x ==0:
    print(1)
else:
    print(0)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
x=int(input())
if(x==1):
  print("0")
 elif(x==0):
  
  print("1")
 else:
  pass

x=int(input())
if(x==1):
  print("0")
 elif(x==0):
  print("1")
 else:
  pass

x=int(input())
if(x==1):
  
  print("0")
elif(x==0):
  
  print("1")
else:
  
  pass


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1.

Submission attempts (in order):
print(not int(input()))

print(not(int(input())))

if input() == '0':
    print(1)
else:
    print(0)

Verdicts: Wrong Answer

Wrong Answer

Accepted