jiahuimbzuai/CoQuIR huggingface dataset:
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <class T> inline bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> inline bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}

int main() {
	int N;
	cin >> N;
	vector <int> v( N );
	vector <int> c( N );
	rep( i, 0, N )
		cin >> v[ i ];
	rep( i, 0, N )
		cin >> c[ i ];
	int lim = (int)pow(2, N);
	int maximum = -k_mod;
	rep(bit,0,lim){
		int cost = 0;
		int sum = 0;
		fprintf(stderr, "(%d)", bit);
		rep(i,0,N){
			if (bit & (1 << i)){
				cost += c[i];
				sum += v[i];
			}
		}
		fprintf(stderr, "\n");
		if (maximum < sum-cost)
			maximum = sum-cost;
	}
	cout << maximum << endl;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int arr[n+5],frr[n+5];
    for(int i=0;i<n;i++)cin>>arr[i];
    for(int i=0;i<n;i++)cin>>frr[i];

    int counter=0;

    for(int i=0;i<=pow(2,n);i++)
    {
        vector<int>v;
        vector<int>f;
        for(int j=0;j<n;j++)
        {
            if(i&(1<<j))
            {
                v.push_back(arr[j]);
                f.push_back(frr[j]);
            }
        }
        int sum=0;
        for(int i=0;i<v.size();i++)
        {
            sum+=(v[i]-f[i]);
        }
        counter=max(counter,sum);
      // cout<<endl;

    } cout<<counter<<endl;
}
//  [c]
#include<stdio.h>
#include<math.h>

typedef long long ll;

int main() {
	ll n, v[20], c[20],ans=0;
	scanf("%lld", &n);
	for (int i = 0; i < n; i++) {
		scanf("%lld", &v[i]);
	}
	for (int i = 0; i < n; i++) {
		scanf("%lld", &c[i]);
	}
	for (int i = 0; i < pow(2, n); i++) {
		ll sum=0;
		for (int mask = 0; mask < n; mask++) {
			if (i & (ll)pow(2, mask)) sum += v[mask]-c[mask];
		}
		ans = (ans < sum) ? sum : ans;
	}
	printf("%lld", ans);

	return 0;
}
//  [c]
#include<stdio.h>
#include<math.h>

int main(void){
    int N;
    scanf("%d", &N);
    int V[N];
    int C[N];
    int i,j,k;
    for(i = 0; i < N; i++){scanf("%d", &V[i]);}
    for(i = 0; i < N; i++){scanf("%d", &C[i]);}
    
    int box[N];
    int tmp = 1;
    int cnt;
    int max = -1;
    int vsum = 0;
    int csum = 0;
    
    int time = (int)pow((double)2, (double)N);
    for(i = 1; i <= time; i++){
        tmp = i;
        cnt = 0;
        while(cnt < N){
            box[cnt] = tmp % 2;
            tmp /= 2;
            cnt++;
        }
        //printf("i:%d    ", i);
        //for(k = 0; k < N; k++){printf("box[%d]:%d  ", k, box[k]);}
        //printf("\n");
        for(j = 0; j < N; j++){
            if(box[j] == 1){
                vsum += V[j];
                csum += C[j];
            }
        }
        if(max < vsum - csum){max = vsum - csum;}
        vsum = 0;
        csum = 0;
    }
    printf("%d\n", max);
    return 0;
}
//  [c]
#include<stdio.h>
#define N 20

struct object{
int value;
int cost;
};
struct object a[N];

int totv,maxv=0;
int sel[N]={};

void try(int i);

int main(void)
{ 
    
    int n,i;
 scanf("%d",&n);
    

for (i=0;i < n;i++){ 
    scanf("%d",&a[i].value);}
    
   
for (i=0;i < n;i++){ 
    scanf("%d",&a[i].cost);}
 
    try(n-1);
    
printf("%d\n",maxv);
}

void try(int i)
{ int j;
    sel[i]=0;
 if(i!=0){try(i-1);}
 else{totv=0;
        for(j=0;j<N;j++){if(sel[j]==1)totv+=(a[j].value-a[j].cost);}
        if(totv>maxv)maxv=totv;}
     
 sel[i]=1;
 if(i!=0){try(i-1);}
 else{totv=0;
        for(j=0;j<N;j++){if(sel[j]==1)totv+=(a[j].value-a[j].cost);}
        if(totv>maxv)maxv=totv;}
}
//  [javascript]
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=r(1);r(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var n=r(3),i=r(5);t.exports=function(t){var e=new n(t);i(e)}},function(t,e,r){"use strict";var n=r(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new n(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,r){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,r){"use strict";t.exports=function(t){for(var e=t.in(),r=new Array(e),n=0;n<e;n++)r[n]=t.in();for(var i=new Array(e),o=0;o<e;o++)i[o]=t.in();for(var s=0,u=0;u<e;u++)r[u]-i[u]>0&&(s+=r[u]-i[u]);console.log(s)}}]);
//  [javascript]
"use strict";
function main(input) {
    const args = input.split("\n");
    const Vs = args[1].split(" ");
    const Cs = args[2].split(" ");

    const N = parseInt(args[0]);

    let value = 0;
    let ans = 0;

    for(let i = 0; i < N; i++) {
        value = Vs[i] - Cs[i];
        if(value > 0) {
            ans += value
        }
    }

    console.log(ans);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
	var jl = input.split("\n")[1].split(" ");
	var cl = input.split("\n")[2].split(" ");
	var r = 0;
	jl.forEach((j, i) => {
		var s = +j - +cl[i];
		if(s > 0) {
			r += s;
		}
	});
	console.log(r);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import (
	"fmt"
	"sort"
)

var (
	priceList []int
)

func main() {
	var n int

	fmt.Scanf("%d", &n)

	gems := make([]Gem, n)

	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &gems[i].Value)
	}

	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &gems[i].Cost)
	}

	X := 0
	Y := 0

	// 再帰での探索
	buy(n-1, gems, X, Y)

	sort.Sort(sort.Reverse(sort.IntSlice(priceList)))

	fmt.Println(priceList[0])

}

