akhauriyash/Code-Regression huggingface dataset:
#[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)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;
type I = usize;

fn main() {
    input!{
      n: usize,
      s: chars,
    }
    let mut red = 0;
    let mut blue = 0;
    for i in 0..n {
        if s[i] == 'R' {
            red += 1;
        } else {
            blue += 1;
        }
    }
    if red > blue {
        println!("{}", "Yes");
    } else  {
        println!("{}", "No");
    }

}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int H, W, K, sum1d[15][1005], sum2d[15][1005];
int count(vector<int> cutp) {
  int cnt = cutp.size()-1; bool end = false;
  for(int l = 0, r = 1; r <= W && !end; ++r) {
    int u = 0, b = 0;
    for(int i = 0; i < cutp.size(); ++i) {
      u = b, b = cutp[i];
      if((sum2d[b][r]-sum2d[u][r])-(sum2d[b][l]-sum2d[u][l]) <= K) continue;
      end = (r-l <= 1);
      l = --r, ++cnt;
      break;
    }
    if(end) cnt = 1e9;
  }
  return cnt;
}
int main() {
  cin >> H >> W >> K;
  string S;
  for(int i = 1; i <= H; ++i) {
    cin >> S;
    for(int j = 1; j <= W; ++j) {
      sum1d[i][j] = sum1d[i][j-1]+(S.at(j-1)-'0');
      sum2d[i][j] = sum1d[i][j]+sum2d[i-1][j];
    }
  }
  int ans = 1e9;
  for(int i = 0; i < (1<<H-1); ++i) {
    vector<int> cutp;
    for(int j = 0; j < H-1; ++j) {
      if(i & (1<<j)) cutp.push_back(j+1);
    }
    cutp.push_back(H);
    ans = min(ans, count(cutp));
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
//typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	string s;
	cin>>s;
	int n=s.size();
	int out=(s.size()+1)/2;
	while(out<n)if(s[out]==s[n/2]&&s[n-out-1]==s[n/2])out++;
	else break;
	cout<<out<<endl;
}












Measured memory_bytes: 512
var
 n,i,max,min,x,m:longint;
 a:array[0..100000001] of longint;
begin
 readln(n);
 min:=maxlongint;
 for i:=1 to n do 
  begin
   read(x);
   if x>n then inc(m)
    else begin
   inc(a[x]);
   if x>max then max:=x;
   if x<min then min:=x;end;
  end;
 for i:=min to max do 
  if a[i]<i then m:=m+a[i]
   else if a[i]>i then m:=m+(a[i]-i);
 writeln(m);
end.

Measured memory_bytes: 128
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <string>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  string s; cin>>s;
	rep(i,s.size())if(!(i%2))cout<<s[i];
	cout<<endl;
  return 0;
}


Measured memory_bytes: 592
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class TaskB {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int x = in.nextInt();
            int[] a = new int[n + 1];

            for (int i = 0; i < m; i++) {
                int ca = in.nextInt();
                a[ca]++;
            }

            for (int i = 1; i <= n; i++)
                a[i] += a[i - 1];

            out.println(Math.min(a[x], m - a[x]));

        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public long nextLong() {
            long n = 0;

            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while (b >= '0' && b <= '9') {
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

        public int nextInt() {
            long n = nextLong();

            if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)
                throw new NumberFormatException();

            return (int) n;
        }

    }
}



Measured memory_bytes: 23380
#include<stdio.h>
#include<math.h>

int main(){

int x,y,z,N,r;
int n[1001]={};
while(1){
scanf("%d %d %d",&n[0],&n[1],&n[2]);if(n[0]==0&&n[1]==0&&n[2]==0)break;
for(int i=0;i<3;i++)
for(int j=2;j>i;j--)
if(n[j-1]>n[j]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}

//printf("%d %d %d\n",n[0],n[1],n[2]);

double rad=atan2( (double)(n[1]), (double)(n[0]));
//rad=rad*3.141592/180;
//printf("%lf\n",rad);

scanf("%d",&N);
for(int i=0;i<N;i++){

scanf("%d",&r);
//printf("%d %lf\n",n[1],(r*2*sin(rad)));



if(n[1]>=(r*2*sin(rad)))printf("NA\n");
else printf("OK\n");
}
}
return 0;
}

Measured memory_bytes: 1064
# -*- coding: utf-8 -*-

import sys
from operator import itemgetter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
LR = []
for i in range(N):
    x, l = MAP()
    LR.append((x-l+0.5, x+l-0.5))

LR.sort(key=itemgetter(1))
cur = -INF
cnt = 0
for l, r in LR:
    if cur < l:
        cur = r
        cnt += 1
print(cnt)


Measured memory_bytes: 16660
n, a, b = map(int, input().split())
MOD = int(1e9) + 7
ans = pow(2, n, MOD) - 1


