akhauriyash/Code-Regression huggingface dataset:
function main(input) {
  var n = input[0].split(" ")[0]-0;
  var m = input[0].split(" ")[1]-0;
  var nummap = [0,2,5,5,4,5,6,3,7,6];
  var mattis = input[1].split(" ").map(v=>{return {val:v, num:nummap[v-0]}});
  var ans = "";
  var dp = [];
  dp[0] = "";
  for(var i=1;i<=n;i++){
    for(var j=0;j<m;j++){
      var matti = mattis[j];
      if(dp[i-matti.num] !== undefined){
        var tv = (dp[i-matti.num]?dp[i-matti.num]:"") + matti.val;
        if(dp[i] === undefined || diff(tv, dp[i]) > 0){
          dp[i] = tv;
        }
      }
    }
  }
  console.log(dp[n]);
}
function diff(a, b){
  if(a.length != b.length) return a.length-b.length;
  for(var i=0;i<a.length;i++){
    if(a[i]!=b[i]) return a[i]-b[i];
  }
  return 0;
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


Measured memory_bytes: 47180
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
    int p,q,r;
    cin >> p >> q >> r;
    cout << p+q+r - max({p,q,r}) << endl;


    return 0;
}

Measured memory_bytes: 888
# coding: utf-8

# 標準入力 <int><int>
a, b = map(int, input().split())

A = ""
B = ""

for _a in range(a):
    A += str(b)
for _b in range(b):
    B += str(a)

d = [A, B]
d.sort()

print(d[0])


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define INT(str) stoi((str), 0)
#define INTB(str) stoi((str), 0, 2) // 2進数の文字列を int に
//cout << fixed << setprecision(15);

int main() {

    int x;
    cin >> x;

    if (x < 600)
        cout << 8 << endl;
    else if (x < 800)
        cout << 7 << endl;
    else if (x < 1000)
        cout << 6 << endl;
    else if (x < 1200)
        cout << 5 << endl;
    else if (x < 1400)
        cout << 4 << endl;
    else if (x < 1600)
        cout << 3 << endl;
    else if (x < 1800)
        cout << 2 << endl;
    else if (x < 2000)
        cout << 1 << endl;

}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main() {
   // cout<<"Hello World!";
   string s;
   cin>>s;
   int l=s.size()/2;
   int n=s.size();
   int count=0;
   for(int i=0;i<l;++i)
   {
       if(s[i]!=s[n-1-i])count++;
   }
   cout<<count<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
typedef long long ll;
int inf = 1000000000;
ll dp[200005] = {};
ll a[200005];
using namespace std;
int main(void) {
	int n, m;;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> a[i];
		dp[a[i]] = inf;
	}
	dp[0] = 1;
	int flag = 0;
	for (int i = 1; i <= n; i++) {
		if (dp[i] != inf) {
			if (dp[i - 1] == inf) {
				if (dp[i - 2] == inf) {
					cout << "0" << endl;
					return 0;
				}
				else {
					dp[i] = dp[i - 2];
					dp[i]=dp[i] % 1000000007;
					flag = 1;
				}
			}
			else {
				if (flag == 0) {
					dp[i] += dp[i - 1]  + dp[i - 2];
					dp[i]=dp[i] % 1000000007;
				}
				else {
					dp[i] = dp[i - 1];
					dp[i] = dp[i] % 1000000007;
					flag = 0;
				}
			}
		}
	}
	cout << dp[n] << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
#define each(i, mp) for(auto& i:mp)

int main() {
  long double a, b, n;
  cin >> a >> b>> n;

  ll ans = 0;
  ll tmp = 0;
  // rep(x,n+1)
  bool is_stop = 0;
  // for (ll x = 0; x < n+1; x++){
  //   tmp = floor(a*(long double)x/b) - a*floor((long double)x/b);
  //   if (tmp >= ans) ans = tmp;
  //   if(x%(ll)b == 0){
  //     if (is_stop) break;
  //     is_stop = 1;
  //   }
  //   // cout << x<< " " << tmp<< " " << a*(long double)x/b<<endl;
  // }
  if (n >= b) {
    ans = floor(a*(b-1.0)/b) - a*floor((b-1.0)/b);
  }
  else{
    ans =  floor(a*n/b) - a*floor(n/b);
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> D(N), cnt(N);
  for (int i = 0, d; cin >> d; i++) {
    D.at(i) = d;
    cnt.at(d)++;
  }
  if (D.at(0) || cnt.at(0) != 1) return cout << 0 << "\n", 0;
  long ans = 1;
  int mx = *max_element(D.begin(), D.end());
  for (long i = 1; i <= mx; i++) {
    long tmp = cnt.at(i);
    while (tmp--) {
      ans *= cnt.at(i - 1);
      ans %= 998244353;
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 4024
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL)

const int N = 1e5+10;

int h[N];
int dp[N];
int n, k;
int func(int ind){
	if(ind == 0)
		return 0;
	if(dp[ind] != -1)
		return dp[ind];
	int cost = INT_MAX;
	for(int i = 1; i <= k; ++i)
		if(ind-i >= 0){
			cost = min(cost, abs(h[ind] - h[ind-i]) + func(ind-i));
		}
	return dp[ind] = cost;
}

int main(){
	FIO;
	cin >> n >> k;
	memset(dp, -1,sizeof(dp));
	for(int i = 0; i < n; ++i){
		cin >> h[i];
	}
	cout << func(n-1);
}

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

using namespace std;

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

    long long money = 1000;
    long long stock = 0;

    vector<int> A(N);

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

    for(int i = 0; i < N-1; i++) {
        stock = 0;
        if(A[i] < A[i+1]) {
            stock = money / A[i];
            money += (A[i+1] - A[i]) * stock;
        }

        
    }

    cout << money << endl;    
	return 0;
}

Measured memory_bytes: 3592
package main

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

const BUFSIZE = 10000000

var rdr = bufio.NewReaderSize(os.Stdin, BUFSIZE)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	a := NextLineInt()

	l := make([]int, n+2)
	r := make([]int, n+2)
	l[1] = a[0]
	r[n] = a[n-1]
	for i := 1; i < n; i++ {
		l[i+1] = Gcd(l[i], a[i])
	}

	for j := n; j > 1; j-- {
		r[j-1] = Gcd(r[j], a[j-2])
	}

	var ans int

	for i := 1; i <= n; i++ {
		ans = Max(ans, Gcd(l[i-1], r[i+1]))
	}
	fmt.Println(ans)
}

func Gcd(a, b int) int {
	if a == 0 {
		return b
	}
	return Gcd(b%a, a)
}

func NextLineInt() []int {
	buf := make([]byte, 0, BUFSIZE)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}

		buf = append(buf, l...)

		if !p {
			break
		}
	}
	str := strings.Split(string(buf), " ")
	l := len(str)

	ret := make([]int, l)

	for i := range str {
		// ret[i], ok = strconv.Atoi(str[i])
		v, ok := strconv.Atoi(str[i])

		if ok == nil {
			ret[i] = v
		}
	}

	return ret
}