type Gem struct {
	Value int
	Cost  int
}

func buy(now int, gems []Gem, X int, Y int) {
	if now < 0 {
		priceList = append(priceList, X-Y)
	} else {
		// now番目を買わない
		buy(now-1, gems, X, Y)

		// now番目を買う
		X += gems[now].Value
		Y += gems[now].Cost
		buy(now-1, gems, X, Y)
	}
}
//  [go]
package main

import (
	"fmt"
	"math"
)

type Gem struct {
	Cost  int
	Value int
}

func main() {
	var n int
	fmt.Scan(&n)

	var Gems = make([]Gem, n)

	for i := 0; i < n; i++ {
		var v int
		fmt.Scan(&v)
		Gems[i].Value = v
	}

	for i := 0; i < n; i++ {
		var c int
		fmt.Scan(&c)
		Gems[i].Cost = c
	}

	var bestBenefit = 0
	for i := 0; i < int(math.Pow(2.0, float64(n))); i++ {
		var j = 0
		var temp = i
		var sum = 0
		for temp > 0 {
			if temp%2 == 1 {
				sum += (Gems[j].Value - Gems[j].Cost)
			}
			j++
			temp = temp / 2
		}

		if bestBenefit < sum {
			bestBenefit = sum
		}
	}

	fmt.Println(bestBenefit)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
)

func main() {
	n := nextInt()
	v := nextInts(n)
	c := nextInts(n)
	// vx := make([]pair, n)
	// for i := 0; i < n; i++ {
	// 	vx[i].a = v[i]
	// 	vx[i].b = c[i]
	// }
	// sort.Sort(pairs(vx))
	var ans int
	for i := 0; i < pow(2, 20); i++ {
		var x, y int
		var j uint
		for j = 0; j < uint(n); j++ {
			if (1<<j)&i > 0 {
				x += v[j]
				y += c[j]
			}
		}
		// log.Println(x - y)
		ans = max(ans, x-y)
	}
	fmt.Println(ans)
}

var dy = []int{1, 0, -1, 0, 0}
var dx = []int{0, 1, 0, -1, 0}
var inf = int(1e9)

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type pair struct {
	a, b int
}

type pairs []pair

func (p pairs) Len() int {
	return len(p)
}
func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b > p[j].b
	}
	return p[i].a < p[j].a
}

var nextReader func() []byte

func init() {
	nextReader = newScanner()
	log.SetFlags(log.Lshortfile)
}

func newScanner() func() []byte {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() []byte {
		r.Scan()
		return r.Bytes()
	}
}
func nextBytes() []byte {
	return nextReader()
}

func nextString() string {
	return string(nextReader())
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(string(nextReader()), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(string(nextReader()))
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(string(nextReader()), 64)
	return f
}
//  [ruby]
n = gets.chomp!.to_i
vs = gets.chomp!.split(" ")
vs = vs.map{|item| item = item.to_i}
cs = gets.chomp!.split(" ")
cs = cs.map{|item| item = item.to_i}
vcs = []

for i in 0..n-1
	vcs = vcs + [Complex(vs[i],cs[i])]
end

ans = -Float::INFINITY

for kosu in 0..n
	vcs.combination(kosu){|arr| 
		alans = 0
		for j in 0..arr.length-1
			alans = alans + arr[j].real - arr[j].imag
		end
		
		if ans <= alans && alans >= 0 then
		ans = alans
		end
	}
end

puts ans
//  [ruby]
N = gets.to_i
V = gets.split(' ').map(&:to_i)
C = gets.split(' ').map(&:to_i)
max = 0
tmp = 0

(1..N).each do |n|
  (0..N - 1).to_a.combination(n).each do |index|
    tmp = index.inject(0) do |sum, i|
      sum + V[i] - C[i]
    end
    max = tmp if tmp > max
  end
end

puts max
//  [ruby]
n=gets.to_i
v=gets.split.map &:to_i
c=gets.split.map &:to_i
max=0
[0,1].repeated_permutation(n).each do |i|
  sum=0
  for j in 0..n-1
    if i[j]==1
      sum+=(v[j]-c[j])
    end
  end
  max=[max,sum].max
end
puts max
//  [rust]
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        n: usize,
        v: [i64;n],
        c: [i64;n]
    }

    let mut ret = i64::min_value() >> 4;
    for mask in 0..1<<n {
        let vmask = bit_filter(mask, &v);
        let cmask = bit_filter(mask, &c);
        ret = std::cmp::max(ret, vmask .iter().fold(0, |acc, &x| acc + x) - cmask .iter().fold(0, |acc, &x| acc + x));
    }
    println!("{}", ret);
}