def comb_fermat(n: int, r: int) -> int:

    if r > n:
        return 0
    if r > n-r:
        return comb_fermat(n, n-r)
    mul, div = 1, 1
    for i in range(r):
        mul *= n-i
        mul %= MOD
        div *= i+1
        div %= MOD

    ret = mul * pow(div, MOD-2, MOD) % MOD
    return ret


ans -= comb_fermat(n, a)
ans -= comb_fermat(n, b)
ans %= MOD
print(ans)


Measured memory_bytes: 3064
N,W=map(int,input().split())
w=[]
v=[]
vmax=100010
nmax=110

for i in range(N):
    a,b=map(int,input().split())
    w.append(a)
    v.append(b)
    
DP= [[10**12 for j in range(vmax)] for i in range(nmax)]

def chmin(a,b):
    if a>b:
        return b
    else:
        return a

DP[0][0]=0

for i in range(N):
    for j in range(vmax):
        if  j-v[i]>=0:
            DP[i+1][j]=chmin(DP[i][j],DP[i][j-v[i]]+w[i])
        else:
            DP[i+1][j]=DP[i][j]

ans=0            
for i in range(nmax):
    for j in range(vmax):
        if DP[i][j]<=W and ans<j:
            ans=j
print(ans)

Measured memory_bytes: 219088
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int d[n+1];
    d[0] = 1;
    d[1] = 1;
    for (int i = 2; i < n+1; i++)
    {
        d[i] = d[i-1] + d[i-2];
    }
    
    cout << d[n] << endl;
}


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


long long ans=0;
long long cloon(long long a){
    ans++;
    if(a>1){
        ans=ans*2;
        a=a/2;
        cloon(a);
    }
}

int main() {
    long long H;
    cin >> H;

    cloon(H);
    cout << ans << endl;

}


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

int main(){
  int N,X; cin>>N>>X;
  vector<int> D(N+1);
  D[0]=0;
  
  for(int i=0;i<N;i++){
    int x; cin>>x;
    D[i+1]=D[i]+x;
  }
  
  int ans=0;
  for(int i=0;i<=N;i++){
    if(D[i]<=X) ans++;
  }
  
  cout<<ans;
}

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

int main(){
    int n;
    cin>>n;
    vector<int> v(n);
    for(int i=0;i<n;i++) cin>>v[i];
    map<int,int> m1,m2;
    for(int i=0;i<n;i++){
        m1[i+v[i]]++;
        m2[i-v[i]]++;
    }
    long long ans=0;
    for(auto x:m1){
        if(m2.find(x.first)!=m2.end()) ans+=((long long)(x.second))*(m2[x.first]);
    }
    cout<<ans<<endl;
}

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

#define INPUT_FROM_FILE (0)
#if INPUT_FROM_FILE
#include <fstream>
#endif

int partition(std::vector<int> &A, int p, int r){
	int x = A[r];
	int i = p - 1;
	
	for(int j = p; j < r; j++){
		if(A[j] <= x){
			i++;
			std::swap(A[i], A[j]);
		}
	}
	std::swap(A[i + 1], A[r]);
	return i + 1;
}

int main(int argc, char **argv){
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif
	int n = 0;
	std::vector<int> A;

#if INPUT_FROM_FILE
	ifs >> n;
#else
	std::cin >> n;
#endif

	A.resize(n, -1);
	for(int i = 0; i < n; i++){
#if INPUT_FROM_FILE
		ifs >> A[i];
#else
		std::cin >> A[i];
#endif
	}

	int idx_pivot = partition(A, 0, n - 1);

	std::cout << A[0];
	for(unsigned int i = 1; i < A.size(); i++){
		if(i == idx_pivot){
			std::cout << " [" << A[i] << "]";
		}
		else{
			std::cout << " " << A[i];
		}
	}
	std::cout << std::endl;
	return 0;
}


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

#define vdd vector<pair<double, double>>
#define PI 3.141592653589793

vdd get_points(vdd& A) {
    vdd B;
    double sx, sy;
    double lx, ly;
    for (int i = 0; i < A.size() - 1; i++) {
        B.push_back(A[i]);
        sx = A[i].first;
        sy = A[i].second;
        lx = (A[i+1].first  - A[i].first)  / 3;
        ly = (A[i+1].second - A[i].second) / 3;
        B.push_back(make_pair(sx + lx, sy + ly));
        B.push_back(make_pair(sx + lx + cos(PI/3) * lx - sin(PI/3) * ly,
                              sy + ly + sin(PI/3) * lx + cos(PI/3) * ly));
        B.push_back(make_pair(sx + lx * 2, sy + ly * 2));
    }
    B.push_back(A[A.size()-1]);
    return B;
}

