akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)

                    
using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll mod = 1e9+7;
void chmod(ll &M){
  if(M >= mod) M %= mod;
  else if(M < 0){
     M += (abs(M)/mod + 1)*mod;
    M %= mod;
}
}
ll modpow(ll x, ll n){
   if(n==0) return 1;
  ll res=modpow(x, n/2);
 if(n%2==0) return res*res%mod;
else return res*res%mod*x%mod;
}
int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

using namespace std;
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
int main()
{
    string S;
    cin >> S;
    if (S == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
 }

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;
typedef long long ll;

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

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

    for (const auto& tmp : a){
        cout << tmp.second << " ";
    }

    cout << endl;
}

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

int main() {
	int N = 0;
	double* A;
	double B = 0;

	cin >> N;

	A = new double[N];
	
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int j = 0; j < N; j++) {
		B += (1 / A[j]);
	}

	printf("%.16f", 1/B);

	delete[] A;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
 
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

#define MOD 1000000007LL

ll n, k;
vector<ll> a;

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

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

  for (int i=k-1; i<n-1; i++) {
    if (a[i-k+1] < a[i+1]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 4816
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[] = new int[n+1];
    int b[] = new int[n];
    for(int i=0;i<n+1;i++){
      a[i]=sc.nextInt();
    }
    for(int i=0;i<n;i++){
      b[i]=sc.nextInt();
    }
    long answer =0;
    
    for(int i=0;i<n;i++){
      answer=answer+Math.min(a[i],b[i]);
      b[i]=Math.max(b[i]-a[i],0);
      if(b[i]>0){
        answer=answer+Math.min(a[i+1],b[i]);
        a[i+1]=Math.max(a[i+1]-b[i],0);
      }
      
      
      
    }
    System.out.println(answer);
    
    
    
  }
  

  
}

Measured memory_bytes: 65680
object Main extends App {
  val read = scala.io.StdIn.readLine()
  val arrayNd =  read.split(" ").map(_.toInt).toVector
  val n = arrayNd(0)
  val d = arrayNd(1)
  var xArray = Vector.empty[Vector[Int]]
  (1 to n).foreach { _ =>
    val readX = scala.io.StdIn.readLine()
    xArray :+= readX.split(" ").map(_.toInt).toVector
  }
  var count = 0
  for(i <- 0 to n - 2) {
    for(k <- (i+1) to n -1) {
      var sum = 0d
      for(j <- 0 to d - 1) {
        sum += Math.pow((xArray(i)(j) - xArray(k)(j)), 2)
      }
      val sqrtDouble = Math.sqrt(sum)
      if(sqrtDouble - sqrtDouble.toInt == 0) {
        count += 1
      }
    }
  }
  println(count)
}

Measured memory_bytes: 25528
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int A,B,X;
  cin>>A>>B>>X;
  string ans="NO";
  if(A<=X&&X<=A+B)
    ans="YES";
  cout<<ans;
  }


Measured memory_bytes: 256
import math

def prime_numbers(numbers):
    return list(map(is_prime, numbers)).count(True)


def is_prime(n):
    if (n == 2):
        return True
    elif (n % 2 == 0):
        return False
    else:
        i = 3
        while i <= math.sqrt(n):
            if n % i == 0:
                return False
            i += 2

    return True

if __name__ == '__main__':
    n = int(input())
    numbers = []
    for i in range(0, n):
        numbers.append(int(input()))
    print(prime_numbers(numbers))



Measured memory_bytes: 6000
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math


NN = 202020
MOD = 10**9+7
# MOD = 998244353
INF = float("inf")

n = int(input())
A = list(map(int, input().split()))

seen = defaultdict(int)
count = 0
for i in range(n):
    count += seen[A[i]-i]
    seen[-A[i]-i] += 1
    # print(i, A[i]-i, count, seen)

print(count)





Measured memory_bytes: 142288
import math as m
import itertools


def calc(x1, y1, x2, y2):
    return m.sqrt((x1 - x2)**2 + (y1 - y2)**2)


def resolve():
    N = int(input())
    xx, yy = [], []
    for i in range(N):
        x, y = [int(i) for i in input().split()]
        xx.append(x)
        yy.append(y)
    n = [i for i in range(N)]
    perm = itertools.permutations(n)
    sumD = 0.0
    count = 0
    for p in perm:
        count += 1
        for i in range(N - 1):
            sumD += calc(xx[p[i]], yy[p[i]], xx[p[i + 1]], yy[p[i + 1]])
    print(sumD / count)


resolve()


Measured memory_bytes: 3064
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    double a = sc.nextDouble();
    double b = sc.nextDouble();
    double x = sc.nextDouble();
    sc.close();

    double answer = 0.0;
    double rangle = 0.0;

    double wh = x / (a * a); 
    double dh = b - wh;

    if (dh <= wh) {

      rangle = Math.atan2(dh * 2, a);
      answer = rangle * 180.0 / Math.PI;

    } else {

      double ab = a * b;
      double x2 = 2 * x;
      double a2 = x2 / ab;
      rangle = Math.atan2(a2, b);
      answer = rangle * 180.0 / Math.PI;
      answer = 90 - answer;

    }

    System.out.println(answer);

  }

}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  int N;
  cin >>N;
  
    if(N%111 !=0) {
      int a=N%111;
  
      int c=N+(111-a);
      cout <<c<< endl;
    }
    else {
      cout <<N<< endl;
    }
  }
      


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

