akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    int n;
    cin >> n;
    vector<vi> es(n);
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        es[a].pb(b);
        es[b].pb(a);
    }
    auto calc_dist =[&](int s) {
        vector<ll> d(n, INF);
        d[s] = 0;
        queue<int> q;
        q.push(s);
        while(!q.empty()) {
            auto p = q.front(); q.pop();
            for(auto&& to: es[p]) {
                if(d[to] > d[p] + 1) {
                    d[to] = d[p] + 1;
                    q.push(to);
                }
            }
        }
        return d;
    };
    auto d0 = calc_dist(0);
    auto d1 = calc_dist(n-1);
    // vi path(1, 0);
    // while(path.back() != n-1) {
    //     int cur = path.back();
    //     for(auto&& to: es[cur]) {
    //         if(d0[to] == d0[cur] + 1 && d1[cur] == d1[to] + 1) {
    //             path.push_back(to);
    //             break;
    //         }
    //     }
    // }
    int x = 0;
    rep(i, n) {
        if(d0[i] <= d1[i]) ++x;
    }
    int y = n - x;
    cout << (x > y ? "Fennec" : "Snuke") << endl;
    return 0;
}

Measured memory_bytes: 7296
N, P = map(int, input().split())
A = list(map(int, input().split()))

#N = 3
#P = 0
#A = [1, 1, 1]
#N = 45
#P = 0
#A = [17, 55, 85, 55, 74, 20, 90, 67, 40, 70, 39, 89, 91, 50, 16, 24, 14, 43, 24, 66, 25, 9, 89, 71, 41, 16, 53, 13, 61, 15, 85, 72, 62, 67, 42, 26, 36, 66, 4, 87, 59, 91, 4, 25, 26]

A = [i%2 for i in A]

if(A[0]==0 and P==0):
    dp = 2
elif(A[0]==0 and P==1):
    dp = 0
elif(A[0]==1 and P==0):
    dp = 1
else:
    dp = 1

for i in range(N-1):
    if(A[i+1]==0):
        dp = 2*dp
    else:
        dp = 2**(i+1)
print(dp)

Measured memory_bytes: 3064
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def collatz(n):
    return n // 2 if n % 2 == 0 else 3 * n + 1


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    s = ii()
    st = set()

    cnt = 1
    while s not in st:
        cnt += 1
        st.add(s)
        s = collatz(s)
    print(cnt)