int main() {

    int N;
    cin >> N;

    vdd A;
    A.push_back(make_pair(0.0, 0.0));
    A.push_back(make_pair(100.0, 0.0));

    for (int i = 0; i < N; i++) {
        A = get_points(A);
    }

    std::cout << std::fixed;
    for (int i = 0; i < A.size(); i++) {
        cout << std::setprecision(8) << A[i].first << " " << A[i].second << endl;
    }

    return 0;
}



Measured memory_bytes: 3320
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll modpow(ll a, ll n, ll mod_) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod_;
        a = a * a % mod_;
        n >>= 1;
    }
    return res;
}

const ll MAX_SIZE = 200005;
array<ll, MAX_SIZE> fac, inv, finv;
void finit() {
    // combination init
    fac[0] = 1;
    for (ll i = 1; i < MAX_SIZE; i++) fac[i] = fac[i - 1] * i % MOD;
    finv[MAX_SIZE - 1] = modpow(fac[MAX_SIZE - 1], MOD - 2, MOD);
    for(ll i = MAX_SIZE - 1; i > 0; i--) finv[i - 1] = finv[i] * i % MOD;
    
    //inv init
    repe(i, 1, MAX_SIZE) inv[i] = modpow(i, MOD - 2, MOD);
}

ll perm(ll a, ll b) { return fac[a] * finv[a - b] % MOD; }

ll comb(ll a, ll b) { return fac[a] * finv[b] % MOD * finv[a - b] % MOD; }

int main() {
    init();
    finit();
    ll N,M;
    cin >> N >> M;

    vl X(N), Y(M);
    rep(i, N) cin >> X[i];
    rep(i, M) cin >> Y[i];

    ll xs = 0, ys = 0, Cx = comb(N, 2), Cy = comb(M, 2);
    rep(i, N - 1){
        ll xd = X[i + 1] - X[i], cnt = Cx;
        if (i > 0) cnt -= comb(i + 1, 2);
        if (i < N - 2) cnt -= comb(N - i - 1, 2);

        cnt = (MOD + cnt % MOD) % MOD;
        (xs += cnt * xd) %= MOD;
    }
    rep(i, M - 1){
        ll yd = Y[i + 1] - Y[i], cnt = Cy;
        if (i > 0) cnt -= comb(i + 1, 2);
        if (i < M - 2) cnt -= comb(M - i - 1, 2);

        cnt = (MOD + cnt % MOD) % MOD;
        (ys += cnt * yd) %= MOD;
    }

    cout << xs * ys % MOD << endl;

}

Measured memory_bytes: 6528
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		FastScanner in = new FastScanner(System.in);
		int n= in.nextInt();
		int a= in.nextInt()*10;
		int b= in.nextInt();
		if((a+b)%4==0){
			System.out.println("YES");
			return;
		}
		System.out.println("NO");
	}
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
			st = new StringTokenizer("");
		}

		public double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		public String next() throws IOException {
			if (!st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
				return next();
			}
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 21076
n = int(input())
s =[input() for i in range(n)]
a = (s.count("AC"))
b = (s.count("WA"))
c = (s.count("TLE"))
d = (s.count("RE"))

print("AC x " + str(a) )
print("WA x " + str(b))
print("TLE x " + str(c))
print("RE x " + str(d))

Measured memory_bytes: 16304
fun main(args: Array<String>) {
    val (n, a, b) = readLongList()
    val t = a + b
    var ans = a * (n / t)
    val t2 = n % t
    ans += Math.min(t2, a)
    println(ans)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)


Measured memory_bytes: 37820
/*
    Life Before Death, Strength Before Weakness, Journey Before Destination
    ------------------------------------------------------------------------
    You don't become great by trying to be great.
    You become great by wanting to do something,
    and then doing it so hard that you become great in the process.
    */
 
    //#pragma comment(linker, ack:200000000")
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #include <bits/stdc++.h>
    using namespace std;
    
    #define TRACE
    
    #ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
      cerr << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
      const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
    #else
    #define trace(...)
    #endif
    
    #define rep(i, n)    for(int i = 0; i < (n); ++i)
    #define repA(i, a, n)  for(int i = a; i <= (n); ++i)
    #define repD(i, a, n)  for(int i = a; i >= (n); --i)
    #define trav(a, x) for(auto& a : x)
    #define all(x) x.begin(), x.end()
    #define sz(x) (int)(x).size()
    #define fill(a)  memset(a, 0, sizeof (a))
    #define fst first
    #define snd second
    //#define mp make_pair
    #define pb push_back
    #define PI           3.141592653589793238462643383279502884197169399  /* pi */
    #define te  ll ti;   cin >> ti;  while(ti--) solve();  
    typedef long double ld;
    typedef long long ll;
    typedef pair<ll, ll> pii;
    typedef vector<ll> vi;
    const int maxN = 103000;
    
    vector<pii> adj[1050];
    void solve() {
        ll n, a, b;
        cin >> n >> a >> b;
        cout << min(n*a, b) << endl;
    }
 
    int main() {
      cin.sync_with_stdio(0); cin.tie(0);
      cin.exceptions(cin.failbit);
      //te
      solve();
      return 0;
    } 

Measured memory_bytes: 256
import copy
a = list(input())
n = len(a)-1
ans = 0
if n == 0:
  print(int(a[0]))
else:
  for i in range(2 ** n):
    l=[]
    l = copy.copy(a)
    dokoka = [0]*(n)
    for j in range(n):
        if ((i >> j)&1):
            dokoka[j] = 1
    x = l.pop(0)
    while True:
      d = dokoka.pop(0)
      if d == 0:
          x += l.pop(0)
      else:
          ans += int(x)
          x = l.pop(0)
      if not dokoka:
          ans += int(x)
          break
  print(ans)

Measured memory_bytes: 3572
n = int(input())
s = [list(map(int, input().split())) for i in range(n)]
dp = [[0, 0, 0] for _ in range(n)]
dp[0][:] = s[0][:]
for i in range(1, n):
    for j in range(3):  # dasu te
        for k in range(3):  # maeno te
            if j != k:
                try:
                    dp[i][j] = max(dp[i][j], dp[i-1][k] + s[i][j])
                except:
                    pass

print(max(dp[-1][:]))


Measured memory_bytes: 76268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int n, i, j, k, len;
ll pre [401];
ll dp [401][401];

int main ()
	{
	scanf ("%d",&n);
	for (i=1; i<=n; i++)
		{
		scanf ("%lld",&pre[i]);
		pre[i]+=pre[i-1];
		}
	for (len=1; len<n; len++)
		for (i=1; i+len<=n; i++)
			{
			j=i+len;
			dp[i][j]=1000000000000000001;
			for (k=i; k<j; k++)
				dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]);
			dp[i][j]+=pre[j]-pre[i-1];
			}
	printf ("%lld\n",dp[1][n]);
	return 0;
	}


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