const int mx=1e7+777;
ll dp[mx];
int flag[mx];

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	dp[1]=1;
	for (int i=0; i<mx; i++)
		flag[i]=i;
	flag[0]=flag[1]=0;
	for (int i=2; i*i<mx; i++)
		if(flag[i])
			for (int j=i; j*i<mx; j++)
				flag[i*j]=min(flag[i*j],flag[i]);
	for (int i=2; i<mx; i++) {
		int t=i, cur=0, val=flag[i];
		while(t%val==0)
			t/=val, cur++;
		dp[i]=dp[t]*(1+cur);
	}
	int N; cin>>N;
	ll ret=0;
	for (int K=1; K<=N; K++)
		ret+=K*dp[K];
	cout<<ret<<"\n";
	return 0;
}

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

int N;
vector<pair<int, int> > interval;
vector<pair<int, int> > result;

int main() {
  cin >> N;
  
  int left, right;
  for (int i = 0; i < N; i++) {
    cin >> left >> right;
    interval.push_back( pair<int, int>(left, right) );
  }

  sort(interval.begin(), interval.end());

  result.push_back(interval[0]);
  for(int i = 1; i < (int)interval.size(); i++) {
    auto &last = result.back();

    auto &now_check = interval[i];
    
    if (last.second >= now_check.first) {
      last.second = now_check.second;
    } else {
      result.push_back(now_check);
    }
  }

  int cnt = 0;
  for(auto &iter : result) {
    //    cout << iter.first << " " << iter.second << endl;
    cnt += (iter.second - iter.first + 1);
  }

  cout << cnt << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <math.h>
using namespace std;

#define M 100001
long long int A[M];

int cmp(const void *a,const void *b)
{ return *(int *)b-*(int *)a; }

int main()
{
    long long int N, i;
    cin >> N;
    for(i = 0; i < N; i++) cin >> A[i];
    
    qsort(A, N, sizeof(A[0]), cmp);
    
    long long int box[2] = {0}; int j=0;
    
    for(i = 0; i < N; i++)
    {
        if(A[i] == A[i+1])
        { box[j++] = A[i]; i++; if(j > 1) break; }
    }
    
    /*
    for(i = 0; i < N; i++) cout << A[i] << " ";
    cout << endl;
    
    for(i = 0; i < 2; i++) cout << box[i] << " ";
    cout << endl;
    */
    
    long long int result = box[0] * box[1];
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 1788
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
#define PI acos(-1.0);

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
	int H,N; cin >> H >> N;
	vector<int> A(N);
	rep(i,N) cin >> A[i];
	ll sum = 0;
	rep(i,N) sum += A[i];
	cout << (sum >= H?"Yes":"No") << endl;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
template <typename T> using V = vector<T>;
    
int n, l, r;

bool check(int x, const V<int> &A) {
    for(int i = 0; i < n; i++) {
        if(x % A[i]) continue;
        return (i + 1) % 2 == 1;
    }
    return n % 2 == 0;
}

int calc(int right, const V<int> &A) {
    int ret = 0;
    for(int x = 1; x < right; x++) ret += check(x, A);
    return ret;
}

bool solve() {
    cin >> n >> l >> r;
    if(!(n + l + r)) return false;
    r++;
    V<int> A(n);
    for(int &e : A) cin >> e;
    cout << calc(r, A) - calc(l, A) << endl;
    return true;
}

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



Measured memory_bytes: 3072
guusuu, kisuu = map(int, input().split())
guusuuhairetu = [i for i in range(2, guusuu * 2 + 1, 2)]
kisuuhairetu = [i for i in range(1, kisuu * 2, 2)]
count = 0
haiiretu = guusuuhairetu + kisuuhairetu
hairetu2 = guusuuhairetu + kisuuhairetu
for i in hairetu2:
    haiiretu.remove(i)
    for u in haiiretu:
        if (i + u) % 2 == 0:
            count += 1
print(count)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(X,Y) for(int X=0;X<(Y); ++X)
#define pb push_back
#define eb emplace_back
#define all(X) (X).begin(),(X).end()

using namespace std;

typedef long long ll;
const ll MOD=1e9+7;
const ll INF=1e15;

ll dp[1<<15][112];

int main(){
  int n,m;
  while(cin>>n>>m, n){
    fill(dp[0],dp[1<<15],INF);
    rep(i,1<<15) dp[i][0]=0;
    vector<ll> a(n);
    vector<ll> vs(m);
    rep(i,n) cin>>a[i];
    rep(i,m) cin>>vs[i];
    sort(all(vs));
    rep(i,m){
      rep(j,n)rep(k,1<<n)if(k>>j&1) dp[k][i]=min(dp[k][i],dp[k^(1<<j)][i]);
      rep(j,1<<n){
	ll sum=0;
	rep(k,n)if(j>>k&1) sum+=a[k];
	dp[j][i+1]=min(dp[j][i+1],dp[j][i]+abs(sum-vs[i]));
      }
    }
    //rep(i,m+1){rep(j,1<<n) cout<<dp[j][i]<<",";cout<<endl;}
    ll re=INF;
    rep(i,1<<n) re=min(re,dp[i][m]);
    cout<<re<<endl;
  }
  return 0;
}

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

    # divisors.sort()
    return divisors
N = make_divisors(a)
#print(N)
m = 10000000000000
for i in range(len(N)):
  if m > (a//N[i]-1) + (N[i]-1):
    m = (a//N[i]-1) + (N[i]-1)
    
print(m)
  

Measured memory_bytes: 3280
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

int main() {
	int n, m, a, b;
	set<int> st;
	cin >> n;
	while (n--) {
		cin >> a >> b;
		st.insert(a * 60 + b);
	}
	cin >> m;
	while (m--) {
		cin >> a >> b;
		st.insert(a * 60 + b);
	}

	for (auto it = st.begin(); it != st.end(); ++it) {
		if (it != st.begin())
			cout << " ";
		printf("%d:%02d", *it / 60, *it % 60);
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 3236
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
int main(){
	int n,q,a,b,c;
	scanf("%d",&n);
	vector<int>v(n);
	for(int i=0;i<n;i++)
    scanf("%d",&v[i]);
	for(scanf("%d",&q);q--;)
	{
		scanf("%d%d%d",&a,&b,&c);
		for(int k=0;k<b-a;k++)
		swap(v[a+k],v[c+k]);
	}
	for(int i=0;i<n;i++)
    printf(i<n-1?"%d ":"%d\n",v[i]);
}


Measured memory_bytes: 2756
#include <bits/stdc++.h>
 
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
typedef long long ll;
//const ll mod =  1000000007;
const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------

int main(){
  int n,m;
  cin>>n>>m;
  vll c(m);
  rep(i,m)cin>>c.at(i);
  
  vvll dp(m+1,vll(n+1));
  rep(i,m+1){
      rep(j,n+1)dp.at(i).at(j)=maxn;
  }
  dp.at(0).at(0)=0;
  
  rep(i,m){
      rep(j,n+1){
          if(j-c.at(i)>=0)dp.at(i+1).at(j)=min(dp.at(i).at(j),dp.at(i+1).at(j-c.at(i))+1);
          else dp.at(i+1).at(j)=dp.at(i).at(j);
      }
  }
  cout<<dp.at(m).at(n)<<endl;
  
}
  

   
    

   



Measured memory_bytes: 11600
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,c=1,ans=0,a[100005],b[100005]={};
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(;;){
		b[c-1]++;
		c=a[c-1];
		if(b[c-1]==1){
			cout<<"-1"<<endl;
			return(0);
		}
		ans++;
		if(c==2){
			break;
		}
	}
	cout<<ans<<endl;
  return(0);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":"\n");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void PSUM(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int n; cin >> n;
    if (n == 1) {
        cout << "Hello World" << endl;
        return 0;
    }
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;

    return (0^_^0);
}



Measured memory_bytes: 256
n = int(input())

dict_ACGT = {}

for _ in range(n):

    command, string = input().split()
    
    if   command == "insert":
        # insert str
        dict_ACGT[string] = ""
    elif command == "find":
        # find str
        if string in dict_ACGT:
            print("yes")
        else:
            print("no")
    else:
        raise



Measured memory_bytes: 33112
#include <stdio.h>

int main(){
	char n[4];
	int i;
	
	gets(n);
	
	for(i=0;i<3;i++){
		if(n[i]=='1'){
			n[i]='9';
		}else{
			n[i]='1';
		}
	}
	
	n[3]='\0';
	
	puts(n);
	
	return 0;
}

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

#define MAX_N 100000


int N, x;
int A[MAX_N + 10];
long long ans = 0;

int main() {
    scanf("%d %d", &N, &x);
    for (int i = 0; i < N; ++i) {
        scanf("%d", &A[i]);
    }

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

    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
const int Maxx = 1e5 + 7;
const int Inf = 1e9 + 7;
int n;
int a[Maxx];
 
int main() {
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
    sort(a + 1, a + n + 1);
    int t = a[n] / 2;
    int min = Inf;
    int p;
    for(int i = 1; i <= n; i++) {
        if(abs(a[i] - t) <= min) {
            min = abs(a[i] - t);
            p = a[i];
        }
    }
    if(n == 2) printf("%d %d\n", a[2], a[1]);
    else printf("%d %d\n", a[n], p);
}

Measured memory_bytes: 2084
import java.util.*;

import javax.lang.model.util.ElementScanner6;

public class Main {
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		int r=Integer.parseInt(scan.next());
		double PI =Math.PI;
		System.out.print(r*2*PI);


	}
}
//end

Measured memory_bytes: 35872
import copy
S = list(input())
ans = 0
for i in range(2**(len(S)-1)):
  T = copy.copy(S)
  shift = 0
  for j in range(len(S)-1):
    if i & (1 << j):
      shift += 1
      T.insert(j+shift,"+")
  T.append("+")
  NS = ""
  for x in T:
    if x != "+":
      NS = NS + x
    elif x == "+":
      ans += int(NS)
      NS = ""
  if "+" not in T:
    ans += int("".join(T))
print(ans)

Measured memory_bytes: 74072
<?php
 
fscanf(STDIN, '%s' ,$a);
fscanf(STDIN, '%s' ,$b);
fscanf(STDIN, '%s',$c);

$as =str_split($a);
$bs =str_split($b);
$cs =str_split($c);
echo $as[0].$bs[1].$cs[2];

Measured memory_bytes: 3576
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<int,int>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
V<ll> a;
  ll n,k;
bool C(ll m){
   ll cnt=0, ok,ng,mid;
   for(int i=0;i<n;i++){
      if(a[i]>=0){
         //積がm以下の最大indexの値
         ok=i;ng=n;
         while(ng-ok>1){
            mid=(ok+ng)/2;
            if(a[i]*a[mid]>m)ng=mid;
            else ok=mid;
         }
         cnt+=ok-i;
      }
      else{
         // 積がm以下の最小のindex
         ok=n,ng=i;
         while(ok-ng>1){
            mid=(ok+ng)/2;
            if(a[i]*a[mid]>m)ng=mid;
            else ok=mid; 
         }
         cnt+=n-ok;
      }
   }
   return cnt>=k;
}
int main(){
   cin>>n>>k;
   a.resize(n);
   for(int i=0;i<n;i++)cin>>a[i];
   sort(all(a));
   ll ok=inf,ng=-inf,mid;
  while(ok-ng>1){
     mid=(ok+ng)/2;
     if(C(mid))ok=mid;
     else ng=mid;
  }
  cout<<ok<<endl;
}

Measured memory_bytes: 1792
#include<stdio.h>

int main(void){
 int n;
 while(scanf("%d",&n),n!=0){
 
 int i;
 int j;
 j=n/4;
 int sum;
 sum=0;
 for(i=0;i<j;i++){
  int a[j];
  scanf("%d",&a[i]);
  sum+=a[i];
 }
 printf("%d\n",sum);
 }
return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

const int maxN = 3001; int n, t;
struct Dish
{
  int a, b;
  void read() { scanf("%d %d", &a, &b); }
  bool operator<(const Dish &other) const { return a < other.a || (a == other.a && b > other.b); }
};
Dish dishes[maxN];

int memo[maxN][2*maxN];
int solve(int i = 0, int b = 0)
{
  if (i == n) return 0;
  if (memo[i][b] != -1) return memo[i][b];

  int ans = solve(i + 1, b);
  if (b < 2*t)
    ans = max(ans, solve(i + 1, min(2*t, b + 2*dishes[i].a)) + dishes[i].b);
  return memo[i][b] = ans;
}

int main()
{
  while (scanf("%d %d", &n, &t) != EOF)
  {
    for (int i = 0; i < n; i ++)
      dishes[i].read();
    sort(dishes, dishes+n);

    memset(memo, -1, sizeof(memo));
    int ans = solve();
    printf("%d\n", ans);
  }
  return 0;
}

Measured memory_bytes: 70784
#include<bits/stdc++.h>
#define ll long long int
#define jmp cout<<"\n"
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vl>
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define printv(v) for(auto x:v) cout<<x<<" "; jmp;
#define endll "\n"
#define SORT(v) sort(v.begin(),v.end())
#define REV(x)  reverse(x.begin(),x.end())
#define UNI(a) a.erase( unique( a.begin(), a.end() ), a.end() )
#define si(x) x.size()
#define ff first
#define ss second
#define iin insert
using namespace std;
void solve()
{

	ll n, k;
	cin >> n >> k;
	vl a(n);
	for (ll i = 0; i < n; i++)
		cin >> a[i];
	bool dp[k + 1] = {0};
	for (ll i = 0; i <= k; i++)
	{
		for (ll j = 0; j < n; j++)
		{
			if (i >= a[j] && !dp[i - a[j]])
				dp[i] = true;
		}
	}

	dp[k] ? cout << "First" : cout << "Second";

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


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

const int MAX_N = 200005;
int N, K;
int logs[MAX_N];

bool check(int maxlen) {
  if (maxlen == 0) return false;
  int k = 0;
  for (int i = N -1; i  >= 0; --i) {
    int log = logs[i];
    if (log <= maxlen) continue;
    k += log / maxlen;
    if (k > K) return false;
  }
  return true;
}

int main() {
  scanf("%d %d", &N, &K);
  int mm = 0;

  for (int i = 0; i < N; ++i) {
    scanf("%d", logs + i);
    mm = std::max(mm, logs[i]);
  }
  std::sort(logs, logs + N);

  long long hi = 1ll<<31;
  long long lo = 0;
  while (hi - lo > 1) {
    long long mid = (hi + lo) / 2;
    if (check(mid)) {
      hi = mid;
    } else {
      lo = mid;
    }
  }
  if (check(lo)) printf("%lld\n", lo);
  else printf("%lld\n", hi);
}


Measured memory_bytes: 4588
#include <iostream>

using namespace std;

int main() {
  int l, r, d, min, max;
  int p = 0;
  cin>>l>>r>>d;
  min = l/d;
  max = r/d;
  if(float(l)/float(d) == float(l/d)){
    p = 1;
  }
  cout<<max - min + p;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define test int t;cin>>t;while(t--)
#define REP(i,n) for (int i = 1; i <= n; i++)
#define MOD 1000000007
#define ll long long
#define int ll
#define pb push_back
#define ii pair<int,int>
#define llll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<ii>
#define vllll vector<llll>
#define ff first
#define ss second
#define INF 1000000000
#define HINF 1000000000000000
#define mem(a,b) memset(a,b,sizeof(a))
#define deb(x) cout<<#x<<'='<<x<<endl
const double pi = 3.14159265358979323846;

ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int C(int n,int k)
{
	int ans=1;
	if(k>n-k)
	k=n-k;
	for(int i=1;i<=k;i++)
	ans*=(n-i+1),ans/=i;
	return ans;
}

void solve()
{

	int i=0,j=0,k=0,m,n,p,sum=0,cnt=0;
	cin>>n;
	string s;
	int a=0,b=0,c=0,d=0;
	while(n--)
	{
	    cin>>s;
	    if(s=="AC")
	    a++;
	    else if(s=="WA")
	    b++;
	    else if(s=="TLE")
	    c++;
	    else d++;
	    
	}
	cout<<"AC x "<<a<<endl;
	    cout<<"WA x "<<b<<endl;
	    cout<<"TLE x "<<c<<endl;
	    cout<<"RE x "<<d<<endl;
}
int32_t main() {
    fast
    //freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w+", stdout);
    //test
    {
        
        solve();
		
		      
    }
    return 0;
}
  

Measured memory_bytes: 3644
using System;

class MyClass
{
    public static void Main(string[] args)
    {
        while (true)
        {
            var str = Console.ReadLine();
            if (str == "-")
            {
                break;
            }
            var m = int.Parse(Console.ReadLine());
            for (int i = 0; i < m; i++)
            {
                var h = int.Parse(Console.ReadLine());
                var str1 = "";
                var str2 = "";
                for (int j = 0; j < str.Length; j++)
                {
                    if (j<h)
                    {
                        str1 += str[j];
                    }
                    else
                    {
                        str2 += str[j];
                    }
                }
                str = str2 + str1;
            }
            Console.WriteLine(str);
        }
    }
}


Measured memory_bytes: 17932
#include <bits/stdc++.h>
#define INF 100000007
#define rep(i, N) for(ll i = 0; i < N; i++)
#define rep2(i, j, k) for(ll i = j; i < k; i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define print(x) cout << x << "\n"
#define print2(x, y) cout << x << " " << y << "\n"
#define printv(vec) rep(i, vec.size()) cout << vec[i] << " "; print("");
#define ALL(v) v.begin(), v.end()
#define SUM(v) accumulate(ALL(v), 0)
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define SORT(v) sort(ALL(v))
#define REV(v) reverse(ALL(v))
typedef long long ll;
using namespace std;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vs = vector<string>;
using vvs = vector<vector<string>>;


void solve(){
	
	string N;
	cin >> N;

	vvl dp(1000010, vl(2, INF));
	dp[0][0] = 0;
	//dp[0][1] = 0;
	
	REV(N);
	N += '0';
	
	rep(i, N.size()) rep(j, 2){
		ll x = N[i] - '0';
		x += j;
		rep(a, 10){
			ll ni = i + 1;
			ll nj = 0;
			ll b = a - x;
			if(b < 0){
				nj = 1;
				b += 10;
			}
			chmin(dp[ni][nj], dp[i][j] + a + b);
		}
	}
	
	ll ans = min(dp[N.size()][0], dp[N.size()][1]);
	print(ans);
	
}

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	solve();
    
	return 0;
	
}





Measured memory_bytes: 58928
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
using P = pair<ll, ll>;
using Vec = vector<ll>;
using VecP = vector<P>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPR(i, n, 1)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define setp(n) cout << fixed << setprecision(n);
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fs first
#define sc second

const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	ll n, h;
	cin >> n >> h;
	Vec a(n), b(n);
	rep(i, n) cin >> a[i] >> b[i];

	sort(all(a), greater<ll>());
	sort(all(b), greater<ll>());

	ll ans = 0;
	rep(i, n){
		if(b[i] > a[0]){
			h -= b[i];
			ans++;
		}else break;
		if(h <= 0) break;
	}
	if(h > 0) ans += (h-1)/a[0]+1;
	co(ans);

	return 0;
}


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

int main() {
    int a, b, c, tmp;
    cin >> a >> b >> c;
    if (a < 0 || a > 10000) {
        return 0;
    }
    if (b < 0 || b > 10000) {
        return 0;
    }
    if (c < 0 || c > 10000) {
        return 0;
    }
    if (a > b) {
        tmp = a;
        a = b;
        b = tmp;
    }
    if (b > c) {
        tmp = b;
        b = c;
        c = tmp;
    }
    if (a > b) {
        tmp = a;
        a = b;
        b = tmp;
    }
    cout << a << " " << b << " " << c << endl;
}

Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> a(n),v(1000001);
    for(auto&i:a){
        cin>>i;
        ++v[i];
    }
    int ans{};
    for(auto&i:a){
        if(v[i]>1){
            ++ans;
            continue;
        }
        if(i==1) continue;
        if(v[1]){
            ++ans;
            continue;
        }
        for(int j{2};j*j<=i;++j)if(i%j==0){
            if(v[j]){
                ++ans;
                break;
            }
            if(v[i/j]){
                ++ans;
                break;
            }
        }
    }
    cout<<n-ans<<'\n';
}

Measured memory_bytes: 7952
/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl     '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii      map<ll,ll>
using namespace std;

#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
void solve()
{
  ll n,a,b;
  cin>>n>>a>>b;
  ll ans=((n/(a+b))*a+min(a,n%(a+b)));
  cout<<ans;
}
signed main()
{
  
    /***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);
    /***********************************/
 
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS=1;
//  cin>>TESTS;
  while(TESTS--)
  {
    solve();
    
  }
  TIME
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<long long> a(N);
  for (int i=0;i<N;i++){
    cin >> a[i];
  }
  for (int i=1;i<N;i++){
    a[i]+=a[i-1];
  }
  long long sum=a[N-1];
  long long ans=1000000000000000;
  for (int i=0;i<N-1;i++){
    long long count=abs(2*a[i]-sum);
    ans=min(count,ans);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define N 8
#define FREE -1
#define NFREE 1
using namespace std;

vector<int> row(N),col(N),dpos(2*N-1),dneg(2*N-1);
vector<vector<bool>> data(N,vector<bool>(N));

void init(){
  for(int i=0;i<N;i++){
    row.at(i) = FREE;
    col.at(i) = FREE;
  }
  for(int i=0;i<2*N-1;i++){
    dpos.at(i) = FREE;
    dneg.at(i) = FREE;
  }
}

void printdata(){
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			if(data.at(i).at(j)){
				if(row.at(i) != j) return; 
			}
		}
	}
	
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			if(row.at(i) == j) cout << "Q";
			else cout << ".";
		}
	cout << endl;
	}
}

void rec(int i){
	if(i == N){
		printdata();
		return;
	}
	for(int j=0;j<N;j++){
		if(col.at(j) == 1 || dpos.at(i+j) == 1 || dneg.at(i-j+N-1) == 1) continue;
		row.at(i) = j;
		col.at(j) = dpos.at(i+j) = dneg.at(i-j+N-1) = 1;
		rec(i+1);
		row.at(i) = col.at(j) = dpos.at(i+j) = dneg.at(i-j+N-1) = 0;
	}
}

int main(){
	init();
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			data.at(i).at(j) = 0;
		}
	}
	int k,r,c;
	cin >> k;
	for(int i=0;i<k;i++){
		cin >> r >> c;
		data.at(r).at(c) = 1;
	}
	rec(0);
}


Measured memory_bytes: 3116
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	char C[]="Christmas";
	char E[]=" Eve";
	int D;
	scan(D);
	printf("%s",C);
	for(int i=D;i<=24;i++){
		printf("%s",E);
	}
	kaigyo;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int N,C[1000],S[1000],F[10000],t[10000]={};
    cin >> N;
    for(int i=0;i<N-1;i++)    cin >> C[i] >> S[i] >> F[i];
    for(int i=0;i<N-1;i++){
        t[i]+=(S[i]+C[i]);
        for(int j=i+1;j<N-1;j++){
            while(t[i]%F[j]!=0 || S[j]>t[i]){
                t[i]++;
            }
            t[i]+=C[j];
        }
        cout << t[i] << endl;
    }
    cout << "0\n";
}

