akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
int N;
ll p[100001],l[100000],s[100001];
vector<P> vc;
set<int> ids;
set<int>::iterator it;
int bit[100001];
int sum(int i){
	int s=0;
	while(i>0){
		s+=bit[i];
		i=(i&(i-1));
	}
	return s;
}
void add(int i,int x){
	while(i<=N){
		bit[i]+=x;
		i+=(i&-i);
	}
}

int main(){
	cin>>N;
	rep(i,N) cin>>p[i+1];
	rep(i,N) cin>>l[i];
	rep(i,N) p[i+1]+=p[i],s[i+1]=s[i]+l[i];
	rep1(i,N-1) vc.pb(P(p[i],i));
	sort(all(vc));
	vc.insert(vc.begin(),P(0,0));
	vc.pb(P(p[N],0));
	rep(i,N) if(vc[i+1].fs-vc[i].fs<l[i]){
		puts("-1");
		return 0;
	}
	ll ans=0;
	for(int i=N-1;i>0;i--){
		int id=vc[i].sc;
		ans+=i-id+sum(id);
		add(id,1);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 5576
#include <iostream>
#include <map>
using namespace std;

int main() {
  int q;
  cin >> q;
  string k;
  map<string, int> M;
  while (cin >> q >> k) {
    if (q == 0) {
      int x;
      cin >> x;
      M[k] = x;
    }
    if (q == 1)
      cout << M[k] << endl; // key guaranteed to be in map
  }
}


Measured memory_bytes: 27828
#include <bits/stdc++.h>
using namespace std;

int main(void) {
  int n;
  cin >> n;

  for(int i=1;i<10;i++){
      if(n%i ==0){
          int m = n/i;
          if(m <=9 && m>=1){
              cout << "Yes" << endl;
              return 0;
          }
      }
  }
  cout << "No" << endl;
  return 0;

}

Measured memory_bytes: 256
N = int(input())
a = [0] + list(map(int,input().split()))
b = [0] * (N+1)
for i in reversed(range(1,N+1)):
    if sum(b[i::i])%2 != a[i]:
        b[i] = 1

print(sum(b))
for i,j in enumerate(b):
    if j:
        print(i, end=" ")

Measured memory_bytes: 8352
#include <bits/stdc++.h>

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	string s,t,r;
	cin >> s >> t >> r;

	cout << s[0] << t[1] << r[2] << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

#define ull unsigned long long
#define ul unsigned long
#define ll long long
#define size_t long long
// sort(&a[0], &a[4], [](auto& x, auto& y){return x[0] < y[0];});
//accumulate(&arr2[n], &arr2[m-1], 0);
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  string S; std::cin >> S;

  // sort(S.begin(),S.end());
  S.erase(unique(S.begin(),S.end()),S.end());
  std::cout << ((S.size() != 4)?"Bad":"Good" ) << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;

int main() {
  int N; cin >> N;
  string S; cin >> S;
  int x = 0, max = -1000;
  for(int i = 0; i < S.size(); i++) {
    if(S[i] == 'I') {
      x++;
      if( x > max ) max = x;
    } else {
      if( x > max ) max = x;
      x--;
    }
  }
  cout << max << endl;

  return 0;
}


Measured memory_bytes: 256
# include <iostream>

using namespace std;

int main()
{
	int N;

	cin >> N;

	int x = N % 10;

	if (x == 3)
		cout << "bon";
	else if (x == 0 || x == 1 || x == 6 || x == 8)
		cout << "pon";
	else
		cout << "hon";


    return 0;
}

Measured memory_bytes: 3616
#include <iostream>

using namespace std;

int main() {
	int r, c;
	int sum_r, sum_c, sum_rc = 0;
	cin >> r >> c;
	int rc[r][c];

	for(int i=0; i<r; i++) {
		for(int j=0; j<c; j++) {
			cin >> rc[i][j];
		}
	}
	for(int i=0; i<r; i++) {
		sum_r = 0;
		for(int j=0; j<c; j++) {
			cout << rc[i][j] << " ";
			sum_r += rc[i][j];
		}
		cout << sum_r;
		sum_rc += sum_r;
		cout << endl;
	}
	for(int i=0; i<c; i++) {
		sum_c = 0;
		for(int j=0; j<r; j++) {
			sum_c += rc[j][i];
		}
		cout << sum_c << " ";
	}
	cout << sum_rc << endl;

	return 0;
}


Measured memory_bytes: 3116
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
while(true){
int h = sc.nextInt();
int w = sc.nextInt();
if(h==0&&w==0){
    break;
}
for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
        System.out.print("#");
        }
        System.out.println("");
}
System.out.println("");
}
sc.close();
    }
}