func Bool2Int(b bool) int {
	if b {
		return 1
	} else {
		return 0
	}
}

func Abs(v int) int {
	if v < 0 {
		return -v
	}
	return v
}

func Min(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func Max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func Distance(a, b int) int {
	return Abs(a - b)
}


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

int main () {
 int H,W;
 cin >> H >> W;
 char b[H][W];
 int a[H][W];
  for(int i = 0;i < H;i++){
  	for(int j = 0; j < W;j++){
    	cin >> b[i][j];
      a[i][j] = 1;
    }
  }
  for(int i = 0;i < H;i++){
  	for(int j = 0; j < W;j++){
      if(b[i][j] == '#') break;
      if(j == W - 1){
        for(int k = 0;k < W;k++){
			a[i][k] = 0;
        }
      }
    }
  }
   for(int i = 0;i < W;i++){
  	for(int j = 0; j < H;j++){
      if(b[j][i] == '#') break;
      if(j == H - 1){
        for(int k = 0;k < H;k++){
			a[k][i] = 0;
        }
      }
    }
  }
  int c = 0;
  for(int i = 0;i < H;i++){
    c = 0;
  	for(int j = 0; j < W;j++){
      if(a[i][j] != 0){
        cout << b[i][j];
        c = 1;
      }
    }
    if(c == 1){
    cout << endl;
    }
  }
 return 0; 
}

Measured memory_bytes: 256
import itertools
n, k = map(str, input().split())

ok = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
d = set(map(str, input().split()))
ok.difference_update(d)

ok_list = list(ok)
ok_list.sort()
ans = ""

if ok_list[-1] * len(n) < n:
  ans = ok_list[0] * (len(n) + 1) if ok_list[0] != "0" else ok_list[1] + "0" * len(n)
else:
  for nums in itertools.product(ok_list, repeat=len(n)):
    num = "".join(nums)
    if n <= num:
      ans = num
      break

print(ans)

Measured memory_bytes: 3064
PROGRAM TrickORtreat
      IMPLICIT NONE
      integer :: n,k
      integer :: a(100)
      logical :: sunukeByCandy(100,100) = .true.
      integer :: i,j,d,ans
      
      
      
      read*,n,k
      
      do i = 1,k
        read*,d
        read*,a(1:d)
        
        do j = 1,d
          sunukeByCandy(a(j),i) = .false.
        end do
      end do
      
      ans = 0
      do j = 1,n
        if( all(sunukeByCandy(j,1:k)) )then
          ans = ans + 1
        end if
      end do
      
      print*,ans
    !  do i = 1,n
    !    print*,sunukeByCandy(i,1:k)
    !  end do
      
      END PROGRAM

Measured memory_bytes: 2864
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  string s;
  cin>>s;
  ll k;
  cin>>k;
  ll n=s.size();
  ll co=0;
  ll co2=0;
  ll tmp=1;
  ll first=1;
  ll last=1;
  int i,j;
  for(i=0;i<n-1;i++){
      if(s[i]==s[i+1]){
          for(j=i+1;j<n;j++){
              if(s[i]==s[j]){
                  tmp++;
              }else{
                  co+=tmp/2;
                  i=j-1;
                  tmp=1;
                  break;
              }
              if(j==n-1){
                  co+=tmp/2;
                  i=j-1;
                  tmp=1;
                  break;
              }
          }
      }
  }
  if(s[0]==s[n-1]){
      for(i=1;i<n;i++){
          if(s[0]==s[i]){
              first++;
          }else{
            break;
          }
      }
      for(i=n-2;i>=0;i--){
          if(s[n-1]==s[i]){
              last++;
          }else{
            break;
          }
      }
  }
  if(first==n){
  cout<<n*k/2<<endl;
  }else if(first%2==1&&last%2==1&&s[0]==s[n-1]){
      cout<<co*k+k-1<<endl;
  }else{
      cout<<co*k<<endl;
  }
}

