akhauriyash/Code-Regression huggingface dataset:
// ABC162C.cpp
//#include "pch.h"
#include <iostream>
using namespace std;
int GCD(int i, int j) {
	if (i > 0) {
		j = j % i;
		return GCD(j, i);
	}
	else {
		return j;
	}
}
int main()
{
	int k;
	cin >> k;
	int ans = 0;
	for (int a = 1; a <= k; a++)
	{
		for (int b = 1; b <= k; b++)
		{
			for (int c = 1; c <= k; c++)
			{
				ans += GCD(a, GCD(b, c));
			}
		}
	}
	cout << ans << endl;

}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};



int main(){
    int n;cin >> n;
    vector<LL> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<vector<LL>> p(n+1,vector<LL> (62,0));
    vector<vector<LL>> cp(n+1,vector<LL> (62,0));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 61; j++) {
            if((a[i]>>j)&1) p[i][j]++;
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 61; j++) {
            cp[i+1][j] = cp[i][j] + p[i][j]%mod;
        }
    }
    LL ans = 0;
    for (LL i = n-1; i > 0; i--) {
        for (int j = 0; j < 61; j++) {
            if(p[i][j]) ans = (ans + (i-cp[i][j]) %mod * ((1LL<<j)%mod)%mod)%mod;
            else ans = (ans + cp[i][j] * ((1LL<<j)%mod)%mod)%mod;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 316672
program sample
    implicit none
    character(100)::s
    integer(8) :: i,j,m,n,k
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) s
    read(*,*)k
    do i=1,k-1
        if(s(i:i) .ne. '1')then
            write(*,*)s(i:i)
            stop
        end if
    end do
    write(*,*)s(k:k)
  
    stop
end program sample
  



Measured memory_bytes: 2800
#include <iostream>
#include <set>
#include <algorithm>

#include <vector>
using namespace std;


int N;
long long int A[100005];

long long int L[100005], R[100005];

long long int gcd(long long int a, long long int b) {

	if (a < b) { return gcd(b, a); }

	if (b == 0) { return a; }

	return (gcd(b, a%b));
}



int main(void) {
	cin >> N;

	for (int i = 1; i <= N; i++) {
		cin >> A[i];
	}

	L[0] = 0;
	L[1] = A[1];

	for (int i = 2; i <= N; i++) {
		L[i] = gcd(L[i - 1], A[i]);
	}

	R[N + 1] = 0;
	R[N] = A[N];

	for (int i = N - 1; i >= 1; i--) {
		R[i] = gcd(R[i + 1], A[i]);
	}

	
	long long int ans = 1;

	for (int i = 1; i <= N; i++) {
		ans = max(ans, gcd(L[i - 1], R[i + 1]));
	}

	cout << ans << endl;

    // system("pause");
	return 0;
}

Measured memory_bytes: 2560
X, Y = map(int, input().split())
while (X !=0 and Y != 0):
    Slist = []
    for i in range(X):
        S = list(map(str, input()))
        Slist.append(S)
    store = [(0,0)]
    x = 0
    y = 0
    while True:
        if (Slist[x][y] == '>'):
            y += 1
        elif (Slist[x][y] == '<'):
            y -= 1
        elif (Slist[x][y] == 'v'):
            x += 1
        elif (Slist[x][y] == '^'):
            x -= 1
            
        if (Slist[x][y] == '.'):
            loop = 0
            break     
        if ((x,y) in store):
            loop = 1
            break
        store.append((x,y))

    if (loop == 1):
        print('LOOP')
    elif (loop == 0) :  
        print(y,x)   
        
    X, Y = map(int, input().split())


Measured memory_bytes: 5692
#include <bits/stdc++.h>
using namespace std;
int main(){
    string a, b, c;
    cin >> a >> b >> c;
    if(a[a.size()-1]==b[0] && b[b.size()-1]==c[0]){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

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

typedef long long ll;

int N, M;

ll solve(void) {
	if (N > M)
		swap(N, M);
	ll cnt;
	if (N == 2)
		cnt = 0;
	else {
		if (M == 1)
			cnt = 1;
		else
			cnt = M - 2;
	}
	return cnt;
}

int main(void) {
	cin >> N >> M;
	
	ll ans;
	if (N >= 3 && M >= 3)
		ans = (ll)N * M - 2 * M - 2 * (N - 2);
	else
		ans = solve();

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define per(i,r,l) for(int i=r;i>=l;i--)
#define IMAX 0x3f3f3f3f
#define LLMAX 0x3f3f3f3f3f3f3f3f
using namespace std;
typedef long long ll;
typedef double db;
inline int read() {
  int x=0,f=1;
  char c=getchar();
  while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
  while(isdigit(c)){x=x*10+c-'0';c=getchar();}
  return x*f;
}

int gcd(int x, int y){
  if(x>y)swap(x,y);
  if (x == 0) return y;
  return gcd(y % x, x);
}
ll ans;
signed main() {
  int k = read();
  rep(a,1,k){
    rep(b,1,k){
      rep(c,1,k){
        ans+=__gcd(a,__gcd(b,c));
      }
    }
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 3764
#include <stdio.h>
int main(){
for (;;)
{
int a ,b ;
char op ;
scanf("%d %c %d",&a,&op,&b);
if(op=='?')break;
if (op=='+'){printf("%d\n",a+b);}
if (op=='-'){printf("%d\n",a-b);}
if (op=='*'){printf("%d\n",a*b);}
if (op=='/'){printf("%d\n",a/b);}
}
return 0 ;
}

Measured memory_bytes: 600
a, b, c, d = map(int, input().split())

ans = -1000000000000000001
tmp = 0
tmp = a*c
if ans < tmp:
    ans = tmp
tmp = a*d
if ans < tmp:
    ans = tmp
tmp = b*d
if ans < tmp:
    ans = tmp

tmp = b*c
if ans < tmp:
    ans = tmp
print(ans)


Measured memory_bytes: 61640
a,b,n = gets.split.map(&:to_i)

max = 0

if b-1 <= n
  x = b-1
  max = (a * x / b.to_f).floor - a * (x / b.to_f).floor
else
  x = n
  max = (a * x / b.to_f).floor - a * (x / b.to_f).floor
end

puts max


Measured memory_bytes: 14300
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

const R: u64 = 1000000007;

fn main() {
    let nk: Vec<usize> = read_vec();
    let n = nk[0];
    let k = nk[1];
    let mut c: Vec<Vec<u64>> = vec![vec![1; 2001]; 2001];

    for i in 1..2001 {
        for j in 1..2001 {
            c[i][j] = (c[i][j - 1] + c[i - 1][j]) % R;
        }
    }

    for i in 1..(k + 1) {
        if i + k > n + 1 {
            println!("0");
        } else {
            println!("{}", (c[n + 1 - k - i][i] * c[k - i][i - 1]) % R);
        }
    }
}


Measured memory_bytes: 45308
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();
	
    if(a+1 < b){
      int can = Math.max(0,(k-(a-1))/2);
      System.out.print((long)(b-a)*can + a + (k-a+1)%2);
    }else{
      System.out.print(k+1);
    }
  }
}


Measured memory_bytes: 23124
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())

if n == 1:
    print(0)
    sys.exit(0)

import math

prime_factorization = []

copy_n = n
for i in range(2, math.ceil(math.sqrt(n)) + 1):
    if copy_n % i != 0:
        continue
    else:
        ex = 0
        while copy_n % i == 0:
            ex += 1
            copy_n = copy_n // i
        prime_factorization.append((i, ex))
if copy_n != 1:
    prime_factorization.append((copy_n, 1))

ans = 0
memo = dict()
for p in prime_factorization:
    if p[1] in memo:
        ans += memo[p[1]]
        continue
    count = 0
    total = 1
    while total <= p[1]:
        count += 1
        memo[total] = count
        total = total + (count + 1)
    memo[p[1]] = count
    ans += count
print(ans)


Measured memory_bytes: 63444
#include <iostream>
using namespace std;
typedef long long ll;
ll a,b,c,d,e;
int main(void){
    cin>>a>>b>>c>>d>>e;
    if(b<=d){cout<<"NO"<<endl;return 0;}
    if(abs(a-c)<=(b-d)*e)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 3632
#include<iostream>
const int oo = 1e9;
using namespace std;
void fast(){
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
}


int main(){
	fast();
	int n , res = 1 , mx = 0; cin >> n;
	for (int i = 1; i <= n; i++){
		int t = i; int cnt= 0;
		while (t % 2 == 0){
			cnt++; t /= 2;
		}
		if (cnt > mx){
			res = i;
			mx = cnt;
		}
	}
	cout << res << endl;
	return 0;
}
//mosta7il_

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}


/*{
  }*/

using vi = vector<int>;
using vvi = vector<vi>;
using P = pair<int,int>;

//constexpr int mod = 1e9+7;
constexpr int inf = 1<<30;

signed main(){
  int h, w, n;
  cin >> h >> w >> n;

  vi a(n), b(n);
  map<P, int> cnt;
  rep(i, 0, n){
    cin >> a[i] >> b[i];
    rep(y, max(1LL, a[i]-2), min(h-2, a[i])+1){
      rep(x, max(1LL, b[i]-2), min(w-2, b[i])+1){
        cnt[P(y, x)]++;
      }
    }
  }

  vi ans(10);
  for(auto i : cnt){
    ans[i.second]++;
  }

  int sum = 0;
  rep(i, 1, 10) sum += ans[i];
  ans[0] = (h-2)*(w-2) - sum;

  rep(i, 0, 10) cout << ans[i] << endl;

  return 0;
}



Measured memory_bytes: 58112
(let* ((n (read))
       (m (read))
       (lst (loop :repeat n :collect (loop :repeat (read) :collect (read)))))
  (defun f (lst_A lst_B)
    (loop :for a :in lst_A :collect (find a lst_B)))
  (princ (length (remove nil (reduce #'f lst) :test #'equal))))

Measured memory_bytes: 7012
import java.util.Random;
import java.util.Scanner;

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

        int n;
        while (true) {
            n = scanner.nextInt();
            if (n == 0) break;

            int sum = 0, sum2 = 0;
            for (int i = 0; i < n; ++i) {
                int a = scanner.nextInt();
                sum += a;
                sum2 += a * a;
            }

            System.out.println(Math.sqrt(sum2 / (double)n - Math.pow((sum / (double)n), 2)));
        }
    }
}



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


int main(){
  int n;
  string s;
  cin >> n >> s;
  int a = 0;
  for (int i=0; i<n-2; i++){
    if (s.substr(i,3) == "ABC") a++;
  }
  cout << a << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

ll MOD = 1e9+7;

class mint{
    ll n;
public:
    mint(ll m = 0){
        n = ((m % MOD) + MOD) % MOD;
    }
    mint operator-() const {
        return mint(-n);
    }
    mint& operator+=(const mint& m){
        n += m.n;
        if(n >= MOD) n -= MOD;
        return *this;
    }
    mint& operator-=(const mint& m){
        n += MOD - m.n;
        if(n >= MOD) n -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& m){
        n *= m.n;
        n %= MOD;
        return *this;
    }
    mint operator+(const mint& m) const{
        mint res(*this);
        res += m;
        return res;
    }
    mint operator-(const mint& m) const{
        mint res(*this);
        res -= m;
        return res;
    }
    mint operator*(const mint& m) const{
        mint res(*this);
        res *= m;
        return res;
    }
    mint pow(ll t) const{
        if(t == 0) return mint(1);
        mint m = pow(t>>1);
        m *= m;
        if(t & 1 == 1) m *= *this;
        return m;
    }
    // for prime modulo
    mint inv() const{
        return pow(MOD-2);
    }
    mint& operator/=(const mint& m){
        (*this) *= m.inv();
        n %= MOD;
        return *this;
    }
    mint operator/(const mint& m) const{
        mint res(*this);
        res /= m;
        return res;
    }
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.n;
        return os;
    }
};

ll N,M;
ll S[2000];
ll T[2000];
mint dp[2001][2001][2];

int main(){
    cin >> N >> M;
    for(int i=0;i<N;i++) cin >> S[i];
    for(int j=0;j<M;j++) cin >> T[j];
    for(int n=1;n<=N;n++){
        for(int m=1;m<=M;m++){
            if(S[n-1] == T[m-1]) dp[n][m][0] = dp[n-1][m-1][1] + 1;
            dp[n][m][1] = dp[n][m][0] + dp[n][m-1][1] + dp[n-1][m][1] - dp[n-1][m-1][1];
        }
    }
    cout << dp[N][M][1] + mint(1) << endl;
    return 0;
}

Measured memory_bytes: 66188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long int;

int main(){
    int n; cin >> n;
    vector<ll> a(n);
    for(auto& v:a){
        cin >> v;
    }
    sort(a.begin(), a.end());
    ll total = 0;
    int ans = 0;
    for(int i=0; i<n-1; i++){
        total += a[i];
        if(total * 2 >= a[i+1]){
            ans++;
        }
        else{
            ans = 0;
        }
    }
    cout << ans + 1 << endl;
    return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <algorithm>
#include <stdio.h>
#include <functional>
using namespace std;

//??°?????????????????°

void function()
{
	//??¢??°
}

int main()
{
	int m, f, r;
	while (cin >> m >> f >> r)
	{
		if (m == -1 && f == -1 && r == -1)
		{
			return 0;
		}

		if (m == -1 || f == -1)
		{
			cout << "F" << endl;
		}
		else if (m + f >= 80)
		{
			cout << "A" << endl;
		}
		else if (m + f >= 65)
		{
			cout << "B" << endl;
		}
		else if (m + f >= 50)
		{
			cout << "C" << endl;
		}
		else if (m + f >= 30)
		{
			if (r >= 50)
			{
				cout << "C" << endl;
			}
			else
			{
				cout << "D" << endl;
			}
		}
		else
		{
			cout << "F" << endl;
		}
	}
	return 0;
}

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

using namespace std;

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M), B(M), C(M);
  for (int i = 0; i < M; i++) {
    cin >> A[i] >> B[i] >> C[i];
    A[i]--;
    B[i]--;
    C[i] *= -1;
  }
  vector<bool> can_goal(N);
  can_goal[N - 1] = true;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if (can_goal[B[j]]) can_goal[A[j]] = true;
    }
  }
  const long long inf = 1e18;
  vector<long long> D(N, inf);
  D[0] = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if (D[A[j]] == inf) continue;
      bool changed = chmin(D[B[j]], D[A[j]] + C[j]);
      if (i == N - 1 and changed and can_goal[B[j]]) {
        cout << "inf" << endl;
        return 0;
      }
    }
  }
  cout << -D[N - 1] << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		List<Integer> a = new ArrayList<>();
		for(int i=0; i<n; i++){
			a.add(sc.nextInt());
		}
		Collections.sort(a, (i1, i2) -> i2.compareTo(i1));
		int alice = 0, bob = 0;
		for(int i=0; i<n; i++){
			if(i % 2 == 0){
				alice += a.get(i);
			}else{
				bob += a.get(i);
			}
		}
		System.out.println(alice - bob);
	}
}


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