Measured memory_bytes: 256
// AOJ 0212
#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#define rep(i,a) for( int i = 0; i != (a); ++i )

typedef std::pair<int, int> P;
typedef std::pair<P, int> PP;

const int INF = 1 << 30;

int c, n, m, s, d;	
std::vector<P> G[100];
int dist[100][11];

int dijkstra()
{
	std::fill( (int*)dist, (int*)(dist+100), INF );
	dist[s][0] = 0;
	std::priority_queue<PP, std::vector<PP>, std::greater<PP> > pque;
	pque.push( PP( P( s, 0 ), 0 ) );
	while( !pque.empty() )
	{
		PP p = pque.top(); pque.pop();
		int v = p.first.first, cost = p.first.second, tic = p.second;

		if( dist[v][tic] < cost )
			continue;

		rep( i, G[v].size() )
		{
			P &e = G[v][i];

			if( tic < c && dist[e.first][tic+1] > dist[v][tic]+e.second/2 )
			{
				dist[e.first][tic+1] = dist[v][tic]+e.second/2;
				pque.push( PP( P( e.first, dist[e.first][tic+1] ), tic+1 ) );
			}

			if( dist[e.first][tic] > dist[v][tic]+e.second )
			{
				dist[e.first][tic] = dist[v][tic]+e.second;
				pque.push( PP( P( e.first, dist[e.first][tic] ), tic ) );
			}
		}
	}

	return *std::min_element( dist[d], dist[d]+11 );
}