#[allow(dead_code)]
pub fn bit_filter<T: Clone>(mask: usize, v: &[T]) -> Vec<T> {
    let mut ret = vec![];
    for i in 0..v.len() {
        if (mask >> i) & 1 == 1 {
            ret.push(v[i].clone());
        }
    }
    ret
}
//  [rust]
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn ttt(n: u32) -> u64 {
    let mut sum=0;
    for i in 0..n {
        sum += u64::pow(2, i);
    }
    sum
}

fn jj(mut j: i64, len: usize) -> Vec<i64>{
    let mut v = Vec::new();
    while j != 0 {
        v.push(j % 2);
        j /= 2;
    }
    while v.len() < len {
        v.push(0);
    }
    v
}

fn maxi(m: i64, n: i64) -> i64 {
    if m > n {
        return m
    } else {
        return n
    }
}

fn main() {
    input! {
        n: usize,
        v: [usize; n],
        c: [usize; n],
    }
    let till = ttt(n as u32);
    let mut max = -10000;
    for i in 0..till + 1 {
        let s = jj(i as i64, n);
        let mut vn = 0;
        let mut cn = 0;
        for j in 0..n {
            if s[j] == 1 {
                vn+=v[j];
                cn+=c[j];
            }
            max = maxi(max, vn as i64 - cn as i64);
        }
    }
    println!("{}", max);
}
//  [rust]
fn get_input() -> String {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();
    word.trim().to_owned()
}