Measured memory_bytes: 256
// Package main provides
//
// File:  d.go
// Author: ymiyamoto
//
// Created on Fri Dec  7 00:18:18 2018
//
package main

import "fmt"

func main() {
	var N, M, Q int
	fmt.Scan(&N, &M, &Q)
	graph := make([][]int, N+1)
	for i := range graph {
		graph[i] = make([]int, N+1)
	}

	for i := 0; i < M; i++ {
		var L, R int
		fmt.Scan(&L, &R)
		graph[L][R]++
	}

	for i := 0; i < N+1; i++ {
		for j := 0; j < N+1; j++ {
			if j+1 < N+1 {
				graph[i][j+1] += graph[i][j]
			}
		}
	}

	for i := 0; i < Q; i++ {
		var l, r int
		fmt.Scan(&l, &r)
		ans := 0
		for j := l; j <= r; j++ {
			if 0 < l-1 {
				ans += graph[j][r] - graph[j][l-1]
			} else {
				ans += graph[j][r]
			}
		}

		fmt.Println(ans)
	}
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
#define mem(a,i) memset(a,i,sizeof(a))
const double pi=acos(-1);

set<int>st;
int main ()
{
    int a,b;
    for(int i=1;i<=9;i++)
        for(int j=1;j<=9;j++)
        st.insert(i*j);
    sint(a);
    if(st.count(a))
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}



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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

int main() {
  in(int, x);
  if (x >= 30) {
    out("Yes");
  } else {
    out("No");
  }
}

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

typedef long long ll;

const int MAX_N = 1e5 + 5, MOD = 1e9 + 7;
int n, m;
int p[MAX_N];
int q[MAX_N];
int Arr[MAX_N];

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> p[i];
	for (int i = 0; i < n; i++)
		cin >> q[i];

	for (int i = 0; i < n; i++)
		Arr[i] = i + 1;

	int a = 0, b = 0;
	int ind = 0;
	do {
		ind++;
		bool o1 = true, o2 = true;
		for (int i = 0; i < n; i++) {
			if (p[i] != Arr[i])
				o1 = false;
			if (q[i] != Arr[i])
				o2 = false;
		}

		if (o1)
			a = ind;
		if (o2)
			b = ind;
	} while (next_permutation(Arr, Arr + n));
	cout << abs(a - b) << endl;
	return 0;
}

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

#define MAX 1000

int main(){
  int i,j,m,q,x,y,c[MAX+1][MAX+1];
  char X[MAX],Y[MAX];

  scanf("%d",&q);

  for(i=0;i<strlen(X);i++)
    c[i][0] = 0;
  for(j=0;j<strlen(Y);j++)
    c[0][j] = 0;

  for(m=0;m<q;m++){
    scanf("%s",X);
    scanf("%s",Y);
    x = strlen(X);
    y = strlen(Y);
    for(i=0;i<x;i++)
      c[i][0] = 0;
    for(j=0;j<y;j++)
      c[0][j] = 0;

    for(i=1;i<=x;i++){
      for(j=1;j<=y;j++){
	if(X[i-1] == Y[j-1])c[i][j] = c[i-1][j-1] + 1;
	else if(c[i-1][j] >= c[i][j-1])c[i][j] = c[i-1][j];
	else c[i][j] = c[i][j-1];
      }
    }
    printf("%d\n",c[x][y]);
  }

  return 0;
}

Measured memory_bytes: 4516
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
const ll inf = 1e17;
const int maxn = 1e5+2;
vi v[maxn];
bool vis[maxn];
ll dp[maxn][3];
void dfs(int u){
	vis[u] = true;
	for(auto x:v[u]){
		rep(i,3){
			if(dp[u][i] != inf){
				// if(dp[x][(i+1)])
				dp[x][(i+1)%3]=min(dp[u][i]+1ll,dp[x][(i+1)%3]);
			}
		}
		if(!vis[x]){
			dfs(x);
		}
	}
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin>>n;
	int m;
	cin>>m;
	rep(i,m){
		int x,y;
		cin>>x>>y;
		v[x].pb(y);
	}
	int s,t;
	cin>>s>>t;
	rep(i,maxn){
		rep(j,3){
			dp[i][j] = inf;
		}
	}
	dp[s][0] = 0ll;	
	rep(j,20){
		rep(i,maxn)vis[i]=false;
		dfs(s);
	}
	// dfs(s);
	
	// rep(i,maxn)vis[i]=false;
	// dfs(s);
	// repa(i,1,7){
	// 	rep(j,3){
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<"\n";
	// }
	if(dp[t][0] != inf){
		cout<<dp[t][0]/3;
	}
	else{
		cout<<-1;
	}
	return 0;
}

Measured memory_bytes: 12928
#include <cstdio>
#define MAX_N 500