int main()
{
	while( scanf( "%d%d%d%d%d", &c, &n, &m, &s, &d ), c|n|m|s|d )
	{
		--s; --d;
		rep( i, 100 )
			G[i].clear();

		rep( i, m )
		{
			int a, b, f;
			scanf( "%d%d%d", &a, &b, &f );
			--a; --b;
			G[a].push_back( P( b, f ) );
			G[b].push_back( P( a, f ) );
		}

		printf( "%d\n", dijkstra() );
	}

	return 0;
}

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

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

int x , y ,c=0  ;
  x=n*800;
  while (n>=15)
{ 
n-=15;
c++;
   }   

y=c*200;

printf("%d \n " , x-y );
return 0;
}

Measured memory_bytes: 256
use std::io;
use std::cmp;
use std::collections::BinaryHeap;

macro_rules! read {
    ($t:ty) => {
        {
            let mut buf = String::new();
            io::stdin().read_line(&mut buf);
            let mut sp = buf.trim().split(" ");
            sp.next().unwrap().parse::<$t>().unwrap()
        }
    };
    ( $( $t:ty ),* ) => {
        {
            let mut buf = String::new();
            io::stdin().read_line(&mut buf);
            let mut sp = buf.trim().split(" ");
            ($(
                {
                    sp.next().unwrap().parse::<$t>().unwrap()
                },
            )*)
        }
    };
}
macro_rules! read_vec {
    ($t:ty) => {
        {
            let mut buf = String::new();
            io::stdin().read_line(&mut buf);
            let mut sp = buf.trim().split(" ");
            let mut ret = vec![];
            for s in sp {
                ret.push(s.parse::<$t>().unwrap());
            }
            ret
        }
    }
}

