Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import java.util.*;
import java.io.*;
import java.math.BigInteger;
/**
*
* @author rohan
*/
public class Main {
static int mod = (int)1e9+7;
static void solve() {
char[] c = sc.nextLine().toCharArray();
int n = sc.nextInt();
int x=0,y=0;
if(c[0]==94) x=0;
... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | d = {}
d[chr(118)] = 0
d[chr(60)] = 1
d[chr(94)] = 2
d[chr(62)] = 3
s = input()
i = d[s[0]]
f = d[s[2]]
delta = int(input())%4
if (i+1)%4 == f or (i-1)%4 == f:
if (i+delta)%4 == f:
print("cw")
else:
print("ccw")
else:
print("undefined")
| PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import java.util.*;
import java.util.Scanner;
public class Codeforces2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Character a[]=new Character[4];
a[0]='^';
a[1]='>';
a[2]='v';
a[3]='<';
Scanner scn=new Scanner(System.in);
Character start=scn.next().charAt(0);
C... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | # https://codeforces.com/problemset/problem/834/A
# 900
s, e = map(ord, input().split())
n = int(input())
c = [94, 62, 118, 60]
if n % 2 == 0:
print("undefined")
else:
si = c.index(s)
ei = c.index(e)
d = ei - si
if d == -3 or d == 1:
if n == 1:
print("cw")
else:
... | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
const int INF = 1234567890;
string sa, sb;
int cnt;
map<char, int> arrows;
int main() {
cin >> sa >> sb;
cin >> cnt;
char ca = sa[0], cb = sb[0];
arrows['^'] = 0;
arrows['>'] = 1;
arrows['v'] = 2;
arrows['<'] = 3;
int bgn = arrows[ca], ed = arrows[cb];
int... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | a, b = input().split(' ')
n = int(input())
d = {'v': 0, '>': 1, '^': 2, '<': 3}
a, b = d[a], d[b]
ccw = bool((a + n) % 4 == b)
cw = bool((a - n) % 4 == b)
if cw and not ccw:
print('cw')
elif ccw and not cw:
print('ccw')
else:
print('undefined')
| PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def ris(): return list(input())
def pli(a): return "".join(list(map(str, a)))
def plis(a): return " ".join(list(map(str, a)))
di = ["v", "<", "^", ">"]
s, e = input().split()
n = ri() % 4
s = di.index(s)
e = di.index(e)
iscw = True
if(n ==... | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
long long max(long long a, long long b) { return a > b ? a : b; }
long long min(long long a, long long b) { return a < b ? a : b; }
using namespace std;
const int maxn = 1e6 + 5;
int main() {
char a, b;
scanf("%c %c", &a, &b);
int ans1;
if (a == '^') {
if (b == '^')
ans1 = 0;
... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import java.util.*;
public class A834 {
public static void main(String[] args) {
char[] sym = {'v', '<', '^', '>'};
Scanner scan = new Scanner(System.in);
String str = scan.nextLine();
int num = scan.nextInt(), index = 0;
num %= 4;
if(num % 2 == 0)
System.out.println("undefined");
else{
for(int i =... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
void rotate(void) {
long long n, i, j, k, m;
string toy = "v<^>";
char c1, c2, cw, ccw;
cin >> c1 >> c2 >> n;
if (n % 4 == 0 || n % 4 == 2) {
cout << "undefined\n";
} else {
n = n % 4;
for (i = 0; i < 4; i++) {
if (toy[i] == c1) {
j = i... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | a,b = raw_input().split()
n = input()
if a == '^' :
if b == '>' :
if n%4 == 1 :
print 'cw'
elif n%4 == 3 :
print 'ccw'
elif b == '<' :
if n%4 == 1 :
print 'ccw'
elif n%4 == 3 :
print 'cw'
elif b == 'v' or b == '^':
print 'undefined'
elif a == '>' :
if b == '^' :
if n%4 == 1 :
print 'ccw'
... | PYTHON |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import sys
#read in information from std input
ls = ['v', '<', '^', '>']
answer = ''
hw = []
seconds = 0
####################################################
# When submitting for real, comment the next line,
# uncomment when developing.
#sys.stdin = open("../input/input3")
###########################################... | PYTHON |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | k, m = input().split()
n = int(input())
n %= 4
a = ['v', '<', '^', '>', 'v', '<', '^', '>']
if n == 2 or n==0:
print('undefined')
if n == 1:
if m == a[a.index(k) + 1]:
print('cw')
else:
print('ccw')
if n == 3:
if m == a[a.index(k) + 3]:
print('cw')
else:
print('ccw') | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | s=input()
n=int(input())
d={}
d['^']=0
d['>']=1
d['v']=2
d['<']=3
if n%4==2 or n%4==0:
print("undefined")
else:
sum=(d[s[2]]-d[s[0]]+4)%4;
if(sum==n%4):
print("cw")
else:
print("ccw")
| PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
string a = "<^>v";
string b = "<v>^";
char st, en;
int n;
cin >> st >> en >> n;
int i1, i2, i;
n %= 4;
for (i = 0; i < 4; i++) {
if (a[i] == st) {
i1 = i + n;
i1 %= 4;
}
if (b[i] == st) {
i2 = i + n;
i2 %= 4;
... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | keys = ['v', '<', '^', '>']
start, end = raw_input().split()
n = int(raw_input()) % 4
start_ind = keys.index(start)
ans = ''
foo = (start_ind + n) % 4
if (keys[foo] == end and (keys[foo] != keys[start_ind - n])):
ans = 'cw'
elif (keys[start_ind - n] == end and (keys[foo] != keys[start_ind - n])):
ans = 'ccw'
elif (ke... | PYTHON |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
int direcCharToInt(char c) {
switch (c) {
case '^':
return 0;
case '>':
return 1;
case 'v':
return 2;
case '<':
return 3;
}
return -1;
}
int main() {
int start, end, n;
char buf[4];
gets(buf);
scanf("%d", &n);
start = direcCharToInt(buf[0]... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | s=input().split()
d={'^':1,'>':2,'v':3,'<':4}
x=int(input())%4
a=(4+d[s[1]]-d[s[0]])%4
b=(4-a)%4
if a==x and b!=x:
print("cw")
elif b==x and a!=x:
print("ccw")
else:
print("undefined")
| PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | class CodeforcesTask834ASolution:
def __init__(self):
self.result = ''
self.positions = ''
self.time = 0
def read_input(self):
self.positions = input()
self.time = int(input())
def process_task(self):
shift = self.time % 4
if not shift:
s... | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #!/usr/bin/python
# coding: utf-8
cw=['v','<','^','>','v','<','^','>']
ccw=['v','>','^','<','v','>','^','<']
(s,e)=map(str,raw_input().split(' '))
n=int(raw_input())
n=n%4
tmp1=tmp2=0
cwind=cw.index(s)+n
ccwind=ccw.index(s)+n
if(cw[cwind]==e):
tmp1=1
if(ccw[ccwind]==e):
tmp2=1
if(tmp1==1 and tmp2==1):
prin... | PYTHON |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
char s, e;
long long n;
cin >> s >> e;
cin >> n;
n = n % 4;
int ss, ee;
if (s == 118) ss = 0;
if (s == 60) ss = 1;
if (s == 94) ss = 2;
if (s == 62) ss = 3;
if (e == 118) ee = 0;
if (e == 60) ee = 1;
if (e == 94) ee = 2;
if (e == 62)... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int fx[] = {-1, 1, 0, 0};
int fy[] = {0, 0, -1, 1};
int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
int kx[] = {1, 1, -1, -1, 2, 2, -2, -2};
int ky[] = {2, -2, 2, -2, 1, -1, 1, -1};
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
long long pwr(long long base, long long p, long long mod) {
long long ans = 1;
while (p) {
if (p & 1) ans = (ans * base) % mod;
base = (base * base) % mod;
p /= 2;
}
return ans;
}
long long gcd(long long a, long long b) {
if (b == 0) return a;
return... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
char cc[300], x[300];
cc['<'] = 0;
cc['^'] = 1;
cc['>'] = 2;
cc['v'] = 3;
x[0] = '<';
x[1] = '^';
x[2] = '>';
x[3] = 'v';
char c1, c2;
int n;
cin >> c1 >> c2 >> n;
int start = cc[c1];
int finish = x[(start + n) % 4];
int finish2 = ... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 |
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.StringTokenizer;
public class Solution {
public static void main(String[] args) {
// TODO Auto-generated method s... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int p1 = (int) sc.next().charAt(0);
int i1 = p1 == 118 ? 1 : p1 == 60 ? 2 : p1 == 94 ? 3 : p1 == 62 ? 0 : 5;
int p2 = (int) sc.next().charAt(0);
int i2 = p2 == 118 ? 1 : p2 == ... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | /*
⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⡎... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 |
ip=input().split()
sec=int(input())%4
if(sec==0 or sec == 2):
print("undefined")
elif(sec==1):
if(ip[0]=='^'):
if(ip[1]=='>'):
print("cw")
else:
print('ccw')
elif(ip[0]=='>'):
if (ip[1] == 'v'):
print("cw")
else:
print('ccw'... | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | clockwise = ['^', '>', 'v', '<']
counterclockwise = ['^', '<', 'v', '>']
start , end = raw_input().split()
n = int(raw_input())
n = n % 4
x = clockwise.index(end) - clockwise.index(start)
y = counterclockwise.index(end) - counterclockwise.index(start)
if x<0:
x += 4
if y<0:
y += 4
if x == y:
print "und... | PYTHON |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import java.util.*;
public class UselessToy{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String[] spun = new String[] { "^", ">", "v", "<" };
String[] line = input.nextLine().split(" ");
int N = input.nextInt();
int startIndex = 0;
for (int i = 0; i < spun... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | st, en = map(str, input().split())
n = int(input())
n %= 4
m = {"^":1, ">":2, "v":3, "<":4}
if (m[st] + m[en]) % 4 == 2 or (m[st] + m[en]) % 4 == 0:
print("undefined")
elif (m[st] + n) % 4 == m[en] or (m[st] + n) == m[en]:
print("cw")
else:
print("ccw") | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | a,b = input().split(" ")
n = int(input())
if (a == b) or (a == '<' and b == '>') or (a == '<' and b == '<') or (a == '^' and b == 'v') or (a == 'v' and b == '^'):
print('undefined')
if (a == '^' and b == '>'):
if ((n - 1)%4 == 0) or n==0:
print('cw')
if ((n-3)%4 == 0) or n == 0:
print(... | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/*
* public class Main { public static void main(String[] args) { FastReader
* fastReader = new FastReader(); int TC = fastReader.nextInt(); StringBuffer sb
* ... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import sys
import math
import itertools
import collections
def getdict(n):
d = {}
if type(n) is list or type(n) is str:
for i in n:
if i in d:
d[i] += 1
else:
d[i] = 1
else:
for i in range(n):
t = ii()
if t in d... | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | dir1, dir2 = raw_input().split()
rotations = int(raw_input())
def isCW(dir1, dir2, rotations):
cw_rotation = ["^", ">", "v", "<"]
actual_rotations = rotations % 4
for i in xrange(len(cw_rotation)):
if cw_rotation[i] == dir1:
if cw_rotation[(i + actual_rotations) % 4] == dir2:
return True
return False
d... | PYTHON |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main(int argc, const char *argv[]) {
string s, t;
int n = 0, start = 0, end = 0, cw = 0, ccw = 0;
cin >> s >> t >> n;
if (s[0] == '^') {
start = 0;
} else if (s[0] == '>') {
start = 1;
} else if (s[0] == 'v') {
start = 2;
} else {
start = 3... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | cw = [60,94,62,118]
ccw = [60,118,62,94]
i,f = map(ord,input().split())
n = int(input())
ans = 'undefined'
index_i = cw.index(i)
index_f = cw.index(f)
if (index_i+n)%4==index_f:
ans='cw'
index_i = ccw.index(i)
index_f = ccw.index(f)
if (index_i+n)%4==index_f:
if ans=='undefined':
ans='ccw'
else:
ans= 'undefine... | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | pos1, pos2 = input().split()
turns_nr = int(input())
if turns_nr % 2 == 0:
print('undefined')
exit()
elif turns_nr % 4 == 1:
lst = '<^>v<^>v'
for idx1, sym1 in enumerate(lst):
if sym1 == pos1:
if lst[idx1 - 1] == pos2:
print('ccw')
exit()
... | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
char f, s;
cin >> s >> f;
int n;
cin >> n;
n %= 4;
int ff, ss;
switch (f) {
case 'v':
ff = 0;
break;
case '<':
ff = 1;
break;
case '^':
ff = 2;
break;
case '>':
ff = 3;
break;
def... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
public class Main {
private static FastScanner sc = new FastScanner();
public static void main(String[] args) {
String ss = sc.next();
String ts = sc.next();
int n = sc.nextInt();
int s = 0;
int t = 0;
... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | [start, end] = [x for x in input().split()]
duration = int(input())
cw = ['v', '<', '^', '>']
ccw = ['v', '>', '^', '<']
cw_bool = end == cw[((cw.index(start) + duration) % 4)]
ccw_bool = end == ccw[((ccw.index(start) + duration) % 4)]
if cw_bool and ccw_bool:
print("undefined")
elif cw_bool:
print("cw")
el... | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | from sys import stdin, stdout
line = stdin.readline().strip().split(' ')
n = int(stdin.readline().strip())
rot = n % 4
cw_array = ['v', '<', '^', '>']
ccw_array = ['v', '>', '^', '<']
first = line[0]
last = line[1]
cw_flag = False
ccw_flag = False
ci = cw_array.index(first)
ci = (ci+rot) % 4
if(cw_array[ci]==last):
... | PYTHON |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import array
import bisect
import collections
import copy
import fractions
import functools
import heapq
import itertools
import math
import operator
import os
import re
import random
import string
import subprocess
import sys
import time
import unittest
from io import Str... | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
const char s[] = {'^', '>', 'v', '<'};
char a[5], b[5];
int main() {
scanf("%s%s", a, b);
int k;
for (int i = 0; i < 4; i++)
if (a[0] == s[i]) k = i;
int n;
scanf("%d", &n);
n %= 4;
if (s[(k + n) % 4] == b[0] && s[(k + 4 - n) % 4] != b[0])
printf("cw\n");
else if (s[(k +... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
bool first = true;
long long gcd(long long a, long long b) {
while (a != 0 && b != 0) {
if (a < b) swap(a, b);
a %= b;
}
return a + b;
}
string lowreg(string s) {
string ret;
int len = s.length();
for (int i = 0; i < len; i++)
if ((int)s[i] >= (int)'... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
char c1, c2;
cin >> c1 >> c2;
int n;
cin >> n;
if (n % 2 == 0) {
cout << "undefined" << endl;
} else {
int n1, n2;
switch (c1) {
case '^':
n1 = 1;
break;
case '>':
n1 = 2;
break;
case 'v'... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
public class MainY {
public static void main(String[] args) {
List<String> input = getRawInput();
int start = (int)(input.get(0).trim(... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int n;
void panduan(char c1, char c2) {
if (c1 == '^') {
if (c2 == '>') {
if (n % 4 == 1) {
printf("cw\n");
return;
} else if (n % 4 == 3) {
printf("ccw\n");
return;
}
} else if (c2 == '<') {
if (n % 4 == 3) ... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | pos = [None, None]
pos[0], pos[1] = input().split()
sec = int(input())
if pos[0] == '^':
now_pos = 1
elif pos[0] == '>':
now_pos = 2
elif pos[0] == 'v':
now_pos = 3
else:
now_pos = 4
start = now_pos
if pos[1] == '^':
end = 1
elif pos[1] == '>':
end = 2
elif pos[1] == 'v':
end = 3
else:
... | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
HashMap<Integer,Character> cw = new HashMap<Integer,Character>();
HashMap<Integer,Character> ccw = new HashMap<Integer,Character>();
cw.put(0, '^');
cw.put(1, '>');
cw.put(2,'?');
cw.pu... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int sz = 1e5 + 10;
char c[] = {'^', '>', 'v', '<'};
int main() {
char a, b;
int n, st, na, nb;
while (cin >> a >> b >> n) {
for (st = 0; c[st] != a; st++) {
}
na = (st + n) % 4;
nb = ((st - n) % 4 + 4) % 4;
if (b == c[na... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
char a, b;
int t;
cin >> a >> b >> t;
int x = (int)a;
int y = (int)b;
int r = t % 4;
if (r == 0)
cout << "undefined" << endl;
else if (x == 94) {
if (r == 1 && y == 62)
cout << "cw" << endl;
else if (r == 1 && y == 60)
co... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import java.util.HashMap;
import java.util.Scanner;
public class TheUselessToy {
public static void main(String[] args) {
HashMap<Character, Integer> map = new HashMap<Character, Integer>();
map.put('^', 0);
map.put('>', 1);
map.put('v', 2);
map.put('<', 3);
Scanner sc = new Scanner(System.in);
String ... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | startpos,endpos=str(input()).split()
n=int(input())
startnum=0
endnum=0
if(startpos=='^'):
startnum=0
elif(startpos=='>'):
startnum=1
elif(startpos=='v'):
startnum=2
elif(startpos=='<'):
startnum=3
if(endpos=='^'):
endnum=0
elif(endpos=='>'):
endnum=1
elif(endpos=='v'):
endnum=2
elif(endpos=='<'):
endnum=3
if((... | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | /* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc=new Sc... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import java.io.*;
import java.util.*;
import java.lang.*;
public class Rextester{
public static void main(String[] args)throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = new Integer(... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | //package codeforces;
import java.util.Scanner;
/**
* Created by nitin.s on 30/07/17.
*/
public class TheUselessToy {
static String undefined = "undefined";
static String counter = "ccw";
static String clock = "cw";
public static void main(String[] args) {
Scanner in = new Scanner(System.in... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | a=input().split()
n=int(input())
b=["v",">","^","<"]
if n%2==0:
print("undefined")
else:
if (b.index(a[0])+n)%4==b.index(a[1]):
print("ccw")
else:
print("cw") | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
map<string, int> cmp, ccmp;
int main() {
ios::sync_with_stdio(false);
cmp["^ >"] = 1;
cmp["^ v"] = 2;
cmp["^ <"] = 3;
cmp["> v"] = 1;
cmp["> <"] = 2;
cmp["> ^"] = 3;
cmp["v <"] = 1;
cmp["v ^"] = 2;
cmp["v >"] = 3;
cmp["< ^"] = 1;
cmp["< >"] = 2;
cm... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | a=input().split() ##
n=int(input())
m=['^','>','v','<']
a1=a[0]
a2=a[1]
no=m.index(a1)
m1=[m[no],m[(no+1)%4],m[(no+2)%4],m[(no+3)%4]]
n1=n%4
n2=4-n1
if n1==n2 or n==0 or a1==a2:
print('undefined')
else:
if m1[n1]==a2:
print('cw')
else:
print('ccw') | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | dirs = ['v','<','^','>']
a,b = map(dirs.index, input().split())
k = (b-a+4)%4
n = int(input())
if k==0 or k==2:
print('undefined')
elif k==n%4:
print('cw')
else:
print('ccw') | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
map<char, int> mp;
char c1, c2;
long long n;
cin >> c1 >> c2;
cin >> n;
n = n % 4;
if (c1 == '^') {
if (n == 0 || n == 2) {
puts("undefined");
} else if (n == 1) {
if (c2 == '>')
puts("cw");
else if (c2 == '<') {
... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 |
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
public class A {
public static void main(String[] args) {
InputStream inputStream = System.in... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | def pos_to_int(c):
if c == '^': return 0
if c == '>': return 1
if c == 'v': return 2
if c == '<': return 3
assert(False)
a, b = map(pos_to_int, raw_input().split())
n = int(raw_input())
ok1 = (a + n)%4 == b
ok2 = (a - n)%4 == b
if ok1 and ok2: print 'undefined'
elif ok1: print 'cw'
elif ok2: print 'ccw'
el... | PYTHON |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
int main() {
char c1, c2, x, a;
int n, p, i, m;
scanf("%s", &c1);
scanf("%s", &c2);
scanf("%d", &n);
a = c1;
x = c1;
if (n % 4 == 2 || n % 4 == 0) {
printf("undefined");
return 0;
}
for (i = 1; i <= n % 4; i++) {
if (a == '^')
a = '<';
else if (a == '>'... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
char a[] = {'v', '<', '^', '>'};
int main() {
char t1, t2;
scanf("%c %c", &t1, &t2);
int pos, n;
scanf("%d", &n);
for (int i = 0; i < 4; i++) {
if (a[i] == t1) {
pos = i;
break;
}
}
int tt = n % 4;
int a1 = (tt + pos) % 4, a2 = (pos - tt ... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
char ch, ch1;
long long int n, x, y, z;
cin >> ch >> ch1 >> n;
x = (int)ch;
y = (int)ch1;
z = (x - y);
if ((z == 58) || (z == -34) || (z == 32) || (z == -56)) {
if (((3 + n) % 4) == 0) {
cout << "cw" << endl;
} else if (((n + 1) % 4)... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 1;
const int K = 200;
const int M = 1e9 + 7;
const double eps = 1e-6;
char f, t, k;
map<char, int> mp;
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
mp['v'] = 0;
mp['<'] = 1;
mp['^'] = 2;
mp['>'] = 3;
cin >> f >> t;
int tim... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import java.io.*;
import java.util.*;
public class A1008 {
public static void main(String [] args) /*throws Exception*/ {
InputStream inputReader = System.in;
OutputStream outputReader = System.out;
InputReader in = new InputReader(inputReader);//new InputReader(new FileInputStream(new File... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | s=raw_input().split()
k={'^':0,'>':1,'v':2,'<':3}
n=input()
if k[s[1]]==(k[s[0]]+n%4)%4 and k[s[0]]!=(k[s[1]]+n%4)%4:
print 'cw'
elif k[s[0]]==(k[s[1]]+n%4)%4 and k[s[1]]!=(k[s[0]]+n%4)%4:
print 'ccw'
else:
print 'undefined' | PYTHON |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int f(char a) {
if (a == '>') return 0;
if (a == 'v') return 1;
if (a == '<') return 2;
if (a == '^') return 3;
}
int main() {
char s1, s2;
cin >> s1 >> s2;
int n;
cin >> n;
int o = f(s2) - f(s1);
int x = (o - n) % 4;
int y = (n + o) % 4;
if (x == y)... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
long long n;
char c, s;
cin >> c >> s >> n;
char t[4], v[4];
t[0] = '^';
t[1] = '<';
t[2] = 'v';
t[3] = '>';
v[0] = '^';
v[1] = '>';
v[2] = 'v';
v[3] = '<';
int i, r, r1;
for (i = 0; i < ... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
char s[100], s1[5] = {'v', '<', '^', '>'};
int n;
int main() {
int i, j, k = 0;
gets(s);
scanf("%d", &n);
if (s[0] == s[2]) {
printf("undefined");
return 0;
}
if (s[0] == '>' && s[2] == '<') {
printf("undefined");
return 0;
}
if (s[2] == '>' ... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | def read(func=int, is_list=False):
if is_list:
return map(func, raw_input().split())
else:
return func(raw_input())
x, y = read(str, True)
def get(s):
if s == '^':
return 0
if s == '>':
return 1
if s == 'v':
return 2
return 3
x = get(x)
y = get(y)
n = r... | PYTHON |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | s, t = map(lambda x: "v<^>".index(x), input().split())
n = int(input())
cw = (n + s - t) % 4 == 0
ccw = (n + t - s) % 4 == 0
if cw and not ccw:
print("cw")
elif not cw and ccw:
print("ccw")
else:
print("undefined")
| PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int n;
char a, b;
cin >> a >> b >> n;
if (n % 2 == 0)
cout << "undefined";
else if (n % 4 == 1) {
if (a == '<' && b == '^')
cout << "cw";
else if (a == '^' && b == '>')
cout << "cw";
else if (... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
char start, end;
cin >> start >> end;
int n;
cin >> n;
int mapa[120];
mapa[0] = 'v';
mapa[1] = '<';
mapa[2] = '^';
mapa[3] = '>';
mapa['v'] = 0;
mapa['<'] = 1;
mapa['^'] = 2;
mapa['>'] = 3;
int ans = 0;
if ((mapa[start] + n) % 4 ==... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | states = ['v', '<', '^', '>']
start, end = input().split()
n = int(input())
cw = False
ccw = False
if states[(states.index(start)+n)%4] == end:
cw = True
if states[(states.index(start)-n)%4] == end:
ccw = True
print(['cw','ccw','undefined'][cw+ccw-(1-ccw)]) | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
public class tenth {
public static void main(String args[]) throws Exception {
String sp=br.readLine().trim();
String ss[]=sp.split(" ");
int t=input()%... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 1;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
long long n, l, k;
long long array[1 << 18];
int main() {
map<char, int> ref = {{'^', 0}, {'>', 1}, {'v', 2}, {'<', 3}};
char s, e;
cin >> s >> e;
int n;
cin >> n;
int tot = (n ... | CPP |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import java.io.*;
import java.util.*;
public class Main {
static ContestScanner in;
static Writer out;
public static void main(String[] args) {
Main main = new Main();
try {
in = new ContestScanner();
out = new Writer();
main.solve();
out.clos... | JAVA |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | s, n, f, sp= input(), int(input()), 0, 'v<^>'
l = sp.index(s[0])
if sp[(l + n) % 4] == s[2]: f += 1
if sp[(l - n) % 4] == s[2]: f += 2
if f == 1: print('cw')
elif f == 2: print('ccw')
else: print('undefined')
| PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | l = raw_input()
n = int(raw_input()) % 4
alpha = "v<^>"
if n == 0 or n == 2:
print "undefined"
else:
orig = 0
while alpha[orig] != l[0]:
orig += 1
now = 0
while alpha[now] != l[2]:
now += 1
if (orig+n)%4 == now:
print "cw"
elif (orig-n+8)%4 == now:
print "ccw"... | PYTHON |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | d, s, n = '^>v<', input(), int(input())
if n % 2 == 0:
print("undefined")
elif (d.find(s[0])+n)%4 == d.find(s[2]):
print("cw")
else:
print("ccw")
# Made By Mostafa_Khaled | PYTHON3 |
834_A. The Useless Toy | <image>
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of carame... | 2 | 7 | import sys
sys.setrecursionlimit=2000000
init,end=raw_input().strip().split()
t=int(raw_input())
pos={'^':0,'>':1,'v':2,'<':3}
ninit=pos[init]
nend=pos[end]
if (ninit+t)%4==nend:
if (ninit-t)%4==nend:
print 'undefined'
else:
print 'cw'
else:
if (ninit-t)%4==nend:
print 'ccw'
el... | PYTHON |
854_D. Jury Meeting | Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.
There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for... | 2 | 10 | import java.util.*;
import java.text.*;
import javax.swing.plaf.basic.BasicScrollPaneUI.HSBChangeListener;
import java.io.*;
import java.math.*;
public class code5 {
InputStream is;
PrintWriter out;
static long mod=pow(10,9)+7;
static int dx[]={0,0,1,-1},dy[]={1,-1,0,0};
void solve() throws Exception
{
int n=... | JAVA |
854_D. Jury Meeting | Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.
There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for... | 2 | 10 |
import java.io.*;
import java.util.*;
public class B853 {
public static void main(String args[])throws IOException
{
Reader sc=new Reader();
int n=sc.nextInt();
int m=sc.nextInt();
int k=sc.nextInt();
List<flight> pln[]=new ArrayList[1000001];
int arr[][]=n... | JAVA |
854_D. Jury Meeting | Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.
There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for... | 2 | 10 | R=lambda :map(int,input().split())
n,m,k=R()
F,T=[],[]
ans=int(1e12)
for i in range(m):
d,f,t,c=R()
if f:F.append((d,f,c))
else:T.append((-d,t,c))
for p in [F,T]:
cost=[ans]*(n+1)
s=n*ans
q=[]
p.sort()
for d,t,c in p:
#print(p)
if c<cost[t]:
#print(c,cost[t])
... | PYTHON3 |
854_D. Jury Meeting | Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.
There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
struct nod {
int d, f, t, c;
};
long long ans1[1000005], ans2[1000005];
int cmp(nod x, nod y) { return x.d < y.d; }
nod arr[100005];
int n, m, k;
int vis[100005];
long long sum, num;
int main() {
while (cin >> n >> m >> k) {
for (int i = 1; i <= m; i++)
scanf(... | CPP |
854_D. Jury Meeting | Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.
There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
const int N = 1E5 + 8;
struct node {
long long d, s, e, c;
} A[N];
struct val {
long long E, C;
};
int cmp(node A, node B) { return A.d < B.d; }
stack<val> sta;
long long S[N], E[N], INF = 1000005, llen, rrlen, L, R, n, m, k, idl, idr, cal;
void find_ppl() {
int knum ... | CPP |
854_D. Jury Meeting | Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.
There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
struct piii {
int d, f, t, c;
int i;
friend int operator<(const piii &a, const piii &b) {
if (a.d != b.d) return a.d < b.d;
if (a.f != b.f) return a.f < b.f;
if (a.t != b.t) return a.t < b.t;
return a.c < b.c;
}
} a[100008];
struct pii {
int a;
i... | CPP |
854_D. Jury Meeting | Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.
There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
pair<int, int> flight[200010];
int N, M, K;
int D[200010], F[200010], T[200010], C[200010];
long long go[1000000 + 1], back[1000000 + 1], sumGo, sumBack, tmp[200010];
int main() {
scanf("%d%d%d", &N, &M, &K);
for (int i = 0; i < M; i++) {
scanf("%d%d%d%d", D + i, F ... | CPP |
854_D. Jury Meeting | Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.
There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1000010;
pair<int, int> a[maxn];
int t[maxn], u[maxn], v[maxn], c[maxn], w[maxn], num;
long long L[maxn], R[maxn], sum, ans = 1LL << 60;
int main() {
int N, M, K, pos = 0;
scanf("%d%d%d", &N, &M, &K);
for (int i = 1; i <= M; i++) scanf("%d%d%d%d", &t[... | CPP |
854_D. Jury Meeting | Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.
There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 6.66;
const int MAXK = 1e6 + 6.66;
const long long inf = 1e16 + 6.66;
struct Flight {
int day;
int in;
int out;
int price;
bool operator<(const Flight& f) const { return day < f.day; }
} flights[MAXN];
long long price[MAXN];
long long inc[MA... | CPP |
854_D. Jury Meeting | Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.
There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
int n, m, k;
long long acc[2000100][2];
int cnt[2000100][2], last[2000100];
vector<pair<int, pair<int, int> > > a, b;
int main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> n >> m >> k;
for (int i = 0; i < m; i++) {
int t, x, y, cost;
cin >> t >> x >> y >> c... | CPP |
854_D. Jury Meeting | Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.
There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
int read() {
char ch = getchar();
int f = 0;
while (ch < '0' || ch > '9') ch = getchar();
while (ch >= '0' && ch <= '9') {
f = f * 10 + (ch ^ 48);
ch = getchar();
}
return f;
}
struct data {
int cost;
int pla;
int tim;
} come[100005], leave[100005]... | CPP |
854_D. Jury Meeting | Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.
There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
const int N = 100002;
int n, m, k, currentOutCost[N], cntOut, cntIn;
struct flight {
int i, d, c;
} in[N], out[N];
multiset<int> a[N];
bool cmp(flight x, flight y) { return x.d < y.d; }
int main() {
scanf("%d%d%d", &n, &m, &k);
for (int i = (1); i <= (int)(m); ++i) {
... | CPP |
854_D. Jury Meeting | Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.
There are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that is the meeting point for... | 2 | 10 | #include <bits/stdc++.h>
using namespace std;
const int N = 1000 * 1000 + 5;
vector<pair<int, int>> from[N];
vector<pair<int, int>> to[N];
long long inf = 1e13;
long long best_from[N];
long long best_to[N];
long long cost[N];
int main() {
int n, m, k;
scanf("%d%d%d", &n, &m, &k);
for (int i = 0; i < m; i++) {
... | CPP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.