using namespace std;
using ll = long long;

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	map<string, int> cnt;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		cnt[s]++;
	}
	vector<string> ord = {"AC", "WA", "TLE", "RE"};
	for (auto el : ord) {
		cout << el << " x " << cnt[el] << '\n';
	}
}

Measured memory_bytes: 3664
N,A,B=map(int,input().split())
ans=0
for i in range(1,N+1):
    digisum=0
    tmpI=i
    while(True):
        digisum+=tmpI%10
        if tmpI<10:
            if(A<=digisum and digisum<=B):
                ans+=i
            break
        tmpI=int(tmpI/10)
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <cmath>
using namespace std;
#define MOD 1000000009
long long w,h,n;
struct Matrix{
    long long n,m[80][80];
    Matrix  operator * (const Matrix &b)const{
        Matrix c;
        memset(c.m,0,sizeof c.m);
        c.n=n;
        for (int i=0;i<n;i++)
        for (int j=0;j<n;j++)
        for (int k=0;k<n;k++){
            c.m[i][j]=(c.m[i][j]+(m[i][k]*b.m[k][j])%MOD)%MOD;
        }
        return c;
    }
};
Matrix ones;
Matrix Pow(const Matrix &a,unsigned long long n){
    Matrix t=ones,y=a;
    while (n){
        if (n & 1) t = (t * y) ;
        y = (y * y) ;
        n /= 2;
    }
    return t;
}
Matrix A;
long long x[80];
long long k,p,q;
struct node{
    long long a,b;
};
node Pos[80];
int cmp(node a,node b){
    return a.b<b.b;
}
void get_x(Matrix a){
    long long y[80];
    memset(y,0,sizeof y);
    for (int i=0;i<a.n;i++){
        for (int j=0;j<a.n;j++){
            y[i]=(y[i]+(x[j]*a.m[i][j])%MOD)%MOD;
        }
    }
    for (int i=0;i<a.n;i++)
        x[i]=y[i];
}
int main(){
    int i,j;
    int d=0;
    while (scanf("%lld%lld%lld",&w,&h,&n)!=EOF){
        memset(ones.m,0,sizeof ones.m);
        for (i=0;i<w;i++)
            ones.m[i][i]=1;
        ones.n=w;
        for (i=0;i<n;i++)
            scanf("%lld%lld",&Pos[i].a,&Pos[i].b);
        sort(Pos,Pos+n,cmp);
        if ((w==0)&&(h==0)&&(n==0)) return 0;
        memset(x,0,sizeof x);
        x[0]=1;
        memset(A.m,0,sizeof A.m);
        A.n=w;
        A.m[0][0]=1;
        A.m[0][1]=1;
        for (i=1;i<w;i++){
            A.m[i][i]=1;
            A.m[i][i-1]=1;
            A.m[i][i+1]=1;
        }
        k=0;
        j=0;
        while (j<n){
            p=Pos[j].b-1;
            if (p==k){
                x[Pos[j].a-1]=0;
            }
            else{
                get_x(Pow(A,p-k));
                k=p;
                x[Pos[j].a-1]=0;
            }
            j++;
        }
        if (k<h-1){
            get_x(Pow(A,h-1-k));
        }
        printf("Case %d: %lld\n",++d,x[w-1]);
    }
}