fn main() {
    let (x, a, b) = read!(i32, i32, i32);
    let da = (x - a).abs();
    let db = (x - b).abs();
    if da < db {
        println!("A");
    } else {
        println!("B");
    }
}


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

int main() {
  int n;
  long long k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<vector<long long>> par(60, vector<long long>(n, 1e18));
  map<int, int> ma;
  for (int i = n - 1; i >= 0; i--) {
    if (ma.count(a[i])) {
      par[0][i] = ma[a[i]] - i;
    }
    ma[a[i]] = i + 1;
  }
  for (int i = n - 1; i >= 0; i--) {
    if (par[0][i] == 1e18) {
      par[0][i] = ma[a[i]] + n - i;
    }
  }
  for (int i = 0; i < 59; i++) {
    for (int j = 0; j < n; j++) {
      if (par[i][j] == 1e18) continue;
      int p = (par[i][j] + j) % n;
      if (par[i][j] + par[i][p] <= k * n) {
        par[i + 1][j] = par[i][j] + par[i][p];
      }
    }
  }
  long long sum = 0;
  for (int i = 59; i >= 0; i--) {
    if (sum + par[i][sum % n] <= k * n) {
      sum += par[i][sum % n];
    }
  }
  vector<int> ans;
  while (sum < k * n) {
    if (sum + par[0][sum % n] <= k * n) {
      sum += par[0][sum % n];
    } else {
      ans.push_back(a[sum % n]);
      sum++;
    }
  }
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i];
    cout << (i == ans.size() - 1 ? '\n' : ' ');
  }
  return 0;
}


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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  
  if(a+b > c+d){
    cout << "Left" << endl;
  }else if (a+b < c+d){
    cout << "Right" << endl;
  }else if(a+b == c+d){
    cout << "Balanced" << endl;
  }
  
  
  //test出力
  /*
  cout << "x:" << x << endl;
  */

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define cin(a,n) for(i=0;i<n;i++){cin>>a[i];sum+=a[i];}
#define ll long long int
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rf1(i,a,n) for(int i=a;i>n;i--)
#define cases() int q;cin>>q;while(q--)
#define ld long double
#define cout(a,n) for(i=0;i<n;i++)cout<<a[i]<<" ";
#define inf 1e9;
#define mod 1000000007;
#define PI 3.14159265358979323846264338327950L
using namespace std;
int main(){
  string s,t;
  cin>>s;
  cin>>t;
  int n=s.size();
  if(s==t.substr(0,n)){
    cout<<"Yes"<<'\n';
  }
  else
    cout<<"No"<<'\n';
return 0;
}