int main()
{
	int N;
	cin >> N;

	double X = (double)N / 1.08;
	int nl = X;
	int nh = ceil( X );
	int ans = 0;
	for( int i = nl; i <= nh; i++ ) {
		if( (int)(i * 1.08 ) == N ) {
			ans = i;
			break;
		}
	}
	if( ans == 0  ) {
		cout << ":(" << endl;
	}
	else cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, m, c;
    cin >> n >> m >> c;
    int b[m];
    rep(i, 0, m) cin >> b[i];
    int ans = 0;
    rep(i, 0, n) {
        int x = c;
        rep(j, 0, m) {
            int a;
            cin >> a;
            x += (a * b[j]);
        }
        if (x > 0) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N, Q = map(int, input().split())

graph = [[] for _ in range(N)]

for _ in range(N-1):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
#print(graph)

w = [0]*N
for _ in range(Q):
    p, x = map(int, input().split())
    w[p-1] += x
#print(w)

stack = [0]
flag = [False]*N

while stack:
    next = stack.pop()
    flag[next] = True
    for i in graph[next]:
        if flag[i]:
            continue
        w[i] += w[next]
        stack.append(i)
        #print(stack)

print(" ".join(map(str, w)))

Measured memory_bytes: 71204
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) FOR(i,0,n)

int main(){
	
	int a,b,c;cin>>a>>b>>c;
	int ans = (a^b)^c;
	cout<<ans<<endl;
	
	return 0;
}

//cout << ans?"Yes":"No" << endl;

Measured memory_bytes: 256
import java.util.Scanner;

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

        int temp = sc.nextInt() + sc.nextInt();
        if ((int) temp / 2 == (double) temp / 2) {
            System.out.println(temp / 2);
        } else {
            System.out.println("IMPOSSIBLE");
        }
        sc.close();
    }
}