Measured memory_bytes: 1576
#include <bits/stdc++.h>
#define For(i, l, r) for(register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for(register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Set(a, v) memset(a, v, sizeof(a))
using namespace std;

inline bool chkmin(int &a, int b) {return b < a ? a = b, 1 : 0;}
inline bool chkmax(int &a, int b) {return b > a ? a = b, 1 : 0;}

inline int read() {
    int x = 0, fh = 1; char ch = getchar();
    for (; !isdigit(ch); ch = getchar() ) if (ch == '-') fh = -1;
    for (; isdigit(ch); ch = getchar() ) x = (x << 1) + (x << 3) + (ch ^ 48);
    return x * fh;
}

long long a, b, c, k, na, nb, nc;

int main () {
#ifdef zjp_shadow
	freopen ("A.in", "r", stdin);
	freopen ("A.out", "w", stdout);
#endif
	cin >> a >> b >> c >> k;
	printf ("%lld\n", (k & 1 ? -1 : 1) * (a - b) );
    return 0;
}


Measured memory_bytes: 256
/*input
async layered coding
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int main()
{
	IOS;
	string s;
	cin>>s;
	REP(i,SZ(s)-1){
		if(s[i]=='A'&&s[i+1]=='C'){
			cout<<"Yes\n";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}


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

int main() {
  int n, c = 0;
  cin >> n;
  int p[n];
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    if (p[i] != i + 1) {
      c++;
    }
  }
  if (c == 0 || c == 2) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

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

int main(){
  string s;
  int n,i;
  cin >> n >> s;
  int *dpE, *dpW;
  dpE = new int[n]; // dpE[i] = 0,1,2,...,i-1に含まれるEの数
  dpW = new int[n]; // dpW[i] = n-1,n-2,...,i+1に含まれるWの数
  dpW[0] = 0;
  dpE[n-1] = 0;
  for(i = 0;i < n - 1;i++){
    if(s.at(i) == 'W'){
      dpW[i + 1] = dpW[i] + 1;
    }
    else{
      dpW[i + 1] = dpW[i];
    }
  }
  for(i = n - 1; i > 0;i--){
    if(s.at(i) == 'E'){
      dpE[i - 1] = dpE[i] + 1;
    }
    else{
      dpE[i - 1] = dpE[i];
    }
  }
  unsigned int acc = -1;
  for(i = 0;i < n;i++){
    if(dpW[i] + dpE[i] < acc) acc = dpW[i] + dpE[i];
  }
  cout << acc << endl;
  delete dpW;
  delete dpE;
  return 0;
}

Measured memory_bytes: 3076
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
using namespace std;
typedef long long int ll;


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll res=0;
    for(ll i=1;i<=n;i++){
        ll p=n/i*i;
        res+=(i+p)*(n/i)/2;
    }
    cout << res << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
//cout << fixed << setprecision(10);

int main(){
  ll n;
  string s;
  cin>>n>>s;
  if(n%2==1){
    cout<<"No"<<endl;
    return 0;
  }
  rep(i,n/2){
    if(s[i]!=s[i+n/2]){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<< "Yes" <<endl;
}

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

using ll = long long;

template<typename T>
T gcd(T a, T b)
{
	if (a < b)	return gcd(b, a);
	T r;
	while ((r = a % b))
	{
		a = b;
		b = r;
	}
	return b;
}

template<typename T>
T lcm(T a, T b)
{
	return a * b / gcd(a, b);
}

template<typename T>
T ext_gcd(T a, T b, T& x, T& y)
{
	x = 1;
	y = 0;
	T x0 = 0, y0 = 1;
	while (b != 0)
	{
		T q = a / b;
		a -= q * b;
		swap(a, b);
		x -= q * x0;
		swap(x, x0);
		y -= q * y0;
		swap(y, y0);
	}
	return a;
}

template<typename T>
T inv_mod(T a, T mod)
{
	T t1, t2;
	ext_gcd(a, mod, t1, t2);
	t1 %= mod;
	if (t1 < 0)		t1 += mod;
	return t1;
}

template<typename T>
T combination_large(T n, T k, T mod)
{
	if (n < k || n < 0 || k < 0)	return 0;
	vector<T> inv(n + 1, 1), fact(n + 1, 1), fact_inv(n + 1, 1);
	for (T i = 2; i <= n; ++i)
	{
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		fact[i] = (fact[i - 1] * i) % mod;
		fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
	}
	return fact[n] * (fact_inv[k] * fact_inv[n - k] % mod) % mod;
}

template<typename T>
T combination(T n, T k, T mod = 1)
{
	vector<vector<T>> table(n + 1, vector<T>(k + 1, 1));
	for (T i = 1; i <= n; ++i)
	{
		table[i][0] = 1;
		for (T j = 1; j <= n; ++j)
		{
			table[i][j] = (table[i - 1][j - 1] + table[i - 1][j]) % mod;
		}
	}
}

int main(int, char**)
{
	string S;
	cin >> S;
	ll total = 0;
	for (size_t i = 1; i < (static_cast<size_t>(1) << S.size()); ++i)
	{
		if ((i & 1) == 1)	continue;
		ll sum = 0;
		size_t begin = 0;
		for (size_t j = 1; j < S.size(); ++j)
		{
			if ((i & (static_cast<size_t>(1) << j)) != 0)
			{
				sum += stoll(S.substr(begin, j - begin));
				begin = j;
			}
		}
		sum += stoll(S.substr(begin, S.size() - begin));
		total += sum;
	}
	total += stoll(S);
	cout << total << endl;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include <random>
#include <deque>
#include <bitset>
#include <string>
#include <queue>
#include <complex>

//#define int long long

#define mp(a, b) make_pair(a, b)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

#define endl '\n'

using namespace std;
typedef long long ll;
typedef long double ld;

mt19937 mrand(random_device{}());

double PI = acos((double)-1);
const ld eps = 1e-7;
const ll inf0 = 1023 * 1024 * 1024;
const ll inf = inf0 * inf0;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;

void solve();
void scan();

signed main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	cout << fixed; cout.precision(15);
	solve();
	return 0;
}

void solve() {
	int h, w; cin >> h >> w;
	if (w < h) swap(h, w);
	if (h == 1) cout << 1 << endl;
	else {
		cout << (h * 1ll * w + 1) / 2 << endl;
	}
	return;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
	
	int a,b,c;
	
	while(1){
		
		c=0;
		b=1000;
		cin >> a;
		if(a==0) break;
		
		b= b-a;
		
		while(b>=500){
			b -= 500;
			c++;
		}
		while(b>=100){
			b -= 100;
			c++;
		}
		while(b>=50){
			b -= 50;
			c++;
		}
		while(b>=10){
			b -= 10;
			c++;
		}
		while(b>=5){
			b -= 5;
			c++;
		}
		while(b>=1){
			b -= 1;
			c++;
		}
		
		cout << c <<endl;
	}
	
	

	
	return 0;
	
}
	

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

int main() {
    string s; cin >> s;
    ll k; cin >> k;
    int pos = 0;
    while (s[pos] == '1') pos++;
    if (pos >= k) cout << 1 << endl;
    else cout << s[pos] << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  long n,m;
  scanf("%ld %ld", &n, &m);

  long a[n];
	for (long i = 0; i < n; i++) {
		scanf("%ld", &a[i]);
	}

	long all = 0;
	for (long i = 0; i < n; i++) {
		all += a[i];
	}

	double score;
	score = all/(4*m*1.0);

	long avobe = 0;
	for (long i = 0; i < n; i++) {
		if (a[i] >= score) {
			avobe++;
		}
	}

	if (avobe >= m) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}

  return 0;
}

Measured memory_bytes: 128
from collections import deque
import sys
input = sys.stdin.readline

N = int(input())
A = []
for _ in range(N):
    # 選手番号を0-indexにする
    line = list(map(lambda x: int(x) - 1, input().split()))
    A.append(line)

# cnt[i] = 選手iが現在までに何試合したか
cnt = [0] * N
# recent[i] = 選手iが最後に試合をした日
recent = [0] * N

# Qの初期値 = [0, 1, ..., N-1]
Q = deque(range(N))

while Q:
    # ある選手(p1)について
    p1 = Q.popleft()
    # p1がまだ全試合(N-1試合)を終えていない場合
    # p2 = p1が次に当たるべき選手
    if cnt[p1] < N - 1:
        p2 = A[p1][cnt[p1]]
        # p2もまだ全試合を終えていない場合
        if cnt[p2] < N - 1:
            # p2が次に当たるべき選手がp1の場合 -> (p1,p2)の試合を行うことが可能
            if A[p2][cnt[p2]] == p1:
                # day = (p1,p2)の試合を行う日
                day = max(recent[p1], recent[p2]) + 1
                recent[p1] = day
                recent[p2] = day
                cnt[p1] += 1
                cnt[p2] += 1
                Q.append(p1)
                Q.append(p2)

if min(cnt) != N - 1:
    print(-1)
else:
    print(max(recent))


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ll long long
using namespace std;



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



Measured memory_bytes: 3620
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt(); // 冊数
		int M = sc.nextInt(); // アルゴリズム数
		int X = sc.nextInt();

		int C[][] = new int[N][M + 1];

		for (int i = 0; i < N; i++) {
			for (int j = 0; j < M + 1; j++) {
				C[i][j] = sc.nextInt();
			}
		}

		int tmp[] = new int[M + 1];
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < M + 1; j++) {
				tmp[j] += C[i][j];
			}
		}

		int total[] = new int[M + 1];
		List<Integer> lists = new ArrayList<Integer>();

		recursive_check(total, C, N - 1, M + 1, X, lists);

		Collections.sort(lists);

		if (lists == null || lists.size() == 0) {
			System.out.println("-1");
		}

		for (Integer a : lists) {
			System.out.println(a);
			return;
		}

		sc.close();

	}

	public static void recursive_check(int[] total, int[][] A, int n, int M, int X, List<Integer> list) {
		//		System.out.println(n);
		if (n == 0) {
			//System.out.print("X" + X);
			boolean flg = false;
			//System.out.println();
			for (int i = 0; i < M; i++) {
			//	System.out.print(total[i]+ " ");
				if ( i != 0 && X > total[i]) {
					flg = true;
				}
			}
		//	System.out.println();
			if (!flg)
				list.add(total[0]);

			flg = false;

			add(total, A[n]);
			for (int i = 0; i < M; i++) {
	//			System.out.print(total[i]+ " ");
				if ( i != 0 && X > total[i]) {
					flg = true;
				}
			}
//			System.out.println();
			if (!flg)
				list.add(total[0]);

			sub(total,A[n]);
			return;

		} else {
			recursive_check(total, A, n - 1, M, X, list);

			add(total, A[n]);
			recursive_check(total, A, n - 1, M, X, list);
			sub(total,A[n]);

		}
	}

	public static int[] add(int[] a, int[] b) {
		for (int i = 0; i < a.length; i++) {
			a[i] += b[i];
		}
		return a;
	}

	public static int[] sub(int[] a, int[] b) {
		for (int i = 0; i < a.length; i++) {
			a[i] -= b[i];
		}
		return a;
	}

}

Measured memory_bytes: 42536
def main():

    h,w = map(int,input().split())
    d = []
    for i in range(10):
        a = list(map(int,input().split()))
        d.append(a)
    def WF(d):
        for k in range(10):
            for i in range(10):
                for j in range(10):
                    d[i][j] = min(d[i][j],d[i][k] + d[k][j])
        return d
    WF(d)
    L = []
    for i in range(h):
        b = list(map(int,input().split()))
        L.append(b)
    ans = 0
    for i in range(h):
        for j in range(w):
            if L[i][j] == 1 or L[i][j] == -1:
                continue
            else:
                ans += d[L[i][j]][1]
    print(int(ans))

if __name__ == '__main__':
	main()

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

void solve(long long N, std::vector<long long> x, std::vector<long long> y) {
    vector<P> xy(N);
    rep(i, N) {
        xy[i].first = x[i];
        xy[i].second = y[i];
    }
    sort(xy.rbegin(), xy.rend());
    vector<P> candidates1, candidates2;
    rep(i, N) {
        candidates1.push_back(P(xy[i].first - xy[i].second, i));
        candidates2.push_back(P(xy[i].first + xy[i].second, i));
    }
    sort(candidates1.begin(), candidates1.end());
    sort(candidates2.begin(), candidates2.end());

    ll ans = max(candidates1.back().first - candidates1[0].first, candidates2.back().first - candidates2[0].first);

    cout << ans << endl;
}

// Generated by 1.1.7.1 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);
    std::vector<long long> x(N);
    std::vector<long long> y(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &x[i]);
        scanf("%lld", &y[i]);
    }
    solve(N, std::move(x), std::move(y));
    return 0;
}


Measured memory_bytes: 16104
Scanf.scanf "%d %d" (fun n k ->
    let rec loop b acc =
        if b > n then acc else
            let m = n / b in
            let r = n - m * b in
            let acc = acc + m * (b - k) + if k = 0 then max 0 (r - k) else max 0 (r - k + 1) in
            loop (b + 1) acc
    in
    loop (k + 1) 0 |> Printf.printf "%d\n"
)

Measured memory_bytes: 3792
n = int(input())
list = [9,8,7,6,5,4,3,2,1]
if n == 1:
    print("Yes")
    exit()

ans = ""
for item in list:
    if (n % item) == 0 and (n / item) in list:
        ans = "Yes"
        break
    else:
        ans = "No"

print(ans)


Measured memory_bytes: 3060
#coding:utf-8

A, B, K = map(int, input().split())

flag = K % 2

for k in range(K):
    if k % 2 == 0:
        if A % 2 == 1:
            A -= 1
        B = B + A * 0.5
        A = A * 0.5

    else:
        if B % 2 == 1:
            B -= 1
        A = A + B * 0.5
        B = B * 0.5

print(int(A), int(B))


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <unordered_map>
using namespace std;
int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	int b[100001] = { 0 };
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[a[i]]++;
	}
	int m{ 0 };
	for (int i = 1; i < 100000; i++) {
		m = max(m, b[i - 1] + b[i] + b[i + 1]);
	}
	cout << m << endl;
}

Measured memory_bytes: 1024
n,q = map(int,input().split())
from collections import deque
s = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    a = a-1
    b = b-1
    s[a].append(b)
    s[b].append(a)
count = [0 for i in range(n)]
for i in range(q):
    p,x = map(int,input().split())
    count[p-1] += x
ans = [-1 for i in range(n)]
ans[0] = count[0]
d = deque([(0,0)])
while d:
    u,v = d.popleft()
    ans[u] = v + count[u]
    for b in s[u]:
        if ans[b] == -1:
            d.append((b,ans[u]))
        else:
            continue
for i in range(n):
    print(ans[i])

Measured memory_bytes: 106912
N,K = map(int, input().split())
D = input().split()

usable = set([str(i) for i in range(10)]) - set(D)
# print(usable)

for i in range(N, 10000*10):
    if set(list(str(i))).issubset(usable):
        print(i)
        break

Measured memory_bytes: 3060
H, W, K = map(int, input().split())
c = [list(input().strip()) for _ in range(H)]
b = 0
for y in range(H):
    for x in range(W):
        if c[y][x] == "#":
            b += 1

ans = 0
for row in range(2 ** H):
    rows = []
    for h in range(H):
        if row & (1 << h):
            rows.append(h)
    for col in range(2 ** W):
        rc = {}
        cols = []
        for w in range(W):
            if col & (1 << w):
                cols.append(w)

        for y in rows:
            for x in range(W):
                rc[(y, x)] = c[y][x]
        for x in cols:
            for y in range(H):
                rc[(y, x)] = c[y][x]

        tb = b
        for v in rc.values():
            if v == "#":
                tb -= 1
        if tb == K:
            ans += 1
print(ans)


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

int main(){
  int N;
  cin >> N;
  vector<int> B(N,1e9);
  for(int i = 0; i < N-1; ++i)
    cin >> B[i];
  int ans = B[0];
  for(int i = 1; i < N; ++i){
    ans += min(B[i],B[i-1]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>          // printf(), scanf()
#define MAX_N 1000000
#define MAX_G 15

int count;
const int G[11] = {1, 8, 23, 77, 281, 1073, 4193, 16577, 65921, 262913, 1050113};
int ix = 0;

void
insertionSort(int a[MAX_N], int n, int g)
{
	int v;
	int i, j;

	for (i = g; i < n; ++i)
	{
		v = a[i];
		for (j = i - g; j >= 0 && v < a[j]; j -= g)
		{
			a[j + g] = a[j];
			count++;
		}

		a[j + g] = v;
	}
}

void
shellsort(int a[MAX_N], int n)
{
//	int h;
	int i;

	for (ix = 0; ix < MAX_G && G[ix] <= n; ++ix)
		;

#if 0
	ix = 0;
	for (h = 1; h <= n;)
	{
		G[ix++] = h;
		h = 3 * h + 1;
	}
#endif

	for (i = ix - 1; i >= 0; --i)
		insertionSort(a, n, G[i]);
}

int
main(int argc, char** argv)
{
	int a[MAX_N];
	int n;
	int i;

	scanf("%d", &n);
	for (i = 0; i < n; ++i)
		scanf("%d", &a[i]);

	count = 0;
	shellsort(a, n);

	printf("%d\n", ix);
	for (i = ix - 1; i >= 0; --i)
		printf("%d%c", G[i], (i != 0) ? ' ' : '\n');

	printf("%d\n", count);
	for (i = 0; i < n; ++i)
		printf("%d\n", a[i]);

	return 0;
}

Measured memory_bytes: 4508
#import sys
#input = sys.stdin.

def main():
    N = int(input())
    num = 97
    T = [[0 for _ in range(N)] for _ in range(26)]
    for i in range(N):
        S = list(map(str,input()))
        for moji in S:
            T[ord(moji)-num][i] += 1
            
    ans = ""
    for i in range(26):
        use = min(T[i])
        ans += chr(num+i)*use
    
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
import java.util.*;
public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		new A().doIt();
	}

	class A{
		int w,h;
		char[][] map;
		char[][] memo;
		boolean wsw,bsw;
		boolean come[][];
		int sx[] = {1,0,-1,0};
		int sy[] = {0,1,0,-1};
		void dfs(int x,int y){
			if(map[y][x]=='W'){
				wsw=true;return;
			}else if(map[y][x]=='B'){
				bsw=true;return;
			}
			if(come[y][x])return;
			come[y][x]=true;
			for(int i=0;i<4;i++){
				int nx=x+sx[i];
				int ny=y+sy[i];
				if(nx<0||nx>=w||ny<0||ny>=h)continue;
				dfs(nx,ny);
			}
		}
		
		void dfs2(int x,int y,char a){
			if(map[y][x]=='W'||map[y][x]=='B')return;
			if(memo[y][x]=='w'||memo[y][x]=='b'||memo[y][x]=='.')return;
			memo[y][x]=a;
			for(int i=0;i<4;i++){
				int nx=x+sx[i];
				int ny=y+sy[i];
				if(nx<0||nx>=w||ny<0||ny>=h)continue;
				dfs2(nx,ny,a);
			}
		}
		
		void solve(){
			memo = new char[h][w];
			for(int i=0;i<h;i++)Arrays.fill(memo[i], ' ');
			for(int i=0;i<h;i++)for(int s=0;s<w;s++)if(memo[i][s]==' '){
				wsw = false;bsw = false;
				come = new boolean[h][w];
				dfs(s,i);
				char target = '.';
				if(wsw&&!bsw)target='w';
				else if(!wsw&&bsw)target='b';
				dfs2(s, i, target);
			}
			
//			for(int i=0;i<h;i++){
//				for(int s=0;s<w;s++)System.out.print(memo[i][s]);
//				System.out.println();
//			}
//			
			int white=0,black=0;
			for(int i=0;i<h;i++)for(int s=0;s<w;s++){
				if(memo[i][s]=='w')white++;
				else if(memo[i][s]=='b')black++;
			}
			System.out.println(black+" "+white);
		}
		
		void doIt(){
			while(in.hasNext()){
				w = in.nextInt(); h = in.nextInt();
				if(w+h==0)break;
				map = new char[h][w];
				for(int i=0;i<h;i++)map[i]= in.next().toCharArray(); 
				solve();
			}


		}
	}

}

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

int main(){
  char a;
  cin >> a;
  if(a=='a'||a=='i'||a=='u'||a=='e'||a=='o'){
    cout << "vowel" << endl;
  }
  else
    cout << "consonant" << endl;
  return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var xs = new List<string>(Console.ReadLine().Split(' '))
            .Select(x=>int.Parse(x)).ToList();
        var sxs = xs.OrderBy(x => x).ToList();
        var m1 = sxs[n/2 - 1];
        var m2 = sxs[n/2];
        xs.ForEach(x => {
            if(x<m2){Console.WriteLine(m2);}
            else{Console.WriteLine(m1);}
        });
    }
}

Measured memory_bytes: 41160
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    string S;
    cin>>S;
    char a[4];
    a[0]=S[0];
    a[1]=S[1];
    a[2]=S[2];
    a[3]=S[3];
    sort(a,a+4);
    if(a[0]==a[1]&&a[1]!=a[2]&&a[2]==a[3]){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int temp,temp2,a,b;
	vector<int> x,y,r,s;
	for(int i=0;i!=n;++i){
		cin>>temp>>temp2;
		r.push_back(temp);
		s.push_back(temp2);
	}
	for(int i=0;i!=m;++i){
		cin>>temp>>temp2;
		x.push_back(temp);
		y.push_back(temp2);
	}
	for(int i=0;i!=n;++i){
		int ans=1E9,ind;
		for(int j=0;j!=m;++j){
			if((abs(x[j]-r[i])+abs(y[j]-s[i]))<ans){
				ans=abs(x[j]-r[i])+abs(y[j]-s[i]);
				ind=j+1;
			}
		}
		cout<<ind<<endl;
	}
}

Measured memory_bytes: 256
n,k,s = map(int,input().split())

if s == 1000000000:

  for i in range(k):
    print(s, end="")
    print(" ", end="")

  for i in range(n-k):
    print(1, end="")
    print(" ", end="")

else:
  for i in range(k):
    print(s, end="")
    print(" ", end="")

  for i in range(n-k):
    print(1000000000, end="")
    print(" ", end="")


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

using namespace std;

#define ll long long 
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ff first
#define ss second
#define endl "\n"
#define MOD 1000000007
#define MOD1 998244353
#define inf 1e18

ll GCD(ll x,ll y){if(y==0)return x;return GCD(y,x%y);}
ll LCM(ll x,ll y){return (x*y)/(GCD(x,y));}
ll LOGK(ll x,ll k){if(x>=k)return 1+LOGK(x/k,k);return 0;}
ll MPOW( ll a, ll b, ll m) { if(b==0) return 1; ll x=MPOW(a,b/2,m); x=(x*x)%m; if(b%2==1) x=(x*a)%m; return x;}
ll MINV(ll a,ll m) {return MPOW(a,m-2,m);}

class pnc{
  ll FACT_MAX,MODU;
  vector<ll> fact;
public:
  pnc( ll n, ll m) { FACT_MAX = n; fact.resize(FACT_MAX); MODU = m; MFACT_INIT(MODU);}
  void MFACT_INIT( ll m) { fact[0]=1; for(ll i=1;i<FACT_MAX;++i) fact[i]=(i*fact[i-1])%MODU;}
  ll MFACT( ll n) { return fact[n];}
  ll PERM( ll n, ll r) { return (fact[n]*::MINV(fact[n-r],MODU))%MODU;}
  ll COMB( ll n , ll r) { return (PERM(n,r)*::MINV(fact[r],MODU))%MODU;}
};

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

    ll test=1;
    // cin>>test;
    while(test--)
    {
        char ch;
        cin>>ch;

        for(ll i=0;i<26;i++)
        {
            if(ch==(char)(i+'A'))
            {
                cout<<'A';
                return 0;
            }
        }

        cout<<'a';
    }
}

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

using namespace std;

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

    string ans = "~";
    int n = s.size();
    int m = t.size();

    for (int i = 0; i <= n - m; i++) {
        bool match = true;
        string s2 = s;
        for (int j = 0; j < m; j++) {
            if (s[i+j] != '?' && s[i+j] != t[j]) {
                match = false;
            }
            s2[i + j] = t[j];
        }

        if (match) {
            replace(s2.begin(), s2.end(), '?', 'a');
            ans = min(ans, s2);
        }
    }

    if (ans == "~") {
        cout << "UNRESTORABLE" << endl;
    } else {
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;

int R, C;
vector<string> m;
queue<pair<int, int>> P;
vector<int> dr{ -1, 1, 0, 0 }, dc{ 0, 0, 1, -1 };
int nodesLeft, nextNodes;

void find_neighbours(int r, int c, vector<vector<bool>> &visited) {
	for (int i = 0; i < 4; i++) {
		int rr = r + dr[i];
		int cc = c + dc[i];

		if (rr < 0 || cc < 0) continue;
		if (rr >= R || cc >= C) continue;

		if (m[rr][cc] == '#') continue;
		if (visited[rr][cc]) continue;

		P.push(make_pair(rr, cc));
		visited[rr][cc] = true;
		nextNodes++;
	}
}

int bfs(int i, int j) {
	P.push(make_pair(i, j));
	vector<vector<bool>> visited(R, vector<bool>(C));
	visited[i][j] = true;
	nodesLeft = 1;
	nextNodes = 0;
	int moves = 0;
	while (!P.empty()) {
		pair<int, int> p = P.front();
		P.pop();
		int x = p.first;
		int y = p.second;
		find_neighbours(x, y, visited);
		nodesLeft--;
		if (nodesLeft == 0) {
			nodesLeft = nextNodes;
			nextNodes = 0;
			moves++;
		}
	}
	return moves;
}

int main() {
	cin >> R >> C;
	for (int i = 0; i < R; i++) {
		string s;
		cin >> s;
		m.push_back(s);
	}

	int mx = 0;
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) {
			if (m[i][j] == '.') mx = max(mx, bfs(i, j));
		}
	}

	cout << mx-1 << endl;
	return 0;
}

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

int n;
ll res = (ll)1e16;
int arr[200010];

ll f(ll a){
	int i;
	ll nres = 0ll;
	for(i = 0; i < n; i++) nres += abs(arr[i] - a - i); return nres;
}
int main(){
	int i;
	ll l, r, m1, m2;
	ll nres1, nres2;
	scanf("%d", &n);
	for(i = 0; i < n; i++) scanf("%d", &arr[i]);
	l = -(ll)2e9; r = (ll)2e9;
	while(l <= r){
		m1 = (2*l + r) / 3; m2 = (l + 2*r) / 3;
		nres1 = min(f(m1 - 1), min(f(m1), f(m1 + 1))); nres2 = min(f(m2 - 1), min(f(m2), f(m2 + 1)));
		res = min(res, min(nres1, nres2));
		if(nres1 < nres2) r = m2 - 1;
		else l = m1 + 1;
	}
	printf("%lld", res);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FSP(x) fixed << setprecision(x)
using namespace std;
using ll = long long;
constexpr ll INF = LLONG_MAX;
constexpr ll P = 1e9 + 7;
//constexpr ll P = 998244353;
constexpr long double PI = acosl(-1);
void Yes() {cout << "Yes\n";}
void No() {cout << "No\n";}
void YES() {cout << "YES\n";}
void NO() {cout << "NO\n";}

long long floor_sum(long long n, long long m, long long a, long long b) {
    long long ans = 0;
    if (a >= m) {
        ans += (n - 1) * n * (a / m) / 2;
        a %= m;
    }
    if (b >= m) {
        ans += n * (b / m);
        b %= m;
    }

    long long y_max = (a * n + b) / m, x_max = (y_max * m - b);
    if (y_max == 0) return ans;
    ans += (n - (x_max + a - 1) / a) * y_max;
    ans += floor_sum(y_max, a, m, (a - x_max % a) % a);
    return ans;
}

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

	ll t;
	cin >> t;
	while (t--) {
		ll n, m, a, b;
		cin >> n >> m >> a >> b;
		cout << floor_sum(n, m, a, b) << '\n';
	}
}

Measured memory_bytes: 3656
a, b, c = map(int, input().split())
work = sorted([a, b, c])
modu = list(map(lambda x:x%2, work))
if modu[0]==modu[1]:
    result = (2*work[2]-work[1]-work[0])//2
else:
    result = (2*work[2]-work[1]-work[0]+1)//2 + 1
print(result)


Measured memory_bytes: 3060
N = int(input())
S = []
P = []
spa = []
moji = []
memo = {}
for i in range(N):
    s, p = list(input().split())
    if moji.count(s) == 0:
        memo[s] = []
        moji.append(s)
    p = int(p)
    memo[s].append([p, i])
    spa.append([s, p, i])

_spa = sorted(spa)
_moji = sorted(moji)

ans = []
_memo = sorted(memo)
# print(_memo)

for i in range(len(_memo)):
    buff = sorted(memo[_memo[i]])
    for n in range(len(buff)):
        ans.append(buff[::-1][n])

_len = len(ans)

for i in range(_len):
    print(ans[i][1]+1)

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

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    vector<int> x(n);
    for (int i = 0; i < n; i++) cin >> x[i];
    long long ans = 0;
    for (int i = 0; i < n - 1; i++){
        if ((long long)(x[i+1] - x[i]) * a > b) ans += b;
        else ans += (long long)(x[i+1] - x[i]) * a;
    }
    cout << ans << endl;
}

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

int main(void)
{
	
	double pr, tpr, r;

	scanf("%lf", &r);
	
	pr = M_PI * r * r;
	tpr = M_PI * 2 * r;

	printf("%lf %lf\n", pr, tpr);

	return 0;
}


Measured memory_bytes: 2044