fn main() {
    let n: usize = get_input().parse().unwrap();

    let mut v:Vec<i64> = Vec::new();
    let vline = get_input();
    for l in vline.split_whitespace() {
        v.push(l.parse().unwrap());
    }

    let mut c:Vec<i64> = Vec::new();
    let cline = get_input();
    for l in cline.split_whitespace() {
        c.push(l.parse().unwrap());
    }

    let pow:Vec<i64> = (0..(1 << n))
        .map(|i| (0..n)
             .filter(|j| i & (1 << j) > 0)
             .filter(|&i| v[i] > c[i])
             .map(|i| v[i] - c[i])
             .sum())
        .collect();
    let ans = pow.iter().max().unwrap();
    println!("{}", ans);
}
//  [typescript]
((input: string): void => {
    const [_, v, c]: number[][] = input.trim().split(/\n/).map(
        v => v.split(" ").map(Number)
    );
    const hoge = v.map( (v, i) => v - c[i] ).filter(v => v > 0)
    console.log(hoge.length==0 ? 0 : hoge.reduce( (a, b) => a+b ));
})(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
import * as fs from 'fs';


namespace AtCoder.abc125 {
    export class Program {
        // in
        // 4
        // 13 21 6 19
        // 11 30 6 15
        // out
        // 6
        static main(inp: string) {
            const n: number = parseInt(inp.split('\n')[0]);
            const v: number[] = inp.split('\n')[1].split(' ').map(Number);
            const c: number[] = inp.split('\n')[2].split(' ').map(Number);

            let ans: number = 0;
            v.forEach((val: number, idx: number) => {
                if (val > c[idx]) {
                    ans += (val - c[idx]);
                }
            });

            console.log(ans);
        }
    }
}

AtCoder.abc125.Program.main(fs.readFileSync('/dev/stdin', 'utf8').trim());
//  [typescript]
{
  const main = (input: string): void | string | number => {
    const r = reader(input)
    const N = r.n()

    const v = r.ns()
    const c = r.ns()

    let sum = 0

    for (let i = 0; i < N; i++) {
      const k = v[i] - c[i]

      sum += Math.max(0, k)
    }

    return sum
  }

  const reader = (str: string) => {
    const lines = str.trim().split('\n')
    const s = () => lines.shift() || ''
    const n = () => Number(s())

    const ss = () => s().split(' ')
    const ns = () => ss().map(Number)
    const nls = () => lines.map(Number)

    return { lines, s, n, ss, ns, nls }
  }

  const getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')
  const res = main(getInput())

  if (typeof res === 'number' || typeof res == 'string') console.log(res)
}
//  [python]
#!/usr/bin/env python3
# vim: set fileencoding=utf-8

# pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation


"""Module docstring
"""

import functools
import heapq
import itertools
import logging
import math
import random
import string
import sys
from argparse import ArgumentParser
from collections import defaultdict, deque
from copy import deepcopy
from typing import Dict, List, Optional, Set, Tuple


def solve(values: List[int], nb: int) -> int:
    for _v in values:
        pass
    return nb


def do_job():
    "Do the work"
    LOG.debug("Start working")
    # first line is number of test cases
    prev = input()
    print("ABC" if prev == "ARC" else "ARC")


def print_output(testcase: int, result) -> None:
    "Formats and print result"
    if result is None:
        result = "IMPOSSIBLE"
    print("Case #{}: {}".format(testcase + 1, result))
    # 6 digits float precision {:.6f} (6 is the default value)
    # print("Case #{}: {:f}".format(testcase + 1, result))


def configure_log() -> None:
    "Configure the log output"
    log_formatter = logging.Formatter("%(lineno)d - " "%(message)s")
    handler = logging.StreamHandler(sys.stdout)
    handler.setFormatter(log_formatter)
    LOG.addHandler(handler)


LOG = None
# for interactive call: do not add multiple times the handler
if not LOG:
    LOG = logging.getLogger("template")
    configure_log()


def main(argv=None):
    "Program wrapper."
    if argv is None:
        argv = sys.argv[1:]
    parser = ArgumentParser()
    parser.add_argument(
        "-v",
        "--verbose",
        dest="verbose",
        action="store_true",
        default=False,
        help="run as verbose mode",
    )
    args = parser.parse_args(argv)
    if args.verbose:
        LOG.setLevel(logging.DEBUG)
    do_job()
    return 0


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    sys.exit(main())


class memoized:
    """Decorator that caches a function's return value each time it is called.
    If called later with the same arguments, the cached value is returned, and
    not re-evaluated.
    """

    def __init__(self, func):
        self.func = func
        self.cache = {}

    def __call__(self, *args):
        try:
            return self.cache[args]
        except KeyError:
            value = self.func(*args)
            self.cache[args] = value
            return value
        except TypeError:
            # uncachable -- for instance, passing a list as an argument.
            # Better to not cache than to blow up entirely.
            return self.func(*args)

    def __repr__(self):
        """Return the function's docstring."""
        return self.func.__doc__

    def __get__(self, obj, objtype):
        """Support instance methods."""
        return functools.partial(self.__call__, obj)
//  [python]
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
# }}}

def solve():
    s = input()
    if s == "ABC":
        print("ARC")
    else:
        print("ABC")

    return 0

if __name__ == "__main__":# {{{
    solve()

# vim: set foldmethod=marker: }}}
//  [java]
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    // System.out.println(S);
    if(s.equals("ABC")){
    System.out.println("ARC");  
    }else{
    System.out.println("ABC");  
    }

  }
}
//  [java]
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (s.equals("ABC")) {
            System.out.println("ARC");
        } else {
            System.out.println("ABC");
        }
        sc.close();
    }
}
//  [java]
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String S = s.next();
        if (S.equals("ABC")) {
            System.out.println("ARC");
        } else {
            System.out.println("ABC");
        }
        s.close();
    }
}
//  [cpp]
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res % p;
}
int lcm(int a, int b) { return a / __gcd(a, b) * b; }
int prime[20000000];
int a[300001];
map<int, int> mp;
vector<int> pr;
void sieve(int n)
{

    for (int p = 2; p * p <= n; p++)
    {

        if (prime[p] == 0)
        {

            for (int i = p * p; i <= n; i += p)
                prime[i] = p;
        }
    }
    for (int i = 2; i <= 20000000;i++){
        if(prime[i]==0)
            pr.pb(i);
    }
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tc;
    tc = 1;
    sieve(20000000);
    //cin >> tc;
    while (tc--)
    {
        string s;
        cin >> s;
        if(s=="ABC"){
            cout << "ARC";
            
        }
        else{
            cout << "ABC";
        }
    }

    return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>

int main(){
    char s[3];
    scanf("%s",&s);

    if(strcmp(s,"ABC") == 0)printf("ARC\n");
    else printf("ABC\n");
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int main() {
	char s[3];
	scanf("%s",s);
	if(s[1]=='B'){
	    printf("ARC");
	}else{
	    printf("ABC");
	}
    return 0;
}
//  [c]
#include <stdio.h>

int main(){
  char s[4];  scanf("%s", s);

  if(s[1] == 'R') printf("ABC\n");
  else printf("ARC\n");
  return 0;
}
//  [javascript]
"use strict";

const main = (input) => {
    const spi = input.split('\n');
    console.log(spi[0] === "ABC" ? "ARC" : "ABC");
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
const main = stdin => {
  const S = stdin.trim()
  if (S === 'ABC') {
    console.log('ARC')
  } else {
    console.log('ABC')
  }
}

// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))
//  [javascript]
"use strict";
// inputに入力データ全体が入る
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    var input = input.split("\n");
    if(input[0] === "ABC"){
        console.log("ARC");
    }else{
        console.log("ABC");
    }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var txt string
	var s = bufio.NewScanner(os.Stdin)
	if s.Scan() {
		txt = s.Text()
	}

	if txt == "ABC" {
		fmt.Println("ARC")
	} else {
		fmt.Println("ABC")
	}

}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n string
	fmt.Scan(&n)

	if n == "ABC" {
		fmt.Println("ARC")
	} else {
		fmt.Println("ABC")
	}

}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := makeWordScanner()
	s := eGetLine(scanner)
	if s == "ABC" {
		fmt.Println("ARC")
	} else {
		fmt.Println("ABC")
	}
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
const (
	TooLarge = math.MaxInt64
	TooSmall = math.MinInt64
)

func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeCharScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanRunes)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func pow(a, n int) int {
	if n == 0 {
		return 1
	}
	if n == 1 {
		return a
	}
	if n%2 == 1 {
		return pow((a*a), n/2) * a
	}
	return pow((a * a), n/2)
}
func powMod(a, n, mod int) int {
	if n == 0 {
		return 1 % mod
	}
	if n == 1 {
		return a % mod
	}
	if n%2 == 1 {
		return powMod((a*a)%mod, n/2, mod) * a % mod
	}
	return powMod((a*a)%mod, n/2, mod)
}