Measured memory_bytes: 22740
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
    int H, W;
    cin >> H >> W;
    vector< vector<char> > picture(H+2, vector<char>(W+2, '#'));
    for(int i=1; i<=H; i++) {
        for(int j=1; j<=W; j++) {
            cin >> picture[i][j];
        }
    }

    for(int i=0; i<H+2; i++) {
        for(int j=0; j<W+2; j++) {
            cout << picture[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <climits>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << 0; return;}
#define mkp make_pair
#define mkt make_tuple
#define cerr if(0) cerr

const int N = 1e5 + 100;

bool p[N];
vector <int> d;

void solve() {
    for (int i = 2; i < N; ++i)
        if (!p[i]) {
            d.pb(i);
            for (int j = i * i; j < N; j += i)
                p[j] = 1;
        }
    int n; cin >> n;
    cout << *lower_bound(all(d), n);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3816
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){

	int n;
	int tmp;
	string s;

	while(1){

		cin>>n;
		if(n==0) break;

		s="";
		
		while(n!=0){
			tmp=n%8;
			if(tmp>=4) tmp++;
			if(tmp>=6) tmp++;
			s+=tmp+'0';
			n/=8;
		}

		for(int i=0;i<s.size()/2;i++){
			swap(s[i],s[s.size()-i-1]);
		}

		cout<<s<<endl;
	}
}

Measured memory_bytes: 1188
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;
long long MOD = 1000000007LL;

int main() {
	long long N;
	long long A, B;
	cin >> N >> A >> B;
	if ((B - A) % 2 == 0) {
		cout << (B - A) / 2 << endl;
	}
	else {
		if (N - B < A - 1) {
			long long ans = N - B;
			B = N;
			A += ans;
			cout << min(ans + N - A, ans + 1 + (B - (A + 1)) / 2) << endl;
		}
		else {
			long long ans = A - 1;
			A = 1;
			B -= ans;
			cout << min(ans + B - 1, ans + 1 + ((B - 1) - A) / 2) << endl;
		}
	}


	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int a,b;
  cin>>a>>b;
  if(b*2>a)
    cout<<"0";
  else
    cout<<(a-(b*2));
 return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_DEPRECATE
#include<bits/stdc++.h>
#define Rint register int
#define MP make_pair
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii; // 注意必要时改类型
typedef vector<int> vi;
const int N = 1e5 + 5;
int n;
vi a(3);
ll dp[N][3];
void Process() {
	memset(dp, 0, sizeof(dp));
	cin >> n;
	for (Rint i = 1; i <= n; ++i) {
		for (Rint j = 0; j < 3; ++j)
			cin >> a[j];

		// 第一天取j
		for (Rint j = 0; j < 3; ++j) {
			// 第二天取k
			for (Rint k = 0; k < 3; ++k) {
				if (j == k)continue;
				else {
					dp[i][k] = max(dp[i - 1][j] + (ll)a[k], dp[i][k]);
				}
			}
		}
	}
	ll ans = -1;
	for (Rint i = 0; i < 3; ++i) {
		ans = max(ans, dp[n][i]);
	}
	cout << ans << endl;
	return;

}


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
#ifdef _DEBUG
	int tt = clock();
	freopen("in.txt", "r", stdin);
#endif 
	int Tcase = 1;
	// cin >> Tcase;
	while (Tcase--) {
		Process();
	}

#ifdef _DEBUG
	cerr << "\nTIME = " << clock() - tt << endl;
	tt = clock();
#endif
	return 0;
}

Measured memory_bytes: 2560
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    divisors.sort(reverse=True)
    return divisors


def main():
    N, M = map(int, input().split())

    divisors = make_divisors(M)
    ans = 1
    for d in divisors:
        if M // d >= N:
            if ans < d:
                ans = d

    print(ans)


if __name__ == "__main__":
    main()


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

int main()
{
  string S;
  cin >> S;
  int Ac = 0;
  int Bc = 0;
  for(int i = 0; i < 3 ; i ++)
  {
    if(S[i] == 'A'){Ac++;}
    else if(S[i] == 'B'){Bc++;}
  }
  if(Ac == 0 || Bc == 0){ cout << "No" << endl;}
  else{ cout << "Yes" << endl;}
}

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

// あまり大きな数字を入れると桁溢れする
template <typename T>
T comb(T n, T r) {
  // 組み合わせ計算時のかぶっている部分を取り除く
  r = std::min(n - r, r);
  T result = 1;
  T div = 1;
  for (T i = 1; i <= r; ++i) {
    result = (result * (n - i + 1));
    // result = result / i;
    div = div * i;
  }
  return result / div;
}

// 値が大きくなる時の対処用のクラス
template <typename T, T MOD>
class mod_int {
 private:
  typedef mod_int<T, MOD> mint;
  T inverse(T x) {
    T pow = MOD - 2;
    T result = 1;
    for (; pow; pow >>= 1, x = x * x % MOD) {
      if (pow & 1) result = result * x % MOD;
    }
    return result;
  }

 public:
  T val;
  // コンストラクタ
  mod_int() : val(0) {}
  mod_int(const mint &o) : val(o.val % MOD) {}
  mod_int(const T &o) : val(o % MOD) {}

  mint &operator+=(const mint &o) {
    val = (val + o.val) % MOD;
    return *this;
  }
  mint &operator-=(const mint &o) {
    val = (val + MOD - o.val) % MOD;
    return *this;
  }
  mint &operator*=(const mint &o) {
    val = (val * o.val) % MOD;
    return *this;
  }
  mint &operator/=(const mint &o) {
    val = (val * inverse(o.val)) % MOD;
    return *this;
  }

  mint &operator++() {
    val = (++val) % MOD;
    return *this;
  }

  mint &operator--() {
    val = (--val) % MOD;
    return *this;
  }

  mint operator+(const mint &o) const { return mint(*this) += o; }
  mint operator-(const mint &o) const { return mint(*this) -= o; }
  mint operator*(const mint &o) const { return mint(*this) *= o; }
  mint operator/(const mint &o) const { return mint(*this) /= o; }

  void operator=(const mint &o) { this->val = o.val; }
  void operator=(const int i) { this->val = i; }
  void operator=(const T i) { this->val = i; }

  bool operator<(const mint &o) const { return val < o.val; }
  bool operator<=(const mint &o) const { return val <= o.val; }
  bool operator==(const mint &o) const { return val == o.val; }
};

// ioのオーバーライド
template <typename T, T MOD>
std::istream &operator>>(std::istream &i, mod_int<T, MOD> &o) {
  i >> o.val;
  return i;
}
template <typename T, T MOD>
std::ostream &operator<<(std::ostream &i, mod_int<T, MOD> &o) {
  i << o.val;
  return i;
}

// 使うクラスのおまじない
typedef mod_int<uint64_t, 1000 * 1000 * 1000 + 7> muint64_t;

int main() {
  muint64_t N, M, K;
  std::cin >> N >> M >> K;

  muint64_t xsum = 0;
  muint64_t M2 = M * M;
  for (muint64_t xdiff = 1; xdiff <= N; ++xdiff) {
    xsum = xsum + xdiff * M2 * (N - xdiff);
  }

  muint64_t ysum = 0;
  muint64_t N2 = N * N;
  for (muint64_t ydiff = 1; ydiff <= M; ++ydiff) {
    ysum = ysum + ydiff * N2 * (M - ydiff);
  }

  // uint64_t result = (xsum + ysum) * p / k % (1000 * 1000 * 1000 + 7);
  muint64_t result = (xsum + ysum) * comb(N * M - 2, K - 2);
  std::cout << result << std::endl;

  return 0;
}


Measured memory_bytes: 256
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

namespace n91 {

using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

constexpr usize operator"" _z(unsigned long long x) noexcept {
  return static_cast<usize>(x);
}

class rep {
  const usize f, l;

public:
  class itr {
    friend rep;
    usize i;
    constexpr itr(const usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr rep(const usize first, const usize last) noexcept
      : f(first), l(last) {}
  constexpr itr begin() const noexcept { return itr(f); }
  constexpr itr end() const noexcept { return itr(l); }
};
class revrep {
  const usize f, l;

public:
  class itr {
    friend revrep;
    usize i;
    constexpr itr(usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr revrep(usize first, usize last) noexcept : f(--first), l(--last) {}
  constexpr itr begin() const noexcept { return itr(l); }
  constexpr itr end() const noexcept { return itr(f); }
};
template <class T> using vec_alias = std::vector<T>;
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) {
  return a < b ? b - a : a - b;
}

} // namespace n91

#include <utility>

namespace n91 {

template <class T> constexpr T gcd(T m, T n) noexcept {
  while (n != static_cast<T>(0)) {
    m %= n;
    std::swap(m, n);
  }
  return m;
}

template <class T> constexpr T lcm(const T &m, const T &n) noexcept {
  return m / gcd(m, n) * n;
}

} // namespace n91

#include <algorithm>
#include <iostream>
#include <string>
#include <utility>

namespace n91 {

void main_() {
  u64 a, b, c, d;
  std::cin >> a >> b >> c >> d;
  --a;

  const auto f = [&](const u64 x) { return x - x / c - x / d + x / lcm(c, d); };

  std::cout << f(b) - f(a) << std::endl;
}

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c,d,e=0,f=0;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(a>=b)
    {
        e=(b*c)+(d*(a-b));
    }
    else
        e=a*c;
    printf("%d\n",e);
    return 0;
}

Measured memory_bytes: 1704
N = int(input())

As = []
Bs = []
ABs = []
for _ in range(N):
	A,B = map(int,input().split())
	As.append(A)
	Bs.append(B)
	ABs.append([A,B])
	
if max(Bs) < sum(As):
	print("No")
	exit()
else:
	ABs = sorted(ABs,key=lambda x: (x[1],x[0]))
	#print(ABs)
	sum1 = 0
	for i in range(len(ABs)):
		sum1 += ABs[i][0]
		if ABs[i][1] < sum1:
			print("No")
			exit()
	else:
		print("Yes")
		exit()
		
print("Yes")

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

using namespace std;
using ll = long long;
const int F = 26;
const int def = 1e6;


int n;
vector<int> c(F);
vector<vector<int>> a;


void init() {
    cin >> n;
    a.resize(n, vector<int>(F));
    for(int i = 0; i < F; i++)cin >> c[i];
    for(int i = 0; i < n; i++)for(int j = 0; j < F; j++)cin >> a[i][j];
}


vector<int> calc(int rng) {
    vector<int> last(F, -1);
    vector<int> ans;
    for(int i = 0; i < n; i++){ 
        vector<int> cur = a[i];
        for(int j = 0; j < F; j++)cur[j] += (i - last[j]) * (c[j] + rng);
        int ind =  max_element(cur.begin(), cur.end()) - cur.begin();
        last[ind] = i;
        ans.emplace_back(ind);
    }
    return ans;
}

int chack(vector<int> p) {
    int sum = 0;
    vector<int> last(F, -1);
    for(int i = 0; i < n; i++) {
        sum += a[i][p[i]];
        last[p[i]] = i;
        for(int j = 0; j < F; j++)sum -= (i - last[j]) * c[j];
    }
    return sum;
}


int main()
{
    srand((unsigned)time(NULL));   
    init();


    vector<int> ans;
    int M = 4 * 1e4, nax = -1e9;
    for(int I = 1; I <= M; I++) {
        int sed = rand() % (rand() % (M/30) + 1) * ((rand() % 2)? 1 : -1);
        cerr << sed << endl;
        vector<int> cur = calc(sed);
        int k = chack(cur);
        if(k > nax) {
            nax = k;
            ans = cur;
        }
    }

    for(auto i : ans)cout << i + 1 << endl;
}

/*
satisfaction: 424801
score: 1424801
*/

Measured memory_bytes: 3688
// https://atcoder.jp/contests/abc092/tasks/arc093_b

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int A_MAX = 500;
const int B_MAX = 500;

int A, B;
int g[80][50];

void solve() {
  fill(g[0], g[40], 1);
  REP(i, A - 1) g[i / 25 * 2][i % 25 * 2] = 0;
  REP(i, B - 1) g[41 + i / 25 * 2][i % 25 * 2] = 1;
  puts("80 50");
  REP(i, 80) {
    REP(j, 50) printf("%c", g[i][j] ? '#' : '.');
    printf("\n");
  }
}

void input() {
  scanf("%d%d", &A, &B);
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

#define POS(i,j) ((i)*(w+1)+(j))

void run(void){
  int h,w;
  scanf("%d%d",&h,&w);
  char *a=(char *)calloc((h+1)*(w+1),sizeof(char));
  int i,j;
  for(i=1;i<=h;i++) scanf("%s",a+POS(i,1));
  const int mod=1000000007;
  int *dp=(int *)calloc((h+1)*(w+1),sizeof(int));
  dp[POS(0,1)]=1;
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      if(a[POS(i,j)]=='#') continue;
      dp[POS(i,j)]=(dp[POS(i-1,j)]+dp[POS(i,j-1)])%mod;
    }
  }
  printf("%d\n",dp[POS(h,w)]);
}

int main(void){
  run();
  return 0;
}

Measured memory_bytes: 4992
x =list(map(int,input().split()))
y = x[2] - x[1]
z = x[0] - x[3]
if y <= 0:
    print('Yes')
elif z <= 0:
    print('No')
else:
    while True:
        y = y - x[1]
        z = z - x[3]
        if y <= 0 or z <= 0:
            break
    if y <= 0 :
      print('Yes')
    elif y <= 0 and z <= 0:
        print('Yes')
    else:
      print('No')

Measured memory_bytes: 9196
#include<iostream>
#include<iomanip>
#include<string>
#include<array>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>
#include<ctype.h>
using namespace std;


int main() {
	int n,ans=0;
	string s;
	cin >> n >> s;
	for (int i = 0; i < n - 2;i++) {
		if (s[i]=='A'&& s[i+1] == 'B'&& s[i+2] == 'C') {
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<functional>
#include<vector>
#include<queue>
using namespace std;
#define f(i,n) for(int i=0;i<(int)n;i++)
#define MOD 1000000009

int main(void){
	char a[1000];
	f(i, 1000)a[i] = 0;
	int k, s;
	int n, m;
	int x, y, z;
	int ans = 0;

	scanf("%s", a);
	n = strlen(a);

	f(i, n-1){
		if (a[i] == 'A'&&a[i + 1] == 'C')ans = 1;
	}

	if (ans==1)printf("Yes\n");
	else printf("No\n");

	return 0;
}

Measured memory_bytes: 128
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())

b = set(int(input()) for i in range(n))

def check():
    for i in range(3):
        if all(a[i][j] in b for j in range(3)):
            return True
        if all(a[j][i] in b for j in range(3)):
            return True
    return all(a[i][i] in b for i in range(3)) or all(a[2-i][i] in b for i in range(3))

print('Yes' if check() else 'No')

Measured memory_bytes: 38512
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define cool ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll long long
#define MAX 1000001
#define mod 1000000007
#define pie 3.14159265358979323846
void solve()
{
	ll int n,ans=0;
	cin>>n;
	string s;
	map<string,ll int> mp;
	for(ll int i=0;i<n;i++){
		cin>>s;
		sort(s.begin(),s.end());
		mp[s]++;
	}
	for(auto x:mp){
		ans+=((x.second*(x.second-1))/2);
	}
	cout<<ans;
}
int main()
{ 
    cool;
    int t;
    //cin>>t;
    t=1;
    while(t--){
    	solve();
	}
    return 0;
}


Measured memory_bytes: 11264
from collections import deque


def dfs(start, goal, tree):
    """startからgoalまでの木上のpathを出力する"""
    q = deque([start])
    visited = {}
    visited[start] = -1
    while True:
        pos = q.pop()
        if pos == goal:
            break
        for child in tree[pos]:
            if child in visited:
                continue
            visited[child] = pos
            q.append(child)
    res = []
    pos = goal
    while True:
        par = visited[pos]
        if par == -1:
            break
        res.append((min(par, pos), max(par, pos)))
        pos = par
    return res


n = int(input())
info = [list(map(int, input().split())) for i in range(n - 1)]
m = int(input())
path = [list(map(int, input().split())) for i in range(m)]

tree = [[] for i in range(n)]
memo = {}
for i in range(n - 1):
    a, b = info[i]
    a -= 1
    b -= 1
    tree[a].append(b)
    tree[b].append(a)
    memo[(min(a, b), max(a, b))] = i
  

li_path = [0] * m
for i in range(m):
    s, g = path[i]
    s -= 1
    g -= 1
    res = dfs(s, g, tree)
    tmp = 0
    for j in res:
        tmp += (1 << memo[j])
    li_path[i] = tmp
  
ans = 0
for bit_state in range(1 << m):
    mask = 0
    cnt = 0
    for i in range(m):
        if bit_state & (1 << i):
            cnt += 1
            mask |= li_path[i]
    num_n = bin(mask).count("1")
    if cnt % 2 == 0:
        ans += 2 ** (n - 1 - num_n)
    else:
        ans -= 2 ** (n - 1 - num_n)
print(ans)


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

int main() {
    int N;
    cin >> N;
    vector<int> town(N);
    vector<pair<int, int>> position(N);
    for(int i = 0; i < N; i++) {
        int x, y;
        cin >> x >> y;
        position[i] = make_pair(x, y);
    }
    double ans = 0;
    for(int i = 0; i < N; i++) {
        town[i] = i;
    }
    int count = 0;
    do {
        count++;
        long double res = 0;
        for(int i = 1; i < N; i++) {
            long double x_d = pow(position[town[i]].first - position[town[i-1]].first, 2);
            long double y_d = pow(position[town[i]].second - position[town[i-1]].second, 2);
            res += sqrt(x_d + y_d);
        }
        ans += res;
    } while(next_permutation(town.begin(), town.end()));
    long double answer = ans / count;
    cout << fixed << setprecision(15) << answer << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
t=[1,4,1,4,1,2,1,2]
for i in sys.stdin:
    l=list(map(int,i[:-1].split()))
    q={}
    for i in range(8):
        e=int("".join(map(str,t[i:]+t[:i])))
        s=sum([j if j<i else i for (i,j) in zip(t[i:]+t[:i],l)])
        if s not in q:
            q[s]=[e]
        else:
            q[s].extend([e])
    print(" ".join([i for i in str(sorted(q[max(q.keys())])[0])]))


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

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
  
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod=MOD){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}
ll const N=(ll)3e2+11;
ll const LG=(ll)log2(N)+1;


void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
        ll a,b;
        cin>>n>>a>>b;
        cout<<min(n*a,b)<<endl;
        
}       
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        while(q--){
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

int main()
{
    int n;
    cin >> n;
    vector<pair<int, int>> xs(n);
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        xs[i] = make_pair(x, i);
    }
    
    sort(xs.begin(), xs.end());

    vi ans(n);
    for (int i = 0; i < n; i++) {
        if (i < n / 2) {
            ans[xs[i].second] = xs[n / 2].first;
        } else {
            ans[xs[i].second] = xs[n / 2 - 1].first;
        }
    }

    for (auto x : ans) {
        cout << x << endl;
    }
    return 0;
}


Measured memory_bytes: 4480
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = sc.nextInt();
        sc.nextLine();
        HashSet<String> h = new HashSet<>();
        for(int i = 0; i < n; i++) {
            h.add(sc.nextLine().trim());
        }
        System.out.println(h.size());
    }
}


Measured memory_bytes: 79532
n, l = [int(i) for i in input().split()]

aji = [l+i for i in range(n)]
sumaji = sum(aji)
sa = abs(sumaji - (sumaji - aji[0]))
ansind = 0
for i in range(n):
  if sa >  abs(sumaji - (sumaji - aji[i])):
    sa = abs(sumaji - (sumaji - aji[i]))
    ansind = i

print(sumaji-aji[ansind])

Measured memory_bytes: 3064