if __name__ == '__main__':
    main()


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    string S;
    
    cin >> N;
    cin >> S;

    vector<ll> R;
    vector<ll> G;
    vector<ll> B;

    if(N==1){
        cout << 0 << endl;
        return 0;
    }
    if(N==2){
        cout << 0 << endl;
        return 0;
    }
    if(N==3){
        cout << 0 << endl;
        return 0;
    }

    ll ans = 0;
    // if((S[0]!=S[1]) && (S[1]!=S[2]) && (S[2]!=S[0])){
    //     ans = 0;
    // }
    // else{
    //     ans = 0;
    // }

    
    for(ll i=0; i<N; i++){
        if(i >= 3){
            if(S[i] == 'R'){
                REP(j, G.size()){
                    ll temp = 0;
                    if((i-G[j])%2== 0){
                        if(binary_search(B.begin(), B.end(), G[j] +(i-G[j])/2)) temp++;
                    }
                    if(binary_search(B.begin(), B.end(), G[j] - (i-G[j]))) temp++;
                    ans += B.size() - temp;
                }
            }
            if(S[i] == 'G'){
                REP(j, B.size()){
                    ll temp = 0;
                    if((i-B[j])%2== 0){
                        if(binary_search(R.begin(), R.end(), B[j] +(i-B[j])/2)) temp++;
                    }
                    if(binary_search(R.begin(), R.end(), B[j] - (i-B[j]))) temp++;
                    ans += R.size() - temp;
                }
            }
            if(S[i] == 'B'){
                REP(j, R.size()){
                    ll temp = 0;
                    if((i-R[j])%2== 0){
                        if(binary_search(G.begin(), G.end(), R[j] +(i-R[j])/2)) temp++;
                    }
                    if(binary_search(G.begin(), G.end(), R[j] - (i-R[j]))) temp++;
                    ans += G.size() - temp;
                }
            }
        }
        if(S[i] == 'R'){
            R.push_back(i);
        }
        if(S[i] == 'G'){
            G.push_back(i);
        }
        if(S[i] == 'B'){
            B.push_back(i);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3668
def geta(n=0)
  return $stdin.gets.to_i if n==0
  ar = []
  n.times do 
    ar << $stdin.gets.chomp.split
  end
  return ar.flatten(1) if n<=1
  return ar
end

def insert(idx)
  return if idx-1<0
  0.step(idx-1) do |i|
    if @ar[i] > @ar[idx]
      n = @ar.delete_at(idx)
      @ar.insert( i, n)
      return
    end
  end
end


n = geta(0)
@ar = geta(1).map(&:to_i)

n.times do |i|
  insert(i)
  puts @ar.join(" ")
end


Measured memory_bytes: 6896
n = int(input())
a = list(map(int, input().split()))

cost_list = []
sum = 0
cost = 0
for i in range(n):
    sum += a[i]
    if i % 2:
        if sum >= 0:
            cost += sum + 1
            sum -= sum + 1
    else:
        if sum <= 0:
            cost += abs(sum) + 1
            sum += abs(sum) + 1

cost_list.append(cost)
sum = 0
cost = 0
for i in range(n):
    sum += a[i]
    if i % 2:
        if sum <= 0:
            cost += abs(sum) + 1
            sum += abs(sum) + 1
    else:
        if sum >= 0:
            cost += sum + 1
            sum -= sum + 1

cost_list.append(cost)

print(min(cost_list))


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

int main(){
    int n,x;
    cin >> n >> x;
    int M[n];
    int sum = 0;
    for(int i = 0; i < n; i++){
        cin >> M[i];
        sum += M[i];
    }
    sort(M, M+n);
    cout << n + (x - sum) / M[0] << endl;

    return 0;
}


Measured memory_bytes: 256
import numpy as np
n = int(input())
xy = np.array([list(map(int, input().split())) for _ in range(n)]).T
ans = 0
L = np.angle(xy[0]+xy[1]*1j)
A = sorted([[j, xy[0][i], xy[1][i]] for i, j in enumerate(L)])
A = [i[1:] for i in A]
A = np.array(A*2)
for i in range(n):
  for j in range(i+1, i+n+1):
    S = A[i:j]
    t = S.sum(axis=0)
    ans = max(ans, np.hypot(*t))
print(ans)

Measured memory_bytes: 12448
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

func main() {
    sc.Split(bufio.ScanWords)
    a := nextInt()
    b := nextInt()
    
    if a + b >= 10 {
		fmt.Println("error")
	}else {
		fmt.Println(a + b)
	}
}

Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <stack>
#define MAX_VERTEXES 100
#define ZERO 0
#define NIL -1

using namespace std;

//think easy make easy

int n;//num of vertexes(頂点)
int matrix_graph[MAX_VERTEXES+1+1][MAX_VERTEXES+1+1];//1オリジン

stack<int> stk;
bool discovered[MAX_VERTEXES+1+1];//1オリジン
int discovered_time[MAX_VERTEXES+1+1];
int completed_time[MAX_VERTEXES+1+1];
int current_time = 0;

void DFS(int v){
	int v_tmp;
	for(int i=1;i<=n;i++){
		//if(i == v);
		if(matrix_graph[v][i] == 1 && !discovered[i]){
			current_time++;
			discovered_time[i] = current_time;
			stk.push(v);
			matrix_graph[v][i] == 0;
			discovered[i] = true;
			DFS(i);
		}else if(matrix_graph[v][i] == 1 && discovered[i]){
			matrix_graph[v][i] == 0;
		}

		if(i == n){
			current_time++;
			completed_time[v] = current_time;
			//if(!stk.empty())
			//{
				//cout <<stk.top() <<endl;
				//v_tmp = stk.top();
				//stk.pop();
				//DFS(v_tmp);
			//}
		}
	}
}

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

	int v_num;
	int k;//v_numの出次数

	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			matrix_graph[i][j] = ZERO;
		}
	}

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

		for(int j=0;j<k;j++){
			int v_num2;
			scanf("%d",&v_num2);
			matrix_graph[v_num][v_num2] = 1;
		}
	}

	for(int i=1;i<=n;i++){
		discovered[i] = false;
		discovered_time[i] = NIL;
		completed_time[i] = NIL;
	}

	for(int i=1;i<=n;i++){
	//	cout <<"c" <<current_time <<" ";
		//current_time++;//ここではなく
		if(!discovered[i]){
			current_time++;//ココ
			//cout <<i <<endl;
			discovered[i] = true;
			discovered_time[i] = current_time;
			DFS(i);
		}
	}

	for(int i=1;i<=n;i++){
		cout <<i <<" " <<discovered_time[i] <<" " <<completed_time[i] <<endl;
	}

	return 0;
}

Measured memory_bytes: 1252
#include<iostream>
using namespace std;
int main(){
  int graph[100][100]={},n,u,k,v;
  cin>>n;
  for(int i=0;i<n;++i){
    cin>>u>>k;
    for(int j=0;j<k;++j){
      cin>>v;
      graph[u-1][v-1]=1;
    }
  }
  for(int i=0;i<n;++i){
    for(int j=0;j<n;++j){
      if(j) cout<<" ";
      cout<<graph[i][j];
    }
    cout<<endl;
  }
  return 0;
}



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

int main(){
	int a, b;
	char op;

	while(1){
		cin >> a >> op >> b;
		if(op == '?') break;
		if(op == '+') cout << a+b << endl;
		else if(op == '-') cout << a-b << endl;
		else if(op == '*') cout << a*b << endl;
		else if(op == '/') cout << a/b << endl;
		else cout << "笑止" << endl;
	}

	return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
#define ld double
#define ll long long
#define pb emplace_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) x.begin(),x.end()
ll power(ll a, ll b) {ll res = 1; a = a % mod; while (b) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b /= 2;} return res;}
ll invmod(ll a) {return power(a, mod - 2);}
int main(void)
{
	FIO
	int t = 1;
	// cin >> t;
	while (t--)
	{
		int n;
		cin >> n;
		ll arr[n], mul = 1e18, z = 1;
		for (auto &i : arr) {
			cin >> i;
			if (i == 0) {
				cout << 0 << "\n";
				return 0;
			}
		}
		for (auto i : arr) {
			if (i <= mul / z) {
				z *= i;
			}
			else {
				z = -1;
				break;
			}
		}
		cout << z << "\n";
	}
	return 0;
}

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


