#111391
|
- #include <stdio.h>
- int main(void) {
- int a, b, c, d = 0;
- scanf("%d %d %d", &a, &b, &c);
- if (a > b) {
- d = a;
- a = b;
- b = d;
} else if (b > c) {
- }
- if (b > c) {
- d = b;
- b = c;
- c = d;
} else if (a > b) {
- }
- if (a > b) {
- d = a;
- a = b;
- b = d;
- }
- printf("%d %d %d\n", a, b, c);
- return 0;
- }
|
- #include <stdio.h>
- int main(void) {
- int a, b, c, d = 0;
- scanf("%d %d %d", &a, &b, &c);
- if (a > b) {
- d = a;
- a = b;
- b = d;
} else if (b > c) {
- }
- if (b > c) {
- d = b;
- b = c;
- c = d;
} else if (a > b) {
- }
- if (a > b) {
- d = a;
- a = b;
- b = d;
- }
- printf("%d %d %d\n", a, b, c);
- return 0;
- }
|
true
|
|
#116380
|
- #include <iostream>
- using namespace std;
- int main() {
- int x, i = 1;
- while (1) {
- cin >> x;
- if (x != 0) {
cout << "case"
- cout << "Case"
- << " " << i << ": " << x << endl;
- i++;
- } else {
- return 0;
- }
- }
- }
|
- #include <iostream>
- using namespace std;
- int main() {
- int x, i = 1;
- while (1) {
- cin >> x;
if (x != 0) {
cout << "case"
- if (x!= 0) {
- cout << "Case"
- << " " << i << ": " << x << endl;
- i++;
- } else {
- return 0;
- }
- }
- }
|
true
|
|
#118857
|
- #include <algorithm>
- #include <iostream>
- using namespace std;
- int main() {
- int a, b;
while (cin >> a >> b && a != 0 && b != 0) {
- while (cin >> a >> b && (a != 0 || b != 0)) {
- if (a > b)
- swap(a, b);
- cout << a << " " << b << endl;
- }
- }
|
- #include <algorithm>
- #include <iostream>
- using namespace std;
- int main() {
- int a, b;
while (cin >> a >> b && a != 0 && b != 0) {
- while (cin >> a >> b && (a!= 0 || b!= 0)) {
- if (a > b)
- swap(a, b);
- cout << a << " " << b << endl;
- }
- }
|
true
|
|
#129276
|
- #include <stdio.h>
- int main(void) {
int n, i, a, max = -1000000, min = 1000000, sum = 0;
- int n, i, a, max = -1000000, min = 1000000;
- long long sum = 0;
- scanf("%d", &n);
- for (i = 0; i < n; i++) {
- scanf("%d", &a);
- if (max < a)
- max = a;
- if (min > a)
- min = a;
- sum += a;
- }
printf("%d %d %d
", min, max, sum);
- printf("%d %d %lld
- ", min, max, sum);
- return 0;
- }
|
- #include <stdio.h>
- int main(void) {
int n, i, a, max = -1000000, min = 1000000, sum = 0;
- int n, i, a, max = -1000000, min = 1000000;
- long sum = 0;
- scanf("%d", &n);
- for (i = 0; i < n; i++) {
- scanf("%d", &a);
- if (max < a)
- max = a;
- if (min > a)
- min = a;
- sum += a;
- }
printf("%d %d %d
", min, max, sum);
- printf("%d %d %ld
- ", min, max, sum);
- return 0;
- }
|
true
|
|
#130816
|
- #include <stdio.h>
- int main(void) {
- int x, a = 1000000, b = -1000000, i, num;
- long long int c = 0;
- scanf("%d", &x);
- for (i = 0; i < x; i++) {
- scanf("%d", &num);
- c += num;
- if (num <= a) {
- a = num;
- }
- if (num >= b) {
- b = num;
- }
- }
printf("%d %d %d
", a, b, c);
- printf("%d %d %ld
- ", a, b, c);
- return 0;
- }
|
- #include <stdio.h>
- int main(void) {
- int x, a = 1000000, b = -1000000, i, num;
- long long int c = 0;
- scanf("%d", &x);
- for (i = 0; i < x; i++) {
- scanf("%d", &num);
- c += num;
- if (num <= a) {
- a = num;
- }
- if (num >= b) {
- b = num;
- }
- }
printf("%d %d %d
", a, b, c);
- printf("%d %d %lld
- ", a, b, c);
- return 0;
- }
|
true
|
|
#139889
|
- import java.util.Scanner;
- class Main {
- int n, x, y, c;
- public void solve() {
- Scanner sc = new Scanner(System.in);
- sc.useDelimiter("\\s");
- n = sc.nextInt();
- int a[][] = new int[12][10];
- for (x = 0; x < 12; x++) {
- for (y = 0; y < 10; y++) {
- a[x][y] = 0;
- }
- }
- for (x = 0; x < n; x++) {
- int b = sc.nextInt();
- int f = sc.nextInt();
- int r = sc.nextInt();
- int v = sc.nextInt();
- if (b == 1) {
a[f - 1][r - 1] = v;
- a[f - 1][r - 1] += v;
- } else if (b == 2) {
a[f + 2][r - 1] = v;
- a[f + 2][r - 1] += v;
- } else if (b == 3) {
a[f + 5][r - 1] = v;
- a[f + 5][r - 1] += v;
- } else if (b == 4) {
a[f + 8][r - 1] = v;
- a[f + 8][r - 1] += v;
- } else {
- continue;
- }
- }
- for (y = 0; y < 12; y++) {
- for (c = 0; c < 10; c++) {
- System.out.printf(" %d", a[y][c]);
- }
- System.out.println();
- if (y % 3 == 2 && y != 11) {
- System.out.println("####################");
- }
- }
- }
- public static void main(String[] args) { new Main().solve(); }
- }
|
- import java.util.Scanner;
- class Main {
- int n, x, y, c;
- public void solve() {
- Scanner sc = new Scanner(System.in);
- sc.useDelimiter("\\s");
- n = sc.nextInt();
- int a[][] = new int[12][10];
- for (x = 0; x < 12; x++) {
- for (y = 0; y < 10; y++) {
- a[x][y] = 0;
- }
- }
- for (x = 0; x < n; x++) {
- int b = sc.nextInt();
- int f = sc.nextInt();
- int r = sc.nextInt();
- int v = sc.nextInt();
- if (b == 1) {
a[f - 1][r - 1] = v;
- a[f - 1][r - 1] += v;
- } else if (b == 2) {
a[f + 2][r - 1] = v;
- a[f + 2][r - 1] += v;
- } else if (b == 3) {
a[f + 5][r - 1] = v;
- a[f + 5][r - 1] += v;
- } else if (b == 4) {
a[f + 8][r - 1] = v;
- a[f + 8][r - 1] += v;
- } else {
- continue;
- }
- }
- for (y = 0; y < 12; y++) {
- for (c = 0; c < 10; c++) {
- System.out.printf(" %d", a[y][c]);
- }
- System.out.println();
if (y % 3 == 2 && y != 11) {
- if (y % 3 == 2 && y!= 11) {
- System.out.println("####################");
- }
- }
- }
- public static void main(String[] args) { new Main().solve(); }
- }
|
true
|
|
#150069
|
- import sys
- w = sys.stdin.readline().strip().lower()
- cnt = 0
- while True:
- line = sys.stdin.readline().strip()
- if line == 'END_OF_TEXT':
- break
-
- words = line.split(' ')
- for i in words:
if i == w:
- if i.lower() == w:
- cnt += 1
- print(cnt)
|
- import sys
- w = sys.stdin.readline().strip().lower()
- cnt = 0
- while True:
- line = sys.stdin.readline().strip()
- if line == 'END_OF_TEXT':
- break
-
words = line.split(' ')
- words = line.lower().split(' ')
- for i in words:
- if i == w:
- cnt += 1
- print(cnt)
|
true
|
|
#169654
|
- #include <bits/stdc++.h>
- using namespace std;
- /*
- By: Umang Srivastava
- */
- #define lli long long int
- #define ld long double
- #define mod 1e9 + 7
- #define lp(var, start, end, inc) for (var = start; var < end; var = var + inc)
- #define pb push_back
- #define mp make_pair
- #define pf push_front
- #define ff first
- #define ss second
- #define vll vector<lli>
- #define pll pair<lli, lli>
- #define vpll vector<plli>
- #define max(a, b) a > b ? a : b
- #define min(a, b) a < b ? a : b
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- cout.tie(NULL);
int d, t, s;
- lli d, t, s;
- cin >> d >> t >> s;
- if (t * s >= d)
cout << "YES\n";
- cout << "Yes";
- else
cout << "NO\n";
- cout << "No";
- }
|
- #include <bits/stdc++.h>
- using namespace std;
- /*
- By: Umang Srivastava
- */
- #define lli long long int
- #define ld long double
- #define mod 1e9 + 7
- #define lp(var, start, end, inc) for (var = start; var < end; var = var + inc)
- #define pb push_back
- #define mp make_pair
- #define pf push_front
- #define ff first
- #define ss second
- #define vll vector<lli>
- #define pll pair<lli, lli>
- #define vpll vector<plli>
#define max(a, b) a > b ? a : b
#define min(a, b) a < b ? a : b
- #define max(a, b) a > b? a : b
- #define min(a, b) a < b? a : b
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- cout.tie(NULL);
- int d, t, s;
- cin >> d >> t >> s;
- if (t * s >= d)
cout << "YES
";
- cout << "Yes
- ";
- else
cout << "NO
";
- cout << "No
- ";
- }
|
true
|
|
#173652
|
- S = input()
- T = input()
- result = float('inf')
for i in range(len(S) - len(T)):
- for i in range(len(S) - len(T) + 1):
- c = 0
- for j in range(len(T)):
- if S[i + j] != T[j]:
- c += 1
- result = min(result, c)
- print(result)
|
- S = input()
- T = input()
- result = float('inf')
for i in range(len(S) - len(T)):
- for i in range(len(S) - len(T) + 1):
- c = 0
- for j in range(len(T)):
if S[i + j] != T[j]:
- if S[i + j]!= T[j]:
- c += 1
- result = min(result, c)
- print(result)
|
true
|
|
#178476
|
- li = list(input())
- sum_ = 0
- for val in li:
- sum_ += int(val)
- if sum_%9 == 0:
print('YES')
- print('Yes')
- else:
print('NO')
- print('No')
|
- li = list(input())
- sum_ = 0
- for val in li:
- sum_ += int(val)
if sum_%9 == 0:
print('YES')
- if sum_ % 9 == 0:
- print('Yes')
- else:
print('NO')
- print('No')
|
true
|
|
#189827
|
- N, D=map(int, input().split())
- ans=0
- for i in range(N):
- x,y=map(int, input().split())
- if x**2 +y**2 <=D**2:
ans +=1
- ans +=1
- print(ans)
|
- N, D=map(int, input().split())
- ans=0
- for i in range(N):
- x,y=map(int, input().split())
- if x**2 +y**2 <=D**2:
ans +=1
- ans +=1
- print(ans)
|
true
|
|
#190141
|
- #include <bits/stdc++.h>
- #define rep(a, b, c) for (int a = b; a <= c; a++)
- #define per(a, b, c) for (int a = b; a >= c; a--)
- #define ios \
- ; \
- ios::sync_with_stdio(false); \
- cin.tie(0);
- #define pb push_back
- #define mk make_pair
- #define fi first
- #define se second
- #define mem(a, b) memset(a, b, sizeof(a))
- #define inf 0x3f3f3f3f
- #define ls(x) (x << 1)
- #define rs(x) (ls(x) | 1)
- #define eps 1e-11
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef pair<ll, ll> pll;
- typedef pair<int, int> pii;
- typedef vector<int> VI;
- typedef double db;
- mt19937 rnd(random_device{}());
- const int mod = 1e9 + 7;
- const int N = 1e6 + 5;
- const int M = 1e3 + 5;
- inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
- inline ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
- inline ll ksm(ll x, ll y) {
- ll res = 1;
- while (y) {
- if (y & 1)
- res = res * x % mod;
- x = x * x % mod;
- y >>= 1;
- }
- return res;
- }
- ll n, m, k;
- int main() {
- ios;
- ll ans = 0;
- cin >> n >> k;
- rep(i, 1, n) {
int x, y;
- ll x, y;
- cin >> x >> y;
if (x * x + y * y >= k * k)
- if (x * x + y * y <= k * k)
- ++ans;
- }
- cout << ans;
- return 0;
- }
|
- #include <bits/stdc++.h>
- #define rep(a, b, c) for (int a = b; a <= c; a++)
- #define per(a, b, c) for (int a = b; a >= c; a--)
- #define ios \
- ; \
- ios::sync_with_stdio(false); \
- cin.tie(0);
- #define pb push_back
- #define mk make_pair
- #define fi first
- #define se second
- #define mem(a, b) memset(a, b, sizeof(a))
- #define inf 0x3f3f3f3f
- #define ls(x) (x << 1)
- #define rs(x) (ls(x) | 1)
- #define eps 1e-11
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef pair<ll, ll> pll;
- typedef pair<int, int> pii;
- typedef vector<int> VI;
- typedef double db;
- mt19937 rnd(random_device{}());
- const int mod = 1e9 + 7;
- const int N = 1e6 + 5;
- const int M = 1e3 + 5;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
- inline ll gcd(ll a, ll b) { return b? gcd(b, a % b) : a; }
- inline ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
- inline ll ksm(ll x, ll y) {
- ll res = 1;
- while (y) {
- if (y & 1)
- res = res * x % mod;
- x = x * x % mod;
- y >>= 1;
- }
- return res;
- }
- ll n, m, k;
- int main() {
- ios;
- ll ans = 0;
- cin >> n >> k;
- rep(i, 1, n) {
int x, y;
- ll x, y;
- cin >> x >> y;
if (x * x + y * y >= k * k)
- if (x * x + y * y <= k * k)
- ++ans;
- }
cout << ans;
- cout << ans << endl;
- return 0;
- }
|
true
|
|
#191556
|
- # k = int(input())
- K = input()
- k = int(K)
- # if k%2 == 0:
- # print(-1)
- # exit()
- # r7 = 7%k
- r = 0
for i in range(1,k):
- for i in range(1,k*10):
- r = (r*10 + 7)%k
- # print('r {} i {}'.format(r,i))
- if r == 0:
- print(i)
- exit()
- # print(n)
- print(-1)
|
- # k = int(input())
- K = input()
- k = int(K)
- # if k%2 == 0:
- # print(-1)
- # exit()
- # r7 = 7%k
- r = 0
for i in range(1,k):
- for i in range(1,k+1):
- r = (r*10 + 7)%k
- # print('r {} i {}'.format(r,i))
- if r == 0:
- print(i)
- exit()
- # print(n)
- print(-1)
|
true
|
Tested for all k up to 9999
|
#199414
|
- #include <iostream>
- #include <vector>
- using namespace std;
- int main() {
- int N;
- cin >> N;
- vector<int> vec(N);
- for (int i = 0; i < N; i++) {
- cin >> vec.at(i);
- }
- int count = 0;
for (int i = 0; i < N; i++) {
if (i + 1 % 2 == 1 && vec.at(i) % 2 == 1) {
- for (int i = 1; i <= N; i++) {
- if (i % 2 == 1 && vec.at(i - 1) % 2 == 1) {
- count++;
- }
- }
- cout << count << endl;
- }
|
- #include <iostream>
- #include <vector>
- using namespace std;
- int main() {
- int N;
- cin >> N;
- vector<int> vec(N);
- for (int i = 0; i < N; i++) {
- cin >> vec.at(i);
- }
- int count = 0;
- for (int i = 0; i < N; i++) {
if (i + 1 % 2 == 1 && vec.at(i) % 2 == 1) {
- if ((i + 1) % 2 == 1 && vec.at(i) % 2 == 1) {
- count++;
- }
- }
- cout << count << endl;
- }
|
true
|
|
#203845
|
- ma = 1000
- given = int(input())
- c = given%ma
- if(c == 0):
- print(0)
- else:
print(c-1000)
- print(abs((c-1000)))
|
- ma = 1000
- given = int(input())
- c = given%ma
- if(c == 0):
- print(0)
- else:
print(c-1000)
- print(1000-c)
|
true
|
|
#21778
|
- #include <stdio.h>
- int main() {
- int input;
- int i, ans, power5;
- while (1) {
- scanf("%d", &input);
- if (input == 0)
- break;
- ans = 0;
- power5 = 1;
- for (i = 1; (power5 *= 5) <= input; i++) {
- ans += input / power5;
- }
printf("%d", ans);
- printf("%d\n", ans);
- }
- return 0;
- }
|
- #include <stdio.h>
- int main() {
int input;
int i, ans, power5;
- long int input;
- long int i, ans, power5;
- while (1) {
scanf("%d", &input);
- scanf("%ld", &input);
- if (input == 0)
- break;
- ans = 0;
- power5 = 1;
- for (i = 1; (power5 *= 5) <= input; i++) {
- ans += input / power5;
- }
printf("%d", ans);
- printf("%ld\n", ans);
- }
- return 0;
- }
|
true
|
|
#22270
|
- while l = gets do
- c1,c2,c3 = l.split.map(&:to_i)
- cards = (1..10).to_a
- cards.delete(c1)
- cards.delete(c2)
- cards.delete(c3)
p cards
- rest = 20-(c1+c2)
- puts cards.select{|x| x>rest}.size > 3 ? "NO" : "YES"
- end
|
- while l = gets do
- c1,c2,c3 = l.split.map(&:to_i)
- cards = (1..10).to_a
- cards.delete(c1)
- cards.delete(c2)
- cards.delete(c3)
p cards
- rest = 20-(c1+c2)
puts cards.select{|x| x>rest}.size > 3 ? "NO" : "YES"
- puts cards.select{|x| x>rest}.size > 3? "NO" : "YES"
- end
|
true
|
|
#224216
|
- package main
- import (
- "fmt"
- )
- func main() {
- var x, n int
- fmt.Scan(&x, &n)
-
- p := make(map[int]bool)
-
- num := 0
- for i := 0; i < n; i++ {
- fmt.Scan(&num)
- p[num] = true
- }
-
min := 1000
- min := 101
- ans := 101
for j := 100; j >= 0; j-- {
- for j := 101; j >= 0; j-- {
- if !p[j] {
- abs := Abs(x, j)
- if min >= abs {
- min = abs
- ans = j
- }
- }
- }
- fmt.Println(ans)
- }
- func Abs(num1, num2 int)int {
- if num1 < num2 {
- return num2 - num1
- }
- return num1 - num2
- }
|
- package main
- import (
- "fmt"
- )
- func main() {
- var x, n int
- fmt.Scan(&x, &n)
-
- p := make(map[int]bool)
-
- num := 0
- for i := 0; i < n; i++ {
- fmt.Scan(&num)
- p[num] = true
- }
-
- min := 1000
- ans := 101
for j := 100; j >= 0; j-- {
if !p[j] {
- for j := 101; j >= 0; j-- {
- if!p[j] {
- abs := Abs(x, j)
- if min >= abs {
- min = abs
- ans = j
- }
- }
- }
- fmt.Println(ans)
- }
- func Abs(num1, num2 int)int {
- if num1 < num2 {
- return num2 - num1
- }
- return num1 - num2
- }
|
true
|
|
#229907
|
- A, V = gets.split.map(&:to_i)
- B, W = gets.split.map(&:to_i)
- T = gets.to_i
- if A < B
print A+(V*T) > B+(W*T) ? "YES" : "NO"
- print A+(V*T) >= B+(W*T) ? "YES" : "NO"
- else
print A-(V*T) < B-(W*T) ? "YES" : "NO"
- print A-(V*T) <= B-(W*T) ? "YES" : "NO"
- end
|
- A, V = gets.split.map(&:to_i)
- B, W = gets.split.map(&:to_i)
- T = gets.to_i
- if A < B
print A+(V*T) > B+(W*T) ? "YES" : "NO"
- print A+(V*T) >= B+(W*T)? "YES" : "NO"
- else
print A-(V*T) < B-(W*T) ? "YES" : "NO"
- print A-(V*T) <= B-(W*T)? "YES" : "NO"
- end
|
true
|
|
#230023
|
- a,v = map(int,input().split())
- b,w = map(int,input().split())
- t = int(input())
if (v-w)*t >= b-a:
- if (v-w)*t >= abs(a-b):
- print('YES')
- else:
- print('NO')
|
- a,v = map(int,input().split())
- b,w = map(int,input().split())
- t = int(input())
if (v-w)*t >= b-a:
- if (v-w)*t >= abs(b-a):
- print('YES')
- else:
- print('NO')
|
true
|
|
#239859
|
- import java.util.Scanner;
- public class Main {
- public static void main(String args[]) {
- Scanner sc = new Scanner(System.in);
- long A = sc.nextLong();
- double B = sc.nextDouble();
long b = (long)(B * 100.0);
- long b = (long)((B * 100.0) + 0.5);
- final long ans = A * b;
- String ansstr = String.valueOf(ans);
- if (ansstr.length() <= 2) {
- System.out.println("0");
- } else {
- System.out.println(ansstr.substring(0, ansstr.length() - 2));
- }
- }
- }
|
- import java.util.Scanner;
- public class Main {
- public static void main(String args[]) {
- Scanner sc = new Scanner(System.in);
- long A = sc.nextLong();
- double B = sc.nextDouble();
long b = (long)(B * 100.0);
- long b = (long)(B * 100.0 + 0.5);
- final long ans = A * b;
- String ansstr = String.valueOf(ans);
- if (ansstr.length() <= 2) {
- System.out.println("0");
- } else {
- System.out.println(ansstr.substring(0, ansstr.length() - 2));
- }
- }
- }
|
true
|
|
#248308
|
- /*ex4_2
- ryo_1129*/
- #include <math.h>
- #include <stdio.h>
- double distance(int length_hour, int length_minute, double rad);
- int main(void) {
- //変数宣言
- int A, B, H, M;
- double radlong, radshort, rad, length;
- //入力
- scanf("%d %d %d %d", &A, &B, &H, &M);
- //演習率πを決める。
- const double pi = 3.14159265358979;
- //時針、分針を求める。
- radlong = 2 * pi * M / 60;
- radshort = 2 * pi * (H * 60 + M) / 720;
- //角度の差を求める
- rad = radlong - radshort;
- //出力
- length = distance(A, B, rad);
printf("%lf
", length);
- printf("%.9f
- ", length);
- return 0;
- }
- double distance(int length_hour, int length_minute, double rad) {
- double length;
- length = sqrt(pow(length_hour, 2) + pow(length_minute, 2) -
- 2 * length_hour * length_minute * cos(rad));
- return length;
- }
|
- /*ex4_2
- ryo_1129*/
- #include <math.h>
- #include <stdio.h>
- double distance(int length_hour, int length_minute, double rad);
- int main(void) {
- //変数宣言
- int A, B, H, M;
- double radlong, radshort, rad, length;
- //入力
- scanf("%d %d %d %d", &A, &B, &H, &M);
- //演習率πを決める。
- const double pi = 3.14159265358979;
- //時針、分針を求める。
- radlong = 2 * pi * M / 60;
- radshort = 2 * pi * (H * 60 + M) / 720;
- //角度の差を求める
- rad = radlong - radshort;
- //出力
- length = distance(A, B, rad);
printf("%lf
", length);
- printf("%.10lf
- ", length);
- return 0;
- }
- double distance(int length_hour, int length_minute, double rad) {
- double length;
- length = sqrt(pow(length_hour, 2) + pow(length_minute, 2) -
- 2 * length_hour * length_minute * cos(rad));
- return length;
- }
|
true
|
|
#253814
|
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- long long a, b, c, k;
- cin >> a >> b >> c >> k;
- long long suma = 0;
- if (k > a) {
- suma += a;
- k -= a;
- } else {
cout << a << endl;
- cout << k << endl;
- return 0;
- }
- if (k > b) {
- k -= b;
- } else {
cout << suma << endl;
- cout << a << endl;
- return 0;
- }
- if (k <= c) {
- suma -= k;
- cout << suma << endl;
- return 0;
- }
return 0;
- // return 0;
- }
|
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- long long a, b, c, k;
- cin >> a >> b >> c >> k;
- long long suma = 0;
- if (k > a) {
- suma += a;
- k -= a;
- } else {
cout << a << endl;
- cout << k << endl;
- return 0;
- }
- if (k > b) {
- k -= b;
- } else {
- cout << suma << endl;
- return 0;
- }
- if (k <= c) {
- suma -= k;
- cout << suma << endl;
- return 0;
- }
- return 0;
- }
|
true
|
Randomized testing found no input where suma != a, s.t. the attempted fix seems correct.
|
#263281
|
- #include <algorithm>
- #include <cassert>
- #include <cmath>
- #include <cstring>
- #include <iomanip>
- #include <iostream>
- #include <map>
- #include <queue>
- #include <set>
- #include <stack>
- #include <unordered_map>
- #include <vector>
- using namespace std;
- #define pb push_back
- #define FAST_IO \
- ios_base::sync_with_stdio(false); \
- cin.tie(0); \
- cout.tie(0);
- template <typename T, typename S>
- ostream &operator<<(ostream &os, pair<T, S> input) {
- os << "(" << input.first << ", " << input.second << ")";
- return os;
- }
- template <typename T> ostream &operator<<(ostream &os, vector<T> input) {
- for (auto t : input)
- os << t << " ";
- return os;
- }
- template <typename T> ostream &operator<<(ostream &os, set<T> input) {
- for (auto t : input)
- os << t << " ";
- return os;
- }
- int h[100002];
- int a[100002];
- int main() {
- int n, m;
- cin >> n >> m;
- for (int i = 1; i <= n; i++) {
- cin >> h[i];
- }
for (int i = 1; i <= n; i++) {
- for (int i = 1; i <= m; i++) {
- int x, y;
- cin >> x >> y;
- a[x] = max(a[x], h[y]);
- a[y] = max(a[y], h[x]);
- }
- int ans = 0;
- for (int i = 1; i <= n; i++) {
if (h[i] > a[i])
- if (h[i] > a[i]) {
- // cout << i << " ";
- ans++;
- }
- }
- // cout << "\n";
- cout << ans << "\n";
- return 0;
- }
|
- #include <algorithm>
- #include <cassert>
- #include <cmath>
- #include <cstring>
- #include <iomanip>
- #include <iostream>
- #include <map>
- #include <queue>
- #include <set>
- #include <stack>
- #include <unordered_map>
- #include <vector>
- using namespace std;
- #define pb push_back
- #define FAST_IO \
- ios_base::sync_with_stdio(false); \
- cin.tie(0); \
- cout.tie(0);
- template <typename T, typename S>
- ostream &operator<<(ostream &os, pair<T, S> input) {
- os << "(" << input.first << ", " << input.second << ")";
- return os;
- }
- template <typename T> ostream &operator<<(ostream &os, vector<T> input) {
- for (auto t : input)
- os << t << " ";
- return os;
- }
- template <typename T> ostream &operator<<(ostream &os, set<T> input) {
- for (auto t : input)
- os << t << " ";
- return os;
- }
- int h[100002];
- int a[100002];
- int main() {
- int n, m;
- cin >> n >> m;
- for (int i = 1; i <= n; i++) {
- cin >> h[i];
- }
for (int i = 1; i <= n; i++) {
- for (int i = 1; i <= m; i++) {
- int x, y;
- cin >> x >> y;
- a[x] = max(a[x], h[y]);
- a[y] = max(a[y], h[x]);
- }
- int ans = 0;
- for (int i = 1; i <= n; i++) {
- if (h[i] > a[i])
- ans++;
- }
- cout << ans << "\n";
- return 0;
- }
|
true
|
|
#27056
|
- def operation_of_foa(input_seq, times)
- operated_seq = Array.new
- count_seq = Hash.new
- input_seq.each do |n|
- if count_seq.has_key?(n)
- count_seq[n] += 1
- else
- count_seq[n] = 1
- end
- end
- input_seq.each do |n|
- operated_seq << count_seq[n]
- end
- if operated_seq == input_seq
return [operated_seq, times]
- return [operated_seq, times-1]
- else
- operation_of_foa(operated_seq, times+1)
- end
- end
- def print_seq(seq_times)
- puts seq_times.last
- seq_times.first.each.with_index { |x,i| print (i.zero? ? x : " #{x}") }
- puts ""
- end
- while gets
- n = $_.to_i
- break if n == 0
- input_seq = gets.chomp.split.map(&:to_i)
- print_seq(operation_of_foa(input_seq, 1))
- end
|
- def operation_of_foa(input_seq, times)
- operated_seq = Array.new
- count_seq = Hash.new
- input_seq.each do |n|
- if count_seq.has_key?(n)
- count_seq[n] += 1
- else
- count_seq[n] = 1
- end
- end
- input_seq.each do |n|
- operated_seq << count_seq[n]
- end
- if operated_seq == input_seq
- return [operated_seq, times]
- else
- operation_of_foa(operated_seq, times+1)
- end
- end
- def print_seq(seq_times)
- puts seq_times.last
seq_times.first.each.with_index { |x,i| print (i.zero? ? x : " #{x}") }
- seq_times.first.each.with_index { |x,i| print (i.zero?? x : " #{x}") }
- puts ""
- end
- while gets
- n = $_.to_i
- break if n == 0
- input_seq = gets.chomp.split.map(&:to_i)
print_seq(operation_of_foa(input_seq, 1))
- print_seq(operation_of_foa(input_seq, 0))
- end
|
false
|
|
#290705
|
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
int a, b;
- long long a;
- long long b;
- cin >> a;
- b = 0;
- for (int i = 1; i <= a; i++) {
- if (i % 3 > 0 && i % 5 > 0) {
- b = b + i;
- }
- }
- cout << b << endl;
- }
|
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
int a, b;
- long long a, b;
- cin >> a;
- b = 0;
- for (int i = 1; i <= a; i++) {
- if (i % 3 > 0 && i % 5 > 0) {
- b = b + i;
- }
- }
- cout << b << endl;
- }
|
true
|
|
#291793
|
- N=int(input())
- ans = 0
for i in range(N):
- for i in range(N+1):
- if i % 3 != 0 and i % 5 != 0:
- ans+=i
- print(ans)
|
- N=int(input())
- ans = 0
for i in range(N):
if i % 3 != 0 and i % 5 != 0:
- for i in range(1,N+1):
- if i % 3!= 0 and i % 5!= 0:
- ans+=i
- print(ans)
|
true
|
|
#297006
|
- n, m = map(int, input().split())
- A = list(map(int, input().split()))
l = int(sum(A)/(4*m))
- l = sum(A)/(4*m)
- cnt = 0
- for a in A:
- if a >= l:
- cnt += 1
- print("Yes" if cnt >= m else "No")
|
- n, m = map(int, input().split())
- A = list(map(int, input().split()))
l = int(sum(A)/(4*m))
- l = sum(A)/(4*m)
- cnt = 0
- for a in A:
- if a >= l:
- cnt += 1
-
- print("Yes" if cnt >= m else "No")
|
true
|
|
#302686
|
- k=int(input())
- list=[1,2,3,4,5,6,7,8,9]
- for i in range(k-1):
- m=list[i]
- n=m*10+m%10
- if m%10!=0:
list.append(m-1)
list.append(m)
- list.append(n-1)
- list.append(n)
- if m%10!=9:
list.append(m+1)
- list.append(n+1)
- print(list[k-1])
|
- k=int(input())
- list=[1,2,3,4,5,6,7,8,9]
for i in range(k-1):
- for i in range(k):
- m=list[i]
- n=m*10+m%10
if m%10!=0:
list.append(m-1)
list.append(m)
if m%10!=9:
list.append(m+1)
- if n%10!=0:
- list.append(n-1)
- list.append(n)
- if n%10!=9:
- list.append(n+1)
- print(list[k-1])
|
true
|
Random testing: both output the same
|
#312231
|
- def m( s ):
length = int(s / 3)
- length = s / 3
- s -= length
- breadth = s / 2
- height = s - breadth
- return (length * breadth * height)
- x=int(input())
- print("{:.6f}".format(m(x)))
|
- def m( s ):
length = int(s / 3)
- length = float(s / 3)
- s -= length
- breadth = s / 2
- height = s - breadth
- return (length * breadth * height)
- x=int(input())
- print("{:.6f}".format(m(x)))
|
true
|
|
#318467
|
- import sys
- import itertools
- input = sys.stdin.readline
- sys.setrecursionlimit(100000)
- def read_values():
- return map(int, input().split())
- def read_index():
- return map(lambda x: x - 1, map(int, input().split()))
- def read_list():
- return list(read_values())
- def read_lists(N):
- return [read_list() for n in range(N)]
- def functional(N, mod):
- F = [1] * (N + 1)
- for i in range(N):
- F[i + 1] = (i + 1) * F[i] % mod
- return F
- def main():
- H, W = read_values()
- if H == 1 or W == 1:
- print(1)
print((H * W + 1) // 2)
- else:
- print((H * W + 1) // 2)
- if __name__ == "__main__":
- main()
|
- import sys
- import itertools
- input = sys.stdin.readline
- sys.setrecursionlimit(100000)
- def read_values():
- return map(int, input().split())
- def read_index():
- return map(lambda x: x - 1, map(int, input().split()))
- def read_list():
- return list(read_values())
- def read_lists(N):
- return [read_list() for n in range(N)]
- def functional(N, mod):
- F = [1] * (N + 1)
- for i in range(N):
- F[i + 1] = (i + 1) * F[i] % mod
- return F
- def main():
- H, W = read_values()
- if H == 1 or W == 1:
- print(1)
- exit()
- print((H * W + 1) // 2)
- if __name__ == "__main__":
- main()
|
true
|
|
#320996
|
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- typedef pair<int, int> P;
- int main() {
- string s;
- cin >> s;
for (int i = 0; i < s.size() - 1; i += 2) {
- for (int i = 0; i < s.size(); i += 2) {
- if (s[i] != 'h' || s[i + 1] != 'i') {
- cout << "No" << endl;
- return 0;
- ;
- }
- }
- cout << "Yes" << endl;
- return 0;
- }
|
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- typedef pair<int, int> P;
- int main() {
- string s;
- cin >> s;
for (int i = 0; i < s.size() - 1; i += 2) {
if (s[i] != 'h' || s[i + 1] != 'i') {
- for (int i = 0; i < s.size(); i += 2) {
- if (s[i]!= 'h' || s[i + 1]!= 'i') {
- cout << "No" << endl;
- return 0;
- ;
- }
- }
- cout << "Yes" << endl;
- return 0;
- }
|
true
|
|
#327659
|
- A, B = map(int, input().split())
for i in range(1000):
- for i in range(1010):
- if int(i * 0.08) == A and int(i * 0.1) == B:
- print(i)
- break;
if i == 999:
- if i == 1009:
- print(-1)
|
- A, B = map(int, input().split())
for i in range(1000):
- for i in range(1001):
- if int(i * 0.08) == A and int(i * 0.1) == B:
- print(i)
- break;
if i == 999:
- if i == 1000:
- print(-1)
|
true
|
|
#328944
|
- #include <iostream>
- using namespace std;
- #define REP(i, n) for (int i = 0; i < (n); ++i)
- int main(void) {
- int a, b, ans = -1;
- cin.tie(0);
- ios::sync_with_stdio(false);
- cin >> a >> b;
REP(i, 100 + 1) {
- REP(i, 1000 + 1) {
- int price_a = i * 0.08, price_b = i * 0.10;
- if (price_a == a && price_b == b) {
- ans = i;
- break;
- }
- }
- cout << ans << "\n";
- return 0;
- }
|
- #include <iostream>
- using namespace std;
- #define REP(i, n) for (int i = 0; i < (n); ++i)
- int main(void) {
- int a, b, ans = -1;
- cin.tie(0);
- ios::sync_with_stdio(false);
- cin >> a >> b;
REP(i, 100 + 1) {
- REP(i, 10000 + 1) {
- int price_a = i * 0.08, price_b = i * 0.10;
- if (price_a == a && price_b == b) {
- ans = i;
- break;
- }
- }
- cout << ans << "\n";
- return 0;
- }
|
true
|
|
#341637
|
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- long long int n, i, x[300] = {0}, p = 0, k, m = 0;
- cin >> n;
- for (i = 0; i < n; i++) {
- cin >> x[i];
- m += x[i];
- }
k = ceil(m * 1.00 / n);
// cout<<k<<endl;
- k = round(m * 1.00 / n);
- for (i = 0; i < n; i++) {
- p += ((x[i] - k) * (x[i] - k));
- }
- cout << p << endl;
- return 0;
- }
|
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- long long int n, i, x[300] = {0}, p = 0, k, m = 0;
- cin >> n;
- for (i = 0; i < n; i++) {
- cin >> x[i];
- m += x[i];
- }
k = ceil(m * 1.00 / n);
- k = round(m * 1.00 / n);
- // cout<<k<<endl;
- for (i = 0; i < n; i++) {
- p += ((x[i] - k) * (x[i] - k));
- }
- cout << p << endl;
- return 0;
- }
|
true
|
|
#342861
|
- #include <bits/stdc++.h>
- using namespace std;
- int main(void) {
- int A, B, C;
- cin >> A >> B >> C;
- if (A == B && A != C) {
cout << "yes" << endl;
- cout << "Yes" << endl;
- } else if (A == C && A != B) {
cout << "yes" << endl;
- cout << "Yes" << endl;
- } else if (B == C && B != A) {
cout << "yes" << endl;
- cout << "Yes" << endl;
- } else {
cout << "no" << endl;
- cout << "No" << endl;
- }
- return 0;
- }
|
- #include <bits/stdc++.h>
- using namespace std;
- int main(void) {
- int A, B, C;
- cin >> A >> B >> C;
if (A == B && A != C) {
cout << "yes" << endl;
} else if (A == C && A != B) {
cout << "yes" << endl;
} else if (B == C && B != A) {
cout << "yes" << endl;
- if (A == B && A!= C) {
- cout << "Yes" << endl;
- } else if (A == C && A!= B) {
- cout << "Yes" << endl;
- } else if (B == C && B!= A) {
- cout << "Yes" << endl;
- } else {
cout << "no" << endl;
- cout << "No" << endl;
- }
- return 0;
- }
|
true
|
|
#344157
|
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int a[3];
- cin >> a[0] >> a[1] >> a[2];
- sort(a, a + 3);
- if ((a[0] == a[1] && a[0] != a[2]) || (a[1] == a[2] && a[0] != a[1])) {
cout << "YES";
- cout << "Yes";
- } else {
cout << "NO";
- cout << "No";
- }
- // cout<<a[0]<<a[1]<<a[2];
- return 0;
- }
|
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int a[3];
- cin >> a[0] >> a[1] >> a[2];
- sort(a, a + 3);
if ((a[0] == a[1] && a[0] != a[2]) || (a[1] == a[2] && a[0] != a[1])) {
cout << "YES";
- if ((a[0] == a[1] && a[0]!= a[2]) || (a[1] == a[2] && a[0]!= a[1])) {
- cout << "Yes";
- } else {
cout << "NO";
- cout << "No";
- }
- return 0;
- }
|
true
|
|
#345290
|
- #include <algorithm>
- #include <cmath>
- #include <cstdio>
- #include <cstring>
- #include <iostream>
- #include <stdio.h>
- using namespace std;
- int main() {
- int n, x[110];
- bool b = 1;
- cin >> n;
- for (int i = 1; i <= n; i++)
- cin >> x[i];
- for (int i = 1; i <= n; i++)
- if (x[i] % 2 == 0) {
if (x[i] % 3 != 0 && x[i] % 5 != 0)
- if (x[i] % 3 != 0 && x[i] % 5 != 0) {
- b = 0, cout << "DENIED";
- break;
- }
- }
- if (b)
- cout << "APPROVED";
- return 0;
- }
|
- #include <algorithm>
- #include <cmath>
- #include <cstdio>
- #include <cstring>
- #include <iostream>
- #include <stdio.h>
- using namespace std;
- int main() {
- int n, x[110];
- bool b = 1;
- cin >> n;
- for (int i = 1; i <= n; i++)
- cin >> x[i];
- for (int i = 1; i <= n; i++)
- if (x[i] % 2 == 0) {
if (x[i] % 3 != 0 && x[i] % 5 != 0)
- if (x[i] % 3!= 0 && x[i] % 5!= 0) {
- b = 0, cout << "DENIED";
- break;
- }
- }
- if (b)
- cout << "APPROVED";
- return 0;
- }
|
true
|
|
#348147
|
s = gets.chomp.split
- s = gets.chomp.split('')
- s.map!{|e| e = "x"}
- puts s.join
|
s = gets.chomp.split
- s = gets.chomp.split("")
- s.map!{|e| e = "x"}
- puts s.join
|
true
|
|
#361136
|
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int N;
- cin >> N;
- vector<vector<int>> c(9, vector<int>(9)); // 1~Nでcij先頭1末尾jの数字の数
- string tmp;
for (int i = 0; i < N; i++) {
- for (int i = 1; i < N + 1; i++) {
- tmp = to_string(i);
- if (i % 10 != 0)
- c[int(tmp[0] - '0') - 1][i % 10 - 1]++;
- }
- int ans = 0;
- for (int i = 0; i < 9; i++) {
- for (int j = 0; j < 9; j++) {
- ans += c[i][j] * c[j][i];
- }
- }
- cout << ans << endl;
- return 0;
- }
|
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int N;
- cin >> N;
- vector<vector<int>> c(9, vector<int>(9)); // 1~Nでcij先頭1末尾jの数字の数
- string tmp;
for (int i = 0; i < N; i++) {
- for (int i = 1; i <= N; i++) {
- tmp = to_string(i);
if (i % 10 != 0)
- if (i % 10!= 0)
- c[int(tmp[0] - '0') - 1][i % 10 - 1]++;
- }
- int ans = 0;
- for (int i = 0; i < 9; i++) {
- for (int j = 0; j < 9; j++) {
- ans += c[i][j] * c[j][i];
- }
- }
- cout << ans << endl;
- return 0;
- }
|
true
|
|
#362329
|
- <?php
- fscanf(STDIN, "%d", $h);
- fscanf(STDIN, "%d", $w);
- fscanf(STDIN, "%d", $n);
- $array = [$h, $w];
$max = max($h, $w);
$ans = floor($n / $max);
- $max = max($array);
- $ans = ceil($n / $max);
- if($ans > 0){
- echo $ans;
- }else{
- echo 1;
- }
- ?>
|
- <?php
- fscanf(STDIN, "%d", $h);
- fscanf(STDIN, "%d", $w);
- fscanf(STDIN, "%d", $n);
- $array = [$h, $w];
- $max = max($h, $w);
$ans = floor($n / $max);
- $ans = ceil($n / $max);
- if($ans > 0){
- echo $ans;
- }else{
- echo 1;
- }
- ?>
|
true
|
|
#383717
|
- a1,a2,a3 = gets.chomp.split(" ").map(&:to_i)
- sum = a1+a2+a3
- if sum > 21
p "bust"
- puts("bust")
- else
p "win"
- puts("win")
- end
|
- a1,a2,a3 = gets.chomp.split(" ").map(&:to_i)
- sum = a1+a2+a3
- if sum > 21
p "bust"
- puts "bust"
- else
p "win"
- puts "win"
- end
|
true
|
|
#384698
|
- s = list(input())
- length = len(s)
ans = 0
print(s)
- ans= 0
- for i in range(len(s)//2):
- if s[i] != s[-i-1]:
- ans += 1
- print(ans)
|
- s = list(input())
- length = len(s)
- ans = 0
print(s)
- for i in range(len(s)//2):
if s[i] != s[-i-1]:
- if s[i]!= s[-i-1]:
- ans += 1
- print(ans)
|
true
|
|
#388898
|
- import java.util.Scanner;
- public class Main {
- public static void main(final String[] args) {
- final Scanner scanner = new Scanner(System.in);
- final int n = scanner.nextInt();
for (int i = 0; i < n; i++) {
if (n == (int)((double)i * 1.08)) {
- for (int i = 0; i <= n; i++) {
- if (n == (int)((double)i * 1.08d)) {
- System.out.println(i);
- return;
- }
- }
- System.out.println(":(");
- }
- }
|
- import java.util.Scanner;
- public class Main {
- public static void main(final String[] args) {
- final Scanner scanner = new Scanner(System.in);
- final int n = scanner.nextInt();
for (int i = 0; i < n; i++) {
- for (int i = 0; i <= n; i++) {
- if (n == (int)((double)i * 1.08)) {
- System.out.println(i);
- return;
- }
- }
- System.out.println(":(");
- }
- }
|
true
|
|
#407740
|
- import sys
- import math
- N = int(input())
- sqrt = math.sqrt(N)
- ls = []
- for i in range(1, int(sqrt) + 1):
- if N % i == 0:
- ls.append((i, int(N/i)))
print(ls)
- print(min(a[0] + a[1] -2 for a in ls))
|
- import sys
- import math
- N = int(input())
- sqrt = math.sqrt(N)
- ls = []
- for i in range(1, int(sqrt) + 1):
- if N % i == 0:
- ls.append((i, int(N/i)))
print(ls)
- print(min(a[0] + a[1] -2 for a in ls))
|
true
|
|
#408322
|
- #include <bits/stdc++.h>
- #define rep(i, n) for (int i = 0; i < n; i++)
- using namespace std;
- typedef long long ll;
- int main() {
- int a, b, x;
- cin >> a >> b >> x;
- double v = a * a * b;
- if (x <= v / 2) {
double t = a * b * b / (2 * x);
- double t = double(a * b * b) / (2 * x);
- cout << fixed << setprecision(10) << double(atan(t)) / M_PI * 180 << endl;
- } else {
- double y = 2 * b * (1 - x / v);
- double t = y / a;
- cout << fixed << setprecision(10) << double(atan(t)) / M_PI * 180 << endl;
- }
- }
|
- #include <bits/stdc++.h>
- #define rep(i, n) for (int i = 0; i < n; i++)
- using namespace std;
- typedef long long ll;
- int main() {
int a, b, x;
- double a, b, x;
- cin >> a >> b >> x;
- double v = a * a * b;
- if (x <= v / 2) {
- double t = a * b * b / (2 * x);
- cout << fixed << setprecision(10) << double(atan(t)) / M_PI * 180 << endl;
- } else {
- double y = 2 * b * (1 - x / v);
- double t = y / a;
- cout << fixed << setprecision(10) << double(atan(t)) / M_PI * 180 << endl;
- }
- }
|
true
|
|
#427161
|
- S = input()
- T = input()
judgelist = []
- judgelist = [0]
- if S[0] == T[0]:
- judgelist.append(1)
- if S[1] == T[1]:
- judgelist.append(1)
if S[2] == S[2]:
- if S[2] == T[2]:
- judgelist.append(1)
- print(sum(judgelist))
|
- S = input()
- T = input()
- judgelist = []
- if S[0] == T[0]:
- judgelist.append(1)
- if S[1] == T[1]:
- judgelist.append(1)
if S[2] == S[2]:
- if S[2] == T[2]:
- judgelist.append(1)
- print(sum(judgelist))
|
true
|
|
#427268
|
- S = gets.split("")
- T = gets.split("")
p S
p T
- sum = 0
- 3.times do |x|
- sum += 1 if S[x] == T[x]
- end
- p sum
|
- S = gets.split("")
- T = gets.split("")
p S
p T
- sum = 0
- 3.times do |x|
- sum += 1 if S[x] == T[x]
- end
- p sum
|
true
|
|
#428471
|
- #include <bits/stdc++.h>
- #define rep(i, n) for (int i = 0; i < (int)(n); i++)
- using namespace std;
- typedef long long int ll;
- typedef pair<int, int> P;
- template <class T> bool chmax(T &a, const T &b) {
- if (a < b) {
- a = b;
- return 1;
- }
- return 0;
- }
- template <class T> bool chmin(T &a, const T &b) {
- if (b < a) {
- a = b;
- return 1;
- }
- return 0;
- }
- int a, b;
- int main() {
- cin >> a >> b;
- int cnt = 1, num = a;
- while (num < b) {
- num += a - 1;
- cnt++;
- }
- if (b == 1)
cnt = 1;
- cnt = 0;
- cout << cnt << endl;
- }
|
- #include <bits/stdc++.h>
- #define rep(i, n) for (int i = 0; i < (int)(n); i++)
- using namespace std;
- typedef long long int ll;
- typedef pair<int, int> P;
- template <class T> bool chmax(T &a, const T &b) {
- if (a < b) {
- a = b;
- return 1;
- }
- return 0;
- }
- template <class T> bool chmin(T &a, const T &b) {
- if (b < a) {
- a = b;
- return 1;
- }
- return 0;
- }
- int a, b;
- int main() {
- cin >> a >> b;
int cnt = 1, num = a;
- int cnt = 0, num = 1;
- while (num < b) {
- num += a - 1;
- cnt++;
- }
- if (b == 1)
cnt = 1;
- cnt = 0;
- cout << cnt << endl;
- }
|
true
|
Confirmed equivalence with random testing
|
#432384
|
- #include <bits/stdc++.h>
- using namespace std;
- #define all(x) (x).begin(), (x).end()
- #define rall(x) (x).rbegin(), (x).rend()
- #define pb push_back
- typedef long long ll;
- typedef pair<int, int> pii;
- typedef vector<int> vi;
- int main() {
- int n;
- cin >> n;
cout << n * (n + 1) / 2 - n << endl;
- cout << (ll)n * (n - 1) / 2 << endl;
- return 0;
- }
|
- #include <bits/stdc++.h>
- using namespace std;
- #define all(x) (x).begin(), (x).end()
- #define rall(x) (x).rbegin(), (x).rend()
- #define pb push_back
- typedef long long ll;
- typedef pair<int, int> pii;
- typedef vector<int> vi;
- int main() {
int n;
- ll n;
- cin >> n;
- cout << n * (n + 1) / 2 - n << endl;
- return 0;
- }
|
true
|
|
#434725
|
- #include <algorithm>
- #include <cmath>
- #include <cstdlib>
- #include <iomanip>
- #include <iostream>
- #include <map>
- #include <string>
- #include <vector>
- using namespace std;
- #define int long long
- #define endl "\n"
- const long long INF = (long long)1e18;
- const long long MOD = 1'000'000'007;
- string yn(bool f) { return f ? "Yes" : "No"; }
- string YN(bool f) { return f ? "YES" : "NO"; }
- #define x first
- #define y second
- signed main() {
- cin.tie(0);
- ios::sync_with_stdio(false);
- cout << fixed << setprecision(15);
const double PI = cos(-1);
- const double PI = acos(-1);
- int N;
- double ans = 0;
- vector<pair<int, int>> in;
- cin >> N;
- in.resize(N);
- for (int i = 0; i < N; i++) {
- cin >> in[i].x >> in[i].y;
- }
for (int a = 0; a < 1000000; a++) {
double an = a / 1000000.0 * (2 * PI);
- for (int a = 0; a < 10000; a++) {
- double an = a / 10000.0 * (2 * PI);
- double dx = cos(an), dy = sin(an), nx = 0, ny = 0;
- for (int i = 0; i < N; i++) {
- if (dx * in[i].x + dy * in[i].y >= 0) {
- nx += in[i].x;
- ny += in[i].y;
- }
- }
- ans = max(ans, sqrt(nx * nx + ny * ny));
- }
- cout << ans << endl;
- return 0;
- }
|
- #include <algorithm>
- #include <cmath>
- #include <cstdlib>
- #include <iomanip>
- #include <iostream>
- #include <map>
- #include <string>
- #include <vector>
- using namespace std;
- #define int long long
- #define endl "\n"
- const long long INF = (long long)1e18;
- const long long MOD = 1'000'000'007;
string yn(bool f) { return f ? "Yes" : "No"; }
string YN(bool f) { return f ? "YES" : "NO"; }
- string yn(bool f) { return f? "Yes" : "No"; }
- string YN(bool f) { return f? "YES" : "NO"; }
- #define x first
- #define y second
- signed main() {
- cin.tie(0);
- ios::sync_with_stdio(false);
- cout << fixed << setprecision(15);
- const double PI = cos(-1);
- int N;
- double ans = 0;
- vector<pair<int, int>> in;
- cin >> N;
- in.resize(N);
- for (int i = 0; i < N; i++) {
- cin >> in[i].x >> in[i].y;
- }
- for (int a = 0; a < 1000000; a++) {
double an = a / 1000000.0 * (2 * PI);
- double an = a / (2 * PI);
- double dx = cos(an), dy = sin(an), nx = 0, ny = 0;
- for (int i = 0; i < N; i++) {
- if (dx * in[i].x + dy * in[i].y >= 0) {
- nx += in[i].x;
- ny += in[i].y;
- }
- }
- ans = max(ans, sqrt(nx * nx + ny * ny));
- }
- cout << ans << endl;
- return 0;
- }
|
false
|
The initialization of PI does not matter much, but the fix is semantically wrong.
|
#438559
|
- N = int(input())
- V = [int(i) for i in input().split()]
- V.sort()
print(V)
- #print(V)
- ans = 0
- for i in range(N):
- if i == 0 or i == 1:
- ans += V[i] / (2**(N-1))
- else:
- ans += V[i] / (2**(N-i))
- print(ans)
|
- N = int(input())
- V = [int(i) for i in input().split()]
- V.sort()
print(V)
- ans = 0
- for i in range(N):
- if i == 0 or i == 1:
- ans += V[i] / (2**(N-1))
- else:
- ans += V[i] / (2**(N-i))
- print(ans)
|
true
|
|
#43960
|
- import static java.lang.Integer.MAX_VALUE;
- import static java.lang.Integer.parseInt;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.StringTokenizer;
- /**
- * Problem 05: Split Up!
- */
- public class Main {
- public static void main(String[] args) throws IOException {
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- String line;
- String[] words;
- while ((line = br.readLine()) != null && !line.isEmpty()) {
- int n = parseInt(line);
- if (n == 0)
- break;
- int[] a = new int[n];
- int sum = 0;
- StringTokenizer st = new StringTokenizer(br.readLine());
- for (int i = 0; i < n; i++) {
- sum += a[i] = parseInt(st.nextToken());
- }
- int min = MAX_VALUE;
- for (int i = 0; i < 1 << n; i++) {
- int A = 0;
- for (int j = 0; j < n; j++) {
if ((i & 1 << j) != 1)
- if ((i & 1 << j) != 0)
- A += a[j];
- }
- min = Math.min(min, Math.abs(sum - A - A));
- }
- System.out.println(min);
- }
- }
- }
|
- import static java.lang.Integer.MAX_VALUE;
- import static java.lang.Integer.parseInt;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.StringTokenizer;
- /**
- * Problem 05: Split Up!
- */
- public class Main {
- public static void main(String[] args) throws IOException {
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- String line;
- String[] words;
while ((line = br.readLine()) != null && !line.isEmpty()) {
- while ((line = br.readLine())!= null &&!line.isEmpty()) {
- int n = parseInt(line);
- if (n == 0)
- break;
- int[] a = new int[n];
- int sum = 0;
- StringTokenizer st = new StringTokenizer(br.readLine());
- for (int i = 0; i < n; i++) {
- sum += a[i] = parseInt(st.nextToken());
- }
- int min = MAX_VALUE;
- for (int i = 0; i < 1 << n; i++) {
- int A = 0;
- for (int j = 0; j < n; j++) {
if ((i & 1 << j) != 1)
- if ((i & 1 << j)!= 0)
- A += a[j];
- }
- min = Math.min(min, Math.abs(sum - A - A));
- }
- System.out.println(min);
- }
- }
- }
|
true
|
|
#443001
|
- <?php
- $input=explode(' ',trim(fgets(STDIN)));
- $a=intval($input[0]);
- $b=intval($input[1]); //A,B,Cそれぞれを$a,$b,$cに格納
- if((-100 <= $a)&&(100 >= $a)&&($b <= 100)&&($b >= -100)){
- $p = $a + $b; //$sはAとBの和
- $q = $a - $b; //$sはAとBの差
- $r = $a * $b; //$sはAとBの積
- if(($p >= $q)&&($p >= $r)){
- echo $p;
}
if(($q >= $r)&&($q >= $p)){
- }else if(($q >= $r)&&($q >= $p)){
- echo $q;
}
if(($r >= $q)&&($r >= $p)){
echo $p;
- }else if(($r >= $q)&&($r >= $p)){
- echo $r;
- }
- }
- ?>
|
- <?php
- $input=explode(' ',trim(fgets(STDIN)));
- $a=intval($input[0]);
- $b=intval($input[1]); //A,B,Cそれぞれを$a,$b,$cに格納
- if((-100 <= $a)&&(100 >= $a)&&($b <= 100)&&($b >= -100)){
- $p = $a + $b; //$sはAとBの和
- $q = $a - $b; //$sはAとBの差
- $r = $a * $b; //$sはAとBの積
- if(($p >= $q)&&($p >= $r)){
- echo $p;
- }
- if(($q >= $r)&&($q >= $p)){
- echo $q;
- }
- if(($r >= $q)&&($r >= $p)){
echo $p;
- echo $r;
- }
- }
- ?>
|
false
|
Branches are mutually exclusive except if $p==$q==$r, which happens
if $a=0 and $b=0. But then the answer is 000 which might be parsed as 0,
which is the correct answer.
|
#448131
|
- import java.util.*;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int N = sc.nextInt();
- Integer cnt = 0;
for (int i = 0; i < N; i++) {
- for (int i = 1; i < N + 1; i++) {
- if (String.valueOf(i).length() % 2 == 1) {
- cnt++;
- }
- }
- System.out.println(cnt);
- }
- }
|
- import java.util.*;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int N = sc.nextInt();
- Integer cnt = 0;
for (int i = 0; i < N; i++) {
- for (int i = 1; i <= N; i++) {
- if (String.valueOf(i).length() % 2 == 1) {
- cnt++;
- }
- }
- System.out.println(cnt);
- }
- }
|
true
|
|
#460164
|
- function Main(input) {
- input = input.split("\n");
- var length = parseInt(input[0]);
- input.shift();
- for (var i = 0; i < input.length; i++) {
- input[i] = parseInt(input[i]);
- }
- var tmpInput = JSON.parse(JSON.stringify(input));
- tmpInput.sort(function(a, b) { return b - a; });
- var max1 = tmpInput[0];
- var max2 = tmpInput[1];
- var max1Index = input.indexOf(max1);
- // console.log("max1:" + max1Index);
- if (max2 == max1) {
- //最大値が2回以上出てきている場合は、最大値をN回出力して終わり
- var output = "";
- for (var i = 0; i < length; i++) {
- if (i == 0) {
- output += max1;
- } else {
- output += "\n" + max1;
- }
- }
- console.log(output);
- return;
- } else {
- var output = "";
- for (var i = 0; i < length; i++) {
- if (i != max1Index) {
- if (i == 0) {
output == max1;
- output = max1;
- } else {
- output += "\n" + max1;
- }
- } else {
- if (i == 0) {
output == max2;
- output = max2;
- } else {
- output += "\n" + max2;
- }
- }
- }
- console.log(output);
- return;
- }
- }
- Main(require("fs").readFileSync("/dev/stdin", "utf8"));
|
- function Main(input) {
- input = input.split("\n");
- var length = parseInt(input[0]);
- input.shift();
- for (var i = 0; i < input.length; i++) {
- input[i] = parseInt(input[i]);
- }
- var tmpInput = JSON.parse(JSON.stringify(input));
- tmpInput.sort(function(a, b) { return b - a; });
- var max1 = tmpInput[0];
- var max2 = tmpInput[1];
- var max1Index = input.indexOf(max1);
- // console.log("max1:" + max1Index);
- if (max2 == max1) {
- //最大値が2回以上出てきている場合は、最大値をN回出力して終わり
- var output = "";
- for (var i = 0; i < length; i++) {
- if (i == 0) {
- output += max1;
- } else {
- output += "\n" + max1;
- }
- }
- console.log(output);
- return;
- } else {
- var output = "";
- for (var i = 0; i < length; i++) {
if (i != max1Index) {
- if (i!= max1Index) {
- if (i == 0) {
output == max1;
- output += max1;
- } else {
- output += "\n" + max1;
- }
- } else {
- if (i == 0) {
output == max2;
- output += max2;
- } else {
- output += "\n" + max2;
- }
- }
- }
- console.log(output);
- return;
- }
- }
- Main(require("fs").readFileSync("/dev/stdin", "utf8"));
|
true
|
|
#466847
|
- import math
- n, d = tuple([int(s) for s in input().split()])
- x = [[0]*d for i in range(n)]
- for i in range(n):
- x_t = [int(s) for s in input().split()]
- x[i] = x_t
- cnt_fit = 0
- for i in range(n-1):
- for j in range(i+1, n):
- sumd = 0
- for k in range(d):
- sumd += (x[i][k] - x[j][k]) ** 2
- sumd = math.sqrt(sumd)
print(sumd)
if sumd - int(sumd) == 0:
- if sumd - int(sumd) == 0.0:
- cnt_fit += 1
- print(cnt_fit)
|
- import math
- n, d = tuple([int(s) for s in input().split()])
- x = [[0]*d for i in range(n)]
- for i in range(n):
- x_t = [int(s) for s in input().split()]
- x[i] = x_t
- cnt_fit = 0
- for i in range(n-1):
- for j in range(i+1, n):
- sumd = 0
- for k in range(d):
- sumd += (x[i][k] - x[j][k]) ** 2
- sumd = math.sqrt(sumd)
print(sumd)
- if sumd - int(sumd) == 0:
- cnt_fit += 1
- print(cnt_fit)
|
true
|
|
#467652
|
- #include <iostream>
- using namespace std;
- int mod2019(int l, int r) {
- int ans = 2019;
for (long long i = l; i <= r; ++i)
for (long long j = l + 1; j <= r; ++j) {
ans = min(ans, (int)(i * j) % 2019);
- for (long long i = l; i < r; ++i)
- for (long long j = i + 1; j <= r; ++j) {
- ans = min(ans, (int)((i * j) % 2019));
- if (!ans)
- return ans;
- }
- return ans;
- }
- int main() {
- int l, r;
- cin >> l >> r;
- cout << mod2019(l, r) << '\n';
- }
|
- #include <iostream>
- using namespace std;
- int mod2019(int l, int r) {
- int ans = 2019;
- for (long long i = l; i <= r; ++i)
for (long long j = l + 1; j <= r; ++j) {
- for (long long j = i + 1; j <= r; ++j) {
- ans = min(ans, (int)(i * j) % 2019);
- if (!ans)
- return ans;
- }
- return ans;
- }
- int main() {
- int l, r;
- cin >> l >> r;
- cout << mod2019(l, r) << '\n';
- }
|
false
|
Different output for e.g.: (first line r, l; second line gold output, attempt output)
55081 89114
0 -2018
difference
84850 90179
0 -2018
difference
81494 99181
0 -2018
difference
87982 90181
0 -2018
difference
|
#469359
|
- #ABC133-C
- def IL(): return list(map(int,input().split()))
- def SL(): return input().split()
- def I(): return int(input())
- def S(): return list(input())
- l,r=IL()
- ans=2019
for i in range(l,min(l+2019,r)-1):
for j in range(i+1,min(l+2019,r)):
- for i in range(l,min(l+2019,r+1)-1):
- for j in range(i+1,min(l+2019,r+1)):
- ans=min(ans,i*j%2019)
- print(ans)
|
- #ABC133-C
- def IL(): return list(map(int,input().split()))
- def SL(): return input().split()
- def I(): return int(input())
- def S(): return list(input())
- l,r=IL()
- ans=2019
for i in range(l,min(l+2019,r)-1):
for j in range(i+1,min(l+2019,r)):
- for i in range(l,min(l+2019,r)):
- for j in range(i+1,min(l+2019,r+1)):
- ans=min(ans,i*j%2019)
- print(ans)
|
true
|
No failing input found with random testing
|
#471046
|
- import java.util.*;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- char[] s = sc.next().toCharArray();
- Arrays.sort(s);
- if (s[0] == s[1] && s[2] == s[3] && s[1] != s[2])
System.out.println("YES");
- System.out.println("Yes");
- else
System.out.println("NO");
- System.out.println("No");
- }
- }
|
- import java.util.*;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- char[] s = sc.next().toCharArray();
- Arrays.sort(s);
if (s[0] == s[1] && s[2] == s[3] && s[1] != s[2])
System.out.println("YES");
- if (s[0] == s[1] && s[2] == s[3] && s[1]!= s[2])
- System.out.println("Yes");
- else
System.out.println("NO");
- System.out.println("No");
- }
- }
|
true
|
|
#471527
|
- n=int(input())
- P=list(map(int,input().split()))
- ans=0
for i in range(1,n-2):
if sorted(P[i-1:i+2])[1]==P[i]:ans += 1
- for i in range(1,n-1):
- if sorted(P[i-1:i+2])[1]==P[i]: #終点のindexに注意.
- ans += 1
- print(ans)
|
- n=int(input())
- P=list(map(int,input().split()))
- ans=0
for i in range(1,n-2):
- for i in range(1,n-1):
- if sorted(P[i-1:i+2])[1]==P[i]:ans += 1
- print(ans)
|
true
|
|
#480444
|
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
long int n, l, k = 0, sum = 0, d = 0;
- int n, l, k = 0, sum = 0, d = 0;
- cin >> n >> l;
- int a[n + 1], b[n + 1];
- a[0] = 0;
- for (int i = 1; i < n + 1; i++)
- cin >> a[i];
- for (int i = 0; i <= n; i++) {
- sum = sum + a[i];
- b[i] = sum;
- k++;
- }
for (int i = 0; i < n; i++) {
- for (int i = 0; i <= n; i++) {
- if (b[i] <= l)
- d++;
- }
- cout << d;
- return 0;
- }
|
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- long int n, l, k = 0, sum = 0, d = 0;
- cin >> n >> l;
- int a[n + 1], b[n + 1];
- a[0] = 0;
- for (int i = 1; i < n + 1; i++)
- cin >> a[i];
- for (int i = 0; i <= n; i++) {
- sum = sum + a[i];
- b[i] = sum;
- k++;
- }
for (int i = 0; i < n; i++) {
- for (int i = 0; i <= n; i++) {
- if (b[i] <= l)
- d++;
- }
- cout << d;
- return 0;
- }
|
true
|
|
#486829
|
L=list(map(int,input().split))
- L= list(map(int, input().split()))
- L.sort()
- print(L[0]+L[1])
|
L=list(map(int,input().split))
- L=list(map(int,input().split()))
- L.sort()
- print(L[0]+L[1])
|
true
|
|
#49389
|
- // 2006年アジアA How I Wonder What You Are!
- #include <math.h>
- #include <stdio.h>
- #include <stdlib.h>
#define EPS 1e-10
- #define EPS 1e-9
- typedef struct {
- double x, y, z;
- } Position;
- double dot(Position a, Position b) { return a.x * b.x + a.y * b.y + a.z * b.z; }
- double dist(Position a) { return sqrt(a.x * a.x + a.y * a.y + a.z * a.z); }
- double getTheta(Position a, Position b) {
- return acos(dot(a, b) / (dist(a) * dist(b)));
- }
- int main() {
- int i, j;
- int n, m, ans;
- double phi[50];
- Position s[500], t[50];
- while (scanf("%d", &n) && n) {
- for (i = 0; i < n; i++)
- scanf("%lf %lf %lf", &s[i].x, &s[i].y, &s[i].z);
- scanf("%d", &m);
- for (i = 0; i < m; i++)
- scanf("%lf %lf %lf %lf", &t[i].x, &t[i].y, &t[i].z, &phi[i]);
- ans = 0;
- for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
if (getTheta(s[i], t[j]) < phi[j] + EPS) {
- for (j = 0; j < m; j++) {
- if (getTheta(s[i], t[j]) <= phi[j] + EPS) {
- ans++;
- break;
- }
- }
- }
- printf("%d\n", ans);
- }
- return 0;
- }
|
- // 2006年アジアA How I Wonder What You Are!
- #include <math.h>
- #include <stdio.h>
- #include <stdlib.h>
- #define EPS 1e-10
- typedef struct {
- double x, y, z;
- } Position;
- double dot(Position a, Position b) { return a.x * b.x + a.y * b.y + a.z * b.z; }
- double dist(Position a) { return sqrt(a.x * a.x + a.y * a.y + a.z * a.z); }
- double getTheta(Position a, Position b) {
- return acos(dot(a, b) / (dist(a) * dist(b)));
- }
- int main() {
- int i, j;
- int n, m, ans;
- double phi[50];
- Position s[500], t[50];
- while (scanf("%d", &n) && n) {
- for (i = 0; i < n; i++)
- scanf("%lf %lf %lf", &s[i].x, &s[i].y, &s[i].z);
- scanf("%d", &m);
- for (i = 0; i < m; i++)
- scanf("%lf %lf %lf %lf", &t[i].x, &t[i].y, &t[i].z, &phi[i]);
- ans = 0;
- for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
- for (j = 0; j < m; j++) {
- if (getTheta(s[i], t[j]) < phi[j] + EPS) {
- ans++;
- break;
- }
- }
- }
- printf("%d\n", ans);
- }
- return 0;
- }
|
true
|
|
#517535
|
a,b,c=map(int,input().split())
if a<=c<=b or b<=c<=a:
print("Yas")
- a,b,c= map(int, input().split())
- if a <= c <= b or b <= c <= a:
- print("Yes")
- else:
- print("No")
|
- a,b,c=map(int,input().split())
- if a<=c<=b or b<=c<=a:
print("Yas")
- print("Yes")
- else:
- print("No")
|
true
|
|
#521085
|
- S = input()
- li = []
- for s in S:
- li.append(int(s))
- count = 0
- first = li[0]
- for i in range(len(li)):
- if i % 2 == 0:
- if li[i] != first:
- count += 1
- else:
- if li[i] == first:
- count += 1
- count2 = 1
- for i in range(len(li)):
- if i % 2 == 0:
- if li[i] == first:
- count2 += 1
- else:
- if li[i] != first:
count += 1
- count2 += 1
print(min(count,count2))
- print(min(count, count2))
|
- S = input()
- li = []
- for s in S:
- li.append(int(s))
- count = 0
- first = li[0]
- for i in range(len(li)):
- if i % 2 == 0:
if li[i] != first:
- if li[i]!= first:
- count += 1
- else:
- if li[i] == first:
- count += 1
count2 = 1
- count2 = 0
- for i in range(len(li)):
- if i % 2 == 0:
- if li[i] == first:
- count2 += 1
- else:
if li[i] != first:
count += 1
- if li[i]!= first:
- count2 += 1
- print(min(count,count2))
|
false
|
Lots of disagreeing random input:
00101110 3 2
01101011 4 3
001 2 1
00101 2 1
001 2 1
001011110 5 4
110000010 4 3
110 2 1
00001 3 2
001 2 1
00101000 3 2
110111000 4 3
110 2 1
001 2 1
110100110 4 3
001 2 1
110001000 4 3
011010 3 2
011010101 3 2
0110100 4 3
0000111 4 3
001 2 1
000000101 4 3
110 2 1
1100000 4 3
01101 3 2
11110 3 2
0010001 3 2
0011101 3 2
1101 2 1
110 2 1
110101 2 1
001 2 1
00101 2 1
011010 3 2
110100 3 2
01101 3 2
001001001 5 4
1011010 4 3
001 2 1
11010 2 1
000010 3 2
110 2 1
0011100 4 3
1101111 4 3
110010010 5 4
01101 3 2
001 2 1
1001000 4 3
10010 3 2
000111101 5 4
001 2 1
111101 3 2
01101 3 2
10000101 4 3
00100010 3 2
1111110 4 3
110000000 5 4
001000110 5 4
0010 2 1
1101001 4 3
001 2 1
100101 3 2
001 2 1
100100011 5 4
001 2 1
1101000 3 2
11000 3 2
001 2 1
0000001 4 3
001011 3 2
001111001 5 4
0100101 4 3
001 2 1
110 2 1
1111010 3 2
0000001 4 3
0110101 3 2
00111011 4 3
10010 3 2
110111 3 2
|
#524859
|
- times = []
- 5.times { times << gets.to_i}
- ceils = times.map do |time|
- if time % 10 != 0
- time += 10- time % 10
- else
- time
- end
- end
puts ceils.inspect
- lastdif = [times, ceils].transpose.map{|a| a.inject(:-) }.min
- ans = ceils.inject(:+) + lastdif
- puts ans
|
- times = []
- 5.times { times << gets.to_i}
- ceils = times.map do |time|
if time % 10 != 0
- if time % 10!= 0
- time += 10- time % 10
- else
- time
- end
- end
puts ceils.inspect
- lastdif = [times, ceils].transpose.map{|a| a.inject(:-) }.min
- ans = ceils.inject(:+) + lastdif
- puts ans
|
true
|
|
#529579
|
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String S = sc.next();
- int tmp = 0;
- int res = 0;
- for (int i = 0; i < S.length(); i++) {
- if (S.charAt(i) == 'A' || S.charAt(i) == 'T' || S.charAt(i) == 'G' ||
- S.charAt(i) == 'C') {
- tmp++;
- } else {
res = Math.max(tmp, res);
- tmp = 0;
- }
- res = Math.max(tmp, res);
- }
- System.out.println(res);
- }
- }
|
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String S = sc.next();
- int tmp = 0;
- int res = 0;
- for (int i = 0; i < S.length(); i++) {
- if (S.charAt(i) == 'A' || S.charAt(i) == 'T' || S.charAt(i) == 'G' ||
- S.charAt(i) == 'C') {
- tmp++;
} else {
- res = Math.max(tmp, res);
- } else {
- tmp = 0;
- }
- }
- System.out.println(res);
- }
- }
|
true
|
No disagreeing random input found
|
#536946
|
- import math
- A,B,C = map(int,input().split())
if B/A>C:
- if (B/A)>=C:
- print(C)
elif B/A<C:
- elif (B/A)<C:
- print(math.floor(B/A))
|
- import math
- A,B,C = map(int,input().split())
if B/A>C:
- if B/A>=C:
- print(C)
- elif B/A<C:
- print(math.floor(B/A))
|
true
|
|
#543228
|
- def dfs(cur, a, b, c):
- if cur == N:
return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else 10*9+7
- return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else 10**9
- ret0 = dfs(cur + 1, a, b, c)
- ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
- ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
- ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
- return min(ret0, ret1, ret2, ret3)
- N, A, B, C = map(int, input().split())
- l = [int(input()) for _ in range(N)]
- print(dfs(0,0,0,0))
|
- def dfs(cur, a, b, c):
- if cur == N:
return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else 10*9+7
- return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else 10**9+7
- ret0 = dfs(cur + 1, a, b, c)
- ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
- ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
- ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
- return min(ret0, ret1, ret2, ret3)
- N, A, B, C = map(int, input().split())
- l = [int(input()) for _ in range(N)]
- print(dfs(0,0,0,0))
|
true
|
+7 does not matter, value just must be very large
|
#56918
|
- #include <bits/stdc++.h>
- #define rep(i, a, n) for (int i = a; i < n; i++)
- #define int long long
- using namespace std;
- typedef pair<int, int> P;
- const int mod = 1e9 + 7;
- int dp[100010];
int main() {
- signed main() {
- int n, k;
- cin >> n >> k;
- vector<int> a(n);
- rep(i, 0, n) cin >> a[i];
- sort(a.begin(), a.end());
- dp[0] = 1;
- rep(i, 1, n) {
- int idx = lower_bound(a.begin(), a.end(), a[i] - k) - a.begin();
- dp[i] = (dp[i - 1] * (i - idx + 1)) % mod;
- }
- cout << dp[n - 1] << endl;
- }
|
- #include <bits/stdc++.h>
- #define rep(i, a, n) for (int i = a; i < n; i++)
- using namespace std;
- typedef pair<int, int> P;
- const int mod = 1e9 + 7;
int dp[100010];
- long long dp[100010];
- int main() {
- int n, k;
- cin >> n >> k;
- vector<int> a(n);
- rep(i, 0, n) cin >> a[i];
- sort(a.begin(), a.end());
- dp[0] = 1;
- rep(i, 1, n) {
- int idx = lower_bound(a.begin(), a.end(), a[i] - k) - a.begin();
- dp[i] = (dp[i - 1] * (i - idx + 1)) % mod;
- }
- cout << dp[n - 1] << endl;
- }
|
true
|
|
#584631
|
- package main
- import (
- "fmt"
- "strings"
- )
- func main() {
- var D int
- fmt.Scan(&D)
fmt.Println("Christmas" + strings.Repeat("Eve", 25-D))
- fmt.Println("Christmas" , strings.Repeat("Eve ", 25-D))
- }
|
- package main
- import (
- "fmt"
- "strings"
- )
- func main() {
- var D int
- fmt.Scan(&D)
fmt.Println("Christmas" + strings.Repeat("Eve", 25-D))
- fmt.Println("Christmas" + strings.Repeat(" Eve", 25-D))
- }
|
true
|
|
#585153
|
n = input(); l=sorted([int(input()) for _ in range(n)])
- n = int(input()); l=sorted([int(input()) for _ in range(n)])
- print(int(sum(l)-l[-1]/2))
|
n = input(); l=sorted([int(input()) for _ in range(n)])
- n = int(input())
- l=sorted([int(input()) for _ in range(n)])
- print(int(sum(l)-l[-1]/2))
|
true
|
|
#595462
|
- #include <algorithm>
- #include <cmath>
- #include <cstring>
- #include <iomanip>
- #include <iostream>
- #include <map>
- #include <vector>
- using namespace std;
- typedef long long ll;
- int main() {
- int N, T, A;
- cin >> N >> T >> A;
- vector<int> H(N);
- for (int &h : H)
- cin >> h;
- vector<double> AVE(N);
- for (int i = 0; i < N; i++) {
- AVE[i] = T - H[i] * 0.006;
- }
- int ans = 0;
int mn = 100000000;
- double mn = 10000000;
- for (int i = 0; i < N; i++) {
- if (abs(AVE[i] - A) < mn) {
- mn = abs(AVE[i] - A);
- ans = i;
- }
- }
- cout << ans + 1 << endl;
- }
|
- #include <algorithm>
- #include <cmath>
- #include <cstring>
- #include <iomanip>
- #include <iostream>
- #include <map>
- #include <vector>
- using namespace std;
- typedef long long ll;
- int main() {
- int N, T, A;
- cin >> N >> T >> A;
- vector<int> H(N);
- for (int &h : H)
- cin >> h;
- vector<double> AVE(N);
- for (int i = 0; i < N; i++) {
- AVE[i] = T - H[i] * 0.006;
- }
- int ans = 0;
int mn = 100000000;
- double mn = 100000000;
- for (int i = 0; i < N; i++) {
- if (abs(AVE[i] - A) < mn) {
- mn = abs(AVE[i] - A);
- ans = i;
- }
- }
- cout << ans + 1 << endl;
- }
|
true
|
|
#606678
|
- #include <stdio.h>
- int main() {
- int a[3], i, j, c;
- for (i = 0; i < 3; i++) {
- scanf("%d", &a[i]);
- }
- for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
- for (j = i; j < 3; j++) {
- if (a[i] > a[j]) {
- c = a[i];
- a[i] = a[j];
- a[j] = c;
- }
- }
- }
- printf("%d\n", 10 * a[2] + a[1] + a[0]);
- return 0;
- }
|
- #include <stdio.h>
- int main() {
- int a[3], i, j, c;
- for (i = 0; i < 3; i++) {
- scanf("%d", &a[i]);
- }
- for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
- for (j = i + 1; j < 3; j++) {
- if (a[i] > a[j]) {
- c = a[i];
- a[i] = a[j];
- a[j] = c;
- }
- }
- }
- printf("%d\n", 10 * a[2] + a[1] + a[0]);
- return 0;
- }
|
true
|
No disagreeing random input found
|
#615369
|
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
int N, K;
- long long int N, K;
- cin >> N >> K;
- if (K % 2 == 1)
- cout << (N / K) * (N / K) * (N / K) << endl;
- else {
int A = N / (K / 2);
- long long int A = N / (K / 2);
- if (A % 2 == 0)
- cout << A * A * A / 4 << endl;
- else
- cout << (A / 2) * (A / 2) * (A / 2) +
- (A / 2 + 1) * (A / 2 + 1) * (A / 2 + 1)
- << endl;
- }
- }
|
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
int N, K;
- long long N, K;
- cin >> N >> K;
- if (K % 2 == 1)
- cout << (N / K) * (N / K) * (N / K) << endl;
- else {
int A = N / (K / 2);
- long long A = N / (K / 2);
- if (A % 2 == 0)
- cout << A * A * A / 4 << endl;
- else
- cout << (A / 2) * (A / 2) * (A / 2) +
- (A / 2 + 1) * (A / 2 + 1) * (A / 2 + 1)
- << endl;
- }
- }
|
true
|
|
#622671
|
- import java.util.*;
- public class Main {
- public static void main(String[] argc) {
- Scanner sc = new Scanner(System.in);
- String s = sc.next();
- String tmp = sc.next();
- long K = Long.parseLong(tmp);
- if (s.length() == 1) {
- System.out.println(s);
- return;
- }
- for (int i = 0; i < s.length(); i++) {
- if (s.charAt(i) != '1') {
if (K < i) {
- if (K < i + 1) {
- System.out.println(1);
- return;
- } else {
- System.out.println(s.charAt(i));
- return;
- }
- }
- }
- System.out.println(1);
- }
- }
|
- import java.util.*;
- public class Main {
- public static void main(String[] argc) {
- Scanner sc = new Scanner(System.in);
- String s = sc.next();
- String tmp = sc.next();
- long K = Long.parseLong(tmp);
- if (s.length() == 1) {
- System.out.println(s);
- return;
- }
- for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) != '1') {
if (K < i) {
- if (s.charAt(i)!= '1') {
- if (K <= i) {
- System.out.println(1);
- return;
- } else {
- System.out.println(s.charAt(i));
- return;
- }
- }
- }
- System.out.println(1);
- }
- }
|
true
|
|
#623150
|
- #include <stdio.h>
- #include <stdlib.h>
- #define int long long
- signed main() {
- int N, K, i;
- char *S = (char *)malloc(sizeof(char) * 101);
- scanf("%s", S);
- for (N = 0; S[N] != '\0'; N++) {
- }
- scanf("%lld", &K);
- for (i = 0; i < N; i++) {
- if (S[i] != '1') {
- break;
- }
- }
if (K < i) {
- if (K - 1 < i) {
- printf("1\n");
- } else {
- printf("%c\n", S[i]);
- }
- return 0;
- }
|
- #include <stdio.h>
- #include <stdlib.h>
- #define int long long
- signed main() {
- int N, K, i;
- char *S = (char *)malloc(sizeof(char) * 101);
- scanf("%s", S);
for (N = 0; S[N] != '\0'; N++) {
- for (N = 0; S[N]!= '\0'; N++) {
- }
- scanf("%lld", &K);
- for (i = 0; i < N; i++) {
if (S[i] != '1') {
- if (S[i]!= '1') {
- break;
- }
- }
if (K < i) {
- if (K <= i) {
- printf("1\n");
- } else {
- printf("%c\n", S[i]);
- }
- return 0;
- }
|
true
|
|
#628927
|
import re
print("AC") if re.match(r"^A[a-z]+C[a-z]+",input()) else print("WA")
- import re;print("AC") if re.match(r"^A[a-z]+C[a-z]+$",input()) else print("WA")
|
- import re
print("AC") if re.match(r"^A[a-z]+C[a-z]+",input()) else print("WA")
- print("AC") if re.match(r"^A[a-z]+C[a-z]+$",input()) else print("WA")
|
true
|
|
#629314
|
- S=input()
if S[0]!="A":
- if S[0] != "A":
- print("WA")
elif len([i for i in S[3:-1] if i == "C"]) != 1:
- elif len([i for i in S[2:-1] if i == "C"]) != 1:
- print("WA")
- elif len([i for i in S if i.islower()]) != len(S)-2:
- print("WA")
- else:
- print("AC")
|
- S=input()
- if S[0]!="A":
- print("WA")
elif len([i for i in S[3:-1] if i == "C"]) != 1:
- elif len([i for i in S[2:-1] if i == "C"])!= 1:
- print("WA")
elif len([i for i in S if i.islower()]) != len(S)-2:
- elif len([i for i in S if i.islower()])!= len(S)-2:
- print("WA")
- else:
- print("AC")
|
true
|
|
#650587
|
- #include <algorithm>
- #include <iostream>
- #include <math.h>
- #include <string>
- #include <vector>
- using namespace std;
- int main() {
int a, b, c, k;
- long long int a, b, c, k;
- cin >> a >> b >> c >> k;
// if ((a + b + c) * k > pow(10, 18)){
- // if ((a + b + c) * pow(2,k) > pow(10, 18)){
- // cout << "Unfair" << endl;
- // return 0;
- // }
- if (k % 2 == 0)
- cout << a - b << endl;
- else
- cout << b - a << endl;
- return 0;
- }
|
- #include <algorithm>
- #include <iostream>
- #include <math.h>
- #include <string>
- #include <vector>
- using namespace std;
- int main() {
int a, b, c, k;
- long long a, b, c, k;
- cin >> a >> b >> c >> k;
- // if ((a + b + c) * k > pow(10, 18)){
- // cout << "Unfair" << endl;
- // return 0;
- // }
- if (k % 2 == 0)
- cout << a - b << endl;
- else
- cout << b - a << endl;
- return 0;
- }
|
true
|
|
#655769
|
- #include <bits/stdc++.h>
- using namespace std;
- #include <iomanip>
- #include <math.h>
- template <class T> inline bool chmax(T &a, T b) {
- if (a < b) {
- a = b;
- return 1;
- }
- return 0;
- }
- template <class T> inline bool chmin(T &a, T b) {
- if (a > b) {
- a = b;
- return 1;
- }
- return 0;
- }
- const int INF = 1001001001;
- vector<pair<int64_t, int64_t>> prime_factorize(int64_t x) {
- vector<pair<int64_t, int64_t>> p;
- for (int64_t i = 2; i * i <= x; i++) {
- int cnt = 0;
- if (x % i == 0) {
- while (x % i == 0) {
- cnt++;
- x /= i;
- }
- p.push_back(make_pair(i, cnt));
- }
- }
- if (x != 1) {
- p.push_back(make_pair(x, 1));
- }
- return p;
- }
- int main() {
- string s;
- int K;
- cin >> s >> K;
- int n = s.size();
- map<string, int> f;
- for (int i = 0; i < n; i++) {
- for (int j = 1; j <= K; j++) {
if (i + j < n) {
- if (i + j <= n) {
- string t = s.substr(i, j);
- f[t]++;
- }
- }
- }
- int i = 1;
- for (auto c : f) {
- if (i == K) {
- cout << c.first << endl;
- return 0;
- }
- i++;
- }
- return 0;
- }
|
- #include <bits/stdc++.h>
- using namespace std;
- #include <iomanip>
- #include <math.h>
- template <class T> inline bool chmax(T &a, T b) {
- if (a < b) {
- a = b;
- return 1;
- }
- return 0;
- }
- template <class T> inline bool chmin(T &a, T b) {
- if (a > b) {
- a = b;
- return 1;
- }
- return 0;
- }
- const int INF = 1001001001;
- vector<pair<int64_t, int64_t>> prime_factorize(int64_t x) {
- vector<pair<int64_t, int64_t>> p;
- for (int64_t i = 2; i * i <= x; i++) {
- int cnt = 0;
- if (x % i == 0) {
- while (x % i == 0) {
- cnt++;
- x /= i;
- }
- p.push_back(make_pair(i, cnt));
- }
- }
if (x != 1) {
- if (x!= 1) {
- p.push_back(make_pair(x, 1));
- }
- return p;
- }
- int main() {
- string s;
- int K;
- cin >> s >> K;
- int n = s.size();
- map<string, int> f;
- for (int i = 0; i < n; i++) {
- for (int j = 1; j <= K; j++) {
if (i + j < n) {
- if (i + j <= n) {
- string t = s.substr(i, j);
- f[t]++;
- }
- }
- }
- int i = 1;
- for (auto c : f) {
- if (i == K) {
- cout << c.first << endl;
- return 0;
- }
- i++;
- }
- return 0;
- }
|
true
|
|
#665881
|
- #include <stdio.h>
- int main() {
- int a, b, x;
- scanf("%d %d %d", &a, &b, &x);
if (b >= (x - a))
- if (b >= (x - a) && x >= a)
- printf("YES\n");
- else
- printf("NO\n");
- return 0;
- }
|
- #include <stdio.h>
- int main() {
- int a, b, x;
- scanf("%d %d %d", &a, &b, &x);
if (b >= (x - a))
- if (a <= x && b >= (x - a))
- printf("YES\n");
- else
- printf("NO\n");
- return 0;
- }
|
true
|
|
#675799
|
- N = int(input())
- red = [list(map(int, input().split())) for _ in range(N)]
- blue = [list(map(int, input().split())) for _ in range(N)]
- # y座標で降順ソート
- red.sort(reverse=True)
- # x座標でソート
- blue.sort(key=lambda x: x[1])
# print(red)
- # print(blue)
red_list = [0] * N
- # print(red)
- blue_list = [0] * N
- red_list = [0] * N
- for b in range(N):
- for r in range(N):
if blue_list[b] == 1 or red_list == 1:
- if blue_list[b] == 1 or red_list[r] == 1:
- continue
- if red[r][0] < blue[b][0] and red[r][1] < blue[b][1]:
- # print(b, r)
- blue_list[b] = 1
- red_list[r] = 1
- break
- print(sum(blue_list))
|
- N = int(input())
- red = [list(map(int, input().split())) for _ in range(N)]
- blue = [list(map(int, input().split())) for _ in range(N)]
- # y座標で降順ソート
- red.sort(reverse=True)
- # x座標でソート
- blue.sort(key=lambda x: x[1])
- # print(red)
- # print(blue)
- red_list = [0] * N
- blue_list = [0] * N
- for b in range(N):
- for r in range(N):
if blue_list[b] == 1 or red_list == 1:
- if blue_list[b] == 1 or red_list[r] == 1:
- continue
- if red[r][0] < blue[b][0] and red[r][1] < blue[b][1]:
- # print(b, r)
- blue_list[b] = 1
- red_list[r] = 1
- break
- print(sum(blue_list))
|
true
|
|
#677498
|
- package main
- import (
- "bufio"
- "fmt"
- "os"
- "strconv"
- )
- const mod = 1000000007
- // 1MB
- const ioBufferSize = 1 * 1024 * 1024
- var sc = func() *bufio.Scanner {
- sc := bufio.NewScanner(os.Stdin)
- sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
- sc.Split(bufio.ScanWords)
- return sc
- }()
- func next() string {
- sc.Scan()
- return sc.Text()
- }
- func nextInt() int {
- sc.Scan()
- i, e := strconv.Atoi(sc.Text())
- if e != nil {
- panic(e)
- }
- return i
- }
- func isPalindromic(a int) bool {
- var digits []int
- for a != 0 {
- digits = append(digits, a%10)
- a /= 10
- }
- for i, j := 0, len(digits)-1; i < j; i, j = i+1, j-1 {
- if digits[i] != digits[j] {
- return false
- }
- }
- return true
- }
- func main() {
- a, b := nextInt(), nextInt()
- c := 0
for i := a; i < b; i++ {
- for i := a; i <= b; i++ {
- if isPalindromic(i) {
- c++
- }
- }
- fmt.Println(c)
- }
|
- package main
- import (
- "bufio"
- "fmt"
- "os"
- "strconv"
- )
- const mod = 1000000007
- // 1MB
- const ioBufferSize = 1 * 1024 * 1024
- var sc = func() *bufio.Scanner {
- sc := bufio.NewScanner(os.Stdin)
- sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
- sc.Split(bufio.ScanWords)
- return sc
- }()
- func next() string {
- sc.Scan()
- return sc.Text()
- }
- func nextInt() int {
- sc.Scan()
- i, e := strconv.Atoi(sc.Text())
if e != nil {
- if e!= nil {
- panic(e)
- }
- return i
- }
- func isPalindromic(a int) bool {
- var digits []int
for a != 0 {
- for a!= 0 {
- digits = append(digits, a%10)
- a /= 10
- }
- for i, j := 0, len(digits)-1; i < j; i, j = i+1, j-1 {
if digits[i] != digits[j] {
- if digits[i]!= digits[j] {
- return false
- }
- }
- return true
- }
- func main() {
- a, b := nextInt(), nextInt()
- c := 0
for i := a; i < b; i++ {
- for i := a; i <= b; i++ {
- if isPalindromic(i) {
- c++
- }
- }
- fmt.Println(c)
- }
|
true
|
|
#685309
|
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- int n;
unsigned long ans;
- unsigned long long int ans;
- scanf("%d", &n);
- int i;
long m = 0, a = 0, r = 0, c = 0, h = 0;
- unsigned long long int m = 0, a = 0, r = 0, c = 0, h = 0;
- char s[n + 1][12];
- for (i = 0; i <= n; i++)
- gets(s[i]);
- for (i = 0; i <= n; i++) {
- switch (s[i][0]) {
- case 'M':
- m++;
- break;
- case 'A':
- a++;
- break;
- case 'R':
- r++;
- break;
- case 'C':
- c++;
- break;
- case 'H':
- h++;
- break;
- }
// printf("%d %d %d %d %d\n", m,a,r,c,h);
- }
// printf("%d", h);
- ans = m * a * r + m * a * c + m * a * h + m * r * c + m * r * h + m * c * h +
- a * r * c + a * r * h + a * c * h + r * c * h;
printf("%d", ans);
- printf("%llu", ans);
- return 0;
- }
|
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- int n;
unsigned long ans;
- long ans;
- scanf("%d", &n);
- int i;
- long m = 0, a = 0, r = 0, c = 0, h = 0;
- char s[n + 1][12];
- for (i = 0; i <= n; i++)
- gets(s[i]);
- for (i = 0; i <= n; i++) {
- switch (s[i][0]) {
- case 'M':
- m++;
- break;
- case 'A':
- a++;
- break;
- case 'R':
- r++;
- break;
- case 'C':
- c++;
- break;
- case 'H':
- h++;
- break;
- }
- // printf("%d %d %d %d %d\n", m,a,r,c,h);
- }
- // printf("%d", h);
- ans = m * a * r + m * a * c + m * a * h + m * r * c + m * r * h + m * c * h +
- a * r * c + a * r * h + a * c * h + r * c * h;
printf("%d", ans);
- printf("%ld", ans);
- return 0;
- }
|
true
|
|
#687691
|
print('YNeos'[(int(input())%500)<=int(input())::2])
- print('NYoe s'[(int(input())%500)<=int(input())::2])
|
print('YNeos'[(int(input())%500)<=int(input())::2])
- print('YNeos'[(int(input())%500)>int(input())::2])
|
true
|
No disagreeing random input found (ignoring trailing space).
|
#698175
|
- a,b = gets.strip.split.map(&:to_i)
(a*b).even? ? 'Even' : 'Odd'
- puts (a*b).even? ? 'Even' : 'Odd'
|
- a,b = gets.strip.split.map(&:to_i)
(a*b).even? ? 'Even' : 'Odd'
- puts (a*b).even?? 'Even' : 'Odd'
|
true
|
|
#699131
|
- <?php
- fscanf(STDIN, "%d %d", $a, $b);
echo $a * $b % 2 == 0 ? 'Even' : 'odd';
- echo ($a * $b) % 2 == 0 ? 'Even' : 'Odd';
- ?>
|
- <?php
- fscanf(STDIN, "%d %d", $a, $b);
echo $a * $b % 2 == 0 ? 'Even' : 'odd';
- echo $a * $b % 2 == 0? 'Even' : 'Odd';
- ?>
|
true
|
Parens are optional
|
#7050
|
- #include <iostream>
- #include <stdio.h>
- #include <stdlib.h>
- #define N 10
- int main(int argc, const char *argv[]) {
- int x = 0;
- int max1 = -1;
- int max2 = -2;
- int max3 = -3;
- for (int j = 0; j < N; j++) {
- scanf("%d\n", &x);
- if (max1 <= x) {
- max3 = max2;
- max2 = max1;
- max1 = x;
} else if (max2 < x) {
- } else if (max2 <= x) {
- max3 = max2;
- max2 = x;
} else if (max3 < x) {
- } else if (max3 <= x) {
- max3 = x;
- }
printf("%d\n", max1);
printf("%d\n", max2);
printf("%d\n", max3);
- }
- printf("%d\n", max1);
- printf("%d\n", max2);
- printf("%d\n", max3);
- }
|
- #include <iostream>
- #include <stdio.h>
- #include <stdlib.h>
- #define N 10
- int main(int argc, const char *argv[]) {
- int x = 0;
- int max1 = -1;
- int max2 = -2;
- int max3 = -3;
- for (int j = 0; j < N; j++) {
- scanf("%d\n", &x);
- if (max1 <= x) {
- max3 = max2;
- max2 = max1;
- max1 = x;
- } else if (max2 < x) {
- max3 = max2;
- max2 = x;
- } else if (max3 < x) {
- max3 = x;
- }
printf("%d\n", max1);
printf("%d\n", max2);
printf("%d\n", max3);
- }
- printf("%d\n", max1);
- printf("%d\n", max2);
- printf("%d\n", max3);
- }
|
true
|
No disagreeing random input found
|
#709544
|
- //💭💡🎈fold
- #include <bits/stdc++.h>
- #define pb push_back
- #define mp make_pair
- #define frd(x) freopen("x", "r", stdin)
- #define fwt(x) freopen("x", "w", stdout)
- #define fo(i, a) for (int i = 1; i <= (a.n); i++)
- #define fup(i, x, y) for (int i = (x); i <= (y); i++)
- #define fdn(i, x, y) for (int i = (x); i >= (y); i--)
- typedef long long ll;
- typedef unsigned long long ull;
- using namespace std;
- int main() {
- ll n, y;
- scanf("%lld%lld", &n, &y);
- for (int i = 0; i <= y / 1000; i++) {
- for (int j = 0; j <= y / 5000; j++) {
- if (i + j > n)
- break;
- int k = n - i - j;
- if (1000ll * i + 5000ll * j + 10000ll * k == y)
return !printf("%d %d %d
", i, j, k);
- return !printf("%d %d %d
- ", k, j, i);
- }
- }
- printf("-1 -1 -1\n");
- return 0;
- }
|
- //💭💡🎈fold
- #include <bits/stdc++.h>
- #define pb push_back
- #define mp make_pair
- #define frd(x) freopen("x", "r", stdin)
- #define fwt(x) freopen("x", "w", stdout)
- #define fo(i, a) for (int i = 1; i <= (a.n); i++)
- #define fup(i, x, y) for (int i = (x); i <= (y); i++)
- #define fdn(i, x, y) for (int i = (x); i >= (y); i--)
- typedef long long ll;
- typedef unsigned long long ull;
- using namespace std;
- int main() {
- ll n, y;
- scanf("%lld%lld", &n, &y);
- for (int i = 0; i <= y / 1000; i++) {
- for (int j = 0; j <= y / 5000; j++) {
- if (i + j > n)
- break;
- int k = n - i - j;
if (1000ll * i + 5000ll * j + 10000ll * k == y)
return !printf("%d %d %d
", i, j, k);
- if (10000ll * i + 5000ll * j + 1000ll * k == y)
- return!printf("%d %d %d
- ", i, j, k);
- }
- }
- printf("-1 -1 -1\n");
- return 0;
- }
|
false
|
Lots of disagreeing random input:
254 867000
937 829000
825 749000
961 82000
735 310000
362 67000
677 345000
828 649000
641 975000
505 469000
905 773000
813 842000
613 593000
895 703000
274 760000
513 527000
627 449000
707 803000
549 20000
236 635000
329 597000
701 6000
294 880000
654 286000
206 511000
754 110000
635 566000
304 248000
158 198000
302 431000
958 814000
309 936000
614 368000
90 162000
387 325000
149 67000
922 849000
424 567000
81 430000
852 286000
940 605000
396 574000
522 699000
821 31000
248 474000
813 205000
287 473000
492 252000
840 581000
766 578000
906 914000
997 179000
114 420000
97 194000
849 948000
480 788000
904 875000
714 425000
925 886000
807 172000
360 619000
729 998000
91 220000
250 283000
801 15000
212 58000
280 208000
236 393000
628 332000
587 828000
631 66000
968 534000
292 681000
310 216000
918 116000
739 277000
734 467000
275 176000
39 876000
458 191000
890 670000
248 169000
229 835000
913 208000
518 499000
36 148000
916 3000
33 207000
35 694000
774 952000
161 513000
581 246000
331 207000
421 369000
82 231000
911 323000
900 158000
843 480000
344 755000
688 861000
606 723000
360 521000
77 744000
728 111000
437 853000
414 597000
717 994000
842 48000
552 263000
768 633000
493 679000
955 744000
188 149000
223 532000
904 910000
744 861000
|
#713543
|
- N = int(input())
- C = []
- S = []
- F = []
- for i in range(N-1):
- t_C, t_S, t_F = map(int, input().split())
- C.append(t_C)
- S.append(t_S)
- F.append(t_F)
- for k in range(N-1):
- t = 0
- for i in range(k, N-1):
- if t < S[i]:
- t = S[i]
- else:
if t & F[i] != 0:
- if t % F[i] != 0:
- t = t + (F[i] - (t % F[i]))
- t = t + C[i]
- print(t)
- print(0)
|
- N = int(input())
- C = []
- S = []
- F = []
- for i in range(N-1):
- t_C, t_S, t_F = map(int, input().split())
- C.append(t_C)
- S.append(t_S)
- F.append(t_F)
- for k in range(N-1):
- t = 0
- for i in range(k, N-1):
- if t < S[i]:
- t = S[i]
- else:
if t & F[i] != 0:
- if t % F[i]!= 0:
- t = t + (F[i] - (t % F[i]))
- t = t + C[i]
- print(t)
- print(0)
|
true
|
|
#744414
|
- N = int(input())
- t = list(map(int,input().split()))
- T = [0]
- tot = 0
- for i in range(len(t)):
- tot += t[i]
- T.append(tot)
- T = list(map(lambda x: x*2,T))
- v = list(map(int,input().split()))
- v.append(0)
- curv = 0
- dist = 0
- curt = 0
- #print(T)
- #print(v)
- for i in range(N):
- for _ in range(T[i], T[i+1]):
- prev = curv
- ok = 1
- #if (0 < T[j+1]-curt <= curv - v[j+1] for j in range(N)):
- #print(T[1],curt,curv,v[1])
- for j in range(N-i):
- if T[i+j+1]/2.0 - curt > curv - v[i+j+1]:
- continue
- else:
- ok = 0
- break
- if ok == 1:
- if curv < v[i]:
- curv += 0.5
- elif ok == 0:
- curv -= 0.5
- curt += 0.5
dist +=(prev+curv) / 4.0
- dist +=(prev+curv) / 4.0
- print(dist)
|
- N = int(input())
- t = list(map(int,input().split()))
- T = [0]
- tot = 0
- for i in range(len(t)):
- tot += t[i]
- T.append(tot)
- T = list(map(lambda x: x*2,T))
- v = list(map(int,input().split()))
- v.append(0)
- curv = 0
- dist = 0
- curt = 0
- #print(T)
- #print(v)
- for i in range(N):
- for _ in range(T[i], T[i+1]):
- prev = curv
- ok = 1
- #if (0 < T[j+1]-curt <= curv - v[j+1] for j in range(N)):
- #print(T[1],curt,curv,v[1])
- for j in range(N-i):
- if T[i+j+1]/2.0 - curt > curv - v[i+j+1]:
- continue
- else:
- ok = 0
- break
- if ok == 1:
- if curv < v[i]:
- curv += 0.5
- elif ok == 0:
- curv -= 0.5
- curt += 0.5
dist +=(prev+curv) / 4.0
- dist +=(prev+curv) / 4.0
- print(dist)
|
true
|
|
#750478
|
- #include <algorithm>
- #include <iomanip>
- #include <iostream>
- #include <math.h>
- #include <queue>
- #include <set>
- #include <string>
- #include <unordered_set>
- #include <vector>
- using namespace std;
- const int MAX = 1010;
- int H, W, K;
- bool table[MAX * MAX] = {false};
bool solve() {
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
- void solve() {
- for (int i = 0; i <= H; i++) {
- for (int j = 0; j <= W; j++) {
- int n = (j * (H - i)) + (i * (W - j));
- table[n] = true;
- }
- }
return false;
- }
- int main() {
- cin >> W >> H >> K;
- solve();
- if (table[K])
- cout << "Yes" << endl;
- else
- cout << "No" << endl;
- return 0;
- }
|
- #include <algorithm>
- #include <iomanip>
- #include <iostream>
- #include <math.h>
- #include <queue>
- #include <set>
- #include <string>
- #include <unordered_set>
- #include <vector>
- using namespace std;
- const int MAX = 1010;
- int H, W, K;
- bool table[MAX * MAX] = {false};
- bool solve() {
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
- for (int i = 0; i <= H; i++) {
- for (int j = 0; j <= W; j++) {
- int n = (j * (H - i)) + (i * (W - j));
- table[n] = true;
- }
- }
- return false;
- }
- int main() {
- cin >> W >> H >> K;
- solve();
- if (table[K])
- cout << "Yes" << endl;
- else
- cout << "No" << endl;
- return 0;
- }
|
true
|
|
#752883
|
- A, B, C, D, E, F = map(int, input().split())
- water = [(A * i + B * j) * 100 for i in range(11) for j in range(11)][1:]
- sugar = [C * i + D * j for i in range(101) for j in range(101)]
ans = [100, 0]
- ans = [100, -1]
- for w in water:
- for s in sugar:
- if w + s <= F and s <= E * w // 100:
- if s / (w + s) > ans[1] / ans[0]:
- ans = [w + s, s]
-
- print(*ans)
|
- A, B, C, D, E, F = map(int, input().split())
- water = [(A * i + B * j) * 100 for i in range(11) for j in range(11)][1:]
- sugar = [C * i + D * j for i in range(101) for j in range(101)]
ans = [100, 0]
- ans = [100 * A, 0]
- for w in water:
- for s in sugar:
- if w + s <= F and s <= E * w // 100:
- if s / (w + s) > ans[1] / ans[0]:
- ans = [w + s, s]
-
- print(*ans)
|
true
|
Strange, disagreeing input exists:
4 5 27 29 1 583 -- [500, 0] [400, 0]
5 6 12 15 1 924 -- [600, 0] [500, 0]
8 11 26 28 1 2536 -- [1100, 0] [800, 0]
1 2 22 25 1 1827 -- [200, 0] [100, 0]
20 23 24 28 1 2677 -- [2300, 0] [2000, 0]
2 9 23 29 1 1170 -- [900, 0] [200, 0]
4 14 24 27 1 2262 -- [1400, 0] [400, 0]
2 14 26 27 1 1673 -- [1400, 0] [200, 0]
But other ground-correct fixes behave like the attempted patch, not like the gold patch.
So we have to allow both behaviors?
|
#753539
|
- package main
- import "fmt"
- func main() {
- var a, b, c, d, e, f int
- fmt.Scan(&a, &b, &c, &d, &e, &f)
- fmt.Println(solve(a, b, c, d, e, f))
- }
- func solve(a, b, c, d, e, f int) (int, int) {
x, y := 1, 0
- x, y := a*100, 0
- for wa := 0; wa <= f; wa += a * 100 {
- for wb := 0; wa+wb <= f; wb += b * 100 {
- w := wa + wb
- for sc := 0; w+sc <= f && sc <= w/100*e; sc += c {
- for sd := 0; w+sc+sd <= f && sc+sd <= w/100*e; sd += d {
- s := sc + sd
- t := w + s
- if s*x > y*t {
- x, y = t, s
- }
- }
- }
- }
- }
- return x, y
- }
|
- package main
- import "fmt"
- func main() {
- var a, b, c, d, e, f int
- fmt.Scan(&a, &b, &c, &d, &e, &f)
- fmt.Println(solve(a, b, c, d, e, f))
- }
- func solve(a, b, c, d, e, f int) (int, int) {
x, y := 1, 0
- x, y := 1, -1
- for wa := 0; wa <= f; wa += a * 100 {
- for wb := 0; wa+wb <= f; wb += b * 100 {
- w := wa + wb
- for sc := 0; w+sc <= f && sc <= w/100*e; sc += c {
- for sd := 0; w+sc+sd <= f && sc+sd <= w/100*e; sd += d {
- s := sc + sd
- t := w + s
- if s*x > y*t {
- x, y = t, s
- }
- }
- }
- }
- }
- return x, y
- }
|
true
|
There are some ground-correct fixes that fix it like the attempted patch. Both ways pass all tests,
but are not equivalent....
|
#76749
|
- import java.io.BufferedReader;
- // import java.io.FileInputStream;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.Arrays;
- public class Main {
- public static void main(String[] args)
- throws NumberFormatException, IOException {
- // System.setIn(new FileInputStream("./ALDS1_4_D-in35.txt"));
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- int[] t = Arrays.stream(br.readLine().split(" "))
- .mapToInt(Integer::parseInt)
- .toArray();
- int n = t[0];
- int k = t[1]; // max no of dump truck
- int[] w = new int[n];
- int left = 0;
- int right = 0;
- for (int i = 0; i < n; ++i) {
- w[i] = Integer.parseInt(br.readLine());
- right += w[i];
- if (left < w[i]) {
- left = w[i];
- }
- }
- int mid = 0;
- while (left < right) {
- mid = (left + right) / 2;
- int l = 1; // number of dump truck
- int s = mid;
- for (int i = 0; i < n && l <= k; ++i) {
- s -= w[i];
- if (s < 0) {
- l += 1;
- s = mid - w[i];
- }
- }
- if (l <= k) {
- right = mid;
- } else {
- left = mid + 1;
- }
- }
System.out.println(mid);
- System.out.println(right);
- }
- }
|
- import java.io.BufferedReader;
- // import java.io.FileInputStream;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.Arrays;
- public class Main {
- public static void main(String[] args)
- throws NumberFormatException, IOException {
- // System.setIn(new FileInputStream("./ALDS1_4_D-in35.txt"));
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- int[] t = Arrays.stream(br.readLine().split(" "))
.mapToInt(Integer::parseInt)
.toArray();
- .mapToInt(Integer::parseInt)
- .toArray();
- int n = t[0];
- int k = t[1]; // max no of dump truck
- int[] w = new int[n];
- int left = 0;
- int right = 0;
- for (int i = 0; i < n; ++i) {
- w[i] = Integer.parseInt(br.readLine());
- right += w[i];
- if (left < w[i]) {
- left = w[i];
- }
- }
- int mid = 0;
- while (left < right) {
- mid = (left + right) / 2;
- int l = 1; // number of dump truck
- int s = mid;
- for (int i = 0; i < n && l <= k; ++i) {
- s -= w[i];
- if (s < 0) {
- l += 1;
- s = mid - w[i];
- }
- }
- if (l <= k) {
- right = mid;
- } else {
- left = mid + 1;
- }
- }
System.out.println(mid);
- System.out.println(right);
- }
- }
|
false
|
Not equivalent: disagreeing input:
95 32[87, 90, 57, 45, 89, 67, 52, 10, 1, 91, 48, 97, 86, 20, 18, 17, 83,
35, 63, 73, 53, 68, 62, 73, 75, 23, 29, 51, 33, 75, 0, 15, 1, 45, 14,
68, 71, 81, 68, 49, 91, 24, 92, 0, 85, 73, 99, 70, 24, 53, 20, 85, 28,
38, 69, 64, 46, 69, 91, 19, 46, 80, 78, 44, 98, 79, 54, 9, 86, 96, 91,
37, 16, 50, 24, 27, 10, 47, 95, 60, 74, 13, 37, 82, 69, 99, 56, 93, 84,
5, 3, 50, 96, 85, 21]
29 14[24, 62, 40, 90, 2, 70, 34, 22, 35, 20, 56, 23, 58, 26, 50, 36, 85,
81, 45, 26, 67, 76, 21, 70, 90, 57, 94, 94, 41]
10 7[11, 43, 6, 96, 78, 90, 15, 93, 51, 81]
96 18[73, 64, 99, 86, 62, 62, 48, 5, 52, 22, 43, 25, 25, 72, 11, 48, 3,
42, 3, 95, 72, 55, 66, 32, 96, 38, 93, 16, 92, 34, 89, 57, 48, 94, 74,
6, 64, 46, 30, 21, 13, 56, 19, 46, 51, 89, 5, 26, 2, 77, 76, 75, 70, 22,
39, 88, 36, 85, 73, 21, 72, 75, 93, 71, 29, 18, 33, 2, 31, 29, 3, 13,
53, 62, 69, 0, 74, 63, 55, 13, 10, 16, 72, 61, 35, 46, 93, 53, 9, 42, 5,
84, 16, 86, 95, 44]
74 30[11, 11, 91, 68, 5, 58, 33, 80, 30, 13, 41, 78, 45, 49, 2, 63, 29,
6, 64, 39, 18, 64, 10, 12, 31, 4, 47, 2, 19, 67, 22, 52, 41, 91, 28, 16,
21, 78, 54, 60, 68, 25, 47, 56, 39, 18, 16, 4, 61, 34, 92, 41, 83, 67,
76, 96, 46, 48, 52, 91, 8, 48, 70, 85, 64, 51, 92, 7, 48, 57, 53, 24,
49, 43]
|
#768292
|
- voca = input()
output = vaca[0] + str(len(vaca) - 2) + vaca[-1]
-
- output = voca[0] + str(int(len(voca) - 2) )+ voca[-1]
-
- print(output)
|
voca = input()
- vaca = input()
- output = vaca[0] + str(len(vaca) - 2) + vaca[-1]
- print(output)
|
true
|
|
#770952
|
- n = int(input())
- result = 0
- for x in range(100):
if (1 << x) < n and n < (1 << (x+1)):
- if (1 << x) <= n and n <= (1 << (x+1)):
- result = 1 << x
- print(result)
|
- n = int(input())
- result = 0
- for x in range(100):
if (1 << x) < n and n < (1 << (x+1)):
- if (1 << x) <= n and n < (1 << (x+1)):
- result = 1 << x
- print(result)
|
true
|
No disagreeing random input found
|
#774012
|
- #include <bits/stdc++.h>
- using namespace std;
- using ll = long long;
- int main(void) {
- ll n, k;
- cin >> n >> k;
- vector<ll> a(n);
- for (auto &e : a)
- cin >> e;
- ll g = 0;
- for (auto &e : a)
- g = __gcd(g, e);
- cout << (any_of(a.begin(), a.end(),
[&](ll x) { return x <= k && (x - k) % g == 0; })
- [&](ll x) { return x >= k && (x - k) % g == 0; })
- ? "POSSIBLE"
- : "IMPOSSIBLE")
- << endl;
- }
|
- #include <bits/stdc++.h>
- using namespace std;
- using ll = long long;
- int main(void) {
- ll n, k;
- cin >> n >> k;
- vector<ll> a(n);
- for (auto &e : a)
- cin >> e;
- ll g = 0;
- for (auto &e : a)
- g = __gcd(g, e);
- cout << (any_of(a.begin(), a.end(),
[&](ll x) { return x <= k && (x - k) % g == 0; })
? "POSSIBLE"
- [&](ll x) { return x >= k && (x - k) % g == 0; })
- ? "POSSIBLE"
- : "IMPOSSIBLE")
- << endl;
- }
|
true
|
|
#788513
|
- #include <bits/stdc++.h>
- #define rep(i, n) for (int i = 0; i < (int)(n); i++)
- using namespace std;
- int main() {
- int r, g, b;
- cin >> r >> g >> b;
cout << ((g * 10 + b) % 4 == 0 ? "Yes" : "No") << endl;
- cout << ((g * 10 + b) % 4 == 0 ? "YES" : "NO") << endl;
- }
|
- #include <bits/stdc++.h>
- #define rep(i, n) for (int i = 0; i < (int)(n); i++)
- using namespace std;
- int main() {
- int r, g, b;
- cin >> r >> g >> b;
cout << ((g * 10 + b) % 4 == 0 ? "Yes" : "No") << endl;
- cout << ((g * 10 + b) % 4 == 0? "YES" : "NO") << endl;
- }
|
true
|
|
#800166
|
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int a, b, c;
- cin >> a >> b >> c;
a >= c &&c <= b ? cout << "Yes" : cout << "No";
- c >= a &&c <= b ? cout << "Yes" : cout << "No";
- return 0;
- }
|
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int a, b, c;
- cin >> a >> b >> c;
a >= c &&c <= b ? cout << "Yes" : cout << "No";
- a <= c && c <= b? cout << "Yes" : cout << "No";
- return 0;
- }
|
true
|
|
#813202
|
- a,b ,c=gets.split.map &:to_i
puts (a-b==b-c)? "Yes" : "No"
- puts (a-b==b-c)? "YES" : "NO"
|
a,b ,c=gets.split.map &:to_i
puts (a-b==b-c)? "Yes" : "No"
- a,b,c=gets.split.map &:to_i
- puts (a-b==b-c)? "YES" : "NO"
|
true
|
|
#817818
|
- N,M = map(int,input().split())
- ab = []
- for i in range(N):
- a,b = map(int,input().split())
- ab.append((a,b))
- cd = []
for i in range(N):
a,b = map(int,input().split())
cd.append((a,b))
- for i in range(M):
- c,d = map(int,input().split())
- cd.append((c,d))
- ans = []
- for i in range(len(ab)):
- aaa = 1000000000
- for j in range(len(cd)):
- man = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
- if(man < aaa):
- aaa = man
- cnt = j + 1
- ans.append(cnt)
- for i in ans:
- print(i)
|
- N,M = map(int,input().split())
- ab = []
- for i in range(N):
- a,b = map(int,input().split())
- ab.append((a,b))
- cd = []
for i in range(N):
- for i in range(M):
- a,b = map(int,input().split())
- cd.append((a,b))
- ans = []
- for i in range(len(ab)):
- aaa = 1000000000
- for j in range(len(cd)):
- man = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
- if(man < aaa):
- aaa = man
- cnt = j + 1
- ans.append(cnt)
- for i in ans:
- print(i)
|
true
|
|
#824132
|
- n = int(input())
-
- x = n * 800
y = (n // 15) * 150
- y = (n // 15) * 200
-
- print(x - y)
|
- n = int(input())
- x = n * 800
y = (n // 15) * 150
- y = (n // 15) * 200
- print(x - y)
|
true
|
|
#847127
|
- #include <algorithm>
- #include <cmath>
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <iostream>
- #include <map>
- #include <queue>
- #include <stack>
- #include <string>
- #include <vector>
- #define fi first
- #define se second
- #define pb(i) push_back(i)
- #define rep(i, a, b) for (int i = a; i <= b; i++)
- #define per(i, a, b) for (int i = a; i >= b; i--)
- #define mes(a, b) memset(a, b, sizeof(a))
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- const int N = 1e6 + 10;
- const int INF = 0x3f3f3f3f;
- const int inf = -INF;
- const int mod = 1e9 + 7;
- const double pi = acos(-1.0);
- int flag[N];
- int main() {
- std::ios::sync_with_stdio(false);
- string s;
- cin >> s;
- flag[0] = 1;
- rep(i, 0, s.size() - 1) {
- if (flag[i] == 0)
- continue;
- if (i + 5 <= s.size() && (s.substr(i, 5) == "dream"))
- flag[i + 5] = 1;
if (i + 7 <= s.size() && (s.substr(i, 5) == "dreamer"))
- if (i + 7 <= s.size() && (s.substr(i, 7) == "dreamer"))
- flag[i + 7] = 1;
- if (i + 5 <= s.size() && (s.substr(i, 5) == "erase"))
- flag[i + 5] = 1;
- if (i + 6 <= s.size() && (s.substr(i, 6) == "eraser"))
- flag[i + 6] = 1;
- }
- if (flag[s.size()])
- cout << "YES" << endl;
- else
- cout << "NO" << endl;
- return 0;
- }
|
- #include <algorithm>
- #include <cmath>
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <iostream>
- #include <map>
- #include <queue>
- #include <stack>
- #include <string>
- #include <vector>
- #define fi first
- #define se second
- #define pb(i) push_back(i)
- #define rep(i, a, b) for (int i = a; i <= b; i++)
- #define per(i, a, b) for (int i = a; i >= b; i--)
- #define mes(a, b) memset(a, b, sizeof(a))
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- const int N = 1e6 + 10;
- const int INF = 0x3f3f3f3f;
- const int inf = -INF;
- const int mod = 1e9 + 7;
- const double pi = acos(-1.0);
- int flag[N];
- int main() {
- std::ios::sync_with_stdio(false);
- string s;
- cin >> s;
- flag[0] = 1;
- rep(i, 0, s.size() - 1) {
- if (flag[i] == 0)
- continue;
- if (i + 5 <= s.size() && (s.substr(i, 5) == "dream"))
- flag[i + 5] = 1;
if (i + 7 <= s.size() && (s.substr(i, 5) == "dreamer"))
- if (i + 7 <= s.size() && (s.substr(i, 7) == "dreamer"))
- flag[i + 7] = 1;
- if (i + 5 <= s.size() && (s.substr(i, 5) == "erase"))
- flag[i + 5] = 1;
- if (i + 6 <= s.size() && (s.substr(i, 6) == "eraser"))
- flag[i + 6] = 1;
- }
- if (flag[s.size()])
- cout << "YES" << endl;
- else
- cout << "NO" << endl;
return 0;
- }
|
true
|
|
#9323
|
- a[3];
- main(i, m, n) {
- for (scanf("%d", &i); ~scanf("%d%d%d", a, a + 1, a + 2);
- puts(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] - m ? "NO" : "YES"))
for (m = i = 0; i < 2; i++)
- for (m = i = 0; i < 3; i++)
- if (n = 2 * a[i] * a[i], m < n)
- m = n;
- exit(0);
- }
|
- a[3];
- main(i, m, n) {
- for (scanf("%d", &i); ~scanf("%d%d%d", a, a + 1, a + 2);
puts(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] - m ? "NO" : "YES"))
for (m = i = 0; i < 2; i++)
- puts(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] - m? "NO" : "YES"))
- for (m = i = 0; i < 3; i++)
- if (n = 2 * a[i] * a[i], m < n)
- m = n;
- exit(0);
- }
|
true
|
|