Measured memory_bytes: 34948
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    ll N, A[100000], M = 1;
    cin >> N;
    REP(i, N) cin >> A[i];
    REP(i, N) {
        if (A[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    REP(i, N) {
        ll before = M;
        M *= A[i];
        if ((A[i] > 1 && M < before) || (M > 1000000000000000000)) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << M << endl;
    return 0;
}

Measured memory_bytes: 4432
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::iter::FromIterator;

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());
    let n = scan.read::<usize>();
    let s = scan.chars();
    let q = scan.read::<usize>();
    let ks = scan.readn::<usize>(q);
    for k in ks {
        let mut d = 0i64;
        let mut m = 0;
        let mut dm = 0;
        let mut dmc = 0;
        for i in 0..n {
            match s[i] {
                'D' => d += 1,
                'M' => {
                    m += 1;
                    dm += d;
                },
                'C' => {
                    dmc += dm;
                },
                _ => ()
            };
            if i >= k-1 {
                match s[i+1-k] {
                    'D' => {
                        d -= 1;
                        dm -= m;
                    },
                    'M' => {
                        m -= 1;
                    },
                    _ => ()
                };
            }
        }
        println!("{}", dmc);
    }
}

// region template
#[allow(dead_code)]
fn iu(i: i64) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> i64 { i as i64 }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

#[allow(dead_code)]
fn arr<'a, S, T>(n: usize, mut f: S) -> Vec<T> where S: FnMut(usize) -> T + 'a {
    (0..n).map(|i| f(i)).collect::<Vec<T>>()
}

#[allow(dead_code)]
fn alt<S, T>(v: Vec<S>) -> T where T: FromIterator<S> {
    v.into_iter().collect::<T>()
}

#[allow(dead_code)]
fn dup<S, T>(v: &[S]) -> T where T: FromIterator<S>, S: Clone {
    v.iter().cloned().collect::<T>()
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion

Measured memory_bytes: 12532
let () =   
	let (n, m) = Scanf.sscanf(read_line()) "%d %d" (fun x y -> (x, y)) in
	let rec f xss i = 
		if i = n then List.rev xss
		else (
			let ys = Str.split (Str.regexp " ") (read_line ()) 
					 |> List.map int_of_string 
			in f (ys :: xss) (i + 1)
		) in
	let rec g xs i = 
		if i = m then List.rev xs 
		else g ((read_line () |> int_of_string) :: xs) (i + 1) in 
	let nss = f [] 0 in
	let ms  = g [] 0 in
	List.map (fun ns -> List.map2 ( * ) ns ms |> List.fold_left (+) 0) nss
	|> List.iter (Printf.printf "%d\n")
;;


Measured memory_bytes: 4332
n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))

journey = [1]

for i in range(2*n + 100):
    nxt = a[journey[-1]]
    journey.append(nxt)
    
if k < n + 1:
    print(journey[k])
    exit()

loop_end = n

loop_start = n-1

while(journey[loop_start] != journey[loop_end]):
    loop_start -= 1

period = loop_end - loop_start

k %= period
while k<= n:
    k += period

print(journey[k])

Measured memory_bytes: 32384
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, Y) for (int(X) = 0; (X) < (Y); ++(X))
#define rrep(X, Y) for (int(X) = (Y)-1; (X) >= 0; --(X))
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

void solve(long long N, long long K, std::string S) {
  rep(n, N) {
    if (n == K - 1) {
      cout << (char)tolower(S[n]);
    } else {
      cout << S[n];
    }
  }
  cout << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  std::string S;
  std::cin >> S;
  solve(N, K, S);
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int a[] = new int[n];
		int toukou = 1;
		int ans[] = new int[n];
		
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			ans[a[i]-1] = i + 1;
		}
		
		for(int num : ans) {
			System.out.println(num);
		}


	}
}