func factoricalMod(n, count, mod int) int {
	if count == 1 {
		return n % mod
	}
	return (n % mod) * (factoricalMod(n-1, count-1, mod)) % mod
}

func combinationMod(n, a, mod int) int {
	x := factoricalMod(n, a, mod)
	y := factoricalMod(a, a, mod)
	y = powMod(y, mod-2, mod)
	return ((x % mod) * (y % mod)) % mod
}
func countBitOfOn(i, numbits int) int {
	count := 0
	var bit uint64
	for bit = 0; bit < uint64(numbits); bit++ {
		t := 1 << bit
		if i&t > 0 {
			count++
		}
	}
	return count
}

type ints []int

func ToString(slice []int) string {
	format := fmt.Sprint(slice)
	return fmt.Sprint(format[1 : len(format)-1])
}

type String string

func (s String) revese() string {
	b := []byte(s)
	for i := 0; i < len(b)/2; i++ {
		b[i], b[len(b)-1-i] = b[len(b)-1-i], b[i]
	}
	return string(b)
}
//  [ruby]
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
s = gets.chomp

if s == 'ABC'
  puts 'ARC'
else
  puts 'ABC'
end
//  [ruby]
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

a = gets.chomp
puts (a == "ABC")? "ARC" : "ABC"
//  [ruby]
require 'pp'

# 入力値を文字列で返却する
def gets_s()
  gets.chomp
end

S = gets_s

puts S == "ABC" ? "ARC" : "ABC"
//  [swift]
import Foundation
print(readLine()! == "ABC" ? "ARC" : "ABC")
//  [swift]
//
//  main.swift
//  readLine
//
//  Created by MAC on 5/4/20.
//  Copyright © 2020 Ahliddin Akhmedov. All rights reserved.
//

import Foundation

//print("Enter how many days you will swim, bike or run this week?")
//
//var numberOfDays = Int(readLine() ?? "-1") ?? -1
//
//print("you entered \(numberOfDays + 10)")
//
//// command + r => builds and run the application
//// command + b => only builds and checks for errors
//
//var a = Int(readLine()!)!
//var b : [Int] = []
//
//
//
//var s : Int = 0
//var c : Int = 0
//
//for i in b {
//    if i == 10{
//        s += 1
//    } else{
//        c += 1
//    }
//}
//print("s - \(s), c- \(c)")

var str = readLine()
if str == "ARC" {
    print("ABC")
} else{
    print("ARC")
}
//  [swift]
let s = cin.str
print(s == "ABC" ? "ARC" : "ABC")

// MARK: #### 以下、ライブラリ ####

import Foundation
#if os(Linux)
    import Glibc
#else
    import Darwin.C
#endif

enum cin {
    // 123
    static var int: Int { Int(readLine()!)! }
    // 12 23
    static var pair: (Int, Int) { let line = readLine()!.components(separatedBy: " "); return (Int(line[0])!, Int(line[1])!) }
    // 12 23 34
    static var triple: (Int, Int, Int) { let line = readLine()!.components(separatedBy: " "); return (Int(line[0])!, Int(line[1])!, Int(line[2])!) }
    // AtCoder
    static var str: String { readLine()! }
    // At Coder
    static var arrayStr: [String] { str.components(separatedBy: " ") }
    // 1 2 3 4
    static var array: [Int] { str.components(separatedBy: " ").map { Int($0)! } }
    // 1
    // 2
    // 3
    static func v_array(count: Int) -> [Int] { (0..<count).map { _ in int } }
}

extension Int {
    // 123 -> [1, 2, 3]
    var digits: [Int] { Array(String(self)).map { Int(String($0))! } }
}