Measured memory_bytes: 3600
#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(void){
  int n, m;
  cin >> n >> m;
  vector<int> h(n);
  vector<bool> ok(n,true);
  rep(i,n) cin >> h[i];
  rep(i,m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    if(h[a] >= h[b]) ok[b] = false;
    if(h[b] >= h[a]) ok[a] = false;
  }
  int ans = 0;
  rep(i,n) if(ok[i]) ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define dd(x) cout << #x << " = " << x << ", "
#define de(x) cout << #x << " = " << x << endl
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = (int)1e9+7;
const int maxn = (int)-1;

#define IO(x) freopen(x".in", "r", stdin); freopen(x".out", "w", stdout);

const db eps = 1e-6;
bool eq(const db &a, db const &b) { return fabs(a - b) < eps; }
bool ls(const db &a, db const &b) { return a + eps < b; }
bool le(const db &a, db const &b) { return eq(a, b) || ls(a, b); }

int main ()
{
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if (a == b)
        printf("%d\n", c);
    if (a == c)
        printf("%d\n", b);
    if (c == b)
        printf("%d\n", a);



    return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  int fN;
  fN = N / 100000000
    + N / 10000000 - (N / 100000000) * 10
    + N / 1000000 - (N / 10000000) * 10
    + N / 100000 - (N / 1000000) * 10
    + N / 10000 - (N / 100000) * 10
    + N / 1000 - (N / 10000) * 10
    + N / 100 - (N / 1000) * 10
    + N / 10 - (N / 100) * 10
    + N % 10;
  
  if (N % fN == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<array>
#include<vector>
#include<set>
#include <utility>
#include <map>
using namespace std;

int digit(int n){
  int count=0;
  while(n/10>0){
    n/=10;
    count++;
  }
  return count+1;
}
int main(){
 int n; cin>>n;
 int ans=0;
 int di=digit(n);

 if(di ==1){
   for(int i=1;i<=n;i++)
   ans++;
   cout<<ans<<endl;
   return 0;
 }
 else if(di==2){
   cout<<9<<endl;
   return 0;
 }
 else if(di==3){
   ans=9;
   for(int i=100;i<=n;i++)
   ans++;
   cout<<ans<<endl;
   return 0;
 }
 else if(di==4){
   cout<<909<<endl;
 }
 else if(di==5){
   ans=909;
   for(int i=10000;i<=n;i++)
   ans++;
   cout<<ans<<endl;
 }
 else{
   cout<<90909<<endl;
 }
}


Measured memory_bytes: 256
from collections import Counter

N, A, B = map(int, input().split())
S = input()
c = Counter(S)
#S = list(S.replace("c", ""))
if B > len(S):
    B = len(S)
if A + B > len(S):
    AB = len(S)
count = 0
countB = 0

for i in range(N):
    if count < A + B:
        if S[i]=="a":
            count += 1
            print("Yes")
        elif S[i] == "b" and countB < B:
            count += 1
            countB += 1
            print("Yes")
        else:
            print("No")
    else:
        print("No")

    




Measured memory_bytes: 4296
#include<bits/stdc++.h>
using namespace std;
#define read FILE *fp;\
fp=freopen("testcase.txt","r",stdin);
#define ll long long
#define ull unsigned long long
#define sf(n) scanf("%I64d",&n)
#define pf(n) printf("%I64d\n",n)
#define loop for(long long i=0;i<n;i++)
#define lp(b,n) for(long long i=b;i<=n;i++)
#define pb(n) push_back(n)
#define srt(v) sort(v.begin(),v.end())
#define rvs(v) sort(v.begin(), v.end(), greater<long long>());
#define F first
#define S second
#define mp(a,b) make_pair(a,b);
#define fio ios::sync_with_stdio(false); cin.tie(),cout.tie();
ll llmax = numeric_limits<long long>::max();
ll llmin= numeric_limits<long long>::min();
ll mark[5010];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(),cout.tie();
    ll n;
    cin>>n;
    ll a[n+10],b=0,c=0,d=0;
    loop
    {
        cin>>a[i];
    }
    for(ll i=0;i<n;i++)
    {
        c=c+a[i];
        b=a[i];
        for(ll j=i+1;j<n;j++)
        {
            b=min(b,a[j]);
            if(a[j]==0)
            {
                break;
            }
            else if(a[j]>=b)
            {
                a[j]-=b;
            }
            else
            {
                a[j]=0;
            }
        }
        //cout<<c<<endl;
    }
    cout<<c<<endl;
}



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

typedef long long ll;
typedef pair<ll,ll> P;

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

int main() {
	int a, b;
	cin >> a >> b;
	int ans = max(a+b, a-b);
	ans = max(ans, a*b);
	cout << ans << endl;
	return 0;
}


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>;
using namespace std;

int main()
{
    ll a, b, k;
    cin >> a >> b >> k;

    a = a - k;
    if (a < 0) {
        b = b+(a);
    }

    cout << (a < 0 ? 0 : a) << " ";
    cout << (b < 1 ? 0 : b) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int K, A, B;
  cin >> K >> A >> B;
  bool f = false;
  int x = 0;
  for(int i=1;;i++){
    x = K * i;
    if(x >= A && x <= B){
      f = true;
      break;
    }
    if(x > B) {
      break;
    }
  }
  if(f) {
    cout << "OK" << endl;
  } else {
    cout << "NG" << endl;
  }
}

    

Measured memory_bytes: 3636