Measured memory_bytes: 69540
#include<bits/stdc++.h>
using namespace std;
int n,m,q,ans=0,x,y;
vector <int> a[10005];
int main()
{
	cin>>n>>m>>q;
	for (int i=1;i<=m;i++)
	{
		cin>>x>>y;
		a[x].push_back(y);
	}
	for (int i=1;i<=n;i++)
	sort(a[i].begin(),a[i].end());
	for (int i=1;i<=q;i++)
	{
		ans=0;
		cin>>x>>y;
		for (int i=x;i<=y;i++)
		{
			ans+=upper_bound(a[i].begin(),a[i].end(),y)-a[i].begin();
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
ll INF = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};

int main(){
    int N; cin >> N;
    int a[N],b[N],c[N];
    int Adp[100100], Bdp[100100], Cdp[100100];
    for(int i = 0; i < N; i++){
        cin >> a[i] >> b[i] >> c[i];
    }
    Adp[0] = a[0];
    Bdp[0] = b[0];
    Cdp[0] = c[0];
    for(int i = 1; i < N; i++){
        Adp[i] = max(Bdp[i-1], Cdp[i-1]) + a[i];
        Bdp[i] = max(Adp[i-1], Cdp[i-1]) + b[i];
        Cdp[i] = max(Adp[i-1], Bdp[i-1]) + c[i];
    }
    cout << max(Adp[N-1], max(Bdp[N-1], Cdp[N-1])) << endl;
}



Measured memory_bytes: 2560
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;

int find(vector<int> &fa, int x) {
  return fa[x] == x ? x : fa[x] = find(fa, fa[x]);
}

void uni(vector<int> &fa, int x, int y) {
  int px = find(fa, x);
  int py = find(fa, y);
  if (px == py) return;
  fa[px] = py;
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> fa(n + 1);
  for (int i = 1; i <= n; ++i) {
    fa[i] = i;
  }

  int a, b;
  for (int i = 0; i < m; ++i) {
    cin >> a >> b;
    uni(fa, a, b);
  }
  unordered_map<int, int> cnt;
  for (int i = 1; i <= n; ++i) {
    cnt[find(fa, i)]++;
  }
  int ans = 0;
  for (auto p: cnt) {
    ans = max(ans, p.second);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 12092
import java.util.*;
  public class Main{
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int a = Integer.parseInt(sc.next());
      int b = Integer.parseInt(sc.next());
      int c = Integer.parseInt(sc.next());
      int x = Integer.parseInt(sc.next());
      int count = 0;
      for(int d = 0; d <= a; d++){
        for(int e = 0; e <=b; e++){
          for(int f = 0; f <= c; f++){
            int total = 500*d+100*e+50*f;
            if (total == x){
              count++;
            }
          }
        }
      }
      System.out.println(count);
    }
  }

Measured memory_bytes: 23764
// (c) 2020, redotter

// Roses are red
// The Tardis is blue
// The Doctor once said
// Rose Tyler...

#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#pragma comment(linker, "/stack:500000000")
#endif

#define pb push_back
#define the(a) (a).begin(), (a).end()
#define ft first
#define sd second
#define endl "\n"
#define forn(i, n) for (int i = 0; i < (n); i++)
#define forr(i, s, n) for (int i = (s); i < (n); i++)

using i64 = long long;
using i32 = int;
using f64 = long double;

template <class T> using vec = vector<T>;
using str = string; using p64 = pair<i64, i64>;
using v64 = vec<i64>; using vv64 = vec<v64>;
using s64 = set<i64>; using m64 = map<i64, i64>;
template <size_t Size1> using a64 = array<i64, Size1>;
template <size_t Size1, size_t Size2> using aa64 = array<a64<Size2>, Size1>;
template <class T> using hash_set = unordered_set<T>;
template <class T, class U> using hash_map = unordered_map<T, U>;

mt19937 gen(998244353);
const i64 inf = numeric_limits<i64>::max() / 2;

template <class T> inline i64 len(const T& a) { return (i64)(a.size()); }
inline void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }
template <class T, class S>
inline bool check_min(T& a, S b) { if (a > b) return a = b, 1; return 0; }
template <class T, class S>
inline bool check_max(T& a, S b) { if (a < b) return a = b, 1; return 0; }

void read() {}
template<class T, class ...U>
void read(T& a, U& ...b) { cin >> a; read(b...); }
void print() {}
template<class T, class ...U>
void print(const T& a, const U& ...b) { cout << a << " "; print(b...); }
void println() { cout << "\n"; }
template<class T, class ...U>
void println(const T& a, const U& ...b) { cout << a << " "; println(b...); }

struct Problem {
	void files(str in, str out) {
#ifdef ONLINE_JUDGE
		freopen(in.c_str(), "r", stdin), freopen(out.c_str(), "w", stdout);
#endif
	}
	void solve(), input();
	void many() { i32 t; cin >> t; while (t--) input(), solve(); }
	void make(bool mt = 0) { if (mt) many(); else input(), solve(); }
} problem;

signed main() {
	fast();
	problem.make();
#ifdef _DEBUG
	println(); println("[finished]"); system("pause > nul");
#endif
	return 0;
}

i64 n;
vv64 a;

void Problem::solve() {
	vv64 dp(n, v64(3, 0));
	forn(j, 3) dp[0][j] = a[0][j];
	forr(i, 1, n) {
		forn(j, 3) {
			forn(k, 3) {
				if (j == k) continue;
				check_max(dp[i][j], dp[i - 1][k] + a[i][j]);
			}
		}
	}
	i64 ans = *max_element(the(dp[n - 1]));
	println(ans);
}

void Problem::input() {
	read(n);
	a.assign(n, v64(3, 0));
	forn(i, n) {
		read(a[i][0], a[i][1], a[i][2]);
	}
}


Measured memory_bytes: 14268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int N=200010;
ll pr1[N], pr2[N], a1[N], a2[N];
int n, m;
char s[N];
int main(){
	int t;
	// while(){
		scanf("%d%s",&n,s);
		int cnt=0;
		for(int i=0; i<n; ++i){
			cnt+=(s[i]=='1');
		}
		if(cnt==0){
			for(int i=0; i<n; ++i){
				printf("1\n");
			}
			return 0;
		}
		a1[n]=a2[n]=0;
		for(int i=n-1; i>=0; --i){
			if(i==n-1){
				pr1[i]=1;
				pr2[i]=1;
			}
			else{
				pr1[i]=(pr1[i+1]*2)%(cnt+1);
				if(cnt>1)
					pr2[i]=(pr2[i+1]*2)%(cnt-1);
			}
			a1[i]=a1[i+1];
			a2[i]=a2[i+1];
			if(s[i]=='1'){
				a1[i]+=pr1[i];
				a2[i]+=pr2[i];
				a1[i]%=(cnt+1);
				if(cnt>1)
					a2[i]%=(cnt-1);
			}
		}
		ll ans;
		int tmp;
		for(int i=0; i<n; ++i){
			if(s[i]=='1'){
				if(cnt==1){
					tmp=0;
				}
				else{
					ans = a2[0]-pr2[i];
					ans%=(cnt-1);
					if(ans<0){
						ans+=cnt-1;
					}
					tmp=1;
					while(ans>0){
						ans=ans%__builtin_popcount(ans);
						++tmp;
					}
				}
			}
			else{
				ans = a1[0]+pr1[i];
				ans%=(cnt+1);
				tmp=1;
				while(ans>0){
					ans=ans%__builtin_popcount(ans);
					++tmp;
				}
			}
			printf("%d\n",tmp);
		}
	// }
}

Measured memory_bytes: 10224
import collections
N, M = map(int, input().split())

L = []

for _ in range(M):
    a, b = map(int, input().split())
    L.append((a, b))


def f(l):
    passed = {i:False for i in range(1, N+1)}
    q = collections.deque()
    q.append(1)

    while len(q) > 0:
        now = q.popleft()
        nodes = l[now]
        for n in nodes:
            if not passed[n]:
                passed[n] = True
                q.append(n)

    for v in passed.values():
        if not v:
            return False

    return True

count = 0

for i in range(M):
    l = {j:[] for j in range(1,N+1)}
    for j in range(M):
        if j != i:
            l[L[j][0]].append(L[j][1])
            l[L[j][1]].append(L[j][0])
    if not f(l):
        count += 1

print(count)


Measured memory_bytes: 3820
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long


int main()
{
        ios_base::sync_with_stdio(false);
            cin.tie(NULL);

            ll q,a,b,c,d;
            cin>>q;
            while(q--){
                cin>>a>>b>>c>>d;
                if( d < b )cout <<"No"<<endl;
              else  if( b-c > 1 ){
                    ll nzd = __gcd( b,d );
                    ll prvi =  ( b-(a%b)-1 )/nzd ;
                    prvi*=nzd;
                    //cout << prvi << " okoo " << nzd <<endl;
                    if( prvi+(a%b) > c ) cout << "No"<<endl;
                    else cout <<"Yes"<<endl;
                }
                else{
                    if( a >= b ) cout<<"Yes"<<endl;
                    else cout <<"No"<<endl;
                }
            }

            return 0;
}































Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int inf = int (1e9) + int (1e5);
const ll infl = ll (2e18) + ll (1e10);
const ui M=1E9+7;
const double eps = 1e-9;

int main()
{
    std::ios_base::sync_with_stdio (false);

    int n,k;
    cin >> n >> k;
    vi l(n);
    for (int i=0;i<n;i++) cin >> l[i];
    sort(l.begin(),l.end(),greater<int>());
    int s=0;
    for (int i=0;i<k;i++) s += l[i];
    cout << s;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

#define rep(i, n) for(int (i) = 0; i < (n); ++(i))

using ll = long long int;
const ll MOD = 1e9 + 7;

int main() {
  char a;
  std::cin >> a;
  if('A' <= a && a <= 'Z') {
    std::cout << 'A' << '\n';
  } else {
    std::cout << 'a' << '\n';
  }
}


Measured memory_bytes: 3636
n, k = map(int, input().split())
a = list(map(int, input().split()))
visited = [0]
for _ in range(n):
    now = a[visited[-1]]-1
    visited.append(now)

if k < n:
    print(visited[k]+1)
else:
    p = visited.index(visited[-1])
    loop = visited[::-1][1:].index(visited[-1])+1
    x = (k-p-1)%loop
    print(visited[p+x+1]+1)


Measured memory_bytes: 32324
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int A, B;
	string S;
	int check = 1;
	cin >> A >> B >> S;
	for (int i = 0; i < A; i++) {
		if (S[i] < 48) check = 0;
	}
	if (S[A] != '-') check = 0;
	for (int i = A + 1; i < B + A + 1; i++) {
		if (S[i] < 48) check = 0;
	}
	if (check == 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3612
#include<stdio.h>
#include<string.h>
#define N 36

typedef struct{
  char mark;
  int value;
}MV;

int isStable(MV, MV);
int n;

int main()
{
  int i, j, a, b, d=0, min=0;
  MV c[N], c1[N], c2[N], temp;

/* cはbubblesort */
/* c1はselectionsort */
/* c2はそのまま */

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf(" %c%d", &c[i].mark, &c[i].value);
    c1[i] = c[i];
    c2[i] = c[i];
  }

/* bubblesort */
  for(i = 0; i < n-1; i++){
    for(j = n-1; j > i; j--){
      if(c[j].value < c[j-1].value){
  	temp = c[j];
  	c[j] = c[j-1];
  	c[j-1] = temp;
      }
    }
  }

  for(i = 0; i < n-1; i++) printf("%c%d ", c[i].mark, c[i].value);
  printf("%c%d\n", c[n-1].mark, c[n-1].value);

  for(i = 0; i < n-1; i++){
    for(j = i+1; j < n-1; j ++){
      for(a = 0; a < n-1; a++){
	for(b = a+1; b < n-1; b++){
	  if(c2[i].value == c2[j].value && c2[i].mark == c[b].mark && c2[i].value == c[b].value && c2[j].mark == c[a].mark && c2[j].value == c[a].value) d = 1;
	}
      }
    }
  }
  if(d == 1) printf("Not stable\n");
  else printf("Stable\n");

/* selectionsort */
  for(i = 0; i < n; i++){
    min = i;
    for(j = i; j < n; j++){
      if(c1[j].value < c1[min].value) min = j;
    }
    temp = c1[i];
    c1[i] = c1[min];
    c1[min] = temp;
  }

  for(i = 0; i < n-1; i++) printf("%c%d ", c1[i].mark, c1[i].value);
  printf("%c%d\n", c1[n-1].mark, c1[n-1].value);
  
  for(i = 0; i < n-1; i++){
    for(j = i+1; j < n-1; j ++){
      for(a = 0; a < n-1; a++){
	for(b = a+1; b < n-1; b++){
	  if(c2[i].value == c2[j].value && c2[i].mark == c1[b].mark && c2[i].value == c1[b].value && c2[j].mark == c1[a].mark && c2[j].value == c1[a].value) d = 1;
	}
      }
    }
  }
  if(d == 1) printf("Not stable\n");
  else printf("Stable\n");

  return 0;
}

Measured memory_bytes: 608
import java.util.Scanner;

public class Main {

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

		int N = sc.nextInt();
		int[] A = new int[N];
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}

		int Q = sc.nextInt();
		StringBuilder ans = new StringBuilder();
		for(int i = 0; i < Q; i++) {
			int M = sc.nextInt();
			if(exhaustiveSearch(A, 0, M)) {
				ans.append("yes\n");
			}else {
				ans.append("no\n");
			}
		}

		System.out.print(ans);
		sc.close();
	}

	//aのi番目以降の要素を使ってｍを作れる場合trueを返す
	public static boolean exhaustiveSearch(int[] a, int i, int m) {
		if(m == 0) {
			return true;
		}
		if(i >= a.length || m < 0) {
			return false;
		}
		// a[i]を選択しない（加えない）||a[i]を選択する（加える）
		boolean res = exhaustiveSearch(a, i + 1, m) || exhaustiveSearch(a, i + 1, m - a[i]);
		return res;
	}
}


Measured memory_bytes: 26656
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(void){
	vector<int> a(3);
	cin >> a[0] >> a[1] >> a[2];
	sort(a.begin(), a.end());
	cout << a[0] + a[1] << endl;
	return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n , a , b , x ;
    cin>>n>>a>>b;
    if (abs(a-b)<=n)
    {
        cout<<"0"<<endl;
    }
    else
    {
        cout<<abs(a-b)-n<<endl;
    }
}


Measured memory_bytes: 3604
#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 PI  3.14159265358979323846
#define lp(i,n) for(int i = 0; i <n;i++)
#define range1(i,a,b,c) for(int i = int(a);i <= int(b);i+=int(c))
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define fr first
#define sc second
#define sz(v) ((int)((v).size()))
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef pair<int, int> pii;
template<class T> using ordered_set=tree<T,
null_type,
less<T>,
rb_tree_tag,
tree_order_statistics_node_update>;
const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;
int dx[] = {0,0,-1,1};
int dy[] = {1,-1,0,0};
void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    ll a;
    cin>>a;
    cout<<a+a*a+a*a*a<<endl;    
    
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
const int INF = 100100100;
using namespace std;

int main()
{
  int N;
  int a[200001];
  int index;
  int res=0;
  cin >> N;
  rep(i,N) cin >> a[i];

  int cnt = 0;
  int *p=a;
  while(index<N){
    p = find(p,a+N, cnt+1);
    if (p == a+N) break;
    cnt++;
  }
  if(cnt==0) res = -1;
  else res = N-cnt;

  cout << res << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>

using namespace std;

const int MAXN = 100010;

int n, m;

struct edge{
	int ne, to;
}e[MAXN];
int fir[MAXN], num = 0, d[MAXN];
inline void join(int a, int b)
{
	e[++num].ne = fir[a];
	fir[a] = num;
	e[num].to = b;
}

int f[MAXN];
int q[MAXN], h = 1, t = 0;

inline void topo()
{
	for(int i=1;i<=n;i++)
		if(!d[i]) q[++t] = i;
	while(h <= t)
	{
		int u = q[h++];
		for(int i=fir[u];i;i=e[i].ne)
		{
			int v = e[i].to;
			f[v] = max(f[v], f[u]+1);
			--d[v];
			if(!d[v]) q[++t] = v;
		}
	}
}

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1,a,b;i<=m;i++)
		scanf("%d%d",&a,&b),join(a, b),d[b]++;
	topo();
	int ans = -1;
	for(int i=1;i<=n;i++)
		ans = max(ans, f[i]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define faster ios_base::sync_with_stdio(0);
#define faster_tie cin.tie(0);
#define fr(i,a,b) for(int i=a;i<=b;i++)
int main()
{
     //while(1) {
        ll n;
        cin>>n;
        ll h[n];
        for(ll i=0;i<n;i++)
        {
            cin>>h[i];
        }
        for(ll i=n-1;i>0;i--)
        {
            //cout<<h[i-1]-h[i]<<endl;
            if((h[i-1]-h[i])>1)
            {
                cout<<"No";
                return 0;
            }
            else if((h[i-1]-h[i])==1){h[i-1]=h[i-1]-1;}
        }
        cout<<"Yes";
     //}
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;

int main() {
  int N;
  cin >> N;
  int a,b,c,d;
  a = (N - N % 1000) / 1000;
  b = (N % 1000 - N % 100) / 100;
  c = (N % 100 - N % 10) / 10;
  d = N % 10;

  if(a == b  && b == c || b  == c && c == d){ 
    cout << "Yes" << endl; 
  }
  else if(a == b && b == c && c == d) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;
const ll INF = 1e15;

typedef tuple<ll, ll, ll, ll> T;

ll D[1001000][4];
ll H, W, K;
vector<vector<bool> > C;

inline int idx(int y, int x){
    return y*W + x;
}

bool check(int y, int x){
    if(y < 0 || y >= H) return false;
    if(x < 0 || x >= W) return false;
    if(C[y][x]) return false;
    return true;
}

void dijkstra(ll y1, ll x1){
    REP(i,4)
        D[idx(y1, x1)][i] = 0;
    priority_queue<T, vector<T>, greater<T>> que;

    REP(i,4)
        que.push(T(0, y1, x1, i));

    while(!que.empty()){
        auto t = que.top();
        que.pop();

        ll d = get<0>(t);
        ll y = get<1>(t);
        ll x = get<2>(t);
        ll h = get<3>(t);

        if(d > D[idx(y,x)][h])
            continue;

        const int DY[] = {1, -1, 0, 0};
        const int DX[] = {0, 0, 1, -1};

        //REP(i,4){
        //int dy = DY[i];
        //int dx = DX[i];
        int dy = DY[h];
        int dx = DX[h];

        int nty = y+dy; 
        int ntx = x+dx;
        if(!check(nty, ntx)) continue;

        REP(nth, 4){
            ll dd = d + 1;
            ll ntd = dd;
            if(nth != h && ntd % K != 0)
                ntd = ntd + (K - ntd%K);
            if(ntd < D[idx(nty, ntx)][nth]){
                D[idx(nty, ntx)][nth] = ntd;
                que.push(T(ntd, nty, ntx, nth));
            }
        }
        //}
    }
}

int main(){
    cin >> H >> W >> K;

    ll x1, y1, x2, y2;
    cin >> y1 >> x1 >> y2 >> x2;
    x1--, y1--, x2--, y2--;

    C.resize(H, vector<bool>(W));
    REP(i,H){
        REP(j,W){
            char c;
            cin >> c;
            if(c == '@')
                C[i][j] = true;
        }
    }

    REP(i,H*W)
        REP(j,4)
            D[i][j] = INF;


    dijkstra(y1, x1);

    ll ans = INF;
    REP(i,4)
        chmin(ans, D[idx(y2, x2)][i]);

    if(ans == INF)
        cout << -1 << endl;
    else
        cout << (ans+K-1)/K << endl;
        //cout << ans/K << endl;
    return 0;
}


Measured memory_bytes: 50900
#include<stdio.h>
#include<math.h>
int main()
{
    int m,n,s,v,i,j,a[100002][2],p,q,b[100002];
    while(~scanf("%d",&n))
    {
        v=1;
        for(i=0; i<n; i++)
            scanf("%d %d %d",&b[i],&a[i][0],&a[i][1]);
        p=0;
        q=0;
        for(i=0; i<n; i++)
        {
            s=abs(a[i][0]-p)+abs(a[i][1]-q);
            if(i==0)
                m=b[i];
            else
                m=b[i]-b[i-1];
            if(s>m||(m-s)%2!=0)
            {
                v=0;
                break;
            }
            p=a[i][0];
            q=a[i][1];
        }
        if(v==1)
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 1280
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
    ll n,x;
    cin>>n>>x;
    V<ll> a(n),b(n,inf);
    for(int i=0;i<n;i++)cin>>a[i];
    ll ans=inf;
    for(ll k=0;k<n;k++){
        ll c=k*x,sum=0;
        for(int i=0;i<n;i++){
            chmin(b[i],a[(i-k+n)%n]);
            sum+=b[i];
        }
        chmin(ans,sum+c);
    }
    cout<<ans<<"\n";
}
    

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#define llint long long
#define inf 1000000000

using namespace std;
typedef pair<llint, llint> P;

int n, m;
int a[65], r[65], b[65];
int suma[65], sumr[65], sumb[65];
int dp[65][65][6005];
const int Zero = 3002;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> m;
	for(int i = 1; i <= n; i++) cin >> a[i];
	for(int i = 1; i <= m; i++) cin >> r[i];
	for(int i = 1; i <= m; i++) cin >> b[i];
	sort(a+1, a+n+1), sort(r+1, r+m+1), sort(b+1, b+m+1);
	reverse(a+1, a+n+1), reverse(r+1, r+m+1), reverse(b+1, b+m+1);
	
	for(int i = 1; i <= n; i++) suma[i] = suma[i-1] + a[i];
	for(int i = 1; i <= m; i++) sumr[i] = sumr[i-1] + r[i];
	for(int i = 1; i <= m; i++) sumb[i] = sumb[i-1] + b[i];
	
	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= m; j++){
			for(int k = -3000; k <= 3000; k++){
				dp[i][j][Zero+k] = inf;
			}
		}
	}
	dp[0][0][Zero+sumr[m]] = 0;
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j <= m; j++){
			if(i < j) continue;
			for(int k = -3000; k <= 3000; k++){
				int nk = k-a[i+1];
				if(nk >= -3000 && nk <= 3000 && j+1 <= m) dp[i+1][j+1][Zero+nk] = min(dp[i+1][j+1][Zero+nk], dp[i][j][Zero+k] + max(0, a[i+1]-r[j+1]));
				if(i-j+1 <= m) dp[i+1][j][Zero+k] = min(dp[i+1][j][Zero+k], dp[i][j][Zero+k] + max(0, a[i+1]-b[i-j+1]));
			}
		}
	}
	
	/*for(int i = 0; i <= n; i++){
		for(int j = 0; j <= m; j++){
			for(int k = -3000; k <= 3000; k++){
				cout << dp[i][j][Zero+k] << " ";
			}
			cout << endl;
		}
		cout << endl;
	}*/
	
	int ans = inf;
	for(int j = 0; j <= m; j++){
		for(int k = 0; k <= 3000; k++){
			int remR = k, usedR = sumr[m] - remR;
			int usedB = suma[n] - usedR, remB = sumb[m] - usedB;
			//cout << remR << " " << remB << " " << dp[n][j][Zero+k] << endl;
			if(remR < 0 || remB < 0) continue;
			ans = min(ans, dp[n][j][Zero+k]);
		}
	}
	if(ans >= inf) ans = -1;
	cout << ans << endl;
	
	return 0;
}