extension Array where Element == Int {
    // [2, 1, 3, 2] -> 8
    var sum: Int { self.reduce(0, +) }
    // [2, 1, 3, 2] -> [1, 2, 2, 3]
    var orderBy: [Int] { sorted() }
    // [2, 1, 3, 2] -> [3, 2, 2, 1]
    var orderByDesc: [Int] { sorted(by: { $0 > $1 }) }
    // [2, 1, 3, 2] -> [2, 1, 3]
    var distinct: [Int] { Array(Set(self)) }
}

precedencegroup PowerPrecedence { higherThan: MultiplicationPrecedence }
infix operator ^^ : PowerPrecedence
func ^^ (radix: Int, power: Int) -> Int {
    return Int(pow(Double(radix), Double(power)))
}

extension String {
    // e.g. cin.line.regex(match: "^(dream|dreamer|erase|eraser)*$")
    func regex(match pattern: String) -> Bool {
        let regex = try! NSRegularExpression(pattern: pattern)
        return regex.firstMatch(in: self, range: NSRange(location: 0, length: self.count)) != nil
    }
    // "ABC"[1] -> "B"
    subscript(i: Int) -> Character {
        get {
            self[index(at: i)]
        }
        set(char) {
            var characters = Array(self)
            characters[i] = char
            self = String(characters)
        }
    }
    func index(at offset: Int) -> String.Index { index(startIndex, offsetBy: offset) }
    // "ABC".swapAt(0, 1) -> "BAC"
    mutating func swapAt(_ index1: Int, _ index2: Int) {
        var characters = Array(self)
        characters.swapAt(index1, index2)
        self = String(characters)
    }
}
//  [typescript]
"use strict";

const main = arg => {
  const input = arg.trim().split("\n");

  const S = input[0]
  if (S === "ABC") {
    console.log("ARC");
  } else {
    console.log("ABC");
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const S = input[0][0];

  return S[1] === "B" ? "ARC" : "ABC";
};

console.log(main(read()));
//  [python]
import sys
import os
import numpy as np
import re

S = input()

pattern = re.compile('^A[a-z][a-z]*C[a-z]*[a-z]$')
if pattern.match(S):
    print('AC')
else:
    print('WA')
//  [python]
import numpy as np

l = list(input())
l = np.array(l)


state = 'AC'

if l[0] != 'A':
    state = 'WA'
else:
    l[0] = 'a'
    l2 = l[2:-1].copy()
    Cplace = np.where(l2=='C')[0]

    if len(Cplace) == 1:
        l2[Cplace[0]] = 'c'
        l[2:-1] = l2
        arr = ''.join(l)
        if not arr.islower():
            state = 'WA'

    else:
        state = 'WA'

print(state)
//  [python]
import collections
r = raw_input()
print 'AC' if ( r[0] == 'A' and  collections.Counter(r[2:-1])['C'] == 1 and  all([l in set(['A', 'C']) or l.lower() ==l for l in r ])) else 'WA'
//  [java]
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BAcCepted solver = new BAcCepted();
        solver.solve(1, in, out);
        out.close();
    }

    static class BAcCepted {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            out.println(s.chars().filter(Character::isUpperCase).count() == 2
                    && s.substring(2, s.length() - 1).chars().anyMatch(c -> c == 'C')
                    && s.charAt(0) == 'A' ? "AC" : "WA");
        }

    }
}
//  [java]
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        System.out.println(solve(S) ? "AC" : "WA");

        sc.close();
    }

    static boolean solve(String S) {
        int[] uppercaseIndices = IntStream.range(0, S.length()).filter(i -> Character.isUpperCase(S.charAt(i)))
                .toArray();

        return S.charAt(0) == 'A' && uppercaseIndices.length == 2 && uppercaseIndices[1] >= 2
                && uppercaseIndices[1] <= S.length() - 2 && S.charAt(uppercaseIndices[1]) == 'C';
    }
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i]
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
const int MAXN = 1000001;
vector<int> adj[MAXN];
int power(int x, int y, int p = mod){ 
    int res = 1; 
    x = x % p; 
    if (x == 0) return 0; 
    while (y > 0) {  
        if (y & 1) res = (res*x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
} 
int modFact(int n, int p = mod) 
{ 
    if (n >= p) 
        return 0; 
  
    int result = 1; 
    for (int i = 1; i <= n; i++) 
        result = (result * i) % p; 
  
    return result; 
} 
int32_t main(){
    SPEED;
    SPEED;
    string s;
    cin >> s;
    map<char, int> fre;
    for(char c : s){
        fre[c]++;
    }
    int cnt = 0;
    if(s[0] == 'A'){
        int yes = 0;
        for(int i = 2; i < len(s) - 1; ++i){
            if(s[i] == 'C') yes++;
        }
        if(yes == 1){
            for(char c: s){
                if(c >= 97 && c <= 122) cnt++;
            }
            if(cnt + 2 == len(s)) cout << "AC";
            else cout << "WA";
        }
        else cout << "WA" ;
    }
    else cout << "WA" ;
}
// check indices of loop
// check for overflow
//  [c]
#include <stdio.h>
#include <string.h>
int main(void)
{
	char s[9];
	int a,i,x=0,y=0,z=0;
	scanf("%s",s);
	a=strlen(s);
	if(s[0]=='A'){
		if(islower(s[1])){
			for(i=2;i<a-1;i++){
				if(s[i]=='C'){
					x++;
				}else{
					if(isupper(s[i])){
						y++;
					}
				}
			}
			if(islower(s[a-1])){
				if(x==1){
					if(y==0){
						z++;
					}
				}
			}
		}
	}
	if(z==1){
		printf("AC");
	}else{
		printf("WA");
	}return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>

int main(void){
    char s[12],uppercasecmp[27]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    scanf("%s",s);
    if (s[0]!='A'){
        printf("WA\n");
        return 0 ;
    }
    for (int i=0; i<27; i++){
        if (s[1]==uppercasecmp[i]){
            printf("WA\n");
            return 0;
        }
    }
    int count=0;
    for (int i=2; i<strlen(s)-1; i++){
        for (int j=0; j<27; j++){
            if (s[i]==uppercasecmp[j]){
                if (j==2){
                    count++;
                } else {
                    printf("WA\n");
                    return 0 ;
                }
            }
        }
    }
    if (count!=1){
        printf("WA\n");
        return 0 ;
    }
    for (int i=0; i<27; i++){
        if (s[strlen(s)-1]==uppercasecmp[i]){
            printf("WA\n");
            return 0;
        }
    }
    printf("AC\n");
	return 0 ;
}
//  [c]
#include<stdio.h>
int main(){
  int n,i,x=1;
  char s[11];
  scanf("%s",s);
  for(n=0;s[n];n++);
  for(i=1;i<n;i++){if(s[i]=='C')x*=2;else if(s[i]<'a')x=0;}
  printf(x==2&&s[0]=='A'&&s[1]!='C'&&s[n-1]!='C'?"AC":"WA");
}
//  [javascript]
var toInt = x=>parseInt(x,10);
var toIntArr = arr=>arr.map(x=>toInt(x));
var abs = x=>x>0?x:-x;
function min(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]<val)val = rest[i];return val}
function max(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]>val)val = rest[i];return val}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
 