const ll MOD = 1e9 + 7;
template<ll MOD> struct ModInt {
    ll value;
    ModInt() : value(0) {}
    ModInt(const ll& v) : value(v % MOD) {
        if ( value < 0 ) value += MOD;
    }
    ModInt<MOD>& operator=(const ModInt& o) {
        value = o.value;
        return *this;
    }
    inline bool operator==(const ModInt& o) {
        return value == o.value;
    }
    inline bool operator!=(const ModInt& o) {
        return value != o.value;
    }
    ModInt<MOD>& operator+=(const ModInt& o) {
        value += o.value;
        if ( value >= MOD ) value -= MOD;
        return *this;
    }
    ModInt<MOD>& operator-=(const ModInt& o) {
        value += MOD - o.value;
        if (value >= MOD ) value -= MOD;
        return *this;
    }
    ModInt<MOD>& operator*=(const ModInt& o) {
        value *= o.value;
        value %= MOD;
        return *this;
    }
    ModInt<MOD>& operator/=(const ModInt& o) {
        value *= inverse(o.value);
        value %= MOD;
        return *this;
    }
    ModInt<MOD> operator-() {
        return ModInt<MOD>(-value);
    }
    ModInt<MOD> operator+(const ModInt& o) {
        ModInt<MOD> r(*this);
        r += o;
        return r;
    }
    ModInt<MOD> operator-(const ModInt& o) {
        ModInt<MOD> r(*this);
        r -= o;
        return r;
    }
    ModInt<MOD> operator*(const ModInt& o) {
        ModInt<MOD> r(*this);
        r *= o;
        return r;
    }
    ModInt<MOD> operator/(const ModInt& o) {
        ModInt<MOD> r(*this);
        r /= o;
        return r;
    }
    ModInt<MOD> pow(ll n) {
        ModInt<MOD> t(*this), r = 1;
        while ( n > 0 ) {
            if ( n & 1 ) r *= t;
            t *= t;
            n >>= 1;
        }
        return r;
    }
private:
    ll inverse(ll a) {
        ModInt<MOD> t(a);
        return t.pow(MOD - 2).value;
    }
};
template<ll MOD> std::ostream& operator<< (std::ostream& os, const ModInt<MOD>& o) {
    os << o.value;
    return os;
}
template<ll MOD> std::istream& operator>> (std::istream& is, ModInt<MOD>& o) {
    is >> o.value;
    return is;
}

using Int = ModInt<MOD>;

ll solve() {
    ll N, A, B;
    cin >> N >> A >> B;
    Int n2 = 2;
    Int nca = 1, ncb = 1;
    for ( ll a = 0; a < A; a++ ) {
        nca *= (N-a);
        nca /= (a+1);
    }
    for ( ll b = 0; b < B; b++ ) {
        ncb *= (N-b);
        ncb /= (b+1);
    }
    Int ans = n2.pow(N) - nca - ncb - 1;
    return ans.value;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
ans = [None] * n
for i in range(m):
    s, c = map(int, input().split())
    if ((ans[s - 1] is not None and ans[s - 1] != c)
            or (s == 1 and c == 0 and n > 1)):
        ans = -1
        break
    ans[s - 1] = c
if ans != -1:
    if ans[0] is None:
        if n == 1:
            ans[0] = 0
        else:
            ans[0] = 1
    for i in range(1, n):
        if ans[i] is None:
            ans[i] = 0
    ans = ''.join(list(map(str, ans)))
print(ans)


Measured memory_bytes: 3064
#include <stdio.h>
#define N 25
#define NIL -1

typedef struct{ 
    int l;
    int p;
    int r;
}Node;

void preorder( int u );
void inorder ( int u );
void postorder( int u );
Node A[N+1];

int main(){
    int n, i, k, l, r;

    //input
    scanf("%d", &n);
    for( i=0; i<=n; i++ ) A[i].l = A[i].p = A[i].r = NIL;
    for( i=0; i<n; i++ ){
	scanf("%d%d%d", &k, &l, &r);
	A[k].l = l;
	A[k].r = r;
	A[l].p = A[r].p = k;//resister the parent
    }
    //find root node
    for( i=0; i<n; i++ ) if( A[i].p == NIL ) break;

    //tree walk and print
    printf("Preorder\n");
    preorder( i );
    printf("\nInorder\n");
    inorder( i );
    printf("\nPostorder\n");
    postorder( i );
    printf("\n");

    return 0;
}

void preorder( int u ){
    if( u == NIL ) return ;
    printf(" %d", u);
    preorder( A[u].l );
    preorder( A[u].r );

    return ;
}

void inorder( int u ){
    if( u == NIL ) return ;
    
    inorder( A[u].l );
    printf(" %d", u);
    inorder( A[u].r );
    
    return ;
}

void postorder( int u ){
    if( u == NIL ) return ;

    postorder( A[u].l );
    postorder( A[u].r );
    printf(" %d", u);

    return ;
}



Measured memory_bytes: 2140
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  int n;
  cin >> n;
  double ans = 0;
  rep (i, n) {
    double tmp;
    cin >> tmp;
    ans += 1 / tmp;
  }
  printf("%.7f\n", 1 / ans);

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
int root[101][101];

int main(void){
	int n,m;
	for(int i=0;i<=100;i++){
		for(int j=0;j<=100;j++){
			root[i][j]=1000000;
		}
		root[i][i]=1;
	}
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		for(int j=0;j<b;j++){
			int c;
			scanf("%d",&c);
			root[a][c]=1;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			for(int k=1;k<=n;k++){
				root[j][k]=min(root[j][k],root[j][i]+root[i][k]);
			}
		}
	}
	scanf("%d",&m);
	for(int i=0;i<m;i++){
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		if(c>=root[a][b]+1)printf("%d\n",root[a][b]+1);
		else printf("NA\n");
	}
    return 0;
}

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

