akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)

void FIO()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int n, k;
vector<int> a(100005);

int dp[100005];

int solve(int start)
{
	if (start == n )
		return 0;

	if (dp[start] != -1)
		return dp[start];

	int moves = INT_MAX;

	for (int i = start + 1; i <= min(n, start + k); ++i)
	{
		moves = min(moves, abs(a[i] - a[start]) + solve(i));
	}

	return dp[start] = moves;
}

int32_t main()
{
	FIO();
	cin >> n >> k;

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

	memset(dp, -1, sizeof(dp));

	cout << solve(1) << '\n';
	return 0;
}

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

int main() {
	int l, r;
	scanf("%d%d", &l, &r);
	int ans = 2019;
	int start = l%2019, end = start+min(2019*2, r-l+1);
	for (int i = start; i < end; ++i) {
		for (int j = i+1; j < end; ++j) {
			ans = min(i*j%2019, ans);
		}
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define PQ priority_queue
#define UM unordered_map
#define US unordered_set
#define ALL(a) (a).begin(),(a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
const ll INF = (1ll << 60);
typedef pair<ll,ll> pii;
typedef vector<vector<ll>> Graph;
struct Node {ll v,d,p,l,r;};
typedef vector<Node> Tree;

int main(){
  ll N; cin>>N;
  vi a(N); REP(i,N) cin>>a[i];
  UM<ll,ll> um;
  REP(i,N) {um[a[i]]+=1; um[a[i]-1]+=1; um[a[i]+1]+=1;}
  ll ans=0;
  for(auto p:um) ans=max(ans,p.second);
  cout<<ans<<endl;
}


Measured memory_bytes: 5028
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

vector<pii> to[100010];
ll d[100010];

void dfs(int k) {
    for (pii p : to[k]) {
        int nk = p.first;
        int c = p.second;
        if (d[nk] >= 0) continue;
        d[nk] = d[k] + c;
        dfs(nk);
    }
    return;
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        to[a].push_back(make_pair(b, c));
        to[b].push_back(make_pair(a, c));
    }

    int q, k;
    cin >> q >> k;
    k--;
    for (int i = 0; i < n; i++) d[i] = -1;
    d[k] = 0;

    dfs(k);
    
    ll ans[q];
    for (int i = 0; i < q; i++) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        ans[i] = d[x] + d[y];
    }

    for (int i = 0; i < q; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 11136
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>

int a[4], res;

int main () {
    for (int i = 1;i <= 3; ++i) scanf("%d", a + i);
    std :: sort(a + 1, a + 4);

    res += a[3] - a[2];
    a[1] += a[3] - a[2];
    if ((a[3] - a[1]) % 2) res += 2 + (a[3] - a[1] - 1) / 2;
    else res += (a[3] - a[1]) / 2;
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 256
n = int(input())
if n == 1:
    print("Yes")
    quit()
a = list(range(1,10))
a.reverse()
for _ in range(2):
    for i in a:
        if n % i == 0:
            if n // i == 1:
                print("Yes")
                quit()
            n = n // i
            break
print("No")
            

Measured memory_bytes: 9156
function main(input) {
  const inArray = input.trim().split(' ').map(x => parseInt(x));
  const r = inArray[0];
  const D = inArray[1];
  const x2000 = inArray[2];
  var x = x2000;
  for (var i=0; i < 10; i++) {
    x = r * x - D;
    console.log(x);
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 22212
def main
  while (n = gets.to_i) != 0
    sum, diff = 0, 0
    n.times do
      cards = gets.split(" ").map(&:to_i)
      sum += cards[0] + cards[1]
      diff += (cards[0] + cards[1]) * (cards[0] <=> cards[1])
    end
    puts "#{(sum + diff) / 2} #{(sum - diff) / 2}"
  end
end
main

Measured memory_bytes: 6104
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int X; cin >> X;
    FOR(i, 1, 10001){
        int r = X - 100 * i;
        int m = 5 * i;
        if(0 <= r && r <= m){
            Out(1);
            return 0;
        }
    }
    Out(0);

    return 0;
}


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

#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int, int> pi;
typedef vector<int> vi;
void print_pair(pi a){
  cerr<<"("<<a.first<<", "<<a.second<<") ";
}
template<int T1, int T2>
void print_2d(int a[T1][T2], int x, int y){
  For(i, x){
    For(j, y){
      cerr<<a[i][j]<<" ";
    }
    cerr<<endl;
  }
}
ull gcd(ull a,ull b){
  if(a%b==0)return b;
  else return gcd(b,a%b);
}

int T;
ull A,B,C,D;

int main(){
  cin>>T;
  REP(T){
    cin>>A>>B>>C>>D;
    if(A<B||D<B){
      cout<<"No"<<endl;
      continue;
    }
    if(B<=C+1){
      cout<<"Yes"<<endl;
      continue;
    }
    ull g = gcd(B,D);
    ull m = A%B;
    ull mm=m%g;
    if(C<m||(C-mm)/g<(B-1-mm)/g){
      cout<<"No"<<endl;
      continue;
    }
    cout<<"Yes"<<endl;
    cerr<<"end"<<endl;
  }
  return 0;
}



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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if (abs(B - A) <= D && abs(C - B) <= D || abs(C - A) <= D) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    int N;
    cin >> N;
    vector<char> s(N);
    char key[4] = {'P','W','G','Y'};
    map<char,int> m;
    m.insert(make_pair('P',0));
    m.insert(make_pair('W',0));
    m.insert(make_pair('G',0));
    m.insert(make_pair('Y',0));

    for (int i = 0; i < N; i++){
        cin >> s[i];
        m.at(s[i])++;
    }

    bool ok = true;
    for (int i = 0; i < 4; i++){
        if (m.at(key[i]) == 0){
            ok = false;
        }
    }
    if (ok) {
        cout << "Four" << endl;
    } else {
        cout << "Three" << endl;
    }

    return 0;
}


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

int main()
{
  double a, b;cin>>a>>b;
  double x = (a+b)/2 ;
  cout << ceil(x) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll) x.size()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define MAX(x, y, z) max(x, max(y, z))
#define MIN(x, y, z) min(x, min(y, z))
#define ANS cout << ans << "\n"
#define RETURN(x)    \
  cout << x << "\n"; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << "\n"
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define LINE cerr << "[debug] line: " << __LINE__ << "\n";
#define debug(x) cerr << "[debug] " << #x << ": " << x << "\n";
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << "\n";
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

signed main() {
  init();
  ll N;
  cin >> N;

  vector<qll> A(N);

  rep(i, N) {
    rep(j, N - 1) {
      ll a;
      cin >> a;
      a--;
      A[i].push(a);
    }
  }

  ll ans = 0;
  ll count = 0;
  while (1) {
    bool ok = false;
    vector<bool> done(N, false);
    rep(i, N) {
      if (done[i]) continue;
      if (A[i].empty()) continue;
      ll a = A[i].front();
      if (done[a]) continue;
      ll b = A[a].front();
      if (i == b) {
        A[i].pop();
        A[a].pop();
        done[i] = true;
        done[a] = true;
        ok = true;
        count++;
      }
    }

    if (ok) {
      ans++;
    } else {
      COUT(-1);
      return 0;
    }

    if (count == N * (N - 1) / 2) {
      break;
    }
  }
  ANS;
  return 0;
}

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

int f(int x);

int main(){
    int n,ans;
    cin >> n;
    ans = f(n);
    cout << ans << endl; 

}

int f(int x){
    if (x==1){
        return 1;
    }
    else{
        return x+f(x-1);
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
#define deb(x) cout<<#x<<" = "<<x<<"\n";


signed main()
{
	//#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//#endif
	/************************************/
	
	int h, w; cin>>h>>w;
	h = max(h, w);
	
	int n; cin>>n;
	cout<< (n + h- 1)/h ;
	
	
}

Measured memory_bytes: 256
#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<int,int>;

int main() {
    int N, K;
    cin >> N >> K;
    long double p[N];
    for (int i = 0; i < N; i++)
    {
        p[i] = 0.0;
        cin >> p[i];
    }
    
    long double ans = 0;
    for (int i = 0; i < K; i++)
    {
        ans += ((p[i] + 1.0)/2.0);
    }
    
    long double temp = ans;
    for (int i = K; i < N; i++)
    {
        // temp -= ((p[i-K] + 1.0)/2.0);
        temp += ((p[i] - p[i-K])/2.0);
        ans = max(ans, temp);
    }
    cout << fixed << setprecision(15) << ans << endl;
  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    char c;
    cin >>c;
    string a="abcdefghijklmnopqrstuvwxyz";
    
    for (int i=0; i<a.size();i++){
        if(c==a.at(i)){
            cout << a.at(i+1);
        }
    }
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    string s;
    cin >> s;
    ll n = s.size();
    i = 0;
    ll ans = 0;
    ll tmp = 0;
    while(i+1 < n){
        if(s.at(i) == 'A'){
            ++tmp;
            ++i;
        }else if(s.substr(i,2) == "BC"){
            ans += tmp;
            i += 2;
        }else{
            tmp = 0;
            ++i;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define uniq(x) (x).erase(unique(ALL(x)),(x).end())
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define foreach(it,x) for(__typeof((x).begin()) it=(x).begin();it!=(x).end();it++)
#define debug(x) cerr<<#x<<"="<<(x)<<endl
#define gett() cerr<<"Time:"<<clock()<<"ms."<<endl
#define ri(x) scanf("%d",&x)
#define rl(x) scanf("%lld",&x)
#define rlcfpoj(x) scanf("%I64d",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define plcfpoj(x) printf("%I64d",x)
#define lfd() printf("\n")
#define sp() printf(" ")
#define inrep(x) int x;scanf("%d",&x);while(x--)
string s;
int dp[100100][13];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>s;
	int n=s.size();
	dp[0][0]=1;
	for(int i=0;i<n;i++){
		for(int j=0;j<13;j++){
			if(s[i]=='?'){
				for(int k=0;k<10;k++)
					dp[i+1][(j*10+k)%13]=(dp[i+1][(j*10+k)%13]+dp[i][j])%1000000007; 
			}
			else{
				int k=s[i]-'0';
				dp[i+1][(j*10+k)%13]=(dp[i+1][(j*10+k)%13]+dp[i][j])%1000000007; 
			}
		}
	} 
	cout<<dp[n][5]<<endl;
	return 0;
}


Measured memory_bytes: 5584
// https://atcoder.jp/contests/abc159/tasks/abc159_b

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

bool is_kaibun(string s) {
  ll n = s.size();

  rep(i, n) {
    unless(i < n - 1 - i) break;
    unless(s[i] == s[n - 1 - i]) return false;
  }

  return true;
}

bool is_kaibun2(string s) {
  string t(s.rbegin(), s.rend());
  return s == t;
}

void solve() {
  string S;
  cin >> S;
  ll N = S.size();

  ll f_from = 0;
  ll f_to = (N - 1) / 2 - 1;

  ll s_from = (N + 3) / 2 - 1;
  ll s_to = N - 1;

  bool res = is_kaibun(S) && is_kaibun(S.substr(f_from, f_to - (f_from - 1))) &&
             is_kaibun(S.substr(s_from, s_to - (s_from - 1)));

  if (res) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

void solve2() {
  string S;
  cin >> S;
  ll N = S.size();

  ll f_from = 0;
  ll f_to = (N - 1) / 2;

  ll s_from = (N + 3) / 2 - 1;
  ll s_to = N;

  bool res = is_kaibun2(S) &&
             is_kaibun2(string(S.begin() + f_from, S.begin() + f_to)) &&
             is_kaibun2(string(S.begin() + s_from, S.begin() + s_to));

  if (res) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve2();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


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

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



int main()
{
  int N; cin >> N;
  vector<int> array(N);
  REP(i, N){cin >> array[i];}

  int max = 0;
  int tmp = 0;
  REP(i, N-1){
    if(array[i+1] <= array[i]){
      tmp++;
      if(max <= tmp){ max = tmp; }
    } else{
      if(max <= tmp){ max = tmp; } 
      tmp = 0; 
    }
  }

  cout << max << endl;
  return 0;
}

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

#define copy_arr(a, b, n)               \
    for (int __i = 0; __i < n; __i++) { \
        a[__i] = b[__i];                \
    }
int main(void)
{
    char s[100001];
    scanf("%s", s);

    long reminder[13] = { 1 };
    int digit = 1;

    int s_len = strlen(s);
    const int mod = 1000000007;
    for (int i = s_len - 1; i >= 0; i--) {
        long next_reminder[13] = { 0 };
        if (s[i] == '?') {
            for (int j = 0; j < 10; j++) {
                for (int k = 0; k < 13; k++) {
                    next_reminder[(j * digit + k) % 13] += reminder[k];
                    next_reminder[(j * digit + k) % 13] %= mod;
                }
            }
        } else {
            int j = s[i] - '0';
            for (int k = 0; k < 13; k++) {
                next_reminder[(j * digit + k) % 13] += reminder[k];
                next_reminder[(j * digit + k) % 13] %= mod;
            }
        }
        copy_arr(reminder, next_reminder, 13);
        digit *= 10;
        digit %= 13;
    }

    printf("%ld\n", reminder[5]);
    return 0;
}


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

int main() {
  int n;
  cin >>n;
  vector<int> p(n);
  vector<int> s(n);
  vector<int> t(n);
  int Aflag=0,Bflag=0;
  int count=0;
  rep(i,n) cin>>p.at(i);
  rep(i,n) s.at(i)=p.at(i);
  sort(s.begin(),s.end());
  rep(i,n) if(p.at(i)==s.at(i))count++;
  if(count==n) Aflag=1; 
//  cout << Aflag;
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      int count=0;
      rep(i,n) t.at(i) = p.at(i);
      t.at(j) = p.at(i);
      t.at(i) = p.at(j);
      rep(k,n){
        if(t.at(k) == s.at(k))count++;
      }
      if(count==n)Bflag=1;
    }
  }

  if(Aflag==1 || Bflag==1) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
///A drunk man will find his way home, but a drunk bird may get lost forever...
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define int long long
#define sz(x) (int)x.size()
const int mx = 1000 * 100 + 5;
vector < int > ad[mx];
int ans, mark[mx], mark2[mx], a[mx], cnt = 1;
void dfs(int v){
	mark[v] = cnt;
	mark2[a[v]] = cnt;
	for(int i = 0; i < sz(ad[v]); i++){
		int u = ad[v][i];
		if(!mark[u])
			dfs(u);
	}
	return;
}
int32_t main(){
	ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	int n, m, u, v;
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		a[i]--;
	}
	for(int i = 0; i < m; i++){
		cin >> u >> v;
		u--, v--;
		ad[u].pb(v);
		ad[v].pb(u);
	}
	for(int i = 0; i < n; i++){
		if(!mark[i]){
			dfs(i);
			cnt++;
		}
	}
	for(int i = 0; i < n; i++)
		if(mark[i] == mark2[i])
			ans++;
	cout << ans << endl;
	return 0;
}


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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var t = Console.ReadLine();

            var output = a(s, t) ? "Yes" : "No";
            Console.WriteLine(output);
        }

        static bool a(string s, string t)
        {
            var s_sorted = s.OrderBy(c => c).ToArray();
            var t_sorted = t.OrderByDescending(c => c).ToArray();

            for (var i = 0; i < s_sorted.Length; i++)
            {
                if (i == t_sorted.Length) return false;
                if (s_sorted[i] > t_sorted[i]) return false;
                if (s_sorted[i] < t_sorted[i]) return true;
            }

            return s_sorted.Length < t_sorted.Length;
        }
    }
}


Measured memory_bytes: 13268
//R<3S
#include <bits/stdc++.h>
#define hell 1000000007
#define PI 3.14159265358979323844
#define mp make_pair
#define pb push_back
#define fi first 
#define se second
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))  
#define REVERSE(v) reverse(ALL(v))
#define endl "\n"
#define vecmax(v) max_element(all(v))
#define vecmin(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(x) for(auto i : x)
#define sz(a) (int)a.size()
#define sl(a) (int)a.length()
#define int long long
#define ld long double 
#define pii std::pair<int, int> 
#define pll std::pair<ll, ll>  
#define vi vector<int>  
#define vl vector<ll>
#define vvi vector<vi > 
#define vii vector<pii >
#define mii map<int,int>
#define mll map<ll,ll>


using namespace std;

void solve()
  {

	int x;
	cin>>x;
	if(x>=30)cout<<"Yes";
	else cout<<"No";
	cout<<endl;

  }



signed main()
{
   std::ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   int t;
   t=1;
   //cin>>t;
   while(t--)
    {
        solve();
    }


   return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 100000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

int N;
int a[100000+10];


signed main(void) {
    cin>>N;
    set<int> S;
    rep(i, N) {
        cin>>a[i];
        S.insert(a[i]);
    }
    bool ok=false;
    if (S.size()==1) { //全部同じ
        if (N>=2*a[0]||N==a[0]+1) ok=true;
    } else if (S.size()==2) { //2種類
        vi nums;
        for (auto e:S) {
            nums.pb(e);
        }
        sort(all(nums));
        int m=nums[0];
        int M=nums[1];
        if (M!=m+1) {
            cout<<"No"<<endl;
            return 0;
        }
        int B=0;
        rep(i, N) {
            if (a[i]==m) B++;
        }
//        cout << "M:" << M << endl;
//        cout << "m:" << m << endl;
//        cout << "B:" << B << endl;
        if (M-B>0 && 2*(M-B)<=N-B) ok=true;
    } else {
        cout<<"No"<<endl;
        return 0;
    }
    if (ok) cout<<"Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main() {
  int N;
  scanf("%d", &N);
  int a[N];
  bool odd = false;
  for (int i = 0; i < N; ++i) {
    scanf("%d", &a[i]);
    if(a[i]%2!=0) odd = true;
  }

  if(odd) cout << "first" << endl;
  else cout << "second" << endl;

  



}



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

const int MAXN = 5 + 100000;
int arr[MAXN][3];
int memo[MAXN][3];
int N;

int dp(int i, int l) {
    if(i == N) {
        return 0;
    }
    int& ans = memo[i][l];
    if(ans == -1) {
        ans = 0;
        foi(j,0,3) {
            if(j == l) continue;
            ans = max(ans, arr[i][j] + dp(1 + i, j));
        }
    }
    return ans;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    cin >> N;
    foi(i,0,N) {
        foi(j,0,3) {
            cin >> arr[i][j];
        }
    }
    memset(memo, -1, sizeof memo);
    cout << max(dp(0,0), max(dp(0, 1), dp(0, 2))) << '\n';
    return 0;
}


Measured memory_bytes: 10368
import sys

def dis(x0, y0, x1, y1):
    d = 0
    d += abs(x0 - x1)
    d += abs(y0 - y1)
    return d

if __name__ == '__main__':
    N = int(sys.stdin.readline())
    lines = sys.stdin.readlines()

    ls = [[0, 0, 0]]
    for line in lines:
        ls.append([int(i) for i in line.split()])

    for i in range(1, len(ls)):
        d = dis(ls[i][1], ls[i][2], ls[i-1][1], ls[i-1][2])
        t = ls[i][0] - ls[i-1][0]
        # print(ls[i], d, t)
        if d <= t and t % 2 == d %  2:
            continue
        else:
            print('No')
            break
    else:
        print('Yes')


Measured memory_bytes: 28296
<?php
fscanf(STDIN, "%d %d", $N, $M);
fscanf(STDIN, "%s", $S);
fscanf(STDIN, "%s", $T);
$ans = lcm($N, $M);

$step = $ans / $N;
for ($i = 0; $i < $N; $i++) {
    $SS[$i * $step] = $S[$i];
}

$step = $ans / $M;
for ($i = 0; $i < $M; $i++) {
    $TT[$i * $step] = $T[$i];
}

$bool = true;
foreach ($SS as $k => $v) {
    if (isset($TT[$k]) && $SS[$k] !== $TT[$k]) {
        $bool = false;
    }
}

echo $bool ? $ans : '-1';

function gcd($m, $n){
    if($n > $m) list($m, $n) = array($n, $m);
     
    while($n !== 0){
        $tmp_n = $n;
        $n = $m % $n;
        $m = $tmp_n;
    }
    return $m;
}
 
function lcm($m, $n){
    return $m * $n / gcd($m, $n);
}

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

int main(){
  string s,t;
  cin>>s>>t;
  int n = s.size();
  int m = t.size();
  vector<vector<int>> a(26);
  
  rep(i,n) a[s[i]-'a'].pb(i);
  rep(i,n) a[s[i]-'a'].pb(i+n);
  
  int res = 0;
  ll ans = 0;
  rep(i,m){
    int p = t[i]-'a';
    if(a[p].size()==0){
      cout << -1 << endl;
      return 0;
    }
    res = *lower_bound(a[p].begin(),a[p].end(),res)+1;
    if(res>=n){
      res -= n;
      ans += n;
    }
  }
  ans += res;
  cout << ans << endl;
} 

Measured memory_bytes: 1724
'use strict'

function main(input) {
  input = input.split('\n').map(v => ~~v)
  const n = input[0]
  const price = input.slice(1, -1).sort((a, b) => b - a)

  price[0] = price[0] / 2
  const ans = price.reduce((a, b) => a + b)
  console.log(ans)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 11468
N = gets.chop.to_i
A = [nil]
N.times do
  A << gets.chop.to_i
end

now = 1
count = 0
pushed = []

while true do
  if now == 2
    break
  elsif count % 100 == 0
    if pushed.include?(now)
      count = -1
      break
    end
  end
  pushed << now
  now = A[now]
  count += 1
end

puts count

Measured memory_bytes: 3836
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  long long int n,a,b;
  cin>>n;
  vector<long long int> x(n);
  for(int i=0;i<n;i++) cin>>x[i];
  cout<<*max_element(x.begin(),x.end())-*min_element(x.begin(),x.end())<<endl;
}

Measured memory_bytes: 256
//https://drken1215.hatenablog.com/entry/2019/12/14/171657
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
#define all(a)  (a).begin(),(a).end()
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x,y)* mod_pow(kai(y,y), mod - 2, mod) % mod;
}
int per(int n, int r) {
	r = n - r;
	int sum = 1;
	int i;
	for (i = n; i >= r + 1; i--)sum *= i;
	return sum;
}
struct UnionFind {
	vector<int> par;

	UnionFind(int n) : par(n, -1) { }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};
using pint=pair<int, int>;
int n;
vector<vector<pint>>v;
// 整数 bit に対応する「決め打ち」が整合しているかを判定
bool judge(int bit) {
	// i 人目の証言を検証する
	rep(i, n) {
		// i 人目が「不親切」だったら、証言はすべて無意味
		if(!(bit&(1<<i)))continue;
		for (pint xy : v[i]) {
			int x = xy.first;
			int y = xy.second;
			// y = 1 なのに「不親切」
			if (y == 1 && !(bit & (1 << x))) return false;
			// y = 0 なのに「正直者」だったらダメ
			if (y == 0 && (bit & (1 << x))) return false;
		}
	}
	return true;
}
signed main() {
	cin >> n;
	v.resize(n);
	for (int i = 0; i < n; ++i) {
		int a; cin >> a;
		v[i].resize(a);
		for (int j = 0; j < a; ++j) {
			cin >> v[i][j].first >> v[i][j].second;
			v[i][j].first--; 
		}
	}
	int ans = 0;
	for (int bit = 0; bit < (1 << n); ++bit) {
		if (judge(bit)) {
			int cnt = 0;
			// bit に含まれる人数を数える
			rep(i, n) {
				if (bit & (1 << i))cnt++;
			}
			ans = max(ans, cnt);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        bool i = false;
        int n, k, q, j;
        int[] m, x = new int[4], y = new int[4], p = new int[] { 10, 50, 100, 500 };

        while (true)
        {
            n = int.Parse(Console.ReadLine());
            if (n==0) { break; }
            if (!i) { i = !i; } else { Console.WriteLine(); }
            k = 0;
            m = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            for (j = 3; j >= 0; j--)
            {
                k += m[j] * p[j];
            }
            q = k - n;
            for (j = 3; j >= 0; j--)
            {
                x[j] = q / p[j];
		q -= x[j] * p[j];
                y[j] = Math.Max(0, m[j] - x[j]);
            }

            for (j = 0; j < 4; j++)
            {
                if (y[j]!=0) { Console.WriteLine("{0} {1}", p[j], y[j]); }
            }
        }
    }
}


Measured memory_bytes: 9404
package main

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

func getMoney(K int) int {
	switch K {
	case 1:
		return 300000
	case 2:
		return 200000
	case 3:
		return 100000
	}
	return 0

}

func main() {
	sc := NewScanner()
	X, Y := sc.NextInt(), sc.NextInt()
	total := getMoney(X) + getMoney(Y)
	if X == 1 && Y == 1 {
		total += 400000
	}
	fmt.Println(total)
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

int main() {
	int a,b , c, d;
	cin >> a >> b >> c >> d;
	if((abs(b - a) <= d && abs(c - b) <= d) || (abs(c - a) <= d)) {
		cout << "Yes";
	}else {
		cout << "No";
	}
}


















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

int main() {
  int N,M;
  cin>>N>>M;
  
  vector<int> vec(N,-1);
  
  for(int i=0;i<M;i++){
    int s,c;
    cin>>s>>c;
    if(vec.at(s-1)!=-1){
      if(vec.at(s-1)==c) vec.at(s-1)=c;
      else{
        cout<<-1<<endl;
        return 0;
      }
    }
    else vec.at(s-1)=c;
  }
  if(N==1&&vec.at(0)==-1){
    cout<<0<<endl;
    return 0;
  }
  if(vec.at(0)==0){
    if(N==1){
      cout<<0<<endl;
      return 0;
    }
    else{
      cout<<-1<<endl;
      return 0;
    }
  }
  else{
    if(vec.at(0)==-1) cout<<1;
    else cout<<vec.at(0);
    for(int i=1;i<N;i++){
      if(vec.at(i)==-1) cout<<0;
      else cout<<vec.at(i);
    }
    cout<<endl;
  }
    
    

  
}

Measured memory_bytes: 3624
def grundy(N, K):
    if N < K:
        return 0
    while N % K:
        hi = N / (N / K + 1) 
        lo = 1
        while hi - lo > 1:
            mid = (hi + lo) / 2
            M = N - mid * (N/ K + 1)
            if M / K == N / K:
                lo = mid
            else:
                hi = mid
        m = N / K + 1
        N -= m * lo
    return N / K

N = input()
ans = 0
for i in xrange(N):
    a, k = map(int, raw_input().split())
    ans ^= grundy(a, k)
print "Takahashi" if ans else "Aoki"


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

int main() {
    int N,M; cin >> N >> M;
    vector<int> H(N);
    for(int i=0; i<N; i++){
        cin >> H.at(i);
    }
    vector<int> maxh(N);
    for(int i=0; i<M; i++){
        int a,b;
        cin >> a >> b;
        maxh.at(a-1)=max(maxh.at(a-1),H.at(b-1));
        maxh.at(b-1)=max(maxh.at(b-1),H.at(a-1));
    }
    int ans=0;
    for(int i=0; i<N; i++){
        if(maxh.at(i)==0) ans++;
        else if(maxh.at(i)<H.at(i)) ans++;
    }
    cout << ans << endl;


}


Measured memory_bytes: 4048
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define fe(vec,lambda) std::for_each(vec.begin(), vec.end(), lambda );
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#define printv(val) std::for_each(val.begin(),val.end(),[](auto x){cout<<x<<"\n";});
#define lim 1000000007ll
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T& a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T& b,T a){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template <class T> T gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T lcm(T a, T b){return a * b / gcd(a, b);}
inline bool operator<(const pii &lhs,const pii &rhs){return(lhs.second<rhs.second);}
template<class T> vector<pair<T,T>> duplicator(const vector<T>& input){vector<pair<T,T>> out(input.size()-1);rep(i,input.size()-1){out[i].first =input[i  ];out[i].second=input[i+1];}return(out);}
vector<char> String_to_vector_char(const string& input){vector<char> out(input.size());rep(i,input.size()){out[i]=input[i];}return out;}
void YesNo(bool flag){ cout<<(flag? "A":"B");}

ll a,b,c,d,n,x;
vector<ll>v[3];
map<ll,ll>m;
string s,s2;
void input(){
    cin>>x>>a>>b;
}
void src(){
    YesNo(abs(a-x)<abs(b-x));
}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=3e5+5;
const int mod=998244353;
ll n,pre=1,ans=1,a[10];//R G B RG RB GB
char s[N];
int main()
{
	scanf("%lld",&n);
	scanf("%s",s+1);
	for (int i=1;i<=n;i++) pre=pre*i%mod;
	n*=3;
	for (int i=1;i<=n;i++)
	{
		if (s[i]=='R')
		{
			if (a[6])
			{
				ans=ans*a[6]%mod;
				a[6]--;
				continue;
			}
			if (a[2])
			{
				ans=ans*a[2]%mod;
				a[2]--;
				a[4]++;
				continue;
			}
			if (a[3])
			{
				ans=ans*a[3]%mod;
				a[3]--;
				a[5]++;
				continue;
			}
			a[1]++;
		}
		else if (s[i]=='G')
		{
			if (a[5])
			{
				ans=ans*a[5]%mod;
				a[5]--;
				continue;
			}
			if (a[1])
			{
				ans=ans*a[1]%mod;
				a[1]--;
				a[4]++;
				continue;
			}
			if (a[3])
			{
				ans=ans*a[3]%mod;
				a[3]--;
				a[6]++;
				continue;
			}
			a[2]++;
		}
		else if (s[i]=='B')
		{
			if (a[4])
			{
				ans=ans*a[4]%mod;
				a[4]--;
				continue;
			}
			if (a[1])
			{
				ans=ans*a[1]%mod;
				a[1]--;
				a[5]++;
				continue;
			}
			if (a[2])
			{
				ans=ans*a[2]%mod;
				a[2]--;
				a[6]++;
				continue;
			}
			a[3]++;
		}
	}
	ans=ans*pre%mod;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 512
class Char
  def initialize ch
    @value = ch[0]
  end

  def succ
    @value.succ[0]
  end

  def succ!
    @value = self.succ
  end
  
  def to_s
    @value
  end
end

class SwapCipther
  def initialize cipther
    @cipther = cipther
  end

  def decoding i, j
    diff = (i - j).abs
    forward(i, diff)
    forward(j, diff)
    swap(i, j)
  end

  def to_s
    @cipther
  end

  private
  def forward(index, num)
    ch = Char.new(@cipther[index])
    num.times do
      ch.succ!
    end
    @cipther[index] = ch.to_s
  end

  def swap(i, j)
    @cipther[i], @cipther[j] = @cipther[j], @cipther[i]
  end
end

while gets.to_i != 0 do
  n = $_.to_i
  str = gets.chomp;
  cipther = SwapCipther.new(str)
  commands = []
  n.times do
    commands << gets.split.map{|x| x.to_i-1}
  end
  commands.reverse!
  commands.each do |command|
    cipther.decoding(command[0], command[1])
  end
  puts cipther
end

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

const ll mod=1000000007;

int main() {
  int n,k,sum=0;
  cin >> n >> k;
  vector<int> v(n);
  r(i,n) cin >> v[i];
  sort(v.begin(),v.end());
  r(i,k)sum+=v[i];
  cout<<sum<<endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <cmath>
using namespace std;
int main(int argc, char const *argv[])
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int ans = max(a,b);
    ans = max(ans,c);
    int sum = ans;
    while(d>0)
    {
        ans*=2;
        d--;
    }
    sum = a+b+c+ans-sum;
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <cstring>
#include <cstdio>
#include <cmath>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;

#define MOD (ll)(1e9 + 7)
#define MAX_N 200000

// memo
ll fact[MAX_N], fact_inv[MAX_N];

// n!
void factorial_prepare (ll n) {
  fact[0] = fact[1] = 1;
  for (int i = 2; i <= n; ++i) {
    fact[i] = (i * fact[i - 1]) % MOD;
  }
}

// pow(x, n) := x^n
ll power (ll x, ll n) {
  if (n == 0) return 1LL;

  ll ret = power((x * x) % MOD, n / 2) % MOD;
  if (n % 2) ret = (ret * x) % MOD;

  return ret;
}

// x^(-1) ≡ x^(MOD - 2) (mod MOD)
// (x!)^(-1) ≡ (x!)^(MOD - 2) (mod MOD)
void inverse_prepare (ll x) {
  // (x!)^(-1)を求めて, その値にx, x-1, ... を順に掛ける
  fact_inv[x] = power(fact[x], MOD - 2);

  for (int i = x - 1; i >= 1; --i) {
    fact_inv[i] = ((fact_inv[i + 1] * (i + 1)) % MOD);
  }
}

// nCr, nPr の想定される最大の n で初期化
void init (ll n) {
  factorial_prepare(n);
  inverse_prepare(n);
}

// nCr
ll C (ll n, ll r) {
  if (n < r || r < 0) return 0LL;
  if (n == r || r == 0) return 1LL;
  // n! / ((n - r)! * r!)
  return (((fact[n] * fact_inv[r]) % MOD) * fact_inv[n - r]) % MOD;
}

// nPr
ll P (ll n, ll r) {
  if (n < r || r < 0) return 0LL;
  return (fact[n] * fact_inv[r]) % MOD;
}

int h, w, a, b;

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


  cin >> h >> w >> a >> b;

  ll ans = 0;
  init(MAX_N); // nCr, nPr の想定される最大の n で初期化

  for (int i = b; i < w; ++i) {
    ans = (ans + (C(h - a - 1 + i, i) * C(a - 1 + w - i - 1, w - i - 1))) % MOD;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>                          
using namespace std;    
int t,a,n,h,ans;
double x,y,num=1e5; 
int main(){
	cin>>n>>t>>a;
	for(int i=1;i<=n;i++)
	{
		cin>>h;
		x=t-h*0.006;
		y=abs(a-x);
		if(y<num) num=y,ans=i;
	}
	cout<<ans;
	return 0;
}

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

int main(){
    int A,B;
    cin >> A >> B;
    A=(A+11)%13;
    B=(B+11)%13;
    if(A>B) cout << "Alice" << endl;
    else if(A==B) cout << "Draw" << endl;
    else cout << "Bob" << endl;

    return 0;
}

Measured memory_bytes: 256
N,x=map(int,input().split())
a=list(map(int,input().split()))
# スライムの色は0-initialで考える
'''
# スライムiを捕まえてスライムjに変化させるために必要な時間をc[i][j]とする
c=[[-1 for j in range(N)] for i in range(N)]
# スライムjを捕まえてスライムiに変化させるために必要な時間をdとする
d=[[-1 for j in range(N)] for i in range(N)]

for i in range(N):
    for j in range(N):
        d[(i+j)%N][i]=c[i][(i+j)%N]=a[i]+x*j

for ci in c:
    print(ci)
print()
for di in d:
    print(di)
print()
'''
# 
e=[]
for i in range(N):
    e.append([a[(i-k)%N] for k in range(N)])
'''
for ei in e:
    print(ei)
print()
'''
# 
f=[]
for i in range(N):
    fi=[e[i][0]]
    for j in range(1,N):
        fi.append(min(fi[-1],e[i][j]))
    f.append(fi)
'''
for fi in f:
    print(fi)
'''
# k回の魔法で全てのスライムを得るために必要な時間をT[k]とする(0<=k<=N-1)
T=[]
for k in range(N):
    Tk=k*x+sum([f[i][k] for i in range(N)])
    T.append(Tk)

ans=min(T)

print(ans)

# スライムiを最も早く得るために必要なスライムj=s[i]と魔法を唱える回数k[i]=(j-i)%Nを計算する
# →この方針ではWA
'''
s=[d[i].index(min(d[i])) for i in range(N)]
k=[(s[i]-i)%N for i in range(N)]

print(s)
print(k)
'''
# 魔法を唱える回数の最大値(=魔法を唱える回数の合計)*xに，各スライムを捕まえるのに必要な時間Σa[s[i]]を合計する
'''
ans=max(k)*x+sum([a[s[i]] for i in range(N)])
'''
# print(ans)

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

using namespace std;

typedef long long          ll;
typedef unsigned long long ull;
typedef vector<int>	       vi;
typedef vector<bool>       vb;
typedef map<int, int>      mii;
typedef pair<int, int>     ii;

#define INF                0x3f3f3f3f
#define INFLL              0x3f3f3f3f3f3f3f3f
#define each(x, s)         for(auto& x : s)
#define loop(x)	           for(int i = 0;i < x;i++)
#define vloop(v, x)        for(int v = 0;v < x;v++)
#define avg(l, r)          l + (r - l) / 2
#define iter(a)            a.begin(), a.end()
#define riter(a)           a.rbegin(), a.rend()
#define endl               "\n"

const ll mod = 1000000007;

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

	int a;
	cin >> a;
	cout << a + a * a + a * a * a << endl;
	return 0;
}



Measured memory_bytes: 3652
package main

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

var (
	m  = make(map[int]bool)
	a  int
	x  int
	ok bool
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()

	for sc.Scan() {
		a, _ = strconv.Atoi(sc.Text())
		m[a] = !m[a]
	}

	count := 0
	for _, v := range m {
		if v {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 5504
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
	int n, t, a;
	cin >> n >> t >> a;
	double d = 0x3f3f3f3f;
	int res = -1;
	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		if (abs(t - 0.006 * x - a) < d) {
			d = abs(t - 0.006 * x - a);
			res = i;
		}
	}
	cout << res << endl;
}


Measured memory_bytes: 3596