Measured memory_bytes: 90668
N=input()
S=raw_input()

n=0
cnt=0	#minus count
prev=0

for x in S:
	if x=="(":
		n+=1
	else:			
		n=max(n-1,0)
	if n==0:
		if prev!=1:
			cnt+=1
	prev=n


print "("*cnt+S+")"*n


Measured memory_bytes: 28012
#include <bits/stdc++.h>
#include <iostream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;

int main(){
    char a;
    cin >> a;
 
    if(isupper(a)){
        cout << "A" << endl;
    }else
    {
        cout << "a" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3632
using System;
using System.Linq;

namespace Structure_and_Class
{
    class Dice_I
    {
        static void Main(string[] args)
        {
            var dice=new Dice(Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray());
            dice.Move(Console.ReadLine());
            dice.Show();
        }
    }

    public class Dice
    {
        int[] label = new int[6];
        public Dice(int[] label)
        {
            this.label = label;
        }

        public void Show()
        {
            Console.WriteLine(label[0]);
        }

        public void Move(string s)
        {
            for (int i = 0; i < s.Length; i++)
            {
                Move(s[i]);
            }
        }

        public void Move(char c)
        {
            int[] res = new int[6];
            switch (c)
            {
                case 'E':
                    res[0] = label[3];
                    res[1] = label[1];
                    res[2] = label[0];
                    res[3] = label[5];
                    res[4] = label[4];
                    res[5] = label[2];
                    label = res;
                    break;
                case 'N':
                    res[0] = label[1];
                    res[1] = label[5];
                    res[2] = label[2];
                    res[3] = label[3];
                    res[4] = label[0];
                    res[5] = label[4];
                    label = res;
                    break;
                case 'S':
                    Move('N');
                    Move('N');
                    Move('N');
                    break;
                case 'W':
                    Move('E');
                    Move('E');
                    Move('E');
                    break;
            }
        }
    }
}

Measured memory_bytes: 9528
#include<iostream>
using namespace std;
int main(){
    int h,w;
    while(1){
        cin>>h>>w;
        if(h==0&&w==0)break;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if((i+j)%2==0)cout<<"#";
                else cout<<".";
            }
            cout<<endl;
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(int i = (a); i >= (b); i--)
#define LLFOR(i, a, b) for(long long i = (a); i < (b); ++i)
#define LLRFOR(i, a, b) for(long long i = (a); i >= (b); i--)
#define SORT(v, n) sort(v, v+n)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define LLREP(i, n) for(long long i = 0; i < (n); ++i)
#define RREP(i, n) for(int i = n; i >= n; i--)
#define LLRREP(i, n) for(long long i = n; i >= n; i--)

#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))

#define endl "\n"
#define pb push_back
#define ret return

#define INF 2000000000	//int型は2 * 10^9ぐらいまで
#define MOD 1000000007
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};

#define USFOR(i, a, b) for(unsigned i = (a); i < (b); ++i)
#define USREP(i, n) for(unsigned i = 0; i < (n); ++i)

typedef long long ll;
typedef unsigned long long ull;

int MAX(int a,int b){if(a>b){return a;}return b;}
int MIN(int a,int b){if(a<b){return a;}return b;}
int GCD(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int LCM(int a,int b){int c=GCD(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int POW(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
ll LLMAX(ll a,ll b){if(a>b){return a;}return b;}
ll LLMIN(ll a,ll b){if(a<b){return a;}return b;}
ll llGCD(ll a,ll b){ll c;while(b!=0){c=a%b;a=b;b=c;}return a;}
ll llLCM(ll a,ll b){ll c=llGCD(a,b);a/=c;return a*b;}
ll llnCr(ll a,ll b){ll i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
ll llnHr(ll a,ll b){return llnCr(a+b-1,b);}
ll llpow(ll a,ll b){ll i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

signed main(){
	//solve AXCxxx-X
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n, a[100];
	cin >> n;
	REP(i, n) cin >> a[i];
	int max = -1;

	REP(i, n-1){
		FOR(j, i+1, n){
			int k = ABS(a[i] - a[j]);
			if(k > max) max = k;
		}
	}

	cout << max << endl;
	ret 0; 
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int i,n,k,p,r;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d",&k,&p);
		r=k%p;
		if(r==0){
			r=p;
		}
		printf("%d\n",r);
	}
	return 0;
}

Measured memory_bytes: 2760
//I AM THE CREED
/* //I AM THE CREED
/* package codechef; // don't place package name! */
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.StringTokenizer; 
import java.util.*;
import java.awt.Point;
public class Main{
    public static void main(String[] args) throws IOException 
    { 
  
        Scanner input = new Scanner(System.in);
        while(input.hasNext()){
            int n=input.nextInt();
            long[] dp=new long[n+1];
            long mod=1000000007;
            for(int i=0;i<=n;i++){
                for(int j=3;j<=i;j++){
                    dp[i]=(dp[i]+(dp[i-j]))%mod;
                }
                if(i>=3){
                    dp[i]=(dp[i]+1)%mod;
                }
            }
            System.out.println(dp[n]);
            
        }
    }

}

Measured memory_bytes: 35668
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using namespace boost::multiprecision; 
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define nl '\n'
#define mp make_pair
#define debug1(x) cout <<#x<<" "<<x<<'\n';
#define debug2(x,y) cout <<#x<<" "<<x <<" "<<#y<<" "<<y <<'\n';
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<'\n';
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
const int mod = (int)1e9+7;
pair<ll,ll>s4[4]={{-1,0},{1,0},{0,-1},{0,1}};
pair<ll,ll>s8[8]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,1},{1,0},{1,-1}};

void solve() {
	string s;
	cin>> s;
	int a=0,b=0;
	for(int i=0;i<s.length();i++) {
		if(s[i]=='A')
			a++;
		else
			b++;
	}
	if(a==0 || b==0) {
		cout << "No\n";
	}
	else cout << "Yes\n";
}

signed main() {
	boost;
	solve();
}

Measured memory_bytes: 256
// Copyright 2017 Parallelc
#include <bits/stdc++.h>
using namespace std;
using LL = int64_t;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    LL t;
    cin >> n >> t;
    LL sum = 0;
    LL now = 0;
    for (int i = 0; i < n; i++) {
        LL k;
        cin >> k;
        if (k >= now) {
            sum += t;
            now = k + t;
        } else {
            sum += k + t - now;
            now = k + t;
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define rel(i,x,y) for(ll i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    int n; cin >> n;
    ll h[n+1];
    rep(i,0,n) cin >> h[i];
    h[n] = 0;
    stack<pair<ll,ll>> S; //height, locate
    ll ma = 0;
    rep(i,0,n+1){
        if(S.empty()){ S.push(make_pair(h[i],i)); continue; }
        if(S.top().first == h[i]) continue;
        if( S.top().first < h[i]) S.push(make_pair(h[i],i)); //大きいのはstack
        else{
            ll LocateCheck = S.top().second;
            while((!S.empty()) && S.top().first >= h[i] ){
                ma = max(ma,S.top().first * (i-S.top().second));
                LocateCheck = S.top().second;
                S.pop();
            }
            S.push(make_pair(h[i],LocateCheck));
        }
    }
    cout << ma << endl;
}


Measured memory_bytes: 5384
#include <iostream>
#include <memory>
#include <string>
#include <vector>

#define rep(i, n) for (int i = 0; i < (n); ++i)

using lint = long int;
using llint = long long int;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    cout << x * x * x << endl;
}




Measured memory_bytes: 3212
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)

void debug_out() {}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif

int run(istream& in, ostream& out) {
    ll A1, A2, A3;
    in >> A1 >> A2 >> A3;
    // solution here

    out << (A1+A2+A3 >= 22 ? "bust" : "win") << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
const int N=1000000;
vector<bool> pr(N,true);
vector<int> p;

void init()
{
	int i,j;
	p.reserve(80000);
	p.push_back(2);
	for(i=3;i*i<N;i+=2)
		if(pr[i]) {
			p.push_back(i);
			for(j=i;i*j<N;j+=2) pr[i*j]=false;
		}
	for(;i<N;i+=2) if(pr[i]) p.push_back(i);
}

int main()
{
	int n;
	init();
	while(cin>>n) {
		cout<<upper_bound(p.begin(),p.end(),n)-p.begin()<<endl;		
	}
	return 0;
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
typedef long long ll;
typedef pair<int,int> pii;

ll search(ll n){
    if(n==1) return 1;
    else return 2*(search(n/2))+1;
}

int main(){
    ll h;
    cin >>h;
    cout<<search(h)<< endl;
}

Measured memory_bytes: 256
while True:
    try:
        a,b,c,d,e,f=map(int,input().split())
        det=a*e-b*d
        x=(e*c-b*f)
        y=(a*f-d*c)
        if det<0:
            x=-x
            y=-y
            det=-det
        print("%.03f %.03f" %(x/det,y/det))
    except:
        break


Measured memory_bytes: 5604
#include<bits/stdc++.h>
using namespace std;

template <int MOD_> struct modnum {
	static constexpr int MOD = MOD_;
	static_assert(MOD_ > 0, "MOD must be positive");

private:
	using ll = long long;

	int v;

	static int minv(int a, int m) {
		a %= m;
		assert(a);
		return a == 1 ? 1 : int(m - ll(minv(m, a)) * ll(m) / a);
	}

public:

	modnum() : v(0) {}
	modnum(ll v_) : v(int(v_ % MOD)) { if (v < 0) v += MOD; }
	explicit operator int() const { return v; }
	friend std::ostream& operator << (std::ostream& out, const modnum& n) { return out << int(n); }
	friend std::istream& operator >> (std::istream& in, modnum& n) { ll v_; in >> v_; n = modnum(v_); return in; }

	friend bool operator == (const modnum& a, const modnum& b) { return a.v == b.v; }
	friend bool operator != (const modnum& a, const modnum& b) { return a.v != b.v; }

	modnum inv() const {
		modnum res;
		res.v = minv(v, MOD);
		return res;
	}
	modnum neg() const {
		modnum res;
		res.v = v ? MOD-v : 0;
		return res;
	}
	modnum operator- () const {
		return neg();
	}
	modnum operator+ () const {
		return modnum(*this);
	}

	modnum& operator ++ () {
		v ++;
		if (v == MOD) v = 0;
		return *this;
	}
	modnum& operator -- () {
		if (v == 0) v = MOD;
		v --;
		return *this;
	}
	modnum& operator += (const modnum& o) {
		v += o.v;
		if (v >= MOD) v -= MOD;
		return *this;
	}
	modnum& operator -= (const modnum& o) {
		v -= o.v;
		if (v < 0) v += MOD;
		return *this;
	}
	modnum& operator *= (const modnum& o) {
		v = int(ll(v) * ll(o.v) % MOD);
		return *this;
	}
	modnum& operator /= (const modnum& o) {
		return *this *= o.inv();
	}

	friend modnum operator ++ (modnum& a, int) { modnum r = a; ++a; return r; }
	friend modnum operator -- (modnum& a, int) { modnum r = a; --a; return r; }
	friend modnum operator + (const modnum& a, const modnum& b) { return modnum(a) += b; }
	friend modnum operator - (const modnum& a, const modnum& b) { return modnum(a) -= b; }
	friend modnum operator * (const modnum& a, const modnum& b) { return modnum(a) *= b; }
	friend modnum operator / (const modnum& a, const modnum& b) { return modnum(a) /= b; }
};
using num = modnum<int(1e9)+7>;

const int MAXN = 1.1e6;
num invs[MAXN];
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	num res = 0;
	num i3 = num(1) / num(3);
	num v = i3 / num(N);
	invs[1] = 1;
	for (int i = 2; i <= N; i++) {
		invs[i] = - num(num::MOD / i) * invs[num::MOD % i];
	}
	for (int i = 0; i < N; i++) {
		res += v * invs[N-i];
		v *= i3;
	}
	cout << res << '\n';

	return 0;
}


Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 1000001


int N,A[maxn];
int num[maxn];

int main(){
	fast;
	
	cin>>N;
	
	FOR(i,1,N){
		cin>>A[i];
		num[A[i]]++;
	}
	int ans = 0;
	FOR(i,1,N){
		num[A[i]]--;
		bool ok = 1;
		FOR(j,1,sqrt(A[i])){
			if (A[i] % j == 0){
				if (num[A[i]/j] > 0) ok = 0;
				if (num[j] > 0) ok = 0;
			}
		}
		num[A[i]]++;
		ans += ok;
	}
	
	cout<<ans;
}


Measured memory_bytes: 8256