using namespace std;
int main() {
  int N, i, j;
  int C[MAX_N], S[MAX_N], F[MAX_N], t[MAX_N];  // t[i]はi駅に到着する開通式後からの秒数
  scanf("%d", &N);
  for(i = 1; i < N; i++) {
    scanf("%d %d %d", &C[i], &S[i], &F[i]);
  }
  for(i = 1; i <= N; i++) {
    for(j = i; j <= N; j++) {
      if (j == i) {
        t[j] = 0;
        continue;
      }
      if (t[j-1] <= S[j-1]) {
        t[j] = S[j-1] + C[j-1];
      } else {
        int wait_time;
        if ((t[j-1] - S[j-1]) % F[j-1] == 0) {
          wait_time = 0;
        } else {
          wait_time = F[j-1] - (t[j-1] - S[j-1]) % F[j-1];
        }
        t[j] = t[j-1] + wait_time + C[j-1];
      }
    }
    printf("%d\n", t[N]);
  }
  return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<functional>
#include<utility>
#include<vector>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define re register
#define FOR(i,a,b) for(re int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(re int i=(a);i>=(b);i--)
#define temT template<typename T>
using namespace std;
typedef long long ll;

int main(){
	const string str[4]={"AC","WA","TLE","RE"};
	int a[4]={0,0,0,0};
	int n;	string ss;
	cin>>n;
	while(n--){
		cin>>ss;
		FOR(i,0,3)	if(ss==str[i])
			a[i]++;
	}
	FOR(i,0,3)
		cout<<str[i]<<" x "<<a[i]<<endl;
	return 0;
}

Measured memory_bytes: 3628
/* template.cpp [[[ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)(s))
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)(s))
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__;
ll in(){ ll x; cin >> x; return x; }
vector<ll> in(size_t n){ vector<ll> v(n); each(x, v) cin >> x; return v; }
/* ]]] */

int main(){
  string s[3];
  int t[3]{};
  rep(i, 3) cin >> s[i];
  int p = 0;
  while (s[p][t[p]]) p = s[p][t[p]++] - 'a';
  cout << char('A' + p) << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const int N = 200005;
ll inf = 1e16;
ll mod = 1e9 + 7;

char en = '\n';
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

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

  ll n;
  cin >> n;
  string arr[n + 5];

  vector<string> A, B, AB, C;
  for (ll i = 1; i <= n; i++) {
    cin >> arr[i];
    if (arr[i][0] == 'B' && arr[i][arr[i].size() - 1] == 'A')
      AB.push_back(arr[i]);
    else if (arr[i][0] == 'B') {
      B.push_back(arr[i]);
    } else if (arr[i][arr[i].size() - 1] == 'A') {
      A.push_back(arr[i]);
    } else
      C.push_back(arr[i]);
  }

  string res = "";

  if (A.size()) {
    res += A[A.size() - 1];
    A.pop_back();
  }
  while (AB.size()) {
    res += AB[AB.size() - 1];
    AB.pop_back();
  }

  if (B.size()) {
    res += B[B.size() - 1];
    B.pop_back();
  }

  while (1) {
    if (A.size() == 0 && B.size() == 0)
      break;
    if (A.size()) {
      res += A[A.size() - 1];
      A.pop_back();
    }
    if (B.size()) {
      res += B[B.size() - 1];
      B.pop_back();
    }
  }

  while (C.size()) {
    res += C[C.size() - 1];
    C.pop_back();
  }

  ll ans = 0;
  ll len = res.size();
  for (ll i = 0; i < len - 1; i++) {
    if (res[i] == 'A' && res[i + 1] == 'B')
      ans++;
  }

  cout << ans << en;
  return 0;
}


Measured memory_bytes: 1536
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
input = sys.stdin.buffer.readline
def inputS(): return input().rstrip().decode()
readlines = sys.stdin.buffer.readlines 

from functools import reduce

def gcd(a, b):
  while b:
    a, b = b, a%b
  return a

def lcm(a, b):
  return a*b // gcd(a, b)

def div2cnt(a):
  cnt = 0
  while a%2 == 0:
    a //= 2
    cnt += 1
  return cnt

N, M = map(int, input().split())
A = list(map(int, input().split()))
# 2で割ったものに置き換え a -> a'
Ad = [a//2 for a in A]

# 各要素について、2で割り切れる回数が等しいかチェック
div2 = div2cnt(Ad[0])
for a in Ad:
  if div2cnt(a) != div2:
    print(0)
    exit()
    
# LCM
_lcm = reduce(lcm, Ad)
if _lcm > M:
  print(0)
  exit()
  
print((M//_lcm + 1) // 2)   # 切り上げ



Measured memory_bytes: 13024
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#define DEBUG(x) std::cout << '>' << #x << ':' << x << '\n';
#define PRINTVEC(x) for (int i = 0; i < (int)x.size(); i++) std::cout << x[i] << ' '; std::cout << '\n';
#define PRINTP(x) for (int i = 0; i < (int)x.size(); i++) std::cout << x[i].first << ' ' << x[i].second << '\n'; std::cout << '\n';
#define io std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);   
const int INF = 1<<29;
typedef long long ll;
using namespace std;

int main()
{
	io;
    #ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);  
    #endif

    ll n,m;
    cin >> n >> m;
    ll ans = n % m;
    ans = min(ans, m - ans);
    cout << ans;

    #ifndef ONLINE_JUDGE   
    //std::cout << '\n' << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    #endif
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;

int main()
{
    fastio;
    int N;
    vector<int> As;

    cin >> N;
    copy_n(istream_iterator<int>(cin), N, back_inserter(As));
    vector<pair<int, int>> ps;

    for (int i = 1; i <= N; ++i)
    {
        ps.emplace_back(i, As[i - 1]);
    }

    sort(ps.begin(), ps.end(), [](auto &&a, auto &&b) {
        return b.second > a.second;
    });

    for (auto &&p : ps)
    {
        cout << p.first << " ";
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 2164
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
void inline swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void inline swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }

int n;
string s;
vvi nxt;

void init()
{
	cin >> n >> s;

	nxt.resize(n + 1, vi(26, n));

	RREP(i, n)
	{
		REP(j, 26)
			nxt[i][j] = nxt[i + 1][j];
		nxt[i][s[i] - 'a'] = i;
	}

}

void print()
{
	REP(i, SZ(nxt))
	{
		REP(j, 26)
			cout << nxt[i][j] << " ";
		cout << endl;
	}

}

int main()
{
	init();

	int ans = 0;

	REP(c, 26)
	{
		int left = nxt[0][c];
		int right = n;

		if (left < n)
			right = nxt[left + 1][c];

		while (left < n && right < n)
		{
			int len;
			if (ans)
				len = ans;
			else
				len = 1;

			if ((right + len - 1 < n) && ((left + len - 1) < right))
			{
				bool flag = true;
				REP(i, len)
				{
					if (s[left + i] != s[right + i])
					{
						flag = false;
						break;
					}
				}
				if (flag)
				{
					while ((s[left + len - 1] == s[right + len - 1]) && (right + len - 1 < n) && ((left + len - 1) < right))
					{
						chmax(ans, len);
						++len;
					}
				}
			}

			right = nxt[right + 1][c];

			if (right == n || right + len - 1 >= n)
			{
				left = nxt[left + 1][c];

				if (left < n)
					right = nxt[left + 1][c];
				else
					right = n;
			}
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;


string S;

ll sum = 0;



void dfs(int k, int i, int j, long int ss){
    
    
    if (k == S.length()-1) {
        
        ss += atoll((S.substr(i, j)).c_str());
        sum += ss;
        
        
        
    }else{
        
        dfs(k+1, i, j+1, ss);
        dfs(k+1, i+j, 1, ss+atoll((S.substr(i, j)).c_str()));
    
    }
    
}



int main()
{
    
    cin >> S;
    dfs(0, 0, 1, 0);
    
    cout << sum << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int sum,cnt;
    char n[200001];
    scanf("%s",n);
    sum=0; cnt=0;
    while(n[cnt]!='\0'){
        //printf("%c",n[cnt]);
        sum+=0-'0'+n[cnt];
        cnt++;
    }
    if(sum%9==0) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 1836
s = input()
se = set(list(s))
# print('se', se)

if len(se) == 1:
    print(0)
    exit()


def f(v):
    s_list = s.split(v)
    s_list = [len(i) for i in s_list if i]
    return max(s_list)


ans = 1000
for i in se:
    v = f(i)
    ans = min(ans, v)
print(ans)
# serval 6,1
# srvvl  5,2
#        4,3

#  → svvv → vvv

# jackal
# aacaa

# jaajjj
# aaajj
# aaaj
# aaa

# jajjjjjjjajjjjjjjjjj
# aajjjjjjaajjjjjjjjj
# aajjjjjaaajjjjjjjj
# aajjjjaaaajjjjjjj
# ...


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

const int MAX = 200001;
const int MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  rep(i, MAX) {
    if (i==0||i==1) continue;
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}

ll COM(int n, int k) {
  if (n<k) return 0;
  if (n<0||k<0) return 0;
  return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

int main() {
  int h,w,a,b; cin>>h>>w>>a>>b;
  ll ans=0;
  COMinit();
  for(int j=b;j<w;j++){
    ans+=COM(h-a+j-1, h-a-1)*COM(a+w-j-2, a-1);
    ans%=MOD;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4992
n,p=map(int,input().split())
i=2
ans=1
while i*i<=p:
	cnt=0
	while p%i==0:
		p//=i
		cnt+=1
		if cnt>=n:
			ans*=i
			cnt-=n
	i+=1
if p!=1 and n==1:ans*=p
print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define BUFSIZE 10000000
typedef long long ll;
#define WDSIZE 10000

int K;
char a[BUFSIZE]={0};


int main(void){
  scanf("%d\n",&K);
  for(int i = 0;i < BUFSIZE;i++){
    scanf("%c",&a[i]);
    if(a[i] == '\n')   break;
  }

a[strlen(a)-1] = '\0';

  if(K >= strlen(a)){
    for(int i = 0; i < strlen(a);i++){
       printf("%c",a[i]);
     }
  }else{
    for(int i = 0;i < K ;i++){
    printf("%c",a[i]);
    if(i == K-1){
       printf("...");
       break;
     }
    }
  }



}


Measured memory_bytes: 1680
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define me memset
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
using namespace std;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 
ll x,k,d;
 
int main() {
    //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	scanf("%lld %lld %lld",&x,&k,&d);
 	if(x<0) x=-x;
	ll cnt=x/d;
	ll rest1=x%d;
	ll rest2=abs(rest1-d);
	ll ans;
 
	if(cnt%2==k%2) ans=rest1;
	else ans=rest2;
 
	if(x/d>=k) printf("%lld\n",x-k*d);
	else printf("%lld\n",ans);
 
    return 0;
}

Measured memory_bytes: 3832
import std.stdio;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;
 
void main() {
    int N;
    int[] B;
    bool input() {
        scanf("%d\n", &N);
        if (N == 0) return false;
        B = readln.chomp.split(" ").map!(to!int).array;
        return true;
    }
    
    int[] step(int[] xs) {
        int p = cast(int)xs.length;
        foreach (ref x; xs) {
            x--;
        }
        int[] ys;
        foreach (x; xs) {
            if (x == 0) continue;
            ys ~= x;
        }
        ys ~= p;
        return ys;
    }

    bool check(int[] xs) {
        foreach (i; 0 .. xs.length) {
            if (xs[i] != i + 1) return false;
        }
        return true;
    }

    void solve() {
        int[] X = B.dup;
        foreach (i; 0 .. 10000 + 1) {
            if (check(X)) {
                writeln(i);
                return;
            }
            X = step(X);
        }
        writeln(-1);
    }

    while (input) solve;

}

Measured memory_bytes: 3108
INF = int(1e9)
n, A, B, C = map(int, input().split())
L = tuple(map(int, (int(input()) for _ in range(n))))
def f(a, b, c, num):
    if num == n:
        return abs(A - a) + abs(B - b) + abs(C - c) if min(a, b, c) > 0 else INF
    return min(
        f(a + L[num], b, c, num + 1) + (10 if a else 0),
        f(a, b + L[num], c, num + 1) + (10 if b else 0),
        f(a, b, c + L[num], num + 1) + (10 if c else 0),
        f(a, b, c, num + 1)
    )
print(f(0, 0, 0, 0))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    string s[h + 1];
    rep(i, h) cin >> s[i];
    rep(i, h) s[i].push_back('#');
    rep(i, w + 1) s[h].push_back('#');
    int tate[h][w] = {}, yoko[h][w] = {};

    rep(i, h) {//横
        int cnt = 0;
        int start = 0;

        rep(j, w + 1) {
            if (s[i][j] == '.') cnt++;
            else {
                REP(k, start, j) yoko[i][k] = cnt;
                start = j + 1;
                cnt = 0;
            }
        }
    }

    rep(j, w) {//縦
        int cnt = 0;
        int start = 0;

        rep(i, h + 1) {
            if (s[i][j] == '.') cnt++;
            else {
                REP(k, start, i) tate[k][j] = cnt;
                start = i + 1;
                cnt = 0;
            }
        }
    }

    int Max = 0;

    rep(i, h) rep(j, w) {
        if (s[i][j] == '#') continue;
        Max = max(Max, tate[i][j] + yoko[i][j] - 1);
    }
    cout << Max << endl;

    return 0;
}



Measured memory_bytes: 39680
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  string a,b,c;
  cin>>a>>b>>c;
  Int ans=0;
  for(Int i=0;i<n;i++){
    if(a[i]==b[i]&&b[i]==c[i]) continue;
    if(a[i]==b[i]||b[i]==c[i]||a[i]==c[i]) ans++;
    else ans+=2;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <deque>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <unordered_map>
#include <unordered_set>

using namespace std;

int main()
{
	long long n;
	long long k;
	cin >> n >> k;

	vector<long long > minus;
	vector<long long > plus;


	for (int i = 0; i < n; ++i)
	{
		long long a;
		cin >> a;
		if (a > 0)
		{
			plus.emplace_back(a);
		}
		else if (a < 0)
		{
			minus.emplace_back(a);
		}
	}

	sort(minus.begin(), minus.end());
	sort(plus.begin(), plus.end());

	long long zero = n - plus.size() - minus.size();
	long long minusCount = plus.size() * minus.size();
	long long zeroCount = zero * (zero - 1) / 2 + zero * (plus.size() + minus.size());

	if (k <= minusCount)
	{
		long long left = -1e18 - 1;
		long long right = -1;
		while (right - left > 1)
		{
			long long mid = (left + right) / 2;
			long long sum = 0;
			for (long long i : plus)
			{
				long long d = mid / i;
				if (mid % i != 0)
				{
					--d;
				}
				sum += distance(minus.begin(), upper_bound(minus.begin(), minus.end(), d));
			}

			if (sum >= k)
			{
				right = mid;
			}
			else
			{
				left = mid;
			}
		}

		cout << right << endl;
	}
	else if (k <= minusCount + zeroCount)
	{
		cout << 0 << endl;
	}
	else
	{
		k -= minusCount + zeroCount;

		for_each(minus.begin(), minus.end(), [](long long& i) { i = abs(i); });
		sort(minus.begin(), minus.end());

		long long left = 0;
		long long right = 1e18;
		while (right - left > 1)
		{
			long long mid = (left + right) / 2;
			long long sum = 0;
			for (int i = 0; i < plus.size(); ++i)
			{
				int d = distance(plus.begin(), upper_bound(plus.begin(), plus.end(), mid / plus.at(i)));
				if (i < d)
				{
					--d;
				}
				sum += d;
			}
			for (int i = 0; i < minus.size(); ++i)
			{
				int d = distance(minus.begin(), upper_bound(minus.begin(), minus.end(), mid / minus.at(i)));
				if (i < d)
				{
					--d;
				}
				sum += d;
			}
			sum /= 2;

			if (sum>=k)
			{
				right = mid;
			}
			else
			{
				left = mid;
			}
		}
		cout << right << endl;
	}
}

Measured memory_bytes: 2420
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
 
int main(){
  int N,M,sum=0,k;
  cin>>N>>M;
  int ans=0;
  vector<int> a(N);
    for(int i=0;i<N;i++){
      cin>>a[i];
      sum+=a[i];
    }
  for(int i=0;i<N;i++){
    if(4*M*a[i]>=sum){ans++;}
  }
  if(ans>=M){cout<<"Yes";}
  else{cout<<"No";}
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v) do { x = max(x, v); } while(0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

string s;
ll N;
vector<ll> a;

signed main() {
  cin >> s;
  N = s.size() + 1;
  a.resize(N+1, -1);
  //cout << "N=" << N << endl;

  if (s[0] == '<') {
    a[0] = 0;
  }

  if (s[N-2] == '>') {
    a[N-1] = 0;
  }
  for (ll i=1; i<= N-2; i++) {
    if (s[i-1] == '>' && s[i] == '<') {
      a[i] = 0;
    }
  } 

  ll i = 0;
  while(i<N){
    // 0を探す
    while(i<N && a[i]!=0) {
      i++;
    }
    if (i==N)
      break;

    // 昇順の限り1を増やしていく
    ll t = 1;
    while (i <= N-2 && s[i] == '<') {
      chmax(a[i+1], t);
      t++;
      i++;
    }
    i++;
  }

  i = N-1;
  while(i>=0) {
    // 0 を探す
    while(i>=0 && a[i]!=0) {
      i--;
    }
    if (i==-1)
      break;

    // 降順の限り1を増やしていく
    ll t = 1;
    while (i-1 >= 0 && s[i-1] == '>') {
      chmax(a[i-1], t);
      t++;
      i--;
    }
    i--;
  }

  ll ans = 0;
  rep(i,N) {
    ans += a[i];
    //if (a[i] == -1) {
    //  cout << ".";
    //} else {
    //  cout << a[i];
    //}
  }
  // cout << endl;
  cout << ans << endl;
}


Measured memory_bytes: 4740
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <climits>
#include <iomanip>
#include <string.h>
#include <algorithm>

using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n); i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define clr(a,b) memset((a),b,sizeof(a))
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define sz(a) int((a).size())
#define pb push_back

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

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }

const int N = (int)2e5+77;
const ll mod = (ll)1e9+7;

ll n, m, k, x, y;
ll a[N],b[N];

int main() {
    fast;
    cin>>n>>m>>k;
    cout<<min(n+m,min(m+k,k+n))<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
        	array [i] = sc.nextInt();
        }
		sc.close();
		int count = 0;

		for (int a: array){
			if(a >= k){
				count++;
			}
			}
		  System.out.println(count);
	}
}

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

namespace abc116_c
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var hl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
            int r = 0;

            while (true)
            {
                // 終了判定
                if (hl.Sum() == 0) break;

                bool m = false;
                for (int i = 0; i < hl.Count; i++)
                {
                    // 一度でも水をやって0が来たら打ち切り
                    if (m && hl[i] == 0) break; 

                    // 水やり
                    if (hl[i] >= 1)
                    { 
                        hl[i] -= 1;
                        m = true;
                    }

                }
                if (m) r++;

            }
            Console.WriteLine(r);
        }
    }
}


Measured memory_bytes: 13268
// A - Simple Calculator

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int main() {
	int x, y;
	cin >> x >> y;

	int ans;

	if (x > 0 && y > 0) {
		if (abs(y) >= abs(x)) {
			ans = abs(y) - abs(x);
		} else {
			ans = abs(x) - abs(y) + 2;
		}
	}

	if (x < 0 && y > 0) {
		if (abs(y) >= abs(x)) {
			ans = abs(y) - abs(x) + 1;
		} else {
			ans = abs(x) - abs(y) + 1;
		}
	}

	if (x > 0 && y < 0) {
		if (abs(y) >= abs(x)) {
			ans = abs(y) - abs(x) + 1;
		} else {
			ans = abs(x) - abs(y) + 1;
		}
	}

	if (x < 0 && y < 0) {
		if (abs(y) >= abs(x)) {
			ans = abs(y) - abs(x) + 2;
		} else {
			ans = abs(x) - abs(y);
		}
	}

	if (x == 0) {
		if (y >= 0) ans = abs(y);
		else ans = abs(y) + 1;
	}

	if (y == 0) {
		if (x > 0) ans = abs(x) + 1;
		else ans = abs(x);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3516
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

const li mod = 1e9 + 7;


li n, m;

vector<vector<li>> g;
vector<vector<li>> rev;

vector<li> parents;
vector<li> parent_dist;

li dfs(li pos) {
    if (parent_dist[pos] >= 0) {
        return parent_dist[pos];
    }

    li dist = 0;
    for (int i = 0; i < rev[pos].size(); ++i) {
        const li next = rev[pos][i];
        li subdist = dfs(next) + 1;
        if (subdist > dist) {
            parents[pos] = next;
            dist = subdist;
        }
    }

    return parent_dist[pos] = dist;
}

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

    g = vector<vector<li>>(n);
    rev = vector<vector<li>>(n);
    parents = vector<li>(n, -1);
    parent_dist = vector<li>(n, -1);

    for (int i = 0; i < n - 1 + m; ++i) {
        li a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        rev[b].push_back(a);
    }

    for (int i = 0; i < n; ++i) {
        if (g[i].empty()) {
            // leaf
            dfs(i);
        }
    }

    for (int j = 0; j < n; ++j) {
        cout << parents[j] + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 18048
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>

using namespace std;

int main() {
	int n, a;
	cin >> n;

	map<int, int> nums;
	for (int i = 0; i < n; i++) {
		cin >> a;
		nums[a]++;
	}

	int ans = 0;
	for (auto p : nums) {
		if (p.first != p.second) {
			if(p.second < p.first) {
				ans += p.second;
			} else {
				ans += p.second - p.first;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4736
def binary_search(S,n,a):
    first = 0
    last = n
    # count = 0
    # x = int(math.log2(n)) + 1
    # while True:
    #     mid = (first + last) // 2
    #     if S[mid] == a:
    #         return 1
    #     elif a < S[mid]:
    #         last = mid
    #     elif S[mid] < a:
    #         first = mid
    #     count += 1
    #     if x == count:
    #         return 0

    while first < last:
        mid = (first + last) // 2
        if S[mid] == a:
            return 1
        elif a < S[mid]:
            last = mid
        elif S[mid] < a:
            first = mid + 1

    return 0

if __name__ == '__main__':
    import math
    n = int(input())
    S = [int(i) for i in input().split()]
    q = int(input())
    T = [int(i) for i in input().split()]
    count = 0

    for i in range(q):
        count += binary_search(S,n,T[i])

    print(count)



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

int main() {

  int a , b , d , r;

  double f;

  cin >> a >> b ;

  d = a / b;

  r = a % b;

  f = (double) a / (double)b ;

  printf("%d " , d);

  printf("%d " , r);

  printf("%.5lf\n" , f);

  return 0;

}

Measured memory_bytes: 1192
import java.util.*;

public class Main{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long x = sc.nextInt();
    List<Long> sweet = new ArrayList<Long>();
    
    for(int i=0;i<N;i++)
    {
      long a=sc.nextInt();
      sweet.add(a);
    }
    
    Collections.sort(sweet);
    int num=0;
    
    for(int i=0;i<N;i++)
    {
      if(x - sweet.get(num) >= 0)
      {
        x = x - sweet.get(num);
        num++;
      }
      else
      {
        break;  
      }
    }
    
    if((num == N) && (x > 0))
    {
      num -= 1;
    }
    
    System.out.println(num);
  }
}


      

Measured memory_bytes: 21972
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int w = in.nextInt();
		int h = in.nextInt();
		int x = in.nextInt();
		int y = in.nextInt();
		boolean center = false;
		if(x*2==w && y*2==h) center = true;
		double area = ((double)w*(double)h)/2;
		String ans = area + " " + (center?"1":"0");
		System.out.println(ans);
		in.close();
	}

}


Measured memory_bytes: 23124
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
typedef long long ll;
typedef double dd;
#define For(i,j,k) for (int i=(int)j;i<=(int)k;++i)
#define Forr(i,j,k) for (int i=(int)j;i>=(int)k;--i)
#define Set(a,p) memset(a,p,sizeof(a))
using namespace std;

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

ll n,m;

inline void file() {
	freopen("AGC001B.in","r",stdin);
	freopen("AGC001B.out","w",stdout);
}

ll calc(ll x,ll y) {
	if (x>y) swap(x,y);
	if (y%x==0) return 2ll*y-x;
	return 2ll*(y/x)*x+calc(x,y%x);
}

int main() {
//	file();
	scanf("%lld%lld",&n,&m);
	printf("%lld",n+calc(m,n-m));
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,v,b,w,t;
int main()
{
	cin>>a>>v>>b>>w>>t;
	if(v<=w) return puts("NO"),0;
	int d=b-a;
	if(d<0) d=-d;
	if(1ll*(v-w)*t>=d) puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>

int f[100000];
long mod=1000000007;

int main(){
	long n,i,a,ans,c;
	scanf("%ld",&n);
	for(i=0;i<n;i++){
		scanf("%ld",&a);
		f[a]++;
	}
	c=0;
	for(i=n-1;i>=0;i-=2){
		if(i>1){
			if(f[i]!=2) break;
			c++;
		}else if(i==1){
			if(f[i]!=2) break;
			c++;
		}else if(f[i]!=1){
			break;
		}
	}
	if(i>=0){
		printf("0\n");
	}else{
		ans=1;
		for(i=0;i<c;i++){
			ans*=2;
			ans%=mod;
		}
		printf("%ld\n",ans);
	}
	return 0;
}


Measured memory_bytes: 512
#if __has_include("debug.h")
    #include "debug.h"
#else  
#include <bits/stdc++.h>
using namespace std;
#define d(...) 2;
#endif

#define int long long int

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define eps 1e-10

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

int32_t main()
{
    #ifdef DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif 

    fast
    
    int t = 1;
	// cin>>t;
	
	while(t--)
	    solve();
	return 0;  
}

void solve()
{
	int i,j;
	char c;
	cin>>c;

	if(c>=65&&c<=91)
	{
		cout<<'A'<<endl;
	}
	else
	{
		cout<<'a'<<endl;
	}

}

Measured memory_bytes: 3608
using System;
using System.Linq;
using System.Collections.Generic;
public class c
{
  public static void Main()
  {
      int[]tri=Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
     if(tri[0]==tri[1]&&tri[1]==tri[2])Console.WriteLine("Yes");
     else Console.WriteLine("No");
  }
}

Measured memory_bytes: 11220
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args){

		String str = null;
		BufferedReader br = null;
		br = new BufferedReader(new InputStreamReader(System.in));
		
		
		String[] str1;
		int a,b,c,d,r;
		double f;
		try {
			str = br.readLine();
		} catch (IOException e) {
			// TODO ????????????????????? catch ????????????
			e.printStackTrace();
		}
		
		
		str1 = str.split(" ");
		a = Integer.parseInt(str1[0]);
		b = Integer.parseInt(str1[1]);
		d=a/b;
		r=a%b;
		
		f=(double)a/b;
		
		System.out.printf("%d %d %.5f",d,r,f);
		}
}

Measured memory_bytes: 24712