int main()
{
  	int n,m;
  
 	cin >> n >> m;
  
    int a[n][m],b[m],c[n] = {0};
  
  	for(int i = 0;i < n;i++){
      for(int j = 0;j < m;j++){
        cin >> a[i][j];
      }
    }
  	for(int j = 0;j < m;j++){
        cin >> b[j];
    }

  	for(int i = 0;i < n;i++){
      for(int j = 0;j < m;j++){
        c[i] += (a[i][j]*b[j]);
      }
    }
  
  	for(int i = 0;i < n;i++){
      cout << c[i] << endl;
    }
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(void) {
    ll N;
    cin>>N;
    ll A[N+1],B[N];
    for(int i=0;i<N+1;i++){
        cin>>A[i];
    }
    for(int i=0;i<N;i++){
        cin>>B[i];
    }
    ll ans=0;
    if(A[N]<=B[N-1]){
        ans+=A[N];
        B[N-1]-=A[N];
    }
    else{
        ans+=B[N-1];
        B[N-1]=0;
    }
    
    for(int i=N-1;i>=1;i--){
        if(A[i]<=B[i]){
            ans+=A[i];
        }
        else{
            ans+=B[i];
            A[i]-=B[i];
            if(A[i]<=B[i-1]){
                ans+=A[i];
                B[i-1]-=A[i];
            }
            else{
                ans+=B[i-1];
                B[i-1]=0;
            }
        }
    }
    ans+=min(A[0],B[0]);
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main() {
  int min = 1000, max = 0, N; cin >> N;
  for(int i = 0; i < N; i++) {
    int inp; cin >> inp;
    if(inp > max) max = inp;
    if(inp < min) min = inp;
  }
  cout << max - min << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <cassert>
using namespace std; typedef long long ll; const int MINF=-1e9; typedef pair<int,int> P;

int main() {
  int n; cin>>n;
  int a[n]; for(int i=0;i<n;i++) cin>>a[i];
  int an=0;
  for(int i=1;i<n;i++) {
    if (a[i-1]==a[i]) an++, a[i]=-1;
  }
  cout<<an<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lowbit(x) ((x)&(-(x)))
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 0x3f3f3f3f;
const int MOD = 998244353;
const int maxn = 5e5 + 10;
string s, t;
int main()
{
    cin >> s >> t;    int cnt = 0;
    for(int i = 0; i < s.length(); i++)
        cnt += s[i] != t[i];
    cout << cnt;
    return 0;
}


Measured memory_bytes: 3844
D, G= map(int, input().split())
p=[]
c=[]
for i in range(D):
    pi, ci= map(int, input().split())
    p.append(pi)
    c.append(ci)

ans=10000000000
slis=[]
def dfs(i,point,pr):
    global ans
    global slis
    if i==D:
#        print(point)
#        print(slis)
        if G<=point:
            ans=min(ans,pr)
        else:
            for j in range(D-1,-1,-1):
                if slis[j]==0:
                    k=j
                    break
            
#            print('G-point:',G-point)
#            print('(100*(k+1)*(p[k]-1)):',(100*(k+1)*(p[k]-1)))
            if (G-point)<=(100*(k+1)*(p[k]-1)):
                pr+=-(-(G-point)//(100*(k+1)))
                ans=min(ans,pr)
#                print('ans:',ans)


#            if umax!=-1 and (G-point)<(100*(umax+1)*(p[umax]-1)):
        
        return
    #全て解かない
    slis.append(0)
    dfs(i+1,point,pr)
    slis.pop(-1)
    #全て解く
    slis.append(1)
    dfs(i+1,point+(100*(i+1)*p[i]+c[i]),pr+p[i])
    slis.pop(-1)
dfs(0,0,0)
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

typedef struct {
	int key, id;
} data;

void merge_sort(data x[], int n)
{
	static data y[1000010] = {};
	if (n <= 1) return;
	merge_sort(&(x[0]), n/2);
	merge_sort(&(x[n/2]), (n+1)/2);
	
	int i, p, q;
	for (i = 0, p = 0, q = n/2; i < n; i++) {
		if (p >= n/2) y[i] = x[q++];
		else if (q >= n) y[i] = x[p++];
		else y[i] = (x[p].key < x[q].key)? x[p++]: x[q++];
	}
	for (i = 0; i < n; i++) x[i] = y[i];
}

typedef struct {
	data obj[1000010];
	int size;
} max_heap;

void push(data x, max_heap* h)
{
	int i = h->size;
	data tmp;
	h->obj[(h->size)++] = x;
	while (1) {
		if (i == 0) break;
		else if (h->obj[i].key > h->obj[(i-1)/2].key) {
			tmp = h->obj[(i-1)/2];
			h->obj[(i-1)/2] = h->obj[i];
			h->obj[i] = tmp;
			i = (i - 1) / 2;
		} else break;
	}
}

data pop(max_heap* h)
{
	int i = 0, j;
	data output = h->obj[0], tmp;
	h->obj[0] = h->obj[--(h->size)];
	while (1) {
		if (i * 2 + 1 >= h->size) break;
		else if (i * 2 + 2 >= h->size) j = i * 2 + 1;
		else if (h->obj[i*2+1].key > h->obj[i*2+2].key) j = i * 2 + 1;
		else j = i * 2 + 2;
		if (h->obj[j].key > h->obj[i].key) {
			tmp = h->obj[j];
			h->obj[j] = h->obj[i];
			h->obj[i] = tmp;
			i = j;
		} else break;
	}
	return output;
}

int main()
{
	int i, j, N;
	char T[1000010];
	data count[1000010];
	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		scanf("%s", T);
		for (j = 0, count[i].key = 0, count[i].id = 0; T[j] != 0; j++) {
			if (T[j] == '(') count[i].id++;
			else count[i].id--;
			if (count[i].id < count[i].key) count[i].key = count[i].id;
		}
	}
	merge_sort(count, N);
	
	int tmp = 0;
	data d;
	max_heap h[2];
	h[0].size = 0;
	h[1].size = 0;
	for (i = N - 1; i >= 0 && count[i].key == 0; i--) tmp += count[i].id;
	for (; i >= 0 && tmp >= -count[i].key; i--) {
		d.key = count[i].id;
		d.id = count[i].key;
		push(d, &(h[0]));
	}
	while (h[0].size > 0 && h[0].obj[0].key >= 0) {
		d = pop(&(h[0]));
		tmp += d.key;
		for (; i >= 0 && tmp >= -count[i].key; i--) {
			d.key = count[i].id;
			d.id = count[i].key;
			push(d, &h);
		}
	}
	if (i >= 0) {
		printf("No\n");
		fflush(stdout);
		return 0;
	}
	while (h[0].size > 0) {
		d = pop(&(h[0]));
		d.key -= d.id;
		d.id = d.key + d.id;
		push(d, &(h[1]));
	}
	while (h[1].size > 0) {
		d = pop(&(h[1]));
		if (tmp - d.key + d.id < 0) {
			printf("No\n");
			fflush(stdout);
			return 0;
		}
		tmp += d.id;
	}
	if (tmp == 0) printf("Yes\n");
	else printf("No\n");
	fflush(stdout);
	return 0;
}

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



using ll=long long;

int main(){
	#ifndef ONLINE_JUDGE
		//freopen("input.txt","r",stdin);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,i,c=0;
	char ch;
	string s="",t="",u="";
	cin>>n;
	for(i=0;i<n;i++){
		cin>>ch;
		s+=ch;
		u+=(char)('1'+i);
	}
	for(i=0;i<n;i++){
		cin>>ch;
		t+=ch;
	}
	int a=0,b=0;
	while(u != s){
		next_permutation(u.begin(),u.end());
		a++;
	}
	sort(u.begin(),u.end());
	while(u != t){
		next_permutation(u.begin(),u.end());
		b++;
	}
	cout<<abs(a-b);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
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; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
#define fs first
#define sc second
// 多倍長
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using boost::rational;
using boost::multiprecision::cpp_int;

const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;


int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    ll n;
    cin >> n;
    vector<ll> prime(n + 1);
    REP(i, 1, n + 1){
        for(int j = 0; j <= n; j += i) prime[j]++;
    }
    ll ans = 0;
    REP(i, 1, n + 1){
        ans += i * prime[i];
    }
    print(ans);

}




Measured memory_bytes: 81300
// 2011/05/26 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int mnt[10];
	for(int i=0; i<10; i++)
		cin >> mnt[i];

	for(int i=0; i<9; i++)
		for(int j=i+1; j<10; j++)
			if(mnt[i]<mnt[j]){
				int tmp = mnt[i];
				mnt[i] = mnt[j];
				mnt[j] = tmp;
			}

	for(int i=0; i<3; i++)
		cout << mnt[i] << endl;

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define MP make_pair
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
// #define Local
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int N = 2005;

int a[N << 1], c[2][N];
char s[2];
int n;
int cost_w[N][N], cost_b[N][N];
int dp[N][N];

int lowbit(int x) {return x & (-x);}

void add(int id, int x) {
	for(; x < N; x += lowbit(x)) ++c[id][x];
}

int query(int id, int x) {
	int res = 0;
	for(; x; x -= lowbit(x)) res += c[id][x];
	return res;
}

void run() {
	memset(c, 0, sizeof(c));
	for(int i = 1; i <= 2 * n; i++) {
		cin >> s >> a[i];
		if(s[0] == 'W') {
			for(int j = 0; j <= n; j++) {
				cost_w[a[i] - 1][j] = i - 1 - query(0, a[i] - 1) - query(1, j);
			}
			add(0, a[i]);
		} else {
			for(int j = 0; j <= n; j++) {
				cost_b[j][a[i] - 1] = i - 1 - query(1, a[i] - 1) - query(0, j);
			}
			add(1, a[i]);
		}
	}
	memset(dp, INF, sizeof(dp));
	dp[0][0] = 0;
	for(int i = 0; i <= n; i++) {
		for(int j = 0; j <= n; j++) {
			if(i) dp[i][j] = min(dp[i][j], dp[i - 1][j] + cost_w[i - 1][j]);
			if(j) dp[i][j] = min(dp[i][j], dp[i][j - 1] + cost_b[i][j - 1]);
		}
	}
	cout << dp[n][n] << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
#ifdef Local
    freopen("../input.in", "r", stdin);
    freopen("../output.out", "w", stdout);
#endif
    while(cin >> n) run();
    return 0;
}


Measured memory_bytes: 47360
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define fs first
#define sc second
#define P pair<int, int>
#define mk_p make_pair
const int mod = 1e9 + 7;
const int N = 2e6 + 11;
int fac[N], inv[N];
int r1, c1, r2, c2;
int M(int x, int y){
	return 1LL * x * y % mod;
}
int A(LL x, LL y){
	return (x + y) % mod;
}
LL C(int n, int m){
	if(n < m)return 0;
	return M(fac[n], M(inv[m], inv[n-m]));
}
int main(){
	cin>>r1>>c1>>r2>>c2;
	fac[0] = fac[1] = inv[0] = inv[1] = 1;
	for(int i = 2;i <= 2e6 + 1; i++){
		fac[i] = M(fac[i-1], i);
		inv[i] = (mod - 1LL * mod / i * inv[mod%i] % mod) % mod;
	}
	for(int i = 2;i <= 2e6 + 1; i++){
		inv[i] = M(inv[i], inv[i-1]);
	}
	LL ans = 0;
	for(int i = r1;i <= r2; i++){
		ans = A(ans, C(i + c2 + 1, c2) - C(i + c1, c1 - 1) + mod);
//		printf("i=%d ans=%d\n", i, ans);
	}
	cout<<ans<<endl;
	return 0;
}

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

int main()
{
    string one;
    cin >> one;
    if (one == "ABC") {
        cout << "ARC" << endl;
    } else {
        cout << "ABC" << endl;
    }


    return 0;
}

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

#define ll long long
#define mtv(kit) cout<<#kit<<" - "<<kit<<"\n";
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map

void doit(){
	ll n, i, ans = 0;
	cin >> n;
	pii p = {1,n};
	while(p.ss != 0){
		ans += p.ff;
		p.ff = 2*p.ff;
		p.ss = p.ss/2;
	}
	cout << ans << nl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
    // cin >> t;
    for(ll i = 1; i <= t; i++){
        doit();
    }
}



Measured memory_bytes: 3652
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <sstream>
#include <utility>
#include <cstdlib>
#include <cctype>
#include <climits>
#include <fstream>

using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second
using namespace std;

string shift_str(string str)
{
    int ascii;
    string ret;
     
    for (int i=0; i<str.length(); i++)
    {
        ascii = str[i];   
        if (!('a' <= ascii && ascii <= 'z'))
        {
            ret += ascii;
        } else {
        	ret += ((ascii - 'a') + 'A');
        }
         
    }
     
    return ret;
}
 
int main()
{
    string str;
    string ret;
     
    getline(cin,str);
    ret += shift_str(str);
    cout<<ret<<endl;
    return 0;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;
 
int main(){

    long long N,A[200020]={},x=0,y=0,ans,diff;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>A[i];
        y+=A[i];
    }
    ans=abs(x-y);

    for(int i=0;i<N;i++){
        x+=A[i];
        y-=A[i];
        if(ans>abs(x-y))ans=abs(x-y);
    }

    cout <<ans<<endl;
    
    return 0;

}


Measured memory_bytes: 1792
def gcd(a,b):
    while a%b :
        a,b=b,a%b
    return b
def lcm(a,b):
    return a*b/gcd(a,b)

while True :
    try:
        a,b = map(int,raw_input().split())
        a,b = max(a,b), min(a,b)
        print "%d" % gcd(a,b),
        print "%d" % lcm(a,b)
    except EOFError:
        break

Measured memory_bytes: 6148
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define inf 1e9
#define INF 1000000000000000000

int main() {
    ll L, R;
    cin >> L >> R;
    ll MOD = 2019;
    if (R / MOD - (L - 1) / MOD >= 1) {
        cout << 0 << endl;
        return 0;
    }

    ll ans = INF;
    for (ll i = L; i <= R; i++) {
        for (ll j = i + 1; j <= R; j++) {
            ans = min(ans, (i % MOD * j % MOD) % MOD);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(){

  string t,p;
  cin>>t>>p;
  int st=t.size(),sp=p.size(),cnt=0;
  vector <int> wh;
  for(int i=0;i<st;i++){
    if(t[i]==p[cnt]){
      cnt++;
      wh.push_back(i);
    }
  }
  if(cnt!=sp){
    cout<<"no"<<endl;
    return 0;
  }
  cnt--;
  reverse(wh.begin(),wh.end());
  int tmp=0;
  for(int i=st-1;i!=-1;i--){
    if(wh.size()==tmp) break;
    if(p[cnt]==t[i]){
      if(wh[tmp]==i){
	//cout<<"where:"<<i<<endl;
	tmp++;
	cnt--;
	continue;
      }
      cout<<"no"<<endl;
      return 0;
    }
  }

  cout<<"yes"<<endl;
  
  return 0;

}

Measured memory_bytes: 6140
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }
 
const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
 
inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}
 
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int G[10][10];

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  int n,m; cin>>n>>m;
  rep(i,m){
    int a,b; cin>>a>>b; a--,b--;
    G[a][b]=G[b][a]=1;
  }
  vi g(n);
  iota(all(g),0);
  int ans=0;
  do{
    bool ok=true;
    if(g[0]) break; // 0始まりでないグラフは考えない
    irep(i,1,n) if(G[g[i-1]][g[i]]==0) ok=false;
    if(ok) ans++;
  }while(next_permutation(all(g)));
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <math.h>
#include <cstdio>
using namespace std;
int main()
{
    char s[100];
    scanf("%s",s);
    int tmp = 0;
    int i = 0;
    int max1 = 0;
    while(s[i] != '\0') {
        if(s[i] == 'R') {
            tmp++;
            max1 = max(max1, tmp);
        }
        if(s[i] == 'S')
            tmp = 0;
        i++;
    }
    printf("%d\n",max1);
    //system("pause");
    return 0;
}

Measured memory_bytes: 3760
// mod custom_lib;

use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let a = read::<u32>();
  let p = read::<u32>();

  let answer = (a * 3 + p) / 2;

  println!("{}", answer);
}

Measured memory_bytes: 4352
#include<iostream>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, x, n) for (int i = x; i < (n); ++i)
using namespace std;

int main() {
    int r, g, b;
    cin >> r >> g >> b;

    if ((100 * r + 10 * g + b) % 4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}


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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

signed main() {
#ifdef _DEBUG
  freopen("in" , "r", stdin );
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  vector<int> a;
  for (char c; cin >> c; a.push_back(c - '0'));
  for (int i = 0; i <= 1; i++)
  for (int j = 0; j <= 1; j++)
  for (int k = 0; k <= 1; k++) {
    int sum = a[0];
    string res; res += char(a[0] + '0');
    if (i) {
      sum += a[1];
      res += '+';
      res += char(a[1] + '0');
    } else {
      sum -= a[1];
      res += '-';
      res += char(a[1] + '0');
    }
    if (j) {
      sum += a[2];
      res += '+';
      res += char(a[2] + '0');
    } else {
      sum -= a[2];
      res += '-';
      res += char(a[2] + '0');
    }
    if (k) {
      sum += a[3];
      res += '+';
      res += char(a[3] + '0');
    } else {
      sum -= a[3];
      res += '-';
      res += char(a[3] + '0');
    }
    if (sum == 7) {
      cout << res << "=7" << '\n';
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3552
from collections import defaultdict

s = input()
x, y = map(int, input().split())
a = 0
t = [[0], []]
n = 0
for i in range(len(s)):
    if s[i] == 'F':
        t[n][-1] += 1
    else:
        n = 1 - n
        t[n].append(0)
flag = [False, False]
z = [x, y]
for k in range(2):
    tt = t[k]
    zk = z[k]
    if len(tt) == 0:
        if zk == 0:
            flag = True
            continue
        else:
            print(1, k)
            flag = False
            break
    p = sum(tt)
    dp = defaultdict(bool)
    i = 1
    if k == 0:
        dp[tt[0]] = True
    else:
        dp[tt[0]] = True
        dp[-tt[0]] = True
    if len(tt) > 1:
        for tj in tt[1:]:
            dp2 = defaultdict(bool)
            for xj in dp.keys():
                dp2[xj + tj] = True
                dp2[xj - tj] = True
            dp = dp2
    flag = dp[zk]
    if not flag:
        break
if flag:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 4284
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    string s;
    cin>>s;
    string ans="AC";
    int a = s.size();
    int cnt=0;
    if(s[0]!='A') ans = "WA";
    for(int i=1;i<a;i++){
        if(isupper(s[i])){
            if(i==1||i==a-1||s[i] !='C'){
            ans = "WA";
            }
            cnt++;
        }
    }
    if(cnt!=1)ans="WA";
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <math.h>

#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  string s;
  cin >> s;

  int dom = 0;
  int foe = 0;

  rep(i, s.size()) {
    if (s[i] == 'a') {
      if (dom + foe < a + b) {
        cout << "Yes" << endl;
        dom++;
      } else {
        cout << "No" << endl;
      }
    } else if (s[i] == 'b') {
      if (dom + foe < a + b && foe + 1 <= b) {
        cout << "Yes" << endl;
        foe++;
      } else {
        cout << "No" << endl;
      }
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 896
#include <stdio.h>

void swap(int *x, int *y){int t = *x; *x = *y; *y = t;}

int main(){
  int n, a[101], i, j, c = 0;
  scanf("%d", &n);
  for(i = 0; i < n; ++i) scanf("%d", a + i);

  for(i = 0; i < n; ++i)
    for(j = n - 1; j > i; --j)
      if(a[j] < a[j - 1]){
        swap(&a[j], &a[j - 1]);
        c++;
      }

  for(i = 0; i < n; ++i) printf(i != 0 ? " %d": "%d", a[i]);
  printf("\n%d\n", c);
  return 0;
}

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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int, int> PI;
typedef pair<int, pair<int, int>> PII;
static const int INF = 1010000000000000017LL;
static const double eps = 1e-12;
static const double pi = 3.14159265358979323846;
static const int dx[4] = {1, -1, 0, 0};
static const int dy[4] = {0, 0, 1, -1};
static const int ddx[8] = {1, -1, 0, 0, 1, 1, -1, -1};
static const int ddy[8] = {0, 0, 1, -1, 1, -1, 1, -1};

template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}

int N;
int ans;

signed main(){
    cin>>N;
    for(int A=1;A<=N;++A){
        //cout<<A<<endl;
        ans+=(N-1)/A;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int n, m;
string a[60], b[60];
 
int match(int x, int y) {
    // 与えられた開始地点から、画素を比較するループ
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < m; j++) {
            if (a[x+i][y+j] != b[i][j]) {
                return false;
            }
        }
    }
    return true;
}
 
int main() {
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < m; i++) cin >> b[i];
 
    // 開始地点を探るループ
    for (int i = 0; i <= n-m; i++) {
        for (int j = 0; j <= n-m; j++) {
            if (match(i, j) == true) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
 
    cout << "No" << endl;
 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin >> N;
  map <int, int> cnt;
  
  for (int i = 1; i <= N; i++){
        int num = i;
        for (int j = 2; j <= i; j++){
            while (num % j == 0){
                cnt[j]++;
                num = num / j;
            }
        }
    }
  
  vector <int> A(100);
    for (int i = 0; i < 100; i++){
        if (cnt[i] >= 2){
            A[3]++;
        }
        if (cnt[i] >= 4){
            A[5]++;
        }
        if (cnt[i] >= 14){
            A[15]++;
        }
        if (cnt[i] >= 24){
            A[25]++;
        }
        if (cnt[i] >= 74){
            A[75]++;
        }
    }
 
    int ans = 0;
    ans += A[75];
    ans += A[25] * (A[3] - 1);
    ans += A[15] * (A[5] - 1);
    ans += A[5] * (A[5] - 1) / 2 * (A[3] - 2);
 
    cout << ans << endl;
    
    return 0;    
}

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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  
  int dist = B-A-1;
  
  if(dist % 2==0) cout << "Borys" << endl;
  else cout << "Alice" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 10
using namespace std;
typedef long long LL;
LL ans=0;
int len;
char str[MAXN+5];
void DFS(int pos,LL tot,LL totn)
{
	if(pos>len)
		return;
	if(pos==len)
	{
		ans+=1LL*tot+1LL*totn;
		return;
	}
	if(pos!=len-1)
		DFS(pos+1,tot+1LL*totn*10LL+1LL*str[pos]-'0',0);
	DFS(pos+1,tot,totn*10LL+1LL*str[pos]-'0');
}
int main()
{
	scanf("%s",str);
	len=strlen(str);
	DFS(0,0,0);
	printf("%lld\n",ans);
	return 0;
}

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

typedef long long ll; // -9,223,372,036,854,775,808 から 9,223,372,036,854,775,807

template <class T> using vec = std::vector<T>;
template <class T> using vec2 = vec<vec<T>>;
template <class T> using vec3 = vec<vec<vec<T>>>;

#define DEBUG

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long M, std::vector<long long> A){
    auto total = accumulate(A.begin(), A.end(), 0);
    ll res = 0;
    for(auto iter: A){
        if(iter*4*M >= total){
            res++;
        }
    }

    if(res >= M){
        cout << YES << endl;
    }else{
        cout << NO << endl;
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, M, std::move(A));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define fail return puts("Impossible"), 0;

int rd() {
	char c; do{ c = getchar(); }while (!isdigit(c));
	int x = 0; do{ x = x*10+c-'0', c = getchar(); }while (isdigit(c)); return x;
}

const int N = 105;

int n, M, c[N];

int main() {
	//freopen("e.in", "r", stdin);
	//freopen("e.out", "w", stdout);
	
	n = rd();
	F(i, 1, n) {
		int x = rd();
		M = max(M, x);
		c[x]++;
	}
	
	int t;
	if (~M & 1) {
		t = M >> 1;
		if (c[t] != 1) fail;
	}
	else {
		t = (M+1) >> 1;
		if (c[t] != 2) fail;
	}
	F(i, t+1, M)
		if (c[i] < 2) fail;
	F(i, 0, t-1)
		if (c[i] > 0) fail;
	puts("Possible");
	
	return 0;
}

Measured memory_bytes: 256
//Codes by: Umar Bin Qamar

#include <bits/stdc++.h>
using namespace std;
#define int long long

bool compare(int a,int b){
    return a>b;
}

int32_t main(){


char s[3];
cin>>s;
if(s[0]=='7' || s[1]=='7' ||s[2]=='7'){
    cout<<"Yes"<<endl;
}
    else{
        cout<<"No"<<endl;
    }


    return 0;
}




Measured memory_bytes: 3620