function Main(input){
	var input = input.split('\n');
	var s = input[0];
	var n = s.length;
	var isC = 0;
	if(s[0]!=='A'){
		console.log('WA');
		return 0;
	}
	if(s[1]!==s[1].toLowerCase() || s[n-1]!==s[n-1].toLowerCase()){
		console.log('WA');
		return 0;
	}
	for(var i = 2; i < n-1; i++){
		if(s[i]!==s[i].toLowerCase()){
			if(s[i]==='C'){
				if(isC===1){
					console.log('WA');
					return 0;
				}else{
					isC++;
				}
			}else{
				console.log('WA');
				return 0;
			}
		}
	}
	if(isC===0){
		console.log('WA');
	}else{
		console.log('AC');
	}
}
//  [javascript]
function Main(s){
  ans = "AC"
  if(s[0] !== "A")ans = "WA";
  var f = 0;
  for(var i = 1; i < s.length; i++){
    if(s[i] === "C"){
      if(i > 1 && s.length - 1 > i)f++;else ans = "WA";
    }else{
      if("a" > s[i]) ans = "WA";
    }
  }
  if(f !== 1)ans = "WA";
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin","utf8").trim());
//  [go]
package main

import (
	"fmt"
	"unicode"
)

func main() {
	// Code for B - AcCepted
	var S string
	fmt.Scanf("%s", &S)

	var flag1 int = 0
	if S[0] == 'A' {
		flag1++
	}
	var flag2 int = 0
	var number int
	for i := 2; i < len(S)-1; i++ {
		if S[i] == 'C' {
			flag2++
			number = i
		}
	}

	var flag3 int = 0
	for i := 1; i < len(S); i++ {
		if i == number {
			continue
		}
		if !unicode.IsLower(rune(S[i])) {
			flag3++
		}
	}

	if flag1 == 1 && flag2 == 1 && flag3 == 0 {
		fmt.Println("AC")
	} else {
		fmt.Println("WA")
	}
}
//  [go]
package main

import (
	"fmt"
	"strings"
)

func main() {
	var str string
	fmt.Scan(&str)

	s := strings.Split(str, "")
	var flg bool
	flg = true
	if s[0] != "A" || strings.Count(str, "C") != 1 {
		flg = false
	}

	s[0] = "a"
	if flg {
		flg = false
		for i := 2; i < len(s)-1; i++ {
			if s[i] == "C" {
				flg = true
				s[i] = "c"
			}
		}
	}
	if flg {
		for _, v := range s {
			if v >= "A" && v <= "Z" {
				flg = false
			}
		}
	}

	if flg {
		fmt.Println("AC")
	} else {
		fmt.Println("WA")
	}
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
	"unicode"
)

func main() {
	sc = initScanner(os.Stdin)
	s := scanString(sc)
	fmt.Println(solve(s))
}

func solve(s string) string {
	ss := strings.Split(s, "")

	if ss[0] != "A" {
		return "WA"
	}

	cnt, point := 0, 0
	for i := 2; i < len(ss)-1; i++ {
		if ss[i] == "C" {
			cnt++
			point = i
		}
	}
	if cnt != 1 {
		return "WA"
	}

	for i := 1;i<len(ss);i++ {
		if i == point {
			continue
		}
		if unicode.IsUpper(rune(s[i])) {
			return "WA"
		}
	}


	return "AC"
}

// --------------- BASE DEFINITIONS ---------------

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	return sc
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanIntSlice(sc *bufio.Scanner, n int) []int {
	is := make([]int, n)
	for i := 0; i < n; i++ {
		is[i] = scanInt(sc)
	}

	return is
}

func scanFloat64(sc *bufio.Scanner) float64 {
	sc.Scan()
	f, _ := strconv.ParseFloat(sc.Text(), 64)
	return f
}

func scanFloat64Slice(sc *bufio.Scanner, n int) []float64 {
	fs := make([]float64, n)
	for i := 0; i < n; i++ {
		fs[i] = scanFloat64(sc)
	}

	return fs
}

func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanStringSlice(sc *bufio.Scanner, n int) []string {
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		ss[i] = sc.Text()
	}

	return ss
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}
//  [ruby]
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

