s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s355929432 | p03911 | u350997995 | 1566592495 | Python | Python (3.4.3) | py | Runtime Error | 589 | 37764 | 354 | N,M = map(int,input().split())
R = [[] for _ in range(N+M)]
for i in range(N):
L = list(map(lambda x:int(x)-1+N,input().split()))[1:]
R[i]+=L
for l in L:
R[l].append(i)
A = [0]*(N+M)
def f(v):
global R,A
A[v] = 1
for c in R[v]:
if c<N and A[c]==1: continue
f(c)
f(0)
print("YES" if sum(L[:N])==N else "NO") |
s981820060 | p03911 | u509368316 | 1565835769 | Python | Python (3.4.3) | py | Runtime Error | 399 | 25804 | 922 | N,M=map(int,input().split())
L=[list(map(int,input().split())) for i in range(N)]
import sys
sys.setrecursionlimit(10**5)
class UnionFind:
def __init__(self,N):
self.Parent=[-1]*N
def unite(self,m,n):
rm=self.root(m)
rn=self.root(n)
if rm==rn:
return False
else:
if self.size(rm)<self.size(rn):
rm,rn=rn,rm
self.Parent[rm]+=self.Parent[rn]
self.Parent[rn]=rm
return True
def root(self,n):
if self.Parent[n]<0:
return n
else:
self.Parent[n]=self.root(self.Parent[n])
return self.Parent[n]
def size(self,n):
return -self.Parent[self.root(n)]
u=UnionFind(M)
used=[0]*M
for x,*l in L:
used[l[0]-1]=1
for i in range(x-1):
used[l[i+1]-1]=1
u.unite(l[i]-1,l[i+1]-1)
print(['NO','YES'][u.size(L[0][1])==sum(used)]) |
s763220130 | p03911 | u509368316 | 1565835225 | Python | Python (3.4.3) | py | Runtime Error | 390 | 25828 | 887 | N,M=map(int,input().split())
L=[list(map(int,input().split())) for i in range(N)]
class UnionFind:
def __init__(self,N):
self.Parent=[-1]*N
def unite(self,m,n):
rm=self.root(m)
rn=self.root(n)
if rm==rn:
return False
else:
if self.size(rm)<self.size(rn):
rm,rn=rn,rm
self.Parent[rm]+=self.Parent[rn]
self.Parent[rn]=rm
return True
def root(self,n):
if self.Parent[n]<0:
return n
else:
self.Parent[n]=self.root(self.Parent[n])
return self.Parent[n]
def size(self,n):
return -self.Parent[self.root(n)]
u=UnionFind(M)
used=[0]*M
for _,*l in L:
used[l[0]-1]=1
for i in range(len(l)-1):
used[l[i+1]-1]=1
u.unite(l[i]-1,l[i+1]-1)
print(['NO','YES'][u.size(L[0][1])==sum(used)]) |
s919456798 | p03911 | u623819879 | 1561657182 | Python | Python (3.4.3) | py | Runtime Error | 638 | 37040 | 598 | n,m=map(int,input().split())
g=[[] for _ in range((n+m))]
for i in range(n):
a=[int(i)-1 for i in input().split()][1:]
for l in a:
g[i].append(n+l)
g[n+l].append(i)
par=[i for i in range(n+m)]
def root(x):
if x==par[x]:
return x
else:
par[x]=root(par[x])
return par[x]
def connect(x,y):
rx=root(x)
ry=root(y)
if rx==ry:
0
else:
par[rx]=ry
return
for i in range(n+m):
for nb in g[i]:
connect(i,nb)
p=par[0]
ans='YES'
for i in range(n):
if par[i]!=p:
ans='NO'
print(ans) |
s772527701 | p03911 | u623819879 | 1561657088 | Python | Python (3.4.3) | py | Runtime Error | 634 | 37012 | 596 | n,m=map(int,input().split())
g=[[] for _ in range((n+m))]
for i in range(n):
a=[int(i)-1 for i in input().split()][1:]
for l in a:
g[i].append(l)
g[n+l].append(i)
par=[i for i in range(n+m)]
def root(x):
if x==par[x]:
return x
else:
par[x]=root(par[x])
return par[x]
def connect(x,y):
rx=root(x)
ry=root(y)
if rx==ry:
0
else:
par[rx]=ry
return
for i in range(n+m):
for nb in g[i]:
connect(i,nb)
p=par[0]
ans='YES'
for i in range(n):
if par[i]!=p:
ans='NO'
print(ans) |
s913650455 | p03911 | u692632484 | 1546320752 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 2502 | #include<iostream>
#include <vector>
#include <list>
#include<stack>
#include<queue>
#include<array>
#include <set>
#include<map>
#include<string>
#include<stdlib.h>
#include<memory>
#include<algorithm>
#include <functional>
#include<math.h>
#include<fstream>
#include<iomanip>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7
class UnionFind {
public:
vector<int>rank, parent;
//������
UnionFind(int size) {
rank.resize(size, 0);
parent.resize(size, 0);
REP(i, size)parent[i] = i;
}
//�̍������߂�
int find(int x) {
if(parent[x] == x)return x;
else return parent[x] = find(parent[x]);
}
//x��y�̑�����W����
void unite(int x, int y) {
x = find(x);
y = find(y);
if(x == y)return;
if(rank[x] < rank[y])
parent[x] = y;
else {
parent[y] = x;
if(rank[x] == rank[y])rank[x]++;
}
}
//x��y�������W���ɑ����邩�ۂ�
bool same(int x, int y) {
return (find(x) == find(y));
}
//parent�̓��e���o��
void debug() {
for(auto num : parent) {
cout << num << " ";
}
cout << "more:" << endl;
REP(i, parent.size()) {
cout << find(i) << " ";
}
cout << endl << "more:" << endl;
for(auto num : parent) {
cout << num << " ";
}
cout << endl;
}
};
//�ϐ�
int N,M;
vector<vector<int>> L;
//�T�u��
//����
void input()
{
cin>>N>>M;
L.resize(N);
int k;
REP(i, N)
{
cin>>k;
L[i].resize(k);
REP(j,k)cin>>L[i][j];
}
}
//�v�Z
void calc()
{
UnionFind uf(N);
map<int,vector<int>> mp;
REP(i, N)
{
for(auto num : L[i])
{
mp[num].push_back(i);
}
}
for(auto itr = mp.begin(); itr != mp.end(); ++itr)
{
auto v = itr->second;
if(v.size() > 1)
{
REP(i, (int)(v.size() - 1))
{
uf.unite(v[i],v.back());
}
}
}
REP(i, N-1)
{
if(!uf.same(i, N - 1))
{
cout<<"NO"<<endl;
return;
}
}
cout << "YES"<<endl;
}
//�o��
void output()
{
}
//�f�o�b�O
void debug()
{
int N;
cin>>N;
}
//���C����
int main()
{
input();
calc();
output();
debug();
return 0;
}
|
s484369343 | p03911 | u690536347 | 1536247652 | Python | Python (3.4.3) | py | Runtime Error | 498 | 36880 | 527 | n,m=map(int,input().split())
f=lambda x:int(x)-1
langs=[[] for _ in range(m)]
speakers=[[] for _ in range(n)]
used_langs=[False]*m
used_speakers=[False]*n
for i in range(n):
*l,=map(f,input().split()[1:])
speakers[i].extend(l)
for j in l:
langs[j].append(i)
def dfs(n):
if used_speakers[n]:
return
used_speakers[n]=True
for i in speakers[n]:
if used_langs[i]:continue
used_langs[i]=True
for j in langs[i]:
dfs(j)
dfs(0)
if not False in used_speakers:
print("YES")
else:
print("NO") |
s594067364 | p03911 | u569349339 | 1480211177 | Python | Python (3.4.3) | py | Runtime Error | 675 | 45284 | 657 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
N, M = map(int, input().split())
L = [list(map(int, input().split()))[1:] for _ in range(N)]
g = [[] for _ in range(200005)]
for i, l in enumerate(L):
for ll in l:
g[i].append(ll+N)
g[N+ll].append(i)
used = [False] * 200005
def is_connected(v):
if used[v]:
return
used[v] = True
for next_v in g[v]:
is_connected(next_v)
is_connected(0)
if all(used[:N]):
print("YES")
else:
print("NO")
|
s767151348 | p03911 | u569349339 | 1480211073 | Python | Python (3.4.3) | py | Runtime Error | 592 | 44516 | 656 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
N, M = map(int, input().split())
L = [list(map(int, input().split()))[1:] for _ in range(N)]
g = [[] for _ in range(200005)]
for i, l in enumerate(L):
for ll in l:
g[i].append(ll+N)
g[N+ll].append(i)
used = [False] * 200005
def is_connected(v):
if used[v]:
return
used[v] = True
for next_v in g[v]:
is_connected(next_v)
is_connected(0, -1)
if all(used):
print("YES")
else:
print("NO")
|
s465494077 | p03911 | u569349339 | 1480211006 | Python | Python (3.4.3) | py | Runtime Error | 569 | 44548 | 655 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
N, M = map(int, input().split())
L = [list(map(int, input().split()))[1:] for _ in range(N)]
g = [[] for _ in range(N+M+1)]
for i, l in enumerate(L):
for ll in l:
g[i].append(ll+N)
g[N+ll].append(i)
used = [False] * 200005
def is_connected(v):
if used[v]:
return
used[v] = True
for next_v in g[v]:
is_connected(next_v)
is_connected(0, -1)
if all(used):
print("YES")
else:
print("NO")
|
s135204736 | p03911 | u569349339 | 1480210891 | Python | Python (3.4.3) | py | Runtime Error | 587 | 44548 | 657 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
N, M = map(int, input().split())
L = [list(map(int, input().split()))[1:] for _ in range(N)]
g = [[] for _ in range(N+M+1)]
for i, l in enumerate(L):
for ll in l:
g[i].append(ll+N)
g[N+ll].append(i)
used = [False] * (200005)
def is_connected(v):
if used[v]:
return
used[v] = True
for next_v in g[v]:
is_connected(next_v)
is_connected(0, -1)
if all(used):
print("YES")
else:
print("NO")
|
s690851700 | p03911 | u569349339 | 1480206349 | Python | Python (3.4.3) | py | Runtime Error | 424 | 16916 | 760 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
N, M = map(int, input().split())
L = [list(map(int, input().split()))[1:] for _ in range(N)]
g = [[] for _ in range(N+K)]
for i, l in enumerate(L):
for ll in l:
g[i].append(ll+N-1)
g[N+ll-1].append(i)
used = [False] * N
def is_connected(v, prev):
if 0 <= v < N and used[v]:
return
elif 0 <= v < N:
used[v] = True
for next_v in g[v]:
if next_v == prev:
continue
is_connected(next_v, v)
return
is_connected(0, -1)
if all(used):
print("YES")
else:
print("NO")
|
s509930864 | p03911 | u569349339 | 1480206185 | Python | Python (3.4.3) | py | Runtime Error | 660 | 43780 | 764 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
N, M = map(int, input().split())
L = [list(map(int, input().split()))[1:] for _ in range(N)]
g = [[] for _ in range(N+M+100)]
for i, l in enumerate(L):
for ll in l:
g[i].append(ll+N-1)
g[N+ll-1].append(i)
used = [False] * N
def is_connected(v, prev):
if 0 <= v < N and used[v]:
return
elif 0 <= v < N:
used[v] = True
for next_v in g[v]:
if next_v == prev:
continue
is_connected(next_v, v)
return
is_connected(0, -1)
if all(used):
print("YES")
else:
print("NO")
|
s532984883 | p03911 | u569349339 | 1480205926 | Python | Python (3.4.3) | py | Runtime Error | 668 | 43780 | 861 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
N, M = map(int, input().split())
# if N > 1000 and M > 1000:
# print("YES")
# sys.exit()
L = [list(map(int, input().split()))[1:] for _ in range(N)]
g = [[] for _ in range(N+M)]
for i, l in enumerate(L):
for ll in l:
g[i].append(ll+N-1)
g[N+ll-1].append(i)
# print(g)
used = [False] * N
def is_connected(v, prev):
if 0 <= v < N and used[v]:
return
elif 0 <= v < N:
# print(v, prev)
used[v] = True
for next_v in g[v]:
if next_v == prev:
continue
is_connected(next_v, v)
return
is_connected(0, -1)
if all(used):
print("YES")
else:
print("NO")
|
s143902208 | p03911 | u133038626 | 1480183245 | Python | Python (3.4.3) | py | Runtime Error | 718 | 30272 | 538 | # coding: utf-8
import collections
def dfs(i):
if visited[i] == 1:
return
visited[i] = 1
for j in speakers[i]:
for k in langs[j]:
dfs(k)
N, M = map(int, input().split())
langs = collections.defaultdict(list)
speakers = [[] for _ in range(N)]
for i in range(N):
ls = list(map(int, input().split()))
for j in range(1, ls[0] + 1):
langs[ls[j]-1].append(i)
speakers[i].append(ls[j]-1)
visited = [0] * N
dfs(0)
if 0 not in visited:
print("YES")
else:
print("NO")
|
s133665905 | p03912 | u489959379 | 1601509374 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8920 | 1137 | import sys
from collections import defaultdict(int)
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, m = map(int, input().split())
X = list(map(int, input().split()))
MOD = [defaultdict(int) for _ in range(m + 1)]
cnt = defaultdict(int)
for x in X:
MOD[x % m][x] += 1
cnt[x % m] += 1
res = cnt[0] // 2
if m % 2 == 0:
res += cnt[m // 2] // 2
for i in range(1, (m + 1) // 2):
res += min(cnt[i], cnt[m - i])
if cnt[i] > cnt[m - i]:
diff = (cnt[i] - cnt[m - i]) // 2
for v in MOD[i].values():
if diff == 0:
break
t = min(diff, v // 2)
diff -= t
res += t
elif cnt[i] < cnt[m - i]:
diff = (cnt[m - i] - cnt[i]) // 2
for v in MOD[m - i].values():
if diff == 0:
break
t = min(diff, v // 2)
diff -= t
res += t
print(res)
if __name__ == '__main__':
resolve()
|
s387572454 | p03912 | u707124227 | 1595614462 | Python | Python (3.8.2) | py | Runtime Error | 83 | 37568 | 770 | def main():
n,m=map(int,input().split())
x=list(map(int,input().split()))
xmod=[y%m for y in x]
from collections import Counter
cx=dict(Counter(x))
cxmod=dict(Counter(xmod))
ans1,ans2=0,0 # ams1:m倍になるペア、ans2:同数のペア。ans1からもとめる
for k in cxmod.keys():
if k==0:
ans1+=cxmod[k]//2
cxmod[k]-=2*(cxmod[k]//2)
else:
if k==m-k:
ans1+=cxmod[k]//2
cxmod[k]-=2*(cxmod[k]//2)
elif m-k in keys:
tmp=min(cxmod[k],cxmod[m-k])
ans1+=tmp
cxmod[k]-=tmp
cxmod[m-k]-=tmp
for k in cx:
v=cx[k]
if v>=2 and cxmod[k%m]>=2:
tmp=min(v//2,cxmod[k%m]//2)
ans2+=tmp
cxmod[k%m]-=tmp*2
print(ans1+ans2)
if __name__=='__main__':
main()
|
s840434811 | p03912 | u190405389 | 1595300407 | Python | PyPy3 (7.3.0) | py | Runtime Error | 115 | 92724 | 818 | import sys
sys.setrecursionlimit(10**7)
readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))
n,m = readints()
x = readints()
modx = [i%m for i in x]
a = [0]*10**5
b = [0]*m
for i in range(n):
a[x[i]]+=1
b[modx[i]]+=1
ans = b[0]//2
b[0] = 0
y = m//2
if m%2==0:
ans += b[m//2]//2
b[m//2] = 0
else:
y += 1
for i in range(1,y):
c = min(b[i],b[m-i])
b[i]-=c
b[m-i]-=c
ans += c
for i in range(n):
if b[i%m]>1 and a[i]>1:
c = min(b[i%m],a[i])//2
ans += c
b[i%m]-=c*2
print(ans)
|
s944420505 | p03912 | u145600939 | 1588565331 | Python | Python (3.4.3) | py | Runtime Error | 213 | 27248 | 822 | n,m = map(int,input().split())
X = list(map(int,input().split()))
mod = [[0,0] for _ in range(n)]
d = {}
for x in X:
if x not in d.keys():d[x] = 0
d[x] += 1
for k,v in d.items():
mod[k%m][0] += v//2
mod[k%m][1] += v%2
ans = 0
for i in range(m//2+1):
if i == 0 or i == m-i:
ans += mod[i][1]//2 + mod[i][0]
else:
if mod[i][1] < mod[m-i][1]:
ans += min(mod[m-i][1], mod[i][0]*2 + mod[i][1])
ans += mod[m-i][0]
ans += max(0,(mod[i][0]*2 + mod[i][1] - mod[m-i][1]))//2
elif mod[i][1] == mod[m-i][1]:
ans += mod[i][0] + mod[m-i][0] + mod[i][1]
else:
ans += min(mod[i][1], mod[m-i][0]*2 + mod[m-i][1])
ans += mod[i][0]
ans += max(0,(mod[m-i][0]*2 + mod[m-i][1] - mod[i][1]))//2
print(ans)
|
s170818638 | p03912 | u814986259 | 1582084933 | Python | Python (3.4.3) | py | Runtime Error | 1107 | 61456 | 962 | import collections
N, M = map(int, input().split())
X = list(map(int, input().split()))
table = collections.defaultdict(list)
for x in X:
table[x % M].append(x)
Count = [None]*N
for i in range(M):
table[i].sort(key=lambda x: table[x].count(x), reverse=True)
Count[i] = collections.Counter(table[i]).values()
ans = 0
for i in range(M // 2 + 1):
tmp = min(len(table[i]), len(table[(M-i) % M]))
if i != (M-i) % M:
ans += tmp
else:
ans += tmp // 2
k = 0
l = 0
for x in Count[i]:
k += x % 2
l += x // 2
if tmp <= k:
ans += l
else:
ans += ((k + l*2) - tmp) // 2
if i != (M-i) % M:
k = 0
l = 0
for x in Count[(M-i) % M]:
k += x % 2
l += x // 2
if tmp <= k:
ans += l
else:
ans += ((k + l*2) - tmp) // 2
# print(table[i])
# print(table[(M-i) % M])
# print(ans)
print(ans)
|
s319213127 | p03912 | u814986259 | 1582084610 | Python | Python (3.4.3) | py | Runtime Error | 1118 | 61456 | 827 | import collections
N, M = map(int, input().split())
X = list(map(int, input().split()))
table = collections.defaultdict(list)
for x in X:
table[x % M].append(x)
Count = [None]*N
for i in range(M):
table[i].sort(key=lambda x: table[x].count(x), reverse=True)
Count[i] = collections.Counter(table[i]).values()
ans = 0
for i in range(M // 2):
tmp = min(len(table[i]), len(table[(M-i) % M]))
ans += tmp
k = 0
l = 0
for x in Count[i]:
k += x % 2
l += x // 2
if tmp <= k:
ans += l
else:
ans += ((k + l*2) - tmp) // 2
if i != (M-i) % M:
k = 0
l = 0
for x in Count[(M-i) % M]:
k += x % 2
l += x // 2
if tmp <= k:
ans += l
else:
ans += ((k + l*2) - tmp) // 2
print(ans)
|
s345287265 | p03912 | u325227960 | 1579288583 | Python | PyPy3 (2.4.0) | py | Runtime Error | 237 | 54416 | 558 | import sys
input = sys.stdin.readline
n, m = map(int,input().split())
Y = list(map(int,input().split()))
l = max(Y) + 1
X = [0] * l
for i in range(n):
X[Y[i]] += 1
# print(X)
U = [[0] * m for i in range(2)]
for i in range(l):
a = X[i] // 2
U[0][i % m] += a
A = [0] * m
for i in range(l):
A[i % m] += X[i]
# print(A)
for i in range(1, m//2 + 1):
a = min(A[i], A[m-i-1])
U[1][i] += a
U[1][m-i-1] += a
U[1][i] = A[0]
# print(U)
ans = 0
for i in range(m):
ans += min((A[i]-U[1][i]) // 2, U[0][i]) * 2 + U[1][i]
print(ans) |
s311553900 | p03912 | u878326845 | 1577774825 | Python | Python (3.4.3) | py | Runtime Error | 201 | 14220 | 660 | from collections import Counter
n,m = map(int, input().split())
a = list(map(int, input().split()))
c = [0]*100001
b = [a[i]%m for i in range(n)]
rem = [0]*m
for i in range(n):
rem[b[i]] += 1
c[a[i]] += 1
ans = 0
for i in range(m//2+1):
if i == 0 or i*2 == m:
ans += rem[i]//2
rem[i] -= rem[i]//2*2
continue
less = min(rem[i],rem[m-i])
ans += less
rem[i] -= less
rem[m-i] -= less
for j in range(n//m+1):
for i in range(m):
if rem[i] >= c[m*j+i]:
ans += c[m*j+i]//2
rem[i] -= c[m*j+i]//2
else:
ans += rem[i]//2
rem[i] -= rem[i]//2
print(ans) |
s380051565 | p03912 | u201234972 | 1561065084 | Python | PyPy3 (2.4.0) | py | Runtime Error | 322 | 119660 | 863 | #import sys
#input = sys.stdin.readline
from collections import defaultdict, deque
def main():
N, M = map( int, input().split())
X = list( map( int, input().split()))
Y = [deque() for _ in range(M)]
modM = [0]*M
for i in range(N):
Y[X[i]%M].append(X[i])
modM[X[i]%M] += 1
ans = 0
if M >= 2:
ans += modM[0]//2
for i in range(1,(M+1)//2):
x, y = i, M-i
if modM[x] > modM[y]:
x, y = y, x
mx, my = modM[x], modM[y]
ans += mx
before = -1
for z in Y[y]:
if mx+2 > my:
break
if before == z:
ans += 1
my -= 2
before = -1
else:
before = z
if M%2 == 0:
ans += modM[M//2+1]//2
print(ans)
if __name__ == '__main__':
main()
|
s642402484 | p03912 | u201234972 | 1561065072 | Python | Python (3.4.3) | py | Runtime Error | 172 | 71652 | 863 | #import sys
#input = sys.stdin.readline
from collections import defaultdict, deque
def main():
N, M = map( int, input().split())
X = list( map( int, input().split()))
Y = [deque() for _ in range(M)]
modM = [0]*M
for i in range(N):
Y[X[i]%M].append(X[i])
modM[X[i]%M] += 1
ans = 0
if M >= 2:
ans += modM[0]//2
for i in range(1,(M+1)//2):
x, y = i, M-i
if modM[x] > modM[y]:
x, y = y, x
mx, my = modM[x], modM[y]
ans += mx
before = -1
for z in Y[y]:
if mx+2 > my:
break
if before == z:
ans += 1
my -= 2
before = -1
else:
before = z
if M%2 == 0:
ans += modM[M//2+1]//2
print(ans)
if __name__ == '__main__':
main()
|
s647563023 | p03912 | u506127000 | 1480188874 | Python | PyPy3 (2.4.0) | py | Runtime Error | 290 | 54380 | 749 | MAX_X = 10 ** 5
def main():
N, M = [int(i) for i in input().split()]
X = [0] * (MAX_X + 1)
for i in map(int, input().split()):
X[i] += 1
Y = [sum(X[i::M]) for i in range(min(M, N, MAX_X))]
# Mの倍数
ans = Y[0] // 2
Y[0] = 0
# M%2==0のM/2
if M % 2 == 0:
ans += Y[M//2] // 2
Y[M//2] = 0
for i in range(1, M//2+1):
j = M - i
tmp = min(Y[i], Y[j])
ans += tmp
Y[i] -= tmp
Y[j] -= tmp
for i, n in enumerate(X):
j = i % M
if Y[j] < 2 or n < 2:
continue
tmp = min(Y[j]-Y[j]%2, n-n%2)
ans += tmp // 2
Y[j] -= tmp
print(ans)
if __name__ == "__main__":
main()
|
s395261314 | p03913 | u488401358 | 1593841026 | Python | PyPy3 (7.3.0) | py | Runtime Error | 94 | 74748 | 245 | N,A=map(int,input().split())
ans=N
for n in range(1,41):
for i in range(2*n,N**(1/n)+100):
test=i+n*A
q=i//n
r=i%n
prod=pow(q,n-r)*pow(q+1,r)
test+=(N-1)//prod+1
ans=min(ans,test)
print(ans)
|
s807364060 | p03913 | u878326845 | 1591241575 | Python | PyPy3 (2.4.0) | py | Runtime Error | 179 | 38512 | 704 | n,a = map(int,input().split())
if n == 1:
print(1)
exit()
l = -1
r = 10**12+1
#n <= x**(k-i)*(x-1)**iのk-iを返す
def border(x,k):
if k >= 40:
return (n-1).bit_length()
else:
L = 0
R = k
while L+1 < R:
M = (L+R)//2
if x**(k-M)*(x-1)**(M) < n:
R = M
else:
L = M
return k-L
def sec(k):
if k >= 40:
x = 2
else:
y = int(n**(1/k))+1
if (y-1)**k < n <= y**k:
x = y
elif y**k < n <= (y+1)**k:
x = y+1
elif (y-2)**k < n <= (y-1)**k:
x = y-1
b = border(x,k)
return (x+a)*k-(k-b)
while l+2 < r:
ml = (l*2+r)//3
mr = (l+r*2)//3
if sec(ml) < sec(mr):
r = mr
else:
l = ml
print(sec(l+1)-a) |
s453416756 | p03913 | u686900515 | 1590066613 | Python | PyPy3 (2.4.0) | py | Runtime Error | 174 | 38736 | 748 | import sys
readline = sys.stdin.readline
def check(x):
if x - 50*A >= 100:
return N+1
right = x//A
left = 1
while abs(right - left) > 2:
med1 = (left*2+right)//3
med2 = (left+right*2)//3
if calc(med1, x-(med1-1)*A) < calc(med2, x-(med2-1)*A):
left = med1
else:
right = med2
res = 0
for l in range(left, right+1):
cl = calc(l, x-(l-1)*A)
if res < cl:
res = cl
return res
def calc(k, c):
return pow(c//k+1, c%k)*pow(c//k, k-c%k)
N, A = map(int, readline().split())
ok = N
ng = 0
while abs(ok-ng)>1:
med = (ok+ng)//2
if check(med) >= N:
ok = med
else:
ng = med
print(ok)
|
s988560145 | p03913 | u296290704 | 1528864613 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 446 | # seishin.py
N, A = map(int, input().split())
ans = N
for k in range(1, 41):
left = 0; right = N+1
while left+1 < right:
mid = (left + right) // 2
if mid**(k+1) < N:
left = mid
else:
right = mid
m = right
v = (m-1)**(k+1)
for i in range(k+1):
v //= m-1
v *= m
if N <= v:
ans = min(ans, A*k + (m-1)*(k+1) + (i+1))
break
print(ans) |
s640011246 | p03913 | u506127000 | 1480290511 | Python | PyPy3 (2.4.0) | py | Runtime Error | 209 | 38384 | 367 | import sys
from math import ceil
N, A = [int(i) for i in input().split()]
if N > 10 ** 6 or A > 10 ** 6:
print(-1)
sys.exit()
dp = [float("inf")] * (N+1)
dp[1] = 0
for i in range(1, N//2+1):
for n, j in enumerate(range(i+i, N+1, i), start=2):
dp[j] = min(dp[j], dp[i]+n+A)
ans = min(dp[i]+ceil(N/i) for i in range(1, N//2+1), default=N)
print(ans) |
s211710571 | p03913 | u506127000 | 1480194178 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1965 | 142196 | 354 | import sys
from math import ceil
N, A = [int(i) for i in input().split()]
if N > 10 ** 6 or A > 10 ** 6:
raise
dp = [float("inf")] * (N+1)
dp[1] = 0
ans = float("inf")
for i in range(1, N//2+1):
for n, j in enumerate(range(i+i, N+1, i), start=2):
dp[j] = min(dp[j], dp[i]+n+A)
ans = min(dp[i]+ceil(N/i) for i in range(1, N+1))
print(ans)
|
s533524414 | p03913 | u506127000 | 1480191799 | Python | PyPy3 (2.4.0) | py | Runtime Error | 215 | 38640 | 365 | import sys
from math import ceil
if N > 10 ** 6 or A > 10 ** 6:
print(-1)
sys.exit()
N, A = [int(i) for i in input().split()]
dp = [float("inf")] * N
dp[1] = 0
for i in range(1, N//2+1):
for n, j in enumerate(range(i+i, N//2+1, i), start=2):
dp[j] = min(dp[j], dp[i]+n+A)
ans = min(dp[i]+ceil(N/i) for i in range(1, N//2+1))
print(ans)
|
s344460356 | p03913 | u296290704 | 1480189572 | Python | PyPy2 (5.6.0) | py | Runtime Error | 373 | 23020 | 431 | # encoding: utf-8
n, a = map(int, raw_input().split())
if n>10**7 or a >= 10**7:
exit(1)
memo = [-1]*(n+1)
# 残りx個を貯めるために最小の時間を返す予定
def dfs(x):
if x == 0:
return 0
if memo[x] != -1:
return memo[x]
i = 0
res = x
for i in xrange(2, x+1):
# i-sec待つ
res = min(res, dfs((x+i-1)/i)+a+i)
memo[x] = res
return memo[x]
print dfs(n)
|
s595017081 | p03913 | u478870821 | 1480188605 | Python | Python (3.4.3) | py | Runtime Error | 619 | 43108 | 554 | from sys import exit, setrecursionlimit
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect
def read():
return int(input())
def reads():
return [int(x) for x in input().split()]
(N, A) = reads()
assert(N <= 10**6 and A <= 10**6)
c = [0] * (N+3)
for i in range(A+1):
c[i] = i
if c[i] >= N:
print(i)
# print(c[:i+1])
exit()
for i in range(A+1, N+2):
c[i] = max(i, max(c[j]*(i-j-A) for j in range(i-A)))
if c[i] >= N:
print(i)
# print(c[:i+1])
exit()
|
s603109063 | p03913 | u478870821 | 1480188383 | Python | Python (3.4.3) | py | Runtime Error | 592 | 43104 | 580 | from sys import exit, setrecursionlimit
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect
def read():
return int(input())
def reads():
return [int(x) for x in input().split()]
setrecursionlimit(1000000)
(N, A) = reads()
assert(N <= 10**6 and A <= 10**6)
c = [0]*(N+3)
for i in range(A+1):
c[i] = i
if c[i] >= N:
print(i)
# print(c[:i+1])
exit()
for i in range(A+1, N+3):
c[i] = max(i, max(c[j]*(i-j-A) for j in range(i-A)))
if c[i] >= N:
print(i)
# print(c[:i+1])
exit()
|
s087227460 | p03919 | u468972478 | 1598108296 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9124 | 196 | h, w = map(int, input().split())
a = [input().split() for i in range(h)]
for i in range(h):
for j in range(w):
if a[i][w] == "snuke":
print(chr(ord("A") + j) + str(i + 1))
exit() |
s973692069 | p03919 | u468972478 | 1598108214 | Python | Python (3.8.2) | py | Runtime Error | 20 | 8988 | 193 | h, w = map(int, input().split())
a = [input().split() for i in range(h)]
for i in range(h):
for j in range(w):
a[i][j] == "snuke":
print(chr(ord("A") + j) + str(i + 1))
exit() |
s633834091 | p03919 | u468972478 | 1598108161 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8948 | 193 | h, w = map(int, input().split())
a = [input().split() for i in range(h)]
for i in range(h):
for j in range(w):
a[i][w] == "snuke":
print(chr(ord("A") + j) + str(i + 1))
exit() |
s868159665 | p03919 | u088488125 | 1593614286 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9080 | 211 | h,w=map(int, input().split())
s=[list(input().split()) for i in range(h)]
alp="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in range(h):
for j in range(w):
if s[i][j]=="snuke":
print(alp[j+1]+(i+1))
break |
s392522825 | p03919 | u163320134 | 1587622330 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 229 | h,w=map(int,input().split())
board=[list(map(int,input().split())) for _ in range(h)]
pos="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in range(h):
for j in range(w):
if board[i][j]=="snuke":
print(pos[j]+str(i+1))
exit() |
s213402630 | p03919 | u373047809 | 1586970086 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 110 | _, w, *s = open(0).read().split()
a, b = divmod(s.index("snuke"), int(w))
print("ABCDEFGHIJJ"[b], a+1, sep="") |
s670837696 | p03919 | u702786238 | 1584978995 | Python | PyPy3 (2.4.0) | py | Runtime Error | 165 | 38256 | 271 | H, W = map(int, input().split())
for i in range(H):
s = input().split()
if W != 1:
if len(set(s)) == 2:
row = i+1
col = 65+s.index('snuke')
break
else:
if s == ["snuke"]:
row = i+1
col = 65
print("{}{}".format(chr(col), row))
|
s189602841 | p03919 | u702786238 | 1584978837 | Python | PyPy3 (2.4.0) | py | Runtime Error | 187 | 38256 | 187 | H, W = map(int, input().split())
for i in range(H):
s = input().split()
if len(set(s)) == 2:
row = i+1
col = 65+s.index('snuke')
break
print("{}{}".format(chr(col), row)) |
s588187247 | p03919 | u298297089 | 1581459321 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 167 | h,w = map(int , input().split())
alf = 'ABCDEFGHIJKLMN'
for i in range(h):
for j,s in enumerate(input().split()):
if s == 'snuke':
print(alf[j] + str(i+1)) |
s595688796 | p03919 | u995062424 | 1578884702 | Python | Python (3.4.3) | py | Runtime Error | 25 | 3768 | 347 | from string import *
h,w=map(int,input().split())
s =[None] * h
for i in range(h):
s[i] = [None] * w
for j in range(w):
s[i][j] = input()
for i in range(h):
for j in range(w):
if(s[i][j]=='snuke'):
idx1=ascii_lowercase[i].swapcase()
idx2=str(j+1)
print(idx1+idx2)
break |
s188281925 | p03919 | u181215519 | 1576786496 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 269 | H, W = map( int, input().split() )
s = [ [ map( str, input().split() ) ] for i in range(H) ]
for i in range(H) :
for j in range(W) :
if s[i][j] == "snuke" :
w = chr( i + ord( "A" ) )
h = i + 1
exit()
print( w + str( h ) ) |
s898757034 | p03919 | u181215519 | 1576786440 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 269 | H, W = map( int, input().split() )
s = [ [ map( str, input().split() ) ] for i in range(H) ]
for i in range(H) :
for j in range(W) :
if "snuke" in s[i][j] :
w = chr( i + ord( "A" ) )
h = i + 1
exit()
print( w + str( h ) ) |
s377856995 | p03919 | u181215519 | 1576785447 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 259 | H, W = map( int, input().split() )
abc = [ chr(i) for i in range( 65, 65+26 ) ]
for i in range(H) :
s = list( map( str, input().split() ) )
if "snuke" in s :
w = abc[ s.index[ "snuke" ] ]
h = i + 1
break
print( w + str( h ) ) |
s381381638 | p03919 | u181215519 | 1576785324 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 297 | H, W = map( int, input().split() )
abc = [ chr(i) for i in range( 65, 65+26 ) ]
for i in range(H) :
s = list( map( str, input().split() ) )
for j in range(W) :
if "snuke" in s :
w = abc[ s.index[ "snuke" ] ]
h = i + 1
exit()
print( w + str( h ) ) |
s606426437 | p03919 | u181215519 | 1576785250 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 296 | H, W = map( int, input().split() )
abc = [ chr(i) for i in range( 65, 65+26 ) ]
for i in range(H) :
s = list( map( str, input().split() ) )
for j in range(W) :
if "snuke" in s :
w = abc[ s.index[ "snuke" ] ]
h = i + 1
break
print( w + str( h ) ) |
s908126362 | p03919 | u102960641 | 1574783869 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3056 | 241 | h,w = map(int, input().split())
s = [list(map(int, input().split())) for i in range(h)]
for key_i,i in enumerate(s):
key_i += 1
for key_j,j in enumerate(i):
if j == "snuke":
print(chr(ord("A")+key_j)+str(key_i))
exit()
|
s078349426 | p03919 | u303039933 | 1569164071 | Python | PyPy3 (2.4.0) | py | Runtime Error | 181 | 38512 | 410 | from sys import stdin
def readString() :
return stdin.readline().rstrip()
def solve() :
H,W = [int(x) for x in stdin.readline().rstrip().split()]
table = [stdin.readline().rstrip().split() for _ in range(H)]
l = [x for x in "ABCDEFGHIJK"]
for h in range(0,H) :
for w in range(0,W) :
if(table[h][w] == "snuke"):
print(l[w] + "" + str(h + 1))
solve(); |
s885869788 | p03919 | u259334183 | 1566688123 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 193 | h,w=map(int,input().split())
b=['A','B','C','D','E','F','G','H']
for k in range(h):
a=list(input().split())
for l in range(w):
if a[l]=='snuke':
print(b[l]+str(k+1)) |
s988363523 | p03919 | u977193988 | 1561681452 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3188 | 311 | import sys
h,w=map(int,input().split())
A=['A','B','C','D','E','F','G','H','I','J']
s=[]
for i in range(h):
s.append(list(map(str,input().split())))
for i in range(h):
for j in range(w):
if s[i][j]=='snuke':
a=A[j]
b=str(i+1)
print(a+b)
sys.exit() |
s500444308 | p03919 | u497046426 | 1561613394 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 220 | from itertools import product
H, W = map(int, input().split())
table = [input().split() for _ in range(H)]
for i, j in product(range(H), range(W)):
if table[i][j] == 'snuke': print('ABCDEFGHIJ'[j] + str(i+1)); break |
s936823793 | p03919 | u371409687 | 1561148143 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 181 | h,w=map(int,input().split())
s=[input().split() for _ in range(w)]
for i in range(w):
for j in range(h):
if s[i][j]=="snuke":
print(chr(ord("A")+j)+str(i+1)) |
s757872717 | p03919 | u371409687 | 1561148036 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 181 | h,w=map(int,input().split())
s=[input().split() for _ in range(w)]
for i in range(w):
for j in range(h):
if s[i][j]=="snuke":
print(chr(ord("A")+j)+str(i+1)) |
s505647863 | p03919 | u507116804 | 1557023942 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 6 | あ」 |
s869071348 | p03919 | u331464808 | 1556567190 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 145 | h,w = map(int,input(),split())
for i in range(h):
a = input().split()
if "snuke" in a:
ans = chr(ord('A') + j)+str(i)
print(ans) |
s202029301 | p03919 | u331464808 | 1556567120 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 179 | h,w = map(int,input(),split())
for i in range(h):
a = input().split()
for j in range(w):
if a[j] == "snuke":
ans = chr(ord('A') + j)+str(i)
print(ans) |
s482880472 | p03919 | u331464808 | 1556567044 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 186 | h,w = map(int,input(),split())
for i in range(h):
a = input().split()
for j in range(w):
if a[j] == "snuke":
print(chr(ord('A') + j)+str(i))
break |
s828289262 | p03919 | u619819312 | 1556023786 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 377 | import sys
sys.setrecursionlimit(10**6)
n,m=map(int,input().split())
a=[[]for i in range(n+m)]
for i in range(n):
s=list(map(int,input().split()))
for j in s[1:]:
a[i].append(j)
a[n+j-1].append(i)
t=[False]*n
def g(x):
t[x]=True
for i in a[x]:
if not t[x]:
g(j)
g(0)
if all(t):
print("YES")
else:
print("NO")
|
s882642945 | p03919 | u280512618 | 1553957181 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 157 | h,w=map(int, input().split())
for i in range(h):
t=input().split().index('snuke')
if t<0:
continue
print('%s%d' % (chr(t+ord('A')), i+1))
quit(0) |
s612474683 | p03919 | u280512618 | 1553957084 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 156 | h,w=map(int, input().split())
for i in range(h):
t=input().split().find('snuke')
if t<0:
continue
print('%s%d' % (chr(t+ord('A')), i+1))
quit(0) |
s012446781 | p03919 | u859897687 | 1553862023 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 142 | h,w=map(int,input().split())
for i in range(h):
a=input()
if 'snuke' in a:
b=a.find('snuke')
break
print(chr(ord('A')+b)+str(a+1)) |
s336754693 | p03919 | u379692329 | 1553318397 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 277 | from itertools import product
H, W = map(int, input().split())
L = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
S = [[str(_) for _ in input().split()] for _ in range(W)]
for i, j in product(range(H), range(W)):
if S[i][j] == "snuke":
break
res = L[i] + str(j+1)
print(res) |
s764592316 | p03919 | u782654209 | 1553086534 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 214 | H,W=map(int,input().split(' '))
S=[input().split(' ') for i in range(H)]
row=i+1 if 'snuke' in S[i] else continue for i in range(H)
col='ABCDEFGHIJKLMNOPQRSTUVWXYZ'[S[row-1].index('snuke')]
print(str(col)+str(row)) |
s491023419 | p03919 | u782654209 | 1553086490 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 200 | H,W=map(int,input().split(' '))
S=[input().split(' ') for i in range(H)]
row=i+1 if 'snuke' in S[i] for i in range(H)
col='ABCDEFGHIJKLMNOPQRSTUVWXYZ'[S[row-1].index('snuke')]
print(str(col)+str(row)) |
s194677217 | p03919 | u118642796 | 1552622561 | Python | PyPy3 (2.4.0) | py | Runtime Error | 165 | 38256 | 194 | H,W = map(int,input().split())
S = [[i for i in input().split()] for_ in range(H)]
for h in range(H):
for w in range(W):
if S[h][w] == "snuke":
break
print(chr(ord(A)-1+w) + str(h)) |
s401302882 | p03919 | u887207211 | 1552444666 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 223 | H, W = map(int,input().split())
S = [input().split() for _ in range(H)]
w = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"]
for i in range(H):
for j in range(W):
if(S[i][j] == "snuke"):
print(w[j]+str(i+1)) |
s039207905 | p03919 | u543954314 | 1552227574 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 245 | h, w = map(int, input().split())
s = [input().split() for _ in range(h)]
al = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in range(h):
for j in range(w):
if s[i][j] = "snuke":
print("{}{}".format(al[i], j+1))
exit()
else:
pass |
s217452227 | p03919 | u785578220 | 1551243004 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 214 | N, M = map(int, input().split())
k = []
for i in range(N):
t = list(map(str, input().split()))
for j in range(W):
if t[j] == "snuke":p = [i,j]
abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
print(abc[p[1]]+str(p[0]+1)) |
s978274078 | p03919 | u785578220 | 1551242957 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 215 | N, M = map(int, input().split())
k = []
for i in range(N):
t = list(map(int, input().split()))
for j in range(W):
if t[j] == "snuke":p = [i,j]
abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
print(abc[p[1]]+str(p[0]))
|
s151507750 | p03919 | u367130284 | 1551172509 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 119 | h,w,*a=open(0).read().split();b=a.index("snuke");print([chr(i)for i in range(65,65+int(h))][b%int(w)]+str(b//int(w)+1)) |
s566584108 | p03919 | u375616706 | 1548990458 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 279 | def sigma(N):
return N*(N-1)//2
def find_max(N):
for i in range(N+1):
if sigma(i) > N:
return i
def solve(N):
Y = find_max(N)
rem = sigma(Y)-N
for i in range(1, Y):
if i != rem:
print(i)
N = int(input())
solve(N)
|
s055279006 | p03919 | u620084012 | 1527097962 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3060 | 225 | H, W = map(int, input().split())
S = [input().split() for k in range(H)]
A = "ABCDEFGHIJ"
for k in range(H):
for l in range(W):
if S[k][l]=="snuke":
print("".join([A[l],str(k+1)]))
exit(0) |
s986907285 | p03919 | u766407523 | 1525404515 | Python | Python (3.4.3) | py | Runtime Error | 30 | 3900 | 271 | import string
def inpl(): return list(map(int, input().split()))
H, W = inpl()
a = []
for i in range(H):
a.append(inpl())
for i in range(H):
for j in range(W):
if a[i][j] == 'snuke':
print(string.ascii_lowercase[j]+str(i+1))
break |
s408535853 | p03919 | u978494963 | 1523228966 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 287 | import sys
h,w = map(int, input().split(" "))
xnames = [chr(x) for x in range(ord("A"),ord("A")+w+1)]
ynames = [x for x in range(1,h+1)]
for y in range(h):
for x in range(w):
s = input()
if s == "snuke":
print(xnames[x]+ynames[y])
sys.exit(0) |
s556209568 | p03919 | u978494963 | 1523228940 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 286 | import sys
h,w = map(int, input().split(" "))
xnames = [chr(x) for x in range(ord("A"),ord("A")+w+1)]
ynames = [x for x in range(1,h+1)]
for y in range(h):
for x in range(w):
s = input()
if s == "snuke":
print(xnames[x]+ynames[y])
sys.exit() |
s753418242 | p03919 | u030726788 | 1521574154 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 183 | h,w=map(int,input().split())
alh="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in h:
s=list(input().split())
if("snuke" in s):
ind=s.index("snuke")
print(alh[ind]+str(i+1))
break |
s119191501 | p03919 | u651925006 | 1514923588 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 141 | h,w=map(int,input())
for i in range(h):
s=list(input().split())
for j in range(w):
if s[j]=='snuke':
print(chr(65+j)+str(i+1))
|
s699231882 | p03919 | u651925006 | 1514923491 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 141 | h,w=map(int,input())
for i in range(h):
s=list(input().split())
for j in range(w):
if s[j]=='snuke':
print(chr(97+j)+str(i+1))
|
s034442272 | p03919 | u651925006 | 1514923456 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 141 | n,m=map(int,input())
for i in range(h):
s=list(input().split())
for j in range(w):
if s[j]=='snuke':
print(chr(97+j)+str(i+1))
|
s689964271 | p03919 | u692050063 | 1491279320 | Python | Python (2.7.6) | py | Runtime Error | 13 | 2692 | 165 | [H, W] = raw_input().split(' ')
for i in range(H):
for index, string in enumerate(raw_input.split(' ')):
if string == 'snuke':
print i, index |
s130298496 | p03919 | u123756661 | 1480189981 | Python | PyPy2 (5.6.0) | py | Runtime Error | 73 | 11376 | 301 | l=[]
for i in range(1,5001):
if i%2==0:
l.append((1+i)*(i/2))
else:
l.append((1+i)*(i/2)+(i+1)/2)
n=int(raw_input())
if n in l:
for i in range(1,l.index(n)+2):
print i
chk=bisect.bisect_right(l,n)
tmp=l[chk]
for i in range(1,chk+2):
if i!=tmp-n:
print i |
s554943246 | p03919 | u174620969 | 1480185691 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 292 | import sys
#f = open('input.txt')
# f = input()
N = int(f)
out = []
sum = 0
for i in range(0, N+1):
sum = sum + i
out.append(i)
if sum > N:
r = sum - N
out.remove(r)
break
out.remove(0)
for n in out:
print(n)
# print(' '.join(map(str, out))) |
s163863541 | p03919 | u174620969 | 1480185118 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 273 | import sys
#f = open('input.txt')
f = input()
N = int(f)
out = []
sum = 0
for i in range(1, N):
sum = sum + i
out.append(i)
if sum > N:
r = sum - N
out.remove(r)
break
for n in out:
print(n)
# print(' '.join(map(str, out))) |
s867180935 | p03919 | u174620969 | 1480184919 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 291 | #!/bin/python3
import sys
# f = open('input.txt')
f = input()
N = int(f)
out = []
sum = 0
for i in range(1, N):
sum = sum + i
out.append(i)
if sum > N:
r = sum - N
out.remove(r)
break
for n in out:
print(n)
# print(' '.join(map(str, out))) |
s408546263 | p03919 | u237168895 | 1480183781 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 223 | a_,b_ = map(int, (raw_input().strip().split(" ")))
foo = []
for i,a in enumerate(range(a_)):
foo = raw_input().strip().split(" ")
for j in range(b_):
if foo[j] == 'snuke':
print('A'+ str(i + 1)) |
s039419346 | p03919 | u237168895 | 1480183568 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 231 | a_,b_ = map(int, (raw_input().strip().split(" ")))
foo = []
for i,a in enumerate(range(a_)):
foo = raw_input().strip().split(" ")
for j in range(b_):
if foo[j] == 'snuke':
print(chr(65 + j) + str(i + 1)) |
s257972213 | p03919 | u237168895 | 1480182228 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3064 | 237 | a_,b_ = map(int, (raw_input().strip().split(" ")))
foo = []
for i,a in enumerate(range(a_)):
foo = raw_input().strip().split(" ")
for j in range(b_):
if foo[j] == 'snuke':
print(chr(65 + j) + str(i + 1))
|
s471793761 | p03919 | u471797506 | 1480181884 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2572 | 265 | alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
H, W = map(int, raw_input().split())
S = [raw_input().split() for i in xrange(H)]
for h in xrange(H):
for w in xrange(W):
if S[h][w] == "snuke":
print alpha[w] + str(h + 1)
exit()
torii@xps45:~/roiti46/procon/Contest/2 |
s449829203 | p03920 | u668785999 | 1587083448 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3572 | 163 | N = int(input())
vec = []
k = 0
sum = 0
while(k**2 + k < 2*N):
k += 1
sum += k
vec.append(k)
vec.remove(sum - N)
for i in range(len(vec)):
print(vec[i]) |
s978072819 | p03920 | u404290207 | 1585195198 | Python | PyPy3 (2.4.0) | py | Runtime Error | 293 | 67412 | 1438 | import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]
#本当に貪欲法か? DP法では??
#本当に貪欲法か? DP法では??
#本当に貪欲法か? DP法では??
#https://atcoder.jp/contests/cf16-final-open/tasks/codefestival_2016_final_b
n=ii()
if n==1:
print(1)
exit()
ans=0
i=0
while ans<n:
i+=1
ans+=i
if ans>n:
p=ans-n
for k in range(1,i+1):
if k!=p:
print(k) |
s834075229 | p03920 | u303039933 | 1583983496 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38384 | 2671 | cv# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
class Scanner():
@staticmethod
def int():
return int(sys.stdin.readline().rstrip())
@staticmethod
def string():
return sys.stdin.readline().rstrip()
@staticmethod
def map_int():
return [int(x) for x in Scanner.string().split()]
@staticmethod
def string_list(n):
return [input() for i in range(n)]
@staticmethod
def int_list_list(n):
return [Scanner.map_int() for i in range(n)]
@staticmethod
def int_cols_list(n):
return [int(input()) for i in range(n)]
class Math():
@staticmethod
def gcd(a, b):
if b == 0:
return a
return Math.gcd(b, a % b)
@staticmethod
def lcm(a, b):
return (a * b) // Math.gcd(a, b)
@staticmethod
def divisor(n):
res = []
i = 1
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
res.append(i)
if i != n // i:
res.append(n // i)
return res
@staticmethod
def round_up(a, b):
return -(-a // b)
@staticmethod
def is_prime(n):
if n < 2:
return False
if n == 2:
return True
if n % 2 == 0:
return False
d = int(n ** 0.5) + 1
for i in range(3, d + 1, 2):
if n % i == 0:
return False
return True
class PriorityQueue:
def __init__(self, l=[]):
self.q = l
heapq.heapify(self.q)
return
def push(self, n):
heapq.heappush(self.q, n)
return
def pop(self):
return heapq.heappop(self.q)
MOD = int(1e09) + 7
INF = int(1e15)
def factorization(n):
S = {}
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //= i
S[i] = cnt
if temp != 1:
S[temp] = 1
if S == []:
S[n] = 1
return S
def main():
# sys.stdin = open("sample.txt")
N = Scanner.int()
ok = N + 1
ng = 0
while abs(ok - ng) > 1:
m = (ok + ng) // 2
if m * (m + 1) // 2 >= N:
ok = m
else:
ng = m
for i in reversed(range(1, ok + 1)):
if N >= i:
print(i)
N -= i
if __name__ == "__main__":
main()
|
s616952688 | p03920 | u227082700 | 1563309222 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 64 | n=int(input());print(int(round(int(input()))*2)+1if n!=1else"1") |
s312552574 | p03920 | u543954314 | 1553545386 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 150 | n = int(input())
k = int((n*2)**.5)
while k*(k+1)//2 < n:
k += 1
l = [range(1,k+1)]
if k*(k+1)//2-n:
l.remove(k*(k+1)//2-n)
for i in l:
print(l) |
s728202191 | p03920 | u375616706 | 1548990469 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 279 | def sigma(N):
return N*(N-1)//2
def find_max(N):
for i in range(N+1):
if sigma(i) > N:
return i
def solve(N):
Y = find_max(N)
rem = sigma(Y)-N
for i in range(1, Y):
if i != rem:
print(i)
N = int(input())
solve(N)
|
s763589559 | p03920 | u375616706 | 1548990324 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3408 | 279 | def sigma(N):
return N*(N-1)//2
def find_max(N):
for i in range(N):
if sigma(i) > N:
return i
def solve(N):
Y = find_max(N)
rem = sigma(Y)-N
for i in range(1, Y+1):
if i != rem:
print(i)
N = int(input())
solve(N)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.