problem_id
int64
0
1.52k
problem_name
stringlengths
5
112
description
stringlengths
209
6.47k
lang
stringclasses
4 values
code
stringlengths
7
95.5k
status
stringclasses
3 values
passed
int64
0
24
total
int64
0
25
error
stringclasses
567 values
failures
stringlengths
2
2k
source
stringclasses
5 values
difficulty
stringclasses
13 values
442
399_C. Cards
User ainta loves to play with cards. He has a cards containing letter "o" and b cards containing letter "x". He arranges the cards in a row, and calculates the score of the deck by the formula below. 1. At first, the score is 0. 2. For each block of contiguous "o"s with length x the score increases by x2. 3. F...
cpp
#include <bits/stdc++.h> const long long int INFA = 1000000000; const long long int INF = INFA * 10000000; long long int somafeia(long long int a, long long int b, long long int ka, long long int kb) { long long int piso = (long long int)floor(b / kb); long long int res = 0; res += (a - ka ...
partial
13
25
[{"idx": 4, "reason": "wrong_answer", "expected": "6323396597\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "got": " 202...
codeforces
C
442
399_C. Cards
User ainta loves to play with cards. He has a cards containing letter "o" and b cards containing letter "x". He arranges the cards in a row, and calculates the score of the deck by the formula below. 1. At first, the score is 0. 2. For each block of contiguous "o"s with length x the score increases by x2. 3. F...
python3
a, b = map(int, input().split()) sx = lambda p: (a - p + 1) ** 2 + p - 1 sy = lambda q: (b % q) * (1 + b // q) ** 2 + (b // q) ** 2 * (q - b % q) n = min(a, b) if a == 0: print( -b ** 2) print( b * "x" ) elif b <= 1: print( a ** 2 - b ** 2 ) print ( a * "o" + b * "x" ) else: res = - (a + b) ** 2 ...
partial
24
25
[{"idx": 23, "reason": "wrong_answer", "expected": "3\nxoo", "got": "3\noox"}]
codeforces
C
442
399_C. Cards
User ainta loves to play with cards. He has a cards containing letter "o" and b cards containing letter "x". He arranges the cards in a row, and calculates the score of the deck by the formula below. 1. At first, the score is 0. 2. For each block of contiguous "o"s with length x the score increases by x2. 3. F...
cpp
#include <bits/stdc++.h> using namespace std; int main() { long long a, b; while (~scanf("%I64d%I64d", &a, &b)) { long long s = 0; if (!a) { s = -b * b; printf("%I64d\n", s); while (b--) printf("x"); printf("\n"); } else if (!b) { s = a * a; printf("%I64d\n", s); ...
partial
13
25
[{"idx": 4, "reason": "wrong_answer", "expected": "6323396597\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "got": " 202...
codeforces
C
442
399_C. Cards
User ainta loves to play with cards. He has a cards containing letter "o" and b cards containing letter "x". He arranges the cards in a row, and calculates the score of the deck by the formula below. 1. At first, the score is 0. 2. For each block of contiguous "o"s with length x the score increases by x2. 3. F...
java
import java.io.PrintWriter; import java.util.ArrayList; import java.util.Scanner; public class C { static Scanner sc = new Scanner(System.in); static PrintWriter out = new PrintWriter(System.out); static void exit() { sc.close(); out.close(); System.exit(0); } public static void ma...
partial
24
25
[{"idx": 23, "reason": "wrong_answer", "expected": "3\nxoo", "got": "3\noox"}]
codeforces
C
442
399_C. Cards
User ainta loves to play with cards. He has a cards containing letter "o" and b cards containing letter "x". He arranges the cards in a row, and calculates the score of the deck by the formula below. 1. At first, the score is 0. 2. For each block of contiguous "o"s with length x the score increases by x2. 3. F...
java
//package codeforces; import java.io.PrintWriter; import java.util.Scanner; /* * Codeforces Round #233 (Div. 2), Problem C */ public class Cards { private static StringBuilder sb = new StringBuilder(); public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWr...
partial
6
25
[{"idx": 1, "reason": "wrong_answer", "expected": "-1\nxxoox", "got": "-1\nxooxx"}, {"idx": 3, "reason": "wrong_answer", "expected": "-40635107\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
codeforces
C
442
399_C. Cards
User ainta loves to play with cards. He has a cards containing letter "o" and b cards containing letter "x". He arranges the cards in a row, and calculates the score of the deck by the formula below. 1. At first, the score is 0. 2. For each block of contiguous "o"s with length x the score increases by x2. 3. F...
java
import java.io.PrintWriter; import java.util.ArrayList; import java.util.Scanner; public class C { static Scanner sc = new Scanner(System.in); static PrintWriter out = new PrintWriter(System.out); static void exit() { sc.close(); out.close(); System.exit(0); } public static void ma...
partial
24
25
[{"idx": 23, "reason": "wrong_answer", "expected": "3\nxoo", "got": "3\noox"}]
codeforces
C
442
399_C. Cards
User ainta loves to play with cards. He has a cards containing letter "o" and b cards containing letter "x". He arranges the cards in a row, and calculates the score of the deck by the formula below. 1. At first, the score is 0. 2. For each block of contiguous "o"s with length x the score increases by x2. 3. F...
python2
import math import sys a,b = map(int,raw_input().split()) parto = 1 if a else 0 partx = 1 if b else 0 maxScore = a**2-b**2 if(b==0): print a**2 print 'o'*a exit() for i in range(0,a): # i stand for the number of extra 'o' to divide 'x' ii = i+2 sumO = (a-i)**2 + i l1c = b%ii #l1 count l1l...
partial
7
25
[{"idx": 1, "reason": "wrong_answer", "expected": "-1\nxxoox", "got": "-1\nxooxx"}, {"idx": 3, "reason": "wrong_answer", "expected": "-40635107\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
codeforces
C
442
399_C. Cards
User ainta loves to play with cards. He has a cards containing letter "o" and b cards containing letter "x". He arranges the cards in a row, and calculates the score of the deck by the formula below. 1. At first, the score is 0. 2. For each block of contiguous "o"s with length x the score increases by x2. 3. F...
python3
import math,string,itertools,fractions,heapq,collections,re,array,bisect from itertools import chain, dropwhile, permutations, combinations from collections import defaultdict def main2(a,b): if a==0: print(-b**2) print("x"*b) return if b==0: print(a**2) print("o"*a) ...
partial
24
25
[{"idx": 23, "reason": "wrong_answer", "expected": "3\nxoo", "got": "3\noox"}]
codeforces
C
442
399_C. Cards
User ainta loves to play with cards. He has a cards containing letter "o" and b cards containing letter "x". He arranges the cards in a row, and calculates the score of the deck by the formula below. 1. At first, the score is 0. 2. For each block of contiguous "o"s with length x the score increases by x2. 3. F...
python2
a,b = map(int, raw_input().split()) if b==0: print a**2 print "o"*a exit(0) if a==0: print -b**2 print "x"*b exit(0) X = [0]*(a+1) for i in range(1, a+1): X[i] = (i-1) + (a-i+1)**2 Y = [0]*(b+1) for i in range(1, b+1): Y[i] = (b%i)*(b/i+1)**2 + (i-b%i)*(b/i)**2 ans = -b*b for i in range(...
partial
7
25
[{"idx": 1, "reason": "wrong_answer", "expected": "-1\nxxoox", "got": "-1\nxooxx"}, {"idx": 3, "reason": "wrong_answer", "expected": "-40635107\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
codeforces
C
442
399_C. Cards
User ainta loves to play with cards. He has a cards containing letter "o" and b cards containing letter "x". He arranges the cards in a row, and calculates the score of the deck by the formula below. 1. At first, the score is 0. 2. For each block of contiguous "o"s with length x the score increases by x2. 3. F...
python3
def main(): a, b = map(int, input().split(' ')) answer = -b ** 2 a_cluster = a if a: for i in range(a): answer_candicate = (a - i) ** 2 + i quotient = b // (i + 2) remainder = b % (i + 2) answer_candicate -= ((i + 2) - remainder) * quotient ** 2...
partial
6
25
[{"idx": 1, "reason": "wrong_answer", "expected": "-1\nxxoox", "got": "-1\nxooxx"}, {"idx": 3, "reason": "wrong_answer", "expected": "-40635107\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
codeforces
C
447
633_A. Ebony and Ivory
Dante is engaged in a fight with "The Savior". Before he can fight it with his sword, he needs to break its shields. He has two guns, Ebony and Ivory, each of them is able to perform any non-negative number of shots. For every bullet that hits the shield, Ebony deals a units of damage while Ivory deals b units of dama...
java
import java.util.*; import java.io.*; import java.math.*; public final class Solution { public static void main(String[] args) { Reader input = new Reader(); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); int a = input.nextInt(), b = input.nextInt(), total = in...
all_fail
0
25
[{"idx": 0, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 2, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 3, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 4, "reason": "wrong_answer", "e...
codeforces
A
447
633_A. Ebony and Ivory
Dante is engaged in a fight with "The Savior". Before he can fight it with his sword, he needs to break its shields. He has two guns, Ebony and Ivory, each of them is able to perform any non-negative number of shots. For every bullet that hits the shield, Ebony deals a units of damage while Ivory deals b units of dama...
python3
a, b, c = map(int, input().split()) h = 0 if c % a == 0: k = c // a else: k = c // a + 1 if c % b == 0: m = c // b else: m = c // b + 1 if c - a*k < 0 and c - b*m < 0 and ((c < 2 * a) and c < 2*b): print('No') else: for i in range(k+1): if (c - a*i) % b == 0 and (h == 0): pri...
all_fail
0
25
[{"idx": 0, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 2, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 3, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 4, "reason": "wrong_answer", "e...
codeforces
A
447
633_A. Ebony and Ivory
Dante is engaged in a fight with "The Savior". Before he can fight it with his sword, he needs to break its shields. He has two guns, Ebony and Ivory, each of them is able to perform any non-negative number of shots. For every bullet that hits the shield, Ebony deals a units of damage while Ivory deals b units of dama...
python2
#!/usr/bin/env python #-*- coding:utf-8 -*- import sys, math, random, operator from string import ascii_lowercase from string import ascii_uppercase from fractions import Fraction, gcd from decimal import Decimal, getcontext from itertools import product, permutations, combinations from Queue import Queue, PriorityQue...
all_fail
0
25
[{"idx": 0, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 2, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 3, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 4, "reason": "wrong_answer", "e...
codeforces
A
447
633_A. Ebony and Ivory
Dante is engaged in a fight with "The Savior". Before he can fight it with his sword, he needs to break its shields. He has two guns, Ebony and Ivory, each of them is able to perform any non-negative number of shots. For every bullet that hits the shield, Ebony deals a units of damage while Ivory deals b units of dama...
cpp
#include <bits/stdc++.h> using namespace std; int a, b, c; int main() { int a, b, c, i, j, k; cin >> a >> b >> c; for (i = 0; i <= c / a; i++) if ((c - i * a) % b == 0) { cout << "Yes"; return 0; } cout << "No"; }
all_fail
0
25
[{"idx": 0, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 2, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 3, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 4, "reason": "wrong_answer", "e...
codeforces
A
447
633_A. Ebony and Ivory
Dante is engaged in a fight with "The Savior". Before he can fight it with his sword, he needs to break its shields. He has two guns, Ebony and Ivory, each of them is able to perform any non-negative number of shots. For every bullet that hits the shield, Ebony deals a units of damage while Ivory deals b units of dama...
java
import java.util.Scanner; public class Guns { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int a = scan.nextInt(), b = scan.nextInt(), c = scan.nextInt(); int xx = c / a, yy = c / b; for(int x = 0; x <= xx; x++) { for(int y = 0; y <= yy; y+...
all_fail
0
25
[{"idx": 0, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 2, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 3, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 4, "reason": "wrong_answer", "e...
codeforces
A
447
633_A. Ebony and Ivory
Dante is engaged in a fight with "The Savior". Before he can fight it with his sword, he needs to break its shields. He has two guns, Ebony and Ivory, each of them is able to perform any non-negative number of shots. For every bullet that hits the shield, Ebony deals a units of damage while Ivory deals b units of dama...
python2
""" CODEFORCES 633-A Ebony and Ivory by: Ariel Roque """ a,b,c = map(int,raw_input().split()) x = 0 found = False while(True): y = (c - (a*x)) / b if((a*x + b*y > c) or y < 0): break if(((c - (a*x)) % b == 0) and (a*x + b*y == c )): print("YES") found = True break x+=1 if(foun...
partial
17
25
[{"idx": 2, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 3, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 8, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 10, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 17, "reason": "wrong_answer", "exp...
codeforces
A
447
633_A. Ebony and Ivory
Dante is engaged in a fight with "The Savior". Before he can fight it with his sword, he needs to break its shields. He has two guns, Ebony and Ivory, each of them is able to perform any non-negative number of shots. For every bullet that hits the shield, Ebony deals a units of damage while Ivory deals b units of dama...
cpp
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; for (int i = 0; i <= (c / b); i++) { int tmp = c - (i * b); if (tmp % a == 0) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; return 0; }
all_fail
0
25
[{"idx": 0, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 2, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 3, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 4, "reason": "wrong_answer", "e...
codeforces
A
447
633_A. Ebony and Ivory
Dante is engaged in a fight with "The Savior". Before he can fight it with his sword, he needs to break its shields. He has two guns, Ebony and Ivory, each of them is able to perform any non-negative number of shots. For every bullet that hits the shield, Ebony deals a units of damage while Ivory deals b units of dama...
python2
a, b, c = map(int, raw_input().split()) mmax = max(a, b) mmin = min(a, b) ans = 'No' if c % mmin == 0: ans = 'Yes' else: while c >= mmax: c -= mmax if c % mmin == 0: break if c % mmin == 0: ans = 'Yes' print ans
all_fail
0
25
[{"idx": 0, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 2, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 3, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 4, "reason": "wrong_answer", "e...
codeforces
A
447
633_A. Ebony and Ivory
Dante is engaged in a fight with "The Savior". Before he can fight it with his sword, he needs to break its shields. He has two guns, Ebony and Ivory, each of them is able to perform any non-negative number of shots. For every bullet that hits the shield, Ebony deals a units of damage while Ivory deals b units of dama...
python3
n,m,o=map(int,input().split()) for i in range(o//n+1): if (o - i*n) % m == 0: print("Yes") break else: print("No")
all_fail
0
25
[{"idx": 0, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 2, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 3, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 4, "reason": "wrong_answer", "e...
codeforces
A
449
774_D. Lie or Truth
Vasya has a sequence of cubes and exactly one integer is written on each cube. Vasya exhibited all his cubes in a row. So the sequence of numbers written on the cubes in the order from the left to the right equals to a1, a2, ..., an. While Vasya was walking, his little brother Stepan played with Vasya's cubes and chan...
java
var inp = readline(); var n = inp.split(' ')[0]; var l = inp.split(' ')[1]; var r = inp.split(' ')[2]; var flag = true; var a1 = readline().split(' '); var a2 = readline().split(' '); for (var i = 1; i <= n; ++i) { if (i < l || i > r) { if (a1[i - 1] ...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_4myjzkfq/Main.java:1: error: class, interface, enum, or record expected var inp = readline(); ^ /tmp/sbx_4myjzkfq/Main.java:2: error: class, interface, enum, or record expected var n = inp.split(' ')[0]; ^ /tmp/sbx_4myjzkfq/Main.java:3: error: class, interface, enum, or record expected ...
[]
codeforces
D
450
799_D. Field expansion
In one of the games Arkady is fond of the game process happens on a rectangular field. In the game process Arkady can buy extensions for his field, each extension enlarges one of the field sizes in a particular number of times. Formally, there are n extensions, the i-th of them multiplies the width or the length (by Ar...
java
import java.io.*; import java.math.*; import java.security.KeyStore.Entry; import java.util.*; public class CODEFORCES { private InputStream is; private PrintWriter out; public static class Pair implements Comparable<Pair> { long u; long v; public Pair(long u, long v) { this.u = u; this.v = v; } ...
all_fail
0
25
[{"idx": 0, "reason": "wrong_answer", "expected": "-1", "got": "-1\n[4ms]"}, {"idx": 1, "reason": "wrong_answer", "expected": "0", "got": "0\n[6ms]"}, {"idx": 2, "reason": "wrong_answer", "expected": "1", "got": "1\n[2ms]"}, {"idx": 3, "reason": "wrong_answer", "expected": "3", "got": "3\n[8ms]"}, {"idx": 4, "reason": ...
codeforces
D
451
819_D. Mister B and Astronomers
After studying the beacons Mister B decided to visit alien's planet, because he learned that they live in a system of flickering star Moon. Moreover, Mister B learned that the star shines once in exactly T seconds. The problem is that the star is yet to be discovered by scientists. There are n astronomers numerated fr...
cpp
#include <bits/stdc++.h> using namespace std; const int size = 200 * 1000 + 100; int ans[size]; int a[size]; int mycur[size]; int t, n; int d; int shift[size]; int ord[size]; int nod(int a, int b) { if (b == 0) return a; else return nod(b, a % b); } int pwr(int a, int b, int mdl) { if (b == 0) return 1 % ...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_g3e6w43v/tmpdbg4ah11.cpp:4:9: error: reference to ‘size’ is ambiguous 4 | int ans[size]; | ^~~~ In file included from /usr/include/c++/11/string:54, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_base.h:41, ...
[]
codeforces
D
451
819_D. Mister B and Astronomers
After studying the beacons Mister B decided to visit alien's planet, because he learned that they live in a system of flickering star Moon. Moreover, Mister B learned that the star shines once in exactly T seconds. The problem is that the star is yet to be discovered by scientists. There are n astronomers numerated fr...
java
//package round421; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; public class D { InputStream is; PrintWriter out; String INPUT = ""; void sol...
all_fail
0
25
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.util.InputMismatchException\n\tat D.readByte(D.java:109)\n\tat D.ni(D.java:164)\n\tat D.solve(D.java:18)\n\tat D.run(D.java:97)\n\tat D.main(D.java:102)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "st...
codeforces
D
452
845_B. Luba And The Ticket
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky. The ticket is considered lucky if the sum of first three digits equals to the sum of las...
java
import java.util.*; public class b { public static void main(String[] args) { Scanner in = new Scanner(System.in); String str = in.next(); int[] arr = new int[6]; for (int i = 0; i < 6; i++) { arr[i] = str.charAt(i) - '0'; } int min = 6; for (int ...
all_fail
0
25
[{"idx": 0, "reason": "timeout"}, {"idx": 1, "reason": "runtime_error", "rc": -24, "stderr": "", "stdout_tail": ""}, {"idx": 2, "reason": "timeout"}, {"idx": 3, "reason": "runtime_error", "rc": -24, "stderr": "", "stdout_tail": ""}, {"idx": 4, "reason": "runtime_error", "rc": -24, "stderr": "", "stdout_tail": ""}]
codeforces
B
453
865_D. Buy Low Sell High
You can perfectly predict the price of a certain stock for the next N days. You would like to profit on this knowledge, but only want to transact one share of stock per day. That is, each day you will either buy one share, sell one share, or do nothing. Initially you own zero shares, and you cannot sell shares when you...
java
/* * Author Ayub Subhaniya * Institute DA-IICT */ import java.io.*; import java.util.*; public class Codeforces429A { InputStream in; PrintWriter out; void solve() { int n=ni(); int a[]=na(n); long ans=0; PriorityQueue<Integer> pq=new PriorityQueue<>(); for (int i:a) { pq.add(i);pq.add(i); ...
all_fail
0
7
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.io.FileNotFoundException: C:/Users/ayubs/Desktop/input.txt (No such file or directory)\n\tat java.base/java.io.FileInputStream.open0(Native Method)\n\tat java.base/java.io.", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_er...
codeforces
D
455
913_G. Power Substring
You are given n positive integers a1, a2, ..., an. For every ai you need to find a positive integer ki such that the decimal notation of 2ki contains the decimal notation of ai as a substring among its last min(100, length(2ki)) digits. Here length(m) is the length of the decimal notation of m. Note that you don't ha...
python2
#yuhao du (*_*) from random import * n=input() #n=2000 bit=[1] for j in xrange(30): bit.append(4*10**j) val=[pow(2,w,10**30) for w in bit] for i in xrange(n): a=input() # a=randint(10**10,10**11-1) r=(a*(10**12)+5*10**11)%(2**30) r=a*(10**12)+5*10**11-r while r%5==0: r+=2**30 c=10000 ret=pow(2,c,10**30) for j...
all_fail
0
11
[{"idx": 0, "reason": "wrong_answer", "expected": "3\n1", "got": "41320977205205645241257294174\n9373777321285284172088426977"}, {"idx": 1, "reason": "wrong_answer", "expected": "5\n20", "got": "137213329732040813765209346044\n44856488441288125289324094440"}, {"idx": 2, "reason": "wrong_answer", "expected": "99999\n378...
codeforces
G
455
913_G. Power Substring
You are given n positive integers a1, a2, ..., an. For every ai you need to find a positive integer ki such that the decimal notation of 2ki contains the decimal notation of ai as a substring among its last min(100, length(2ki)) digits. Here length(m) is the length of the decimal notation of m. Note that you don't ha...
cpp
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } void exgcd(long long a, long long b, long long& d, long long& x, long long& y) { if (!b) { d = a, x = 1, y = 0; } else { exgcd(b, a % b, d, y, x); y -= (a / b) * x; } } long long add...
all_fail
0
11
[{"idx": 0, "reason": "wrong_answer", "expected": "3\n1", "got": "37507\n25007"}, {"idx": 1, "reason": "wrong_answer", "expected": "5\n20", "got": "12506\n805554"}, {"idx": 2, "reason": "wrong_answer", "expected": "99999\n3787651\n2509597\n3516786\n96025\n6352070\n126398\n921114\n85899\n182804\n1075899\n4859997\n625027...
codeforces
G
455
913_G. Power Substring
You are given n positive integers a1, a2, ..., an. For every ai you need to find a positive integer ki such that the decimal notation of 2ki contains the decimal notation of ai as a substring among its last min(100, length(2ki)) digits. Here length(m) is the length of the decimal notation of m. Note that you don't ha...
python3
import sys #sys.stdout = open('output.txt', 'w') #sys.stdin = open('input.txt', 'r') #for line in sys.stdin: #while 1: # line = sys.stdin.readline() # if line: # print (line,end="") def phi(p,i): if i == 0: return 1 return p**i - p**(i-1) def pwr(x,p,mod): if p == 0: return 1 ...
all_fail
0
11
[{"idx": 0, "reason": "wrong_answer", "expected": "3\n1", "got": "37507\n25007"}, {"idx": 1, "reason": "wrong_answer", "expected": "5\n20", "got": "12506\n805554"}, {"idx": 2, "reason": "wrong_answer", "expected": "99999\n3787651\n2509597\n3516786\n96025\n6352070\n126398\n921114\n85899\n182804\n1075899\n4859997\n625027...
codeforces
G
455
913_G. Power Substring
You are given n positive integers a1, a2, ..., an. For every ai you need to find a positive integer ki such that the decimal notation of 2ki contains the decimal notation of ai as a substring among its last min(100, length(2ki)) digits. Here length(m) is the length of the decimal notation of m. Note that you don't ha...
python3
import sys import random N = 20 ntest = int(sys.stdin.readline()) for _ in range(ntest): target = int(sys.stdin.readline()) # target = random.randint(1, 10 ** 11 - 1) # savetarget = target divtarget = 2 ** N target_min = target target_max = target + 1 while True: target_min *= 10 target_max *= 10 ...
all_fail
0
11
[{"idx": 0, "reason": "wrong_answer", "expected": "3\n1", "got": "125023\n125021"}, {"idx": 1, "reason": "wrong_answer", "expected": "5\n20", "got": "108127\n13975705"}, {"idx": 2, "reason": "wrong_answer", "expected": "99999\n3787651\n2509597\n3516786\n96025\n6352070\n126398\n921114\n85899\n182804\n1075899\n4859997\n6...
codeforces
G
455
913_G. Power Substring
You are given n positive integers a1, a2, ..., an. For every ai you need to find a positive integer ki such that the decimal notation of 2ki contains the decimal notation of ai as a substring among its last min(100, length(2ki)) digits. Here length(m) is the length of the decimal notation of m. Note that you don't ha...
python3
m10=10000000000 mp=21 p2=2**mp def qmd(log, md): ans=1 a=2 while log>0: if log%2: ans=ans*a%md log=log//2 a=a*a%md return ans n=int(input()) for nn in range(n): a=int(input()) #print(a) x=a*m10//p2*p2+p2 while x%5==0: x+=p2 #print(x) ...
all_fail
0
11
[{"idx": 0, "reason": "wrong_answer", "expected": "3\n1", "got": "361886221096998\n380205502827450"}, {"idx": 1, "reason": "wrong_answer", "expected": "5\n20", "got": "45962361120309\n377624836183189"}, {"idx": 2, "reason": "wrong_answer", "expected": "99999\n3787651\n2509597\n3516786\n96025\n6352070\n126398\n921114\n8...
codeforces
G
455
913_G. Power Substring
You are given n positive integers a1, a2, ..., an. For every ai you need to find a positive integer ki such that the decimal notation of 2ki contains the decimal notation of ai as a substring among its last min(100, length(2ki)) digits. Here length(m) is the length of the decimal notation of m. Note that you don't ha...
python2
def solve(a): n = len(str(a)) m = 0 while 10 ** m < 2 ** (n + m) * (n + m + 1): m += 1 for t in xrange(100000): p2 = 2 ** (n + m) q = a * 10 ** m + ((-a * 10 ** m) % p2 + p2) % p2 + t * p2 if q % 5 == 0: continue k = 0 while pow(2, k, 5) != q %...
all_fail
0
11
[{"idx": 0, "reason": "wrong_answer", "expected": "3\n1", "got": "63\n43"}, {"idx": 1, "reason": "wrong_answer", "expected": "5\n20", "got": "22\n150489"}, {"idx": 2, "reason": "wrong_answer", "expected": "99999\n3787651\n2509597\n3516786\n96025\n6352070\n126398\n921114\n85899\n182804\n1075899\n4859997\n6250277\n71876\...
codeforces
G
455
913_G. Power Substring
You are given n positive integers a1, a2, ..., an. For every ai you need to find a positive integer ki such that the decimal notation of 2ki contains the decimal notation of ai as a substring among its last min(100, length(2ki)) digits. Here length(m) is the length of the decimal notation of m. Note that you don't ha...
python2
from random import * n=input() #n=2000 bit=[1] for j in xrange(30): bit.append(4*10**j) val=[pow(2,w,10**30) for w in bit] for i in xrange(n): a=input() # a=randint(10**10,10**11-1) r=(a*(10**12)+5*10**11)%(2**30) r=a*(10**12)+5*10**11-r while r%5==0: r+=2**30 c=10000 ret=pow(2,c,10**30) for j in xrange(30): ...
all_fail
0
11
[{"idx": 0, "reason": "wrong_answer", "expected": "3\n1", "got": "41320977205205645241257294174\n9373777321285284172088426977"}, {"idx": 1, "reason": "wrong_answer", "expected": "5\n20", "got": "137213329732040813765209346044\n44856488441288125289324094440"}, {"idx": 2, "reason": "wrong_answer", "expected": "99999\n378...
codeforces
G
455
913_G. Power Substring
You are given n positive integers a1, a2, ..., an. For every ai you need to find a positive integer ki such that the decimal notation of 2ki contains the decimal notation of ai as a substring among its last min(100, length(2ki)) digits. Here length(m) is the length of the decimal notation of m. Note that you don't ha...
java
import java.io.*; import java.util.*; import java.math.BigInteger; public class Codeforces913G { public static void main (String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = input.nextLong(); } input.close(); ...
all_fail
0
11
[{"idx": 0, "reason": "wrong_answer", "expected": "3\n1", "got": "255988255566\n21"}, {"idx": 1, "reason": "wrong_answer", "expected": "5\n20", "got": "522246877948\n451006163205"}, {"idx": 2, "reason": "wrong_answer", "expected": "99999\n3787651\n2509597\n3516786\n96025\n6352070\n126398\n921114\n85899\n182804\n1075899...
codeforces
G
469
p03143 NIKKEI Programming Contest 2019 - Weights on Vertices and Edges
There is a connected undirected graph with N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. Also, each of these vertices and edges has a specified weight. Vertex i has a weight of X_i; Edge i has a weight of Y_i and connects Vertex A_i and B_i. We would like to remove zero o...
cpp
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <vector> using namespace std; const int N=100010; bool w[N]; int fa[N],pa[N]; vector <int> q[N]; long long a[N],b[N]; inline int gi() { int x=0,o=1; char ch=getchar(); while(ch<'0'||ch>'9') ch=='-'?o=-1:...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_mslfvkqn/tmpuvf_v1d0.cpp: In function ‘int main()’: /tmp/sbx_mslfvkqn/tmpuvf_v1d0.cpp:36:18: error: use of an operand of type ‘bool’ in ‘operator++’ is forbidden in C++17 36 | ++w[i],q[x].push_back(i); | ~~~^
[]
atcoder
UNKNOWN
475
p00156 Moats around the Castle
Now, a ninja is planning to sneak into the castle tower from outside the castle. This ninja can easily run on the ground and swim in the moat, but he is not very good at climbing up from the moat, so he wants to enter the moat as few times as possible. Create a program that takes a sketch of the castle as input and ou...
cpp
#include <iostream> #include <vector> #include <string> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <algorithm> // require sort next_permutation count __gcd reverse etc. #include <cstdlib> // require abs exit atof atoi #include <cstdio> // require scanf printf #include <f...
partial
1
2
[{"idx": 1, "reason": "timeout"}]
aizu
UNKNOWN
475
p00156 Moats around the Castle
Now, a ninja is planning to sneak into the castle tower from outside the castle. This ninja can easily run on the ground and swim in the moat, but he is not very good at climbing up from the moat, so he wants to enter the moat as few times as possible. Create a program that takes a sketch of the castle as input and ou...
cpp
#include <iostream> #include <vector> #include <queue> struct Point { int x; int y; int cost; bool checked; }; bool operator > (const Point& p, const Point& q) { return p.cost > q.cost; } int main() { int n, m; while (true) { std::cin >> n >> m; if (n==0) break; char** board = new char*[m+2]; for (int i...
partial
1
2
[{"idx": 1, "reason": "timeout"}]
aizu
UNKNOWN
475
p00156 Moats around the Castle
Now, a ninja is planning to sneak into the castle tower from outside the castle. This ninja can easily run on the ground and swim in the moat, but he is not very good at climbing up from the moat, so he wants to enter the moat as few times as possible. Create a program that takes a sketch of the castle as input and ou...
java
import java.util.PriorityQueue; import java.util.Scanner; public class Main { public static class Walk implements Comparable<Walk>{ int x; int y; int cost; public Walk(int x, int y, int cost) { super(); this.x = x; this.y = y; this.cost = cost; } @Override public int compareTo(Walk arg...
partial
1
2
[{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4\n\tat Main.main(Main.java:46)\n", "stdout_tail": ""}]
aizu
UNKNOWN
475
p00156 Moats around the Castle
Now, a ninja is planning to sneak into the castle tower from outside the castle. This ninja can easily run on the ground and swim in the moat, but he is not very good at climbing up from the moat, so he wants to enter the moat as few times as possible. Create a program that takes a sketch of the castle as input and ou...
cpp
#include <iostream> #include <vector> #include <string> #include <set> #include <queue> #include <algorithm> using namespace std; typedef pair<int, int> ii; struct Node { int c; bool d; vector<int> tos; }; const int INF = 1 << 30; const int dx[] = {0, 1, 0, -1}; const int dy[] = {-1, 0, 1, 0}; int w, h;...
partial
1
2
[{"idx": 1, "reason": "runtime_error", "rc": -11, "stderr": "", "stdout_tail": ""}]
aizu
UNKNOWN
475
p00156 Moats around the Castle
Now, a ninja is planning to sneak into the castle tower from outside the castle. This ninja can easily run on the ground and swim in the moat, but he is not very good at climbing up from the moat, so he wants to enter the moat as few times as possible. Create a program that takes a sketch of the castle as input and ou...
java
import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class Main { int INF = 1 << 28; int WALL = 10000; int GOAL = 100000; int w, h; int map[][]; void run() { Scanner sc = new Scanner(System.in); for(;;) { w = sc.nextInt(); h = sc.nextInt(); if( (w|h) == 0 ...
partial
1
2
[{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.StringIndexOutOfBoundsException: String index out of range: 4\n\tat java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)\n\tat java.base/java.lang.String.char", "stdout_tail": ""}]
aizu
UNKNOWN
475
p00156 Moats around the Castle
Now, a ninja is planning to sneak into the castle tower from outside the castle. This ninja can easily run on the ground and swim in the moat, but he is not very good at climbing up from the moat, so he wants to enter the moat as few times as possible. Create a program that takes a sketch of the castle as input and ou...
java
import java.util.ArrayDeque; import java.util.Arrays; import java.util.Deque; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (true) { int w = scanner.nextInt(); int h = scanner.nextInt(); if (w == 0 && h == 0) br...
partial
1
2
[{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4\n\tat Main.main(Main.java:24)\n", "stdout_tail": ""}]
aizu
UNKNOWN
475
p00156 Moats around the Castle
Now, a ninja is planning to sneak into the castle tower from outside the castle. This ninja can easily run on the ground and swim in the moat, but he is not very good at climbing up from the moat, so he wants to enter the moat as few times as possible. Create a program that takes a sketch of the castle as input and ou...
python3
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0156 """ import sys from sys import stdin from collections import deque input = stdin.readline def bfs(field, sx, sy): """ ??????????????°???????????°??????????????§?????????????????? :param field: :param sx: ???????...
partial
1
2
[{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_56fw84x6/tmpiaoffbph.py\", line 111, in <module>\n main(sys.argv[1:])\n File \"/tmp/sbx_56fw84x6/tmpiaoffbph.py\", line 106, in main\n result = sol", "stdout_tail": "0\n1\n"}]
aizu
UNKNOWN
475
p00156 Moats around the Castle
Now, a ninja is planning to sneak into the castle tower from outside the castle. This ninja can easily run on the ground and swim in the moat, but he is not very good at climbing up from the moat, so he wants to enter the moat as few times as possible. Create a program that takes a sketch of the castle as input and ou...
python3
from heapq import heappush, heappop while True: n, m = map(int, input().split()) if n == 0: break mp = ["X" + input() + "X" for _ in range(m)] mp.insert(0, "X" * (n + 2)) mp.append("X" * (n + 2)) que = [] visited = [[False] * (n + 2) for _ in range(m + 2)] sur_flag = False for i in range(1, n + 1...
partial
1
2
[{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_rdh0a0pa/tmpj104xr4c.py\", line 15, in <module>\n if mp[1][i] ==\"&\" or mp[m][i] == \"&\":\n ~~~~~^^^\nIndexError: string index ", "stdout_tail": "0\n"}]
aizu
UNKNOWN
475
p00156 Moats around the Castle
Now, a ninja is planning to sneak into the castle tower from outside the castle. This ninja can easily run on the ground and swim in the moat, but he is not very good at climbing up from the moat, so he wants to enter the moat as few times as possible. Create a program that takes a sketch of the castle as input and ou...
python2
def ReadMap(n, m): Map = [0] * m for i in range(m): a = raw_input() b = list(a) if a.count('&')>0: j = a.index('&') PosCas = [j, i] b[j] = '.' Map[i] = b return Map, PosCas def fill(SP, c1, c2): for x, y in SP: if not (0 <= x < n and 0 <= y < m): continue if Map[...
partial
1
2
[{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_g5jrb9hn/tmpey_taqb2.py\", line 39, in <module>\n if fill(SP, '.', '#'): break\n File \"/tmp/sbx_g5jrb9hn/tmpey_taqb2.py\", line 17, in fill\n if M", "stdout_tail": "0\n1\n"}]
aizu
UNKNOWN
475
p00156 Moats around the Castle
Now, a ninja is planning to sneak into the castle tower from outside the castle. This ninja can easily run on the ground and swim in the moat, but he is not very good at climbing up from the moat, so he wants to enter the moat as few times as possible. Create a program that takes a sketch of the castle as input and ou...
python3
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0156 """ import sys from sys import stdin from collections import deque input = stdin.readline def bfs(field, sx, sy): """ ??????????????°???????????°??????????????§?????????????????? :param field: :param sx: ???????...
partial
1
2
[{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_duzbxh1v/tmpjigup14h.py\", line 111, in <module>\n main(sys.argv[1:])\n File \"/tmp/sbx_duzbxh1v/tmpjigup14h.py\", line 106, in main\n result = sol", "stdout_tail": "0\n1\n"}]
aizu
UNKNOWN
475
p00156 Moats around the Castle
Now, a ninja is planning to sneak into the castle tower from outside the castle. This ninja can easily run on the ground and swim in the moat, but he is not very good at climbing up from the moat, so he wants to enter the moat as few times as possible. Create a program that takes a sketch of the castle as input and ou...
python2
from heapq import heappush, heappop, heapify from itertools import product def solve(): hq = [(0, y, x) for y, x in product(xrange(m), xrange(n)) if not(0 < y < m - 1 and 0 < x < n - 1)] heapify(hq) while len(hq) != 0: cost, cy, cx = heappop(hq) if field[cy][cx] == "&": ...
partial
1
2
[{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_w8l74k0n/tmpxjsrhp56.py\", line 29, in <module>\n print solve()\n File \"/tmp/sbx_w8l74k0n/tmpxjsrhp56.py\", line 18, in solve\n if field[ny][nx] !", "stdout_tail": ""}]
aizu
UNKNOWN
475
p00156 Moats around the Castle
Now, a ninja is planning to sneak into the castle tower from outside the castle. This ninja can easily run on the ground and swim in the moat, but he is not very good at climbing up from the moat, so he wants to enter the moat as few times as possible. Create a program that takes a sketch of the castle as input and ou...
python2
def ReadMap(n, m): Map = {} for i in range(m): a = raw_input() b = list(a) if a.count('&')>0: j = a.index('&') PosCas = [j, i] b[j] = '.' Map[i] = b return Map, PosCas def fill(SP, c1, c2): for x, y in SP: try: if Map[y][x] != c1: continue except: continue if...
partial
1
2
[{"idx": 1, "reason": "wrong_answer", "expected": "1\n2\n0\n0", "got": "0\n1\n0\n0"}]
aizu
UNKNOWN
482
p02398 How Many Divisors?
How Many Divisors? Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b. Constraints * 1 ≤ a, b, c ≤ 10000 * a ≤ b Input Three integers a, b and c are given in a line separated by a single space. Output Print the number of divisors in a line. Example Inp...
cpp
#include<stdio.h> int main(void){ int a,b,c,d,x=0; scanf("%d %d %d",&a,&b,&c); for(x=a;x<=b;x++){ if(c%x==0){ d++; } } printf("%d\n",d); return 0; }
all_fail
0
1
[{"idx": 0, "reason": "wrong_answer", "expected": "3", "got": "1404519579"}]
aizu
UNKNOWN
482
p02398 How Many Divisors?
How Many Divisors? Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b. Constraints * 1 ≤ a, b, c ≤ 10000 * a ≤ b Input Three integers a, b and c are given in a line separated by a single space. Output Print the number of divisors in a line. Example Inp...
cpp
#include <iostream> using namespace std; int main() { int a,b,c,d; cin>>a>>b>>c; for(int x=a;x<=b;x++){ if(c%x==0){ d++; } } cout<<d<<"\n"; }
all_fail
0
1
[{"idx": 0, "reason": "wrong_answer", "expected": "3", "got": "4"}]
aizu
UNKNOWN
482
p02398 How Many Divisors?
How Many Divisors? Write a program which reads three integers a, b and c, and prints the number of divisors of c between a and b. Constraints * 1 ≤ a, b, c ≤ 10000 * a ≤ b Input Three integers a, b and c are given in a line separated by a single space. Output Print the number of divisors in a line. Example Inp...
cpp
#include <stdio.h> #include <cstdio> int main(){ int a,b,c,i,j; scanf("%d %d %d",&a,&b,&c); for(j=a;j<=b;j++){ if(c%j==0){ i++; } } printf("%d\n",i); }
all_fail
0
1
[{"idx": 0, "reason": "wrong_answer", "expected": "3", "got": "-1556268885"}]
aizu
UNKNOWN
490
1062_D. Fun with Integers
You are given a positive integer n greater or equal to 2. For every pair of integers a and b (2 ≤ |a|, |b| ≤ n), you can transform a into b if and only if there exists an integer x such that 1 < |x| and (a ⋅ x = b or b ⋅ x = a), where |x| denotes the absolute value of x. After such a transformation, your score increas...
cpp
#include <bits/stdc++.h> using namespace std; long long n, ans; int main() { scanf("%I64d", &n); for (long long i = 2; i <= n; i++) { for (long long j = i + i; j <= n; j += i) { ans += (j / i); } } printf("%I64d\n", ans * 4ll); return 0; }
partial
16
25
[{"idx": 6, "reason": "wrong_answer", "expected": "8539207488", "got": " -50727104"}, {"idx": 8, "reason": "wrong_answer", "expected": "4816051228", "got": " 521083932"}, {"idx": 9, "reason": "wrong_answer", "exp...
codeforces
D
490
1062_D. Fun with Integers
You are given a positive integer n greater or equal to 2. For every pair of integers a and b (2 ≤ |a|, |b| ≤ n), you can transform a into b if and only if there exists an integer x such that 1 < |x| and (a ⋅ x = b or b ⋅ x = a), where |x| denotes the absolute value of x. After such a transformation, your score increas...
python2
#!/usr/bin/env python """ This file is part of https://github.com/Cheran-Senthil/PyRival. Copyright 2018 Cheran Senthilkumar all rights reserved, Cheran Senthilkumar <hello@cheran.io> Permission to use, modify, and distribute this software is given under the terms of the MIT License. """ from __future__ import divisi...
partial
15
25
[{"idx": 3, "reason": "timeout"}, {"idx": 5, "reason": "timeout"}, {"idx": 6, "reason": "timeout"}, {"idx": 9, "reason": "timeout"}, {"idx": 13, "reason": "timeout"}]
codeforces
D
496
120_C. Winnie-the-Pooh and honey
As we all know, Winnie-the-Pooh just adores honey. Ones he and the Piglet found out that the Rabbit has recently gotten hold of an impressive amount of this sweet and healthy snack. As you may guess, Winnie and the Piglet asked to come at the Rabbit's place. Thus, there are n jars of honey lined up in front of Winnie-t...
java
import java.io.*; import java.util.*; import java.text.*; import java.util.regex.*; /** * Problem-(#) - Main.java * * @author Isuru Madushanka Weerarathna * @team CSECodersV2 * @written 2011/10/22 * @competetion IEEEXtreme 5.0 */ public class Main { public static void main(String[] args) { try { ...
all_fail
0
20
[{"idx": 0, "reason": "wrong_answer", "expected": "9", "got": ""}, {"idx": 1, "reason": "wrong_answer", "expected": "4801", "got": ""}, {"idx": 2, "reason": "wrong_answer", "expected": "1208", "got": ""}, {"idx": 3, "reason": "wrong_answer", "expected": "1021", "got": ""}, {"idx": 4, "reason": "wrong_answer", "expected...
codeforces
C
496
120_C. Winnie-the-Pooh and honey
As we all know, Winnie-the-Pooh just adores honey. Ones he and the Piglet found out that the Rabbit has recently gotten hold of an impressive amount of this sweet and healthy snack. As you may guess, Winnie and the Piglet asked to come at the Rabbit's place. Thus, there are n jars of honey lined up in front of Winnie-t...
java
import java.util.*; import java.math.*; import java.io.*; public class LOL { public static void main(String[] args) throws Exception { //Scanner in = new Scanner(System.in); Scanner in = new Scanner(new File("input.txt")); PrintStream out = new PrintStream(new File("output.txt")); in...
all_fail
0
20
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.io.FileNotFoundException: input.txt (No such file or directory)\n\tat java.base/java.io.FileInputStream.open0(Native Method)\n\tat java.base/java.io.FileInputStream.open(Fi", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_er...
codeforces
C
496
120_C. Winnie-the-Pooh and honey
As we all know, Winnie-the-Pooh just adores honey. Ones he and the Piglet found out that the Rabbit has recently gotten hold of an impressive amount of this sweet and healthy snack. As you may guess, Winnie and the Piglet asked to come at the Rabbit's place. Thus, there are n jars of honey lined up in front of Winnie-t...
java
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class solution { void solve() throws IOException { int n = nextInt(), k = nextInt(), sum = 0; int[] a = new int[110]; int[] c = new ...
all_fail
0
20
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.io.FileNotFoundException: input.txt (No such file or directory)\n\tat java.base/java.io.FileInputStream.open0(Native Method)\n\tat java.base/java.io.FileInputStream.open(Fi", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_er...
codeforces
C
496
120_C. Winnie-the-Pooh and honey
As we all know, Winnie-the-Pooh just adores honey. Ones he and the Piglet found out that the Rabbit has recently gotten hold of an impressive amount of this sweet and healthy snack. As you may guess, Winnie and the Piglet asked to come at the Rabbit's place. Thus, there are n jars of honey lined up in front of Winnie-t...
cpp
#include <bits/stdc++.h> using namespace std; using namespace std; void check() { int a, b, s = 0, k; cin >> a >> b; vector<int> v; for (typeof(a) i = 0; i < (a); ++i) { cin >> k; v.push_back(k); } for (typeof(a) i = 0; i < (a); ++i) { int c = v[i]; for (typeof(3) j = 0; j < (3); ++j) ...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_tg2nr_3o/tmp3xdfwl2d.cpp: In function ‘void check()’: /tmp/sbx_tg2nr_3o/tmp3xdfwl2d.cpp:8:8: error: ‘typeof’ was not declared in this scope 8 | for (typeof(a) i = 0; i < (a); ++i) { | ^~~~~~ /tmp/sbx_tg2nr_3o/tmp3xdfwl2d.cpp:8:25: error: ‘i’ was not declared in this scope 8...
[]
codeforces
C
498
1251_E1. Voting (Easy Version)
The only difference between easy and hard versions is constraints. Now elections are held in Berland and you want to win them. More precisely, you want everyone to vote for you. There are n voters, and two ways to convince each of them to vote for you. The first way to convince the i-th voter is to pay him p_i coins....
python2
import os import sys from atexit import register from io import BytesIO sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size)) sys.stdout = BytesIO() register(lambda: os.write(1, sys.stdout.getvalue())) input = lambda: sys.stdin.readline().rstrip('\r\n') import heapq t = int(input()) for _ in range(t): n = int(input()...
all_fail
0
1
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_hh7pxngs/tmp_n5dzyii.py\", line 12, in <module>\n t = int(input())\nValueError: invalid literal for int() with base 10: ''\n", "stdout_tail": ""}]
codeforces
E
499
1271_C. Shawarma Tent
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parallel to the coordinate axes. The main school of the capital is located in (s_x, ...
python3
import sys input = sys.stdin.readline N, Sx, Sy = map(int,input().split()) XY = [list(map(int,input().split())) for _ in range(N)] around = [(0,1),(1,0),(0,-1),(-1,0)] pxpy = [(Sx+dx, Sy+dy) for dx, dy in around] cand = [0] * 4 for x, y in XY: k = abs(x-Sx) + abs(y-Sy) for t, (px, py) in enumerate(pxpy): ...
partial
6
8
[{"idx": 2, "reason": "wrong_answer", "expected": "2\n99 100", "got": "2\n100 99"}, {"idx": 6, "reason": "wrong_answer", "expected": "1\n99 100", "got": "1\n100 99"}]
codeforces
C
499
1271_C. Shawarma Tent
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parallel to the coordinate axes. The main school of the capital is located in (s_x, ...
java
import java.io.*; import java.util.*; public class Main { static point a[]; static int check(int wx, int wy, int sx, int sy) { //waurma int cnt = 0; for (int i = 0; i < a.length; i++) { int x = a[i].x; int y = a[i].y; if (wx >= Math.min(sx, x) && wy >= Math...
partial
7
8
[{"idx": 5, "reason": "wrong_answer", "expected": "1\n1000000000 100001", "got": "1\n1000000000 99999"}]
codeforces
C
499
1271_C. Shawarma Tent
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parallel to the coordinate axes. The main school of the capital is located in (s_x, ...
cpp
#include <bits/stdc++.h> using namespace std; int getDirByXY(const int& x, const int& y, const int& sx, const int& sy) { if (x - sx < 0) { if (y - sy < 0) { return 0; } else if (y - sy > 0) { return 5; } else { return 3; } } else if (x - sx > 0) { if (y - sy < 0) { return...
partial
4
8
[{"idx": 0, "reason": "wrong_answer", "expected": "4\n11 12", "got": "4\n10 11"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n99 100", "got": "2\n99 99"}, {"idx": 5, "reason": "wrong_answer", "expected": "1\n1000000000 100001", "got": "1\n1000000000 99999"}, {"idx": 6, "reason": "wrong_answer", "expected": "1\...
codeforces
C
499
1271_C. Shawarma Tent
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parallel to the coordinate axes. The main school of the capital is located in (s_x, ...
python3
n,a,b=map(int,input().split()) up=down=left=right=0 for i in range(n): p,q=map(int,input().split()) if p>a: right+=1 if p<a: left+=1 if q>b: up+=1 if q<b: down+=1 m=max(up,down,right,left) print(m) if m==up: print(a,b+1) elif m==down: print(a,b-1) elif m==r...
partial
5
8
[{"idx": 0, "reason": "wrong_answer", "expected": "4\n11 12", "got": "4\n10 11"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n99 100", "got": "2\n100 99"}, {"idx": 6, "reason": "wrong_answer", "expected": "1\n99 100", "got": "1\n100 99"}]
codeforces
C
499
1271_C. Shawarma Tent
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parallel to the coordinate axes. The main school of the capital is located in (s_x, ...
java
/* * * @Author Ajudiya_13(Bhargav Girdharbhai Ajudiya) * Dhirubhai Ambani Institute of Information And Communication Technology * */ import java.util.*; import java.io.*; import java.lang.*; public class Code57 { public static void main(String[] args) { InputReader in = new InputReader(System....
partial
7
8
[{"idx": 0, "reason": "wrong_answer", "expected": "4\n11 12", "got": "4\n10 11"}]
codeforces
C
499
1271_C. Shawarma Tent
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parallel to the coordinate axes. The main school of the capital is located in (s_x, ...
java
/* If you want to aim high, aim high Don't let that studying and grades consume you Just live life young ****************************** If I'm the sun, you're the moon Because when I go up, you go down ******************************* */ import java.util.*; import java.io.*; public class x1271C { public sta...
partial
6
8
[{"idx": 0, "reason": "wrong_answer", "expected": "4\n11 12", "got": "4\n10 11"}, {"idx": 5, "reason": "wrong_answer", "expected": "1\n1000000000 100001", "got": "1\n1000000000 99999"}]
codeforces
C
499
1271_C. Shawarma Tent
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parallel to the coordinate axes. The main school of the capital is located in (s_x, ...
python2
# -*- coding: utf-8 -*- import sys def solve(): n, sx, sy = map(int, sys.stdin.readline().strip().split()) n1 = (sx + 1, sy) n2 = (sx - 1, sy) n3 = (sx, sy + 1) n4 = (sx, sy - 1) hm = {n1: 0, n2: 0, n3: 0, n4: 0} for _ in xrange(n): home = map(int, sys.stdin.readline().strip().spl...
partial
5
8
[{"idx": 2, "reason": "wrong_answer", "expected": "2\n99 100", "got": "2\n100 99"}, {"idx": 5, "reason": "wrong_answer", "expected": "1\n1000000000 100001", "got": "1\n1000000000 99999"}, {"idx": 6, "reason": "wrong_answer", "expected": "1\n99 100", "got": "1\n100 99"}]
codeforces
C
500
1294_D. MEX maximizing
Recall that MEX of an array is a minimum non-negative integer that does not belong to the array. Examples: * for the array [0, 0, 1, 0, 2] MEX equals to 3 because numbers 0, 1 and 2 are presented in the array and 3 is the minimum non-negative integer not presented in the array; * for the array [1, 2, 3, 4] MEX eq...
python2
import os import sys from atexit import register from io import BytesIO sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size)) sys.stdout = BytesIO() register(lambda: os.write(1, sys.stdout.getvalue())) input = lambda: sys.stdin.readline().rstrip('\r\n') raw_input = lambda: sys.stdin.readline().rstrip('\r\n') from heapq ...
all_fail
0
2
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_8fixbj80/tmpqaszq9hg.py\", line 11, in <module>\n q,x = map(int,raw_input().split(\" \"))\nValueError: invalid literal for int() with base 10: ''\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_erro...
codeforces
D
501
1315_D. Recommendations
VK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorithm selects a_i publications. The latest A/B test suggests that users are reading recommended publications more actively ...
java
// package com.company; import org.omg.PortableInterceptor.INACTIVE; import java.util.*; import java.lang.*; import java.io.*; //****Use Integer Wrapper Class for Arrays.sort()**** public class BV4 { public static void main(String[] Args){ FastReader scan=new FastReader(); int n=scan.nextInt(); ...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_nzyo_5h5/BV4.java:2: error: package org.omg.PortableInterceptor does not exist import org.omg.PortableInterceptor.INACTIVE; ^ 1 error
[]
codeforces
D
503
1379_F1. Chess Strikes Back (easy version)
Note that the difference between easy and hard versions is that in hard version unavailable cells can become available again and in easy version can't. You can make hacks only if all versions are solved. Ildar and Ivan are tired of chess, but they really like the chessboard, so they invented a new game. The field is a...
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; unsigned euclidean_gcd(unsigned a, unsigned b) { if (a < b) return euclidean_gcd(b, a); unsigned r; while ((r = a % b)) { a = b; b = r; } return b; } ll ll_gcd(ll a, ll b) { if (a < b) return ll_gcd(b, a); ll r; while ((r = a % ...
partial
17
25
[{"idx": 6, "reason": "wrong_answer", "expected": "YES\nNO\nYES\nYES\nYES\nNO\nYES\nNO\nNO\nYES\nYES\nYES\nYES\nNO\nYES\nYES\nYES\nNO\nYES\nYES", "got": "YES\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO"}, {"idx": 7, "reason": "wrong_answer", "expected": "YES\nNO\nYES\nYES\nYES\nYES\nYES\...
codeforces
F
503
1379_F1. Chess Strikes Back (easy version)
Note that the difference between easy and hard versions is that in hard version unavailable cells can become available again and in easy version can't. You can make hacks only if all versions are solved. Ildar and Ivan are tired of chess, but they really like the chessboard, so they invented a new game. The field is a...
cpp
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 5; int n, m, q, x, y; unordered_map<int, unordered_map<int, int> > state; template <class T> void read(T& x, T f = 1, char ch = getchar()) { x = 0; while (ch < '0' || ch > '9') f = (ch == '-' ? -1 : 1), ch = getchar(); while (ch >= '0' && ch <= ...
partial
16
25
[{"idx": 2, "reason": "wrong_answer", "expected": "YES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nNO", "got": "YES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO"}, {"idx": 6, "reason": "wrong_answer", "expected": "YES\nNO\nYES\nYES\nYES\nNO...
codeforces
F
504
139_D. Digits Permutations
Andrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly. Then Andrey got bored from looking at the same number and he started to swap digits first in one, then in the other number, then again in the first number and so o...
cpp
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; char s[N]; int cnt1[10], cnt2[10]; int mi[5]; int ma, mx = -1; int c[10][2] = {{5, 5}, {1, 9}, {2, 8}, {3, 7}, {4, 6}}; int cc[10][2] = {{0, 9}, {5, 4}, {1, 8}, {2, 7}, {3, 6}}; string a1, a2; int main() { scanf("%s", s); int n = strlen(s); for...
partial
24
25
[{"idx": 19, "reason": "wrong_answer", "expected": "997533877542213\n995333122457787", "got": "997333877542215\n997333122457785"}]
codeforces
D
504
139_D. Digits Permutations
Andrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly. Then Andrey got bored from looking at the same number and he started to swap digits first in one, then in the other number, then again in the first number and so o...
cpp
#include <bits/stdc++.h> using namespace std; template <class T> string toStr(const T &x) { stringstream s; s << x; return s.str(); } template <class T> int toInt(const T &x) { stringstream s; s << x; int r; s >> r; return r; } int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0}; int dy[8] = {-1, 0, 1, 1, 1, 0, -1,...
partial
2
25
[{"idx": 1, "reason": "wrong_answer", "expected": "981\n819", "got": "819\n981"}, {"idx": 2, "reason": "wrong_answer", "expected": "545\n455", "got": "455\n545"}, {"idx": 3, "reason": "wrong_answer", "expected": "44443333333221099999999998888888888888777777777776666666655555555544444444433333333222222222221111111111111...
codeforces
D
504
139_D. Digits Permutations
Andrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly. Then Andrey got bored from looking at the same number and he started to swap digits first in one, then in the other number, then again in the first number and so o...
cpp
#include <bits/stdc++.h> using namespace std; void Output(int x, int y) { while (y--) putchar(x + 48); } int main() { int A[10], B[10]; memset(A, 0, sizeof(A)); memset(B, 0, sizeof(B)); char c; while (c = getchar(), c >= '0' && c <= '9') { A[c - 48]++; B[c - 48]++; } int Max = -1, Best; for (i...
partial
16
25
[{"idx": 2, "reason": "wrong_answer", "expected": "545\n455", "got": "455\n545"}, {"idx": 4, "reason": "wrong_answer", "expected": "672400\n427600", "got": "627400\n472600"}, {"idx": 5, "reason": "wrong_answer", "expected": "9901\n1099", "got": "9091\n1909"}, {"idx": 11, "reason": "wrong_answer", "expected": "774499999...
codeforces
D
504
139_D. Digits Permutations
Andrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly. Then Andrey got bored from looking at the same number and he started to swap digits first in one, then in the other number, then again in the first number and so o...
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; public class Solution { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ...
partial
3
25
[{"idx": 2, "reason": "wrong_answer", "expected": "545\n455", "got": "455\n545"}, {"idx": 3, "reason": "wrong_answer", "expected": "4444333333322109999999999888888888888877777777777666666665555555554444444443333333322222222222111111111111100000000010000\n44443333333221100000000001111111111111222222222223333333344444444...
codeforces
D
504
139_D. Digits Permutations
Andrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly. Then Andrey got bored from looking at the same number and he started to swap digits first in one, then in the other number, then again in the first number and so o...
python2
import sys def d( digits ): pair9s = {} for i in range(10): pair9s[i] = 9 - i baseCounts = [0]*10 for digit in digits: baseCounts[int(digit)] += 1 iTen = -1 mxZeros = 0 for i in range(1,6): countsa = baseCounts[:] countsb = baseCounts[:] zeros=0 i10 = 10 - i mn9s = [0]*10 mni...
partial
3
25
[{"idx": 2, "reason": "wrong_answer", "expected": "545\n455", "got": "455\n545"}, {"idx": 3, "reason": "wrong_answer", "expected": "4444333333322109999999999888888888888877777777777666666665555555554444444443333333322222222222111111111111100000000010000\n44443333333221100000000001111111111111222222222223333333344444444...
codeforces
D
504
139_D. Digits Permutations
Andrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly. Then Andrey got bored from looking at the same number and he started to swap digits first in one, then in the other number, then again in the first number and so o...
java
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Art...
partial
10
25
[{"idx": 3, "reason": "wrong_answer", "expected": "4444333333322109999999999888888888888877777777777666666665555555554444444443333333322222222222111111111111100000000010000\n444433333332211000000000011111111111112222222222233333333444444444555555555666", "got": "012233333334444999999999988888888888887777777777766666666...
codeforces
D
504
139_D. Digits Permutations
Andrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly. Then Andrey got bored from looking at the same number and he started to swap digits first in one, then in the other number, then again in the first number and so o...
python2
a = [0]*10 b = [0]*10 s = map(int, list(raw_input())) n = len(s) c1=['']*n c2=['']*n for i in range(n): a[s[i]] += 1 b[s[i]] += 1 n-=1 while (a[0]-a[9])>0: c1[n]=c2[n] = str(0) a[0]-=1 b[0]-=1 n-=1 k = [i for i in range(1,6) if a[i]*b[10-i]>0] d = {} for l in k: o = 0 a[l]-=1 b[1...
partial
19
25
[{"idx": 3, "reason": "wrong_answer", "expected": "4444333333322109999999999888888888888877777777777666666665555555554444444443333333322222222222111111111111100000000010000\n444433333332211000000000011111111111112222222222233333333444444444555555555666", "got": "444333333332211999999999988888888888887777777777766666666...
codeforces
D
504
139_D. Digits Permutations
Andrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly. Then Andrey got bored from looking at the same number and he started to swap digits first in one, then in the other number, then again in the first number and so o...
python3
import itertools def countZeroes(s): ret = 0 for i in s: if i != '0': break ret += 1 return ret def stupid(n): ansMax = 0 bn1 = n bn2 = n for n1 in itertools.permutations(n): for n2 in itertools.permutations(n): val = str(int(''.join(n1)) + i...
partial
10
25
[{"idx": 3, "reason": "wrong_answer", "expected": "4444333333322109999999999888888888888877777777777666666665555555554444444443333333322222222222111111111111100000000010000\n444433333332211000000000011111111111112222222222233333333444444444555555555666", "got": "012233333334444999999999988888888888887777777777766666666...
codeforces
D
505
1423_H. Virus
In Bubbleland a group of special programming forces gets a top secret job to calculate the number of potentially infected people by a new unknown virus. The state has a population of n people and every day there is new information about new contacts between people. The job of special programming forces is to calculate ...
java
//package bubblecup13.f; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class H { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(),...
all_fail
0
4
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.util.InputMismatchException\n\tat H.readByte(H.java:255)\n\tat H.ni(H.java:310)\n\tat H.solve(H.java:17)\n\tat H.run(H.java:243)\n\tat H.main(H.java:248)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "s...
codeforces
H
506
1443_A. Kids Seating
Today the kindergarten has a new group of n kids who need to be seated at the dinner table. The chairs at the table are numbered from 1 to 4n. Two kids can't sit on the same chair. It is known that two kids who sit on chairs with numbers a and b (a ≠ b) will indulge if: 1. gcd(a, b) = 1 or, 2. a divides b or b d...
python3
# cook your dish here for _ in range(int(input())): n=int(input()) s=4*n-2 for i in range(n): print(s,end=" ") s-=2 print()
all_fail
0
7
[{"idx": 0, "reason": "wrong_answer", "expected": "8 6\n12 10 8\n16 14 12 10", "got": "6 4\n10 8 6\n14 12 10 8"}, {"idx": 1, "reason": "wrong_answer", "expected": "8 6\n12 10 8\n16 14 12 10", "got": "6 4\n10 8 6\n14 12 10 8"}, {"idx": 2, "reason": "wrong_answer", "expected": "400 398 396 394 392 390 388 386 384 382 380...
codeforces
A
506
1443_A. Kids Seating
Today the kindergarten has a new group of n kids who need to be seated at the dinner table. The chairs at the table are numbered from 1 to 4n. Two kids can't sit on the same chair. It is known that two kids who sit on chairs with numbers a and b (a ≠ b) will indulge if: 1. gcd(a, b) = 1 or, 2. a divides b or b d...
python3
t = int(input()) for i in range(t): n = int(input()) for j in range(2 * n + 2, 4 * n + 1, 2): print(j, end=' ') print()
partial
1
7
[{"idx": 0, "reason": "wrong_answer", "expected": "8 6\n12 10 8\n16 14 12 10", "got": "6 8\n8 10 12\n10 12 14 16"}, {"idx": 1, "reason": "wrong_answer", "expected": "8 6\n12 10 8\n16 14 12 10", "got": "6 8\n8 10 12\n10 12 14 16"}, {"idx": 2, "reason": "wrong_answer", "expected": "400 398 396 394 392 390 388 386 384 382...
codeforces
A
506
1443_A. Kids Seating
Today the kindergarten has a new group of n kids who need to be seated at the dinner table. The chairs at the table are numbered from 1 to 4n. Two kids can't sit on the same chair. It is known that two kids who sit on chairs with numbers a and b (a ≠ b) will indulge if: 1. gcd(a, b) = 1 or, 2. a divides b or b d...
python2
#!/usr/bin/env python from __future__ import division, print_function import os import sys from io import BytesIO, IOBase if sys.version_info[0] < 3: from __builtin__ import xrange as range from future_builtins import ascii, filter, hex, map, oct, zip def main(): t = int(input()) for _ in range(t):...
partial
1
7
[{"idx": 0, "reason": "wrong_answer", "expected": "8 6\n12 10 8\n16 14 12 10", "got": "6 8\n8 10 12\n10 12 14 16"}, {"idx": 1, "reason": "wrong_answer", "expected": "8 6\n12 10 8\n16 14 12 10", "got": "6 8\n8 10 12\n10 12 14 16"}, {"idx": 2, "reason": "wrong_answer", "expected": "400 398 396 394 392 390 388 386 384 382...
codeforces
A
506
1443_A. Kids Seating
Today the kindergarten has a new group of n kids who need to be seated at the dinner table. The chairs at the table are numbered from 1 to 4n. Two kids can't sit on the same chair. It is known that two kids who sit on chairs with numbers a and b (a ≠ b) will indulge if: 1. gcd(a, b) = 1 or, 2. a divides b or b d...
java
import java.util.Scanner; public class A681 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int k=0;k<t;k++) { int n=sc.nextInt(),ctr=4*n; for(int i=1;i<=n;i++) { ctr-=2; System.out.print(ctr+" "); } System.out.println(); } sc.clo...
all_fail
0
7
[{"idx": 0, "reason": "wrong_answer", "expected": "8 6\n12 10 8\n16 14 12 10", "got": "6 4\n10 8 6\n14 12 10 8"}, {"idx": 1, "reason": "wrong_answer", "expected": "8 6\n12 10 8\n16 14 12 10", "got": "6 4\n10 8 6\n14 12 10 8"}, {"idx": 2, "reason": "wrong_answer", "expected": "400 398 396 394 392 390 388 386 384 382 380...
codeforces
A
506
1443_A. Kids Seating
Today the kindergarten has a new group of n kids who need to be seated at the dinner table. The chairs at the table are numbered from 1 to 4n. Two kids can't sit on the same chair. It is known that two kids who sit on chairs with numbers a and b (a ≠ b) will indulge if: 1. gcd(a, b) = 1 or, 2. a divides b or b d...
python2
'''input 3 5 3 4 ''' from sys import stdin,stdout I = lambda : map(int,stdin.readline().split()) import bisect import math from heapq import heappop, heappush from collections import defaultdict, deque # t = 1 def testcase(): n = input() for i in range(2*n, 2*n + 2*n, 2): print i, print t = input() for i in range...
all_fail
0
7
[{"idx": 0, "reason": "wrong_answer", "expected": "8 6\n12 10 8\n16 14 12 10", "got": "4 6\n6 8 10\n8 10 12 14"}, {"idx": 1, "reason": "wrong_answer", "expected": "8 6\n12 10 8\n16 14 12 10", "got": "4 6\n6 8 10\n8 10 12 14"}, {"idx": 2, "reason": "wrong_answer", "expected": "400 398 396 394 392 390 388 386 384 382 380...
codeforces
A
506
1443_A. Kids Seating
Today the kindergarten has a new group of n kids who need to be seated at the dinner table. The chairs at the table are numbered from 1 to 4n. Two kids can't sit on the same chair. It is known that two kids who sit on chairs with numbers a and b (a ≠ b) will indulge if: 1. gcd(a, b) = 1 or, 2. a divides b or b d...
python2
for _ in range(input()): n=input() for i in range(4*n-2,2*n-1,-2): print i, print
all_fail
0
7
[{"idx": 0, "reason": "wrong_answer", "expected": "8 6\n12 10 8\n16 14 12 10", "got": "6 4\n10 8 6\n14 12 10 8"}, {"idx": 1, "reason": "wrong_answer", "expected": "8 6\n12 10 8\n16 14 12 10", "got": "6 4\n10 8 6\n14 12 10 8"}, {"idx": 2, "reason": "wrong_answer", "expected": "400 398 396 394 392 390 388 386 384 382 380...
codeforces
A
507
1493_C. K-beautiful Strings
You are given a string s consisting of lowercase English letters and a number k. Let's call a string consisting of lowercase English letters beautiful if the number of occurrences of each letter in that string is divisible by k. You are asked to find the lexicographically smallest beautiful string of length n, which is...
python3
import io import os from collections import Counter, defaultdict, deque def solve(N, K, S): if N % K != 0: return -1 ordA = ord("a") A = [ord(x) - ordA for x in S] freq = [0] * 26 for x in A: freq[x] += 1 if all(v % K == 0 for k, v in enumerate(freq)): return S ...
all_fail
0
2
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_skcmt7qr/tmpsl6h9rau.py\", line 116, in <module>\n TC = int(input())\n ^^^^^^^^^^^^\nValueError: invalid literal for int() with base 10: b''\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_e...
codeforces
C
508
1515_I. Phoenix and Diamonds
Phoenix wonders what it is like to rob diamonds from a jewelry store! There are n types of diamonds. The i-th type has weight w_i and value v_i. The store initially has a_i diamonds of the i-th type. Each day, for q days, one of the following will happen: 1. A new shipment of k_i diamonds of type d_i arrive. 2...
cpp
// NOT MY CODE // https://codeforces.com/contest/1515/submission/115143855 #include <bits/stdc++.h> ///#pragma GCC target("sse4.2") ///#pragma GCC opimize("O1") ///#pragma GCC opimize("O2") ///#pragma GCC opimize("Os") ///#pragma GCC opimize("Ofast") ///#pragma GCC target("avx,avx2,fma") ///#pragma GCC target("avx...
all_fail
0
3
[{"idx": 0, "reason": "wrong_answer", "expected": "\n8\n16\n13", "got": ""}, {"idx": 1, "reason": "wrong_answer", "expected": "400\n400\n500\n500\n800\n800\n800\n800", "got": ""}, {"idx": 2, "reason": "wrong_answer", "expected": "600\n600\n600\n700\n800\n1000\n1000\n1000", "got": ""}]
codeforces
I
509
1543_B. Customising the Track
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divided into n sub-tracks. You are given an array a where a_i represents the number of traffic cars in the i-th sub-track. You def...
java
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; import java.math.*; /* Name of the class has to be "Main" only if the class is public. */ public final class Solution { public static void main(String[] args) throws java.lang.Exception { // your code goe...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_2frb4ibq/has.java:9: error: class Solution is public, should be declared in a file named Solution.java public final class Solution { ^ 1 error
[]
codeforces
B
510
171_C. A Piece of Cake
How to make a cake you'll never eat. Ingredients. * 2 carrots * 0 calories * 100 g chocolate spread * 1 pack of flour * 1 egg Method. 1. Put calories into the mixing bowl. 2. Take carrots from refrigerator. 3. Chop carrots. 4. Take chocolate spread from refrigerator. 5. Put chocolate spread ...
java
import java.io.*; import java.math.*; import static java.lang.Math.*; import java.security.SecureRandom; import static java.util.Arrays.*; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import sun.misc.Regexp; import java.awt.geom.*; import sun.net.www.content.text.plain; public c...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_xg3d0dz_/Main.java:10: error: cannot find symbol import sun.misc.Regexp; ^ symbol: class Regexp location: package sun.misc /tmp/sbx_xg3d0dz_/Main.java:12: error: package sun.net.www.content.text is not visible import sun.net.www.content.text.plain; ^...
[]
codeforces
C
511
191_A. Dynasty Puzzles
The ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kings were famous for their long names. But long names are somewhat inconvenient, so the Berlanders started to abbreviate the names of their kings. They called every king by the first letters of its name. Thus, the...
python2
import os, sys, atexit if sys.version_info[0] < 3: range = xrange from cStringIO import StringIO as BytesIO sys.stdout = BytesIO() else: from io import BytesIO sys.stdout = BytesIO() _write = sys.stdout.write sys.stdout.write = lambda s: _write(s.encode()) atexit.register(lambda: os.write...
all_fail
0
12
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_zc1iiszz/tmpddrmh69w.py\", line 21, in <module>\n n = int(input())\nValueError: invalid literal for int() with base 10: ''\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": ...
codeforces
A
511
191_A. Dynasty Puzzles
The ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kings were famous for their long names. But long names are somewhat inconvenient, so the Berlanders started to abbreviate the names of their kings. They called every king by the first letters of its name. Thus, the...
python2
import os, sys, atexit range = xrange from cStringIO import StringIO as BytesIO sys.stdout = BytesIO() atexit.register(lambda: os.write(1, sys.stdout.getvalue())) input = BytesIO(os.read(0, os.fstat(0).st_size)).readline from sys import stdin str_inp = lambda n: [input().strip() for x in range(n)] n = int(input(...
all_fail
0
12
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_5ubcycmz/tmpjvuuvabq.py\", line 16, in <module>\n n = int(input())\nValueError: invalid literal for int() with base 10: ''\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": ...
codeforces
A
512
263_D. Cycle in Graph
You've got a undirected graph G, consisting of n nodes. We will consider the nodes of the graph indexed by integers from 1 to n. We know that each node of graph G is connected by edges with at least k other nodes of this graph. Your task is to find in the given graph a simple cycle of length of at least k + 1. A simpl...
java
//package round161; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class D { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(), m = n...
all_fail
0
12
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.util.InputMismatchException\n\tat D.readByte(D.java:113)\n\tat D.ni(D.java:168)\n\tat D.solve(D.java:16)\n\tat D.run(D.java:101)\n\tat D.main(D.java:106)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "s...
codeforces
D
512
263_D. Cycle in Graph
You've got a undirected graph G, consisting of n nodes. We will consider the nodes of the graph indexed by integers from 1 to n. We know that each node of graph G is connected by edges with at least k other nodes of this graph. Your task is to find in the given graph a simple cycle of length of at least k + 1. A simpl...
cpp
#include <bits/stdc++.h> using namespace std; const int N = 100100; int n, m, k, p[N], niv[N], sol, tata; vector<int> v[N]; void dfs(int nod) { if (sol) return; for (vector<int>::iterator it = v[nod].begin(); it != v[nod].end(); ++it) if (p[nod] != *it) { if (!p[*it]) { p[*it] = nod; niv[*...
all_fail
0
12
[{"idx": 0, "reason": "wrong_answer", "expected": "4\n1 2 3 4", "got": "4\n4 3 2 1"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\n1 2 3", "got": "3\n3 2 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "18\n13 29 4 11 25 10 2 6 30 17 14 8 3 16 19 20 23 12", "got": "9\n25 11 4 29 13 5 27 22 1"}, {"idx": 3,...
codeforces
D
512
263_D. Cycle in Graph
You've got a undirected graph G, consisting of n nodes. We will consider the nodes of the graph indexed by integers from 1 to n. We know that each node of graph G is connected by edges with at least k other nodes of this graph. Your task is to find in the given graph a simple cycle of length of at least k + 1. A simpl...
java
//package ds; import java.io.IOException; import java.io.InputStream; import java.util.*; public class Cycle { static LinkedList<Integer>[] G; static StringBuilder sb = new StringBuilder(); static int[] stack; static boolean flag=false; static int[] par; static int sp = 1,k; static char[] used; static int[]...
partial
5
12
[{"idx": 2, "reason": "wrong_answer", "expected": "18\n13 29 4 11 25 10 2 6 30 17 14 8 3 16 19 20 23 12", "got": "9\n1 22 27 5 13 29 4 11 25"}, {"idx": 4, "reason": "wrong_answer", "expected": "9\n1 10 5 6 9 4 8 3 7", "got": "7\n1 10 5 6 9 4 8"}, {"idx": 6, "reason": "wrong_answer", "expected": "12\n1 9 2 7 11 6 4 3 5 ...
codeforces
D
512
263_D. Cycle in Graph
You've got a undirected graph G, consisting of n nodes. We will consider the nodes of the graph indexed by integers from 1 to n. We know that each node of graph G is connected by edges with at least k other nodes of this graph. Your task is to find in the given graph a simple cycle of length of at least k + 1. A simpl...
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.lang.management.BufferPoolMXBean; import java.math.BigInteger; import java.util.*; public class DFSs { static ArrayList<Integer>[] g; static int[] cl; static int[] p; stat...
partial
5
12
[{"idx": 2, "reason": "wrong_answer", "expected": "18\n13 29 4 11 25 10 2 6 30 17 14 8 3 16 19 20 23 12", "got": "9\n1 22 27 5 13 29 4 11 25"}, {"idx": 4, "reason": "wrong_answer", "expected": "9\n1 10 5 6 9 4 8 3 7", "got": "7\n1 10 5 6 9 4 8"}, {"idx": 6, "reason": "wrong_answer", "expected": "12\n1 9 2 7 11 6 4 3 5 ...
codeforces
D
512
263_D. Cycle in Graph
You've got a undirected graph G, consisting of n nodes. We will consider the nodes of the graph indexed by integers from 1 to n. We know that each node of graph G is connected by edges with at least k other nodes of this graph. Your task is to find in the given graph a simple cycle of length of at least k + 1. A simpl...
cpp
#include <bits/stdc++.h> using namespace std; vector<int> months = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; const int MAX = 1e5 + 55; const int inf = 1e9 + 77; const int MOD = 1e9 + 7; const double PI = acos(-1.0); const double eps = 1e-7; int n, m, k; vector<int> cycle; int loop = -1; int f = 0; int dis[MA...
all_fail
0
12
[{"idx": 0, "reason": "wrong_answer", "expected": "4\n1 2 3 4", "got": "4\n4 3 2 1"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\n1 2 3", "got": "3\n3 2 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "18\n13 29 4 11 25 10 2 6 30 17 14 8 3 16 19 20 23 12", "got": "9\n25 11 4 29 13 5 27 22 1"}, {"idx": 3,...
codeforces
D
512
263_D. Cycle in Graph
You've got a undirected graph G, consisting of n nodes. We will consider the nodes of the graph indexed by integers from 1 to n. We know that each node of graph G is connected by edges with at least k other nodes of this graph. Your task is to find in the given graph a simple cycle of length of at least k + 1. A simpl...
python3
n, m, k = map(int, input().split()) d = {} for _ in range(m): u, v = map(int, input().split()) if u not in d: d[u] = [v] else: d[u].append(v) if v not in d: d[v] = [u] else: d[v].append(u) # print(d) stack = [] not_visited = set(range(1, n+1)) while not_visited: ...
all_fail
0
12
[{"idx": 0, "reason": "wrong_answer", "expected": "4\n1 2 3 4", "got": "4\n1 4 2 3"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\n1 2 3", "got": "3\n1 3 2"}, {"idx": 2, "reason": "wrong_answer", "expected": "18\n13 29 4 11 25 10 2 6 30 17 14 8 3 16 19 20 23 12", "got": "6\n28 14 8 19 26 18"}, {"idx": 3, "reaso...
codeforces
D
512
263_D. Cycle in Graph
You've got a undirected graph G, consisting of n nodes. We will consider the nodes of the graph indexed by integers from 1 to n. We know that each node of graph G is connected by edges with at least k other nodes of this graph. Your task is to find in the given graph a simple cycle of length of at least k + 1. A simpl...
python2
#!/usr/bin/python n, m, k = map(int, raw_input().split()) graph = [[] for i in range(n+1)] for i in range(m) : x, y = map(int, raw_input().split()) graph[x].append(y) graph[y].append(x) startPoint = max(zip(range(1, n+1), [len(graph[i]) for i in range(1, n+1)]), key = lambda pair: pair...
all_fail
0
12
[{"idx": 0, "reason": "wrong_answer", "expected": "4\n1 2 3 4", "got": "4\n1 4 2 3"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\n1 2 3", "got": "3\n1 3 2"}, {"idx": 2, "reason": "wrong_answer", "expected": "18\n13 29 4 11 25 10 2 6 30 17 14 8 3 16 19 20 23 12", "got": "5\n8 19 26 18 4"}, {"idx": 3, "reason": ...
codeforces
D
512
263_D. Cycle in Graph
You've got a undirected graph G, consisting of n nodes. We will consider the nodes of the graph indexed by integers from 1 to n. We know that each node of graph G is connected by edges with at least k other nodes of this graph. Your task is to find in the given graph a simple cycle of length of at least k + 1. A simpl...
python2
#! /Library/Frameworks/Python.framework/Versions/2.6/bin/python inp = raw_input().split() n = int(inp[0]) m = int(inp[1]) k = int(inp[2]) adjList = [set() for i in range(n)] for i in range(m): inp = raw_input().split() a = int(inp[0]) - 1 b = int(inp[1]) - 1 adjList[a].add(b) adjList[b].add(a) path = [0] visi...
all_fail
0
12
[{"idx": 0, "reason": "wrong_answer", "expected": "4\n1 2 3 4", "got": "4\n1 4 3 2"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\n1 2 3", "got": "3\n1 3 2"}, {"idx": 2, "reason": "wrong_answer", "expected": "18\n13 29 4 11 25 10 2 6 30 17 14 8 3 16 19 20 23 12", "got": "11\n1 23 15 24 13 29 2 6 14 8 22"}, {"id...
codeforces
D
514
335_B. Palindrome
Given a string s, determine if it contains any palindrome of length exactly 100 as a subsequence. If it has any, print any one of them. If it doesn't have any, print a palindrome that is a subsequence of s and is as long as possible. Input The only line of the input contains one string s of length n (1 ≤ n ≤ 5·104) c...
cpp
#include <bits/stdc++.h> using namespace std; char s[50005]; int n, dp[3005][3005], dpc[3005][3005]; int gogo() { static int c[26]; memset((c), (0), sizeof((c))); for (int(i) = (int)(1); (i) <= (int)(n); ++(i)) ++c[s[i] - 'a']; int z = -1; for (int(i) = 0; (i) < (int)(26); ++(i)) if (c[i] > 100) z = i; ...
partial
24
25
[{"idx": 24, "reason": "wrong_answer", "expected": "ktrxxktnknrntntnnnntrrnxktnjjjjjjjjjjkjjjjjjjjjjntkxnrrtnnnntntnrnkntkxxrtk", "got": "ktrxxktnknrntntnnnntrrnxktnjjjjjjjjjjjjjjjjjjjjjntkxnrrtnnnntntnrnkntkxxrtk"}]
codeforces
B
514
335_B. Palindrome
Given a string s, determine if it contains any palindrome of length exactly 100 as a subsequence. If it has any, print any one of them. If it doesn't have any, print a palindrome that is a subsequence of s and is as long as possible. Input The only line of the input contains one string s of length n (1 ≤ n ≤ 5·104) c...
cpp
#include <bits/stdc++.h> using namespace std; int n, t, a[35]; int dp[2605][2605]; char s[50005], res[2605]; int rec(int x, int y) { if (x > y) return 0; if (dp[x][y]) return dp[x][y]; if (x == y) return dp[x][y] = 1; if (s[x] == s[y]) return dp[x][y] = rec(x + 1, y - 1) + 2; return dp[x][y] = max(rec(x + 1, ...
partial
24
25
[{"idx": 24, "reason": "wrong_answer", "expected": "ktrxxktnknrntntnnnntrrnxktnjjjjjjjjjjkjjjjjjjjjjntkxnrrtnnnntntnrnkntkxxrtk", "got": "ktrxxktnknrntntnnnntrrnxktnjjjjjjjjjjjjjjjjjjjjjntkxnrrtnnnntntnrnkntkxxrtk"}]
codeforces
B
514
335_B. Palindrome
Given a string s, determine if it contains any palindrome of length exactly 100 as a subsequence. If it has any, print any one of them. If it doesn't have any, print a palindrome that is a subsequence of s and is as long as possible. Input The only line of the input contains one string s of length n (1 ≤ n ≤ 5·104) c...
java
// No sorcery shall prevail. import java.util.*; import java.io.*; public class Main { static long mod = 1000000007; static long mod2 = 998244353; static Scanner inp= new Scanner(System.in); static PrintWriter out= new PrintWriter(System.out); public static void main(String args[]) { Main g=new Main(); ...
partial
24
25
[{"idx": 24, "reason": "wrong_answer", "expected": "ktrxxktnknrntntnnnntrrnxktnjjjjjjjjjjkjjjjjjjjjjntkxnrrtnnnntntnrnkntkxxrtk", "got": "ktrxxktnknrntntnnnntrrnxktnjjjjjjjjjjjjjjjjjjjjjntkxnrrtnnnntntnrnkntkxxrtk"}]
codeforces
B
514
335_B. Palindrome
Given a string s, determine if it contains any palindrome of length exactly 100 as a subsequence. If it has any, print any one of them. If it doesn't have any, print a palindrome that is a subsequence of s and is as long as possible. Input The only line of the input contains one string s of length n (1 ≤ n ≤ 5·104) c...
cpp
#include <bits/stdc++.h> using namespace std; const int W_LEN = sizeof(unsigned int) * 8; const int SHIFT_LEN = (W_LEN == 32 ? 5 : 6); const int MAX_N = 50000 + 10; void AlgB(int m, int n, const char* a, const char* b, int* ll) { static unsigned int bit[128][(MAX_N >> SHIFT_LEN) + 2]; static unsigned int dp[(MAX_N ...
partial
21
25
[{"idx": 2, "reason": "wrong_answer", "expected": "ukueeeitundyhvueeqeudelpiktbnkkknckargaqtheffqmpexxepmqffehtqagrakcnkkknbtkipledueqeeuvhydnutieeeuku", "got": "knckargaqtheffqmpexexvbthkuucaexoqrewyunyubqaoqykookyqoaqbuynuywerqoxeacuukhtbvxexepmqffehtqagrakcnk"}, {"idx": 15, "reason": "wrong_answer", "expected": "ppi...
codeforces
B