S = gets.chomp

sx = S.split('')

ac = true

ac = false if sx.first != 'A'

ac = false unless sx[2..-2].include?('C')

ac = false if sx.count { |s| s.upcase == s } != 2

puts ac ? 'AC' : 'WA'
//  [ruby]
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# 入力値を文字の配列で返却する
def gets_nsp_list()
  gets.chomp.split("")
end

s = gets_nsp_list

if s[0] != "A"
  puts "WA"
  exit
end

if s[2..(s.size-2)].count("C") != 1
  puts "WA"
  exit
end

ls = s - ["A", "C"]

if ls == ls - ("A".."Z").to_a
  puts "AC"
  exit
end

puts "WA"
//  [ruby]
s=gets.chomp
flag=true
l=s.size
flag=false if s[0]!=?A
flag=false if s[1].upcase==s[1]
c=0
(2...l-1).each do |i|
  if s[i].upcase==s[i]
    c+=1 if s[i]==?C
    flag=false if s[i]!=?C
  end
end
flag=false if c!=1
flag=false if s[l-1].upcase==s[l-1]
puts flag ? 'AC':'WA'
//  [rust]
use whiteread::parse_line;

fn main() {
    let s: String = parse_line().unwrap();
    let mut iter = s.as_str().chars();
    let mut flag = false;

    if iter.next() != Some('A') {
        println!("WA");
        return;
    }
    if !iter.next().unwrap().is_lowercase() {
        println!("WA");
        return;
    }
    for _ in 0..s.len() - 3 {
        let c = iter.next();
        if c == Some('C') {
            flag = true;
            break;
        } else if !c.unwrap().is_lowercase() {
            println!("WA");
            return;
        }
    }
    for c in iter {
        if !c.is_lowercase() {
            println!("WA");
            return;
        }
    }
    if flag {
        println!("AC");
    } else {
        println!("WA");
    }
}
//  [rust]
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{
        S: Chars,
    }
    
    if S[0] != 'A' {
        println!("WA")
    } else {
        let mut c_num = 0;
        let mut not_small = 0;
        for i in 1..S.len() {
            if i == 1 || i == S.len() - 1 {
                if !S[i].is_lowercase() {
                    not_small += 1;
                }
            } else {
                if S[i] == 'C' {
                    c_num += 1;
                } else {
                    if !S[i].is_lowercase() {
                        not_small += 1
                    }
                }
            }
        }

        if c_num == 1 && not_small == 0 {
            println!("AC")
        } else {
            println!("WA")
        }
    }

    println!("", );
}
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const S = input[0][0];

  return /^A[a-z]+C[a-z]+$/.test(S) ? "AC" : "WA";
};

console.log(main(read()));
//  [typescript]
function Main(input){
	var a = input.split("\n")[0].split(' ')[0];
  var result="WA";
  	if(a.startsWith('A')&&a.slice(2,a.length-1).split('C').length===2){
      a=a.charAt(1)+a.slice(2,a.length-1).replace('C',"")+a.charAt(a.length-1);
	 if(a.match(/^[a-z]+$/){result="AC"}
    }
  console.log(result)
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [python]
import numpy as np
N = int(input())
list_a = [int(input()) for _ in range(N)]
list_np = np.array(list_a)
maxnum=list_np.max()
index_list = np.where(list_np == maxnum)[0]
if len(index_list) == 1:
  list_drop = [i for i in list_a if i != maxnum]
  a=[]
  for i in range(N):
    if i in index_list:
      a.append(max(list_drop))
    else:
      a.append(maxnum)
else:
  a = [maxnum for i in range(N)]
for i in range(N):
  print(a[i])