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

int main() {
  int n;
  cin >> n;
  int ans = 100000;
  int six = 0, nine = 0;

  for (int k = 0; k <= n; k++) {
    int a = k;
    while (a > 0) {
      six += a % 6;
      a /= 6;
    }
    int b = n - k;
    while (b > 0) {
      nine += b % 9;
      b /= 9;
    }
    ans = min(ans, nine + six);
    nine = 0;
    six = 0;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_DEPRECATE
#include<bits/stdc++.h>
#define Rint register int
#define MP make_pair
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii; // 注意必要时改类型
typedef vector<int> vi;
const int N = 1e5 + 5;
int n, m, ans;
vi edge[N];
queue<int> q;
int dp[N], in[N];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
#ifdef _DEBUG
	int tt = clock();
	// freopen("in.txt", "r", stdin);
#endif 

	cin >> n >> m;
	int x, y;
	for (Rint i = 0; i < m; ++i) {
		cin >> x >> y;
		edge[x].push_back(y);
		++in[y];
	}
	for (Rint i = 1; i <= n; ++i) if (!in[i]) q.push(i);
	while (!q.empty()) {
		int cur = q.front(); q.pop();
		for (Rint i = 0; i < edge[cur].size(); ++i) {
			int to = edge[cur][i];
			in[to]--;
			if (!in[to]) {
				dp[to] = dp[cur] + 1;
				q.push(to);
			}

		}

	}
	cout << *max_element(dp + 1, dp + n + 1) << endl;


#ifdef _DEBUG
	cerr << "\nTIME = " << clock() - tt << endl;
	tt = clock();
#endif

	return 0;
}


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    int x = 0;
    int y = 0;
    int z = 0;
    int p;
    REP(i, n) {
        cin >> p;
        if (p <= a) {
            x++;
        } else if (p <= b) {
            y++;
        } else {
            z++;
        }
    }
    cout << min({x, y , z}) << endl;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  bool pairwise = true;
  vector<int> atable(10000005, 0);
  vector<int> A(N);
  for (auto&& e : A) {
    cin >> e;
    if (e > 1 && atable[e] > 0) {
      pairwise = false;
    }
    atable[e]++;
  }
  vector<bool> table(10000005, false);
  for (int i = 2; i < 10000005; i++) {
    if (table[i]) continue;
    int cnt = 0;
    for (int k = i; k < 10000005; k += i) {
      cnt += atable[k];
      table[k] = true;
    }
    if (cnt > 1) {
      pairwise = false;
    }
  }
  if (pairwise) {
    cout << "pairwise coprime" << '\n';
    return 0;
  }
  int g = A[0];
  for (auto&& e : A) {
    g = gcd(g, e);
  }
  if (g == 1) {
    cout << "setwise coprime" << '\n';
  } else {
    cout << "not coprime" << '\n';
  }
  return 0;
}


Measured memory_bytes: 47500
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())


N,x,y = MI()
dp = [[[10**4]*401 for i in range(401)] for n in range(N+1)]
# dp[n][i][j] = 薬品1~nを用いて、タイプAをiグラム、タイプBをjグラムを作った時に必要な最小予算

dp[0][0][0] = 0
for n in range(1,N+1):
    a,b,c = MI()
    for i in range(401):
        for j in range(401):
            if i >= a and j >= b:
                dp[n][i][j] = min(dp[n-1][i][j],dp[n-1][i-a][j-b]+c)
            else:
                dp[n][i][j] = dp[n-1][i][j]

z = min(dp[N][x*i][y*i] for i in range(1,min(400//x,400//y)+1))

if z == 10**4:
    print(-1)
else:
    print(z)


Measured memory_bytes: 127156
//53:49
//???????????????????????????????????£??????submit????????????????????????????????????
#include <bits/stdc++.h>
using namespace std;

#define EQ(n,m) (abs((n)-(m)) < EPS * (abs(n) + abs(m)))

typedef vector<double> vec;
typedef vector<vec> mat;
const double EPS = 1e-9;

int D;
vec V;

int solve(){
    int checker = D+2;
    for(int outlier=0; outlier<D+2; outlier++){
        double c = 0;
        for(int i=0; i<D+2; i++) if(i != outlier){
            double t = 1;
            for(int j=0; j<D+2; j++) if(j != outlier && i != j)
                t *= double(checker - j)/(i - j);
            c += t * V[i];
        }
        //cout << c << " " << V[checker] << endl;
        if(abs(c - V[checker]) < 0.9)
            return outlier;
    }
    return checker;
}

int main(){
    while(cin >> D, D){
        V.resize(D+3);
        for(auto& v: V) cin >> v;
        cout << solve() << endl;
    }
    return 0;
}

Measured memory_bytes: 3208
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

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

const int MAXH = 51, MAXW = 51;

int dp[MAXH][MAXW];// min number of semi to visit [i][j]
char sem[MAXH][MAXW];

int main()
{
    int h, w;
    while(cin >> h >> w)
    {
        rep(j,h)rep(i,w)cin >> sem[i][j];

        dp[0][0] = sem[0][0] - '0';
        rep(i,w - 1) dp[i+1][0] = dp[i][0] + sem[i+1][0] - '0';
        rep(j,h - 1) dp[0][j+1] = dp[0][j] + sem[0][j+1] - '0';

        rep(j,h-1)rep(i,w-1)dp[i+1][j+1] = min(dp[i][j+1], dp[i+1][j]) + sem[i+1][j+1] - '0';

        cout << dp[w-1][h-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 0
function Main(input){
    // 文字列の長さ取得
    var len = input.length;
    // 変数定義
    var sum = 0;

    // 文字列の長さの数ループ
    for (var i = 0; i < len; i++) {
      var tmp = input[i].split([0],1);
      // 一文字ずつ加算
      sum = sum + Number(tmp[0]);
    }

    // 9の倍数の場合
    if(sum % 9 == 0) {
      console.log("Yes");
    }else{
      console.log("No");
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 35344
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC167D
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] NK = Console.ReadLine().Split(' ');
            long N = long.Parse(NK[0]);
            long K = long.Parse(NK[1]);
            string[] Ainput = Console.ReadLine().Split(' ');
            long[] A = new long[N];
            for (long i = 0; i < N; i++)
            {
                A[i] = long.Parse(Ainput[i]);
            }
            
            long next = A[0];
            int[] seen = new int[N];
            seen[0] += 1;
            long precount = 1;
            while (seen[next-1]==0)
            {
                seen[next - 1] += 1;
                next = A[next - 1];
                precount += 1;
            }
            long loop = next;
            next = A[loop - 1];
            long count = 1;
            while (next != loop)
            {
                next = A[next - 1];
                count += 1;
            }
            precount -= count;
            //Console.WriteLine(loop);
            //Console.WriteLine(precount);
            if (K > precount)
            {
                K -= precount;
                K = K % count;
                next = loop;
                if (K > 0)
                {
                    for (long i = 0; i < K; i++)
                    {
                        next = A[next - 1];
                    }
                }
            }
            else
            {
                next = 1;
                for (long i = 0; i < K; i++)
                {
                    next = A[next - 1];
                }
            }
            Console.WriteLine(next);
        }
    }
}


Measured memory_bytes: 43832
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
int main(){
    int a,b;
    cin>>a>>b;
    cout<<max(0,a-b*2)<<endl;
}

Measured memory_bytes: 764
#define TEST_MODE true
 
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= (int)b; --i)
#define range(i, a, b, c) for (int i = a;		\
                               c > 0 ? i < b : i > b;	\
                               i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) a.begin(), a.end()
#define ifnot(a) if (not(a))
#define int long long
 
#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x) << " "
#define dumpl(x) cerr << #x << " = " << (x) << " " << endl;
#else
const bool test = false;
#define dump(x) 
#define dumpl(x) 
#endif
 
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }
 
//.....................
const int MAX = (int)2e5 + 5;
 
vector<string> split(const string &str, char sep)
{
  vector<string> v;
  stringstream ss(str);
  string buffer;
  while (getline(ss, buffer, sep))
    {
      v.push_back(buffer);
    }
  return v;
}
 
template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
  return accumulate(begin, end, 0ll);
}
 
template<typename T>
T gcd(T a, T b)
{
  T c;
  while (a != 0) {
    c = a; a = b%a;  b = c;
  }
  return b;
}

int pow(int a, int b) {
  int res = 1;
  rep(i, b) res *= a;
  return res;
}
 
class Solver {
public:
  int N;

  void solve() {
    cin >> N;
    cout << N / 3 << endl;
  }
};
 
signed main()
{
  srand(time(NULL));
  cout << fixed << setprecision(20);
  auto ptr = new Solver();
  ptr->solve();
  delete ptr;
  // while (true) {    
  //     auto ptr = new Solver();
  //     ptr->solve();
  //     delete ptr;
  // }
  return 0;
}
 
// class Mycin {
// 	bool flag = true;
// public:
// 	Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
// 	Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
// 	Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
// 	operator bool() {return flag;}
// } mycin;
 
// class Mycout {
// public:
// 	Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
// 	Mycout& operator << (const char c) {printf("%c", c); return *this;}
// 	Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
// } mycout;
 
// #define cin mycin
// #define cout mycout
// #define endl '\n'


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H,W;
  cin>>H>>W;
  vector<vector<char>> vec(H,vector<char>(W));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>vec.at(i).at(j);
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(vec.at(i).at(j)!='#'){
        int c=0;
        if(i-1>=0&&j-1>=0){
         if(vec.at(i-1).at(j-1)=='#'){
          c++;
         }
        }
        if(i-1>=0){
         if(vec.at(i-1).at(j)=='#'){
          c++;
         }
        }
        if(i-1>=0&&j+1<W){
         if(vec.at(i-1).at(j+1)=='#'){
          c++;
          }
         }
        if(j-1>=0){
         if(vec.at(i).at(j-1)=='#'){
          c++;
          }
        }
        if(j+1<W){
         if(vec.at(i).at(j+1)=='#'){
          c++;
          }
        }
        if(i+1<H&&j-1>=0){
         if(vec.at(i+1).at(j-1)=='#'){
          c++;
          }
        }
        if(i+1<H){
         if(vec.at(i+1).at(j)=='#'){
          c++;
          }
        }
        if(i+1<H&&j+1<W){
         if(vec.at(i+1).at(j+1)=='#'){
          c++;
         }
        }
      cout<<c;
     }
     else{
       cout<<'#';
     }
    }
    cout<<endl;
  }
}

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

using namespace std;

int main(void) {
  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;

  int answ, anss;
  const double eps = 1e-10;
  double nou = 0.0;
  for (int a = 1; a <= F / (100 * A); a++) {
    for (int b = 0; b <= (F - 100 * A * a) / (100 * B); b++) {
      int up = min(E * (a * A + b * B), F - 100 * (a * A + b * B));
      for (int c = 0; c <= up / C; c++) {
        if (up - c * C < 0) continue;
        int d = (up - c * C) / D;
        double nnou = 100.0 * (c * C + d * D) / (100.0 * (a * A + b * B) + c * C + d * D);
        if (nnou + eps > nou) {
          nou = nnou;
          answ = 100 * (a * A + b * B);
          anss = c * C + d * D;
        }
      }
    }
  }

  cout << answ + anss << " " << anss << endl;

  return 0;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = n * a;

        if (ans >= b) {
            ans = b;
        }

        System.out.println(ans);

        sc.close();
    }    
}


Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleTest
{
    class Program
    {
        static void Main(string[] args)
        {
            List<char> ca = Console.ReadLine().ToCharArray().ToList();
            var appendFront = new List<char>();
            var appendEnd = new List<char>();
            var num = int.Parse(Console.ReadLine());
            bool isReverse = false;
            for(int i =0; i<num; ++i)
            {
                char[] ma = Console.ReadLine().Split(' ')
                    .Select(ss => ss[0])
                    .ToArray();
                if(ma[0]=='1')
                {
                    isReverse = !isReverse;
                }
                else
                {
                    bool isAppendFront = isReverse ? ma[1] == '2' : ma[1] == '1';
                    if (isAppendFront)
                    {
                        appendFront.Add(ma[2]);
                    }
                    else
                    {
                        appendEnd.Add(ma[2]);
                    }
                }
                //Console.WriteLine(string.Format("step[{0}] : {1}", i, s));
            }
            appendFront.Reverse();
            string j = new string(appendFront.ToArray()) + new string(ca.ToArray()) + new string(appendEnd.ToArray());
            if (isReverse)
            {
                j = new string(j.Reverse().ToArray());
            }
            Console.WriteLine(j.ToArray());

        }
    }
}


Measured memory_bytes: 25496
#include<stdio.h>
int main()
{
    long int n,i;
    scanf("%ld", &n);
   long long int a[3000],cnt=0,j;
    for(i=0;i<n;i++)
        scanf("%lld",&a[i]);

    for(i=0;i<n;i++)
         cnt+=a[i];

     j=cnt-n;
     printf("%lld\n",j);
     return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last)
{
  reverse(middle, last);
  return next_permutation(first , last);
}

int N;
string S[12];
int dat[26];
bool top[26],used[10];
int val[26];
vector<int> C;
int sz;

int rec(int lev, int sum) {
  if (lev == sz) return sum == 0;
  int res = 0;
  REP(i,10) {
    if (used[i]) continue;
    if (i == 0 && top[C[lev]]) continue;
    used[i] = true;
    res += rec(lev+1,sum+dat[C[lev]]*i);
    used[i] = false;
  }
  return res;
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  while (cin >> N, N) {
    ZERO(dat);
    ZERO(top);
    C.clear();
    REP(i,N) {
      cin >> S[i];
      for (int j = S[i].size()-1, p = 1; j >= 0; j--, p *= 10) {
        dat[S[i][j]-'A'] += (i < N-1 ? p : -p);
        if (S[i].size() > 1 && j == 0) top[S[i][j]-'A'] = true;
        C.push_back(S[i][j]-'A');
      }
    }
    UNI(C);
    sz = C.size();
    cout << rec(0,0) << endl;
  }

  return 0;
}


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

int main(){
  int n;
  cin >> n;
  int t = 0, x = 0, y = 0;
  bool f = true;
  while (n--) {
    int tt, xx, yy;
    cin >> tt >> xx >> yy;
    if ((tt - t) < abs(x - xx) + abs(y - yy)) {
      f = false;
      break;
    }
    if ((tt - t) % 2 != (abs(x - xx) + abs(y - yy)) % 2) {
      f = false;
      break;
    }
    t = tt;
    x = xx;
    y = yy;
  }
  if (f) {
    puts("Yes");
  } else {
    puts("No");
  }
  return 0;
}


Measured memory_bytes: 256
#include<cstring>
#include<iostream>
using namespace std;
char a[107];
char b[107];
int main()
{
    cin>>a>>b;
    int len=strlen(a);
    for(int i=0;i<len;++i)
    {
        int flag=0;
        for(int j=0;j<len;++j)
        if(a[j]!=b[(i+j)%len])flag++;
        if(!flag){cout<<"Yes";return 0;}
    }
    cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1<<30;

int main(){
  int n, m;cin>>n>>m;
  vector<int> ans(m);
  for(int i=0;i<m;i++)ans[i]=i+1;
  for(int i=0;i<n;i++){
    vector<int> tmp;
    int k;cin>>k;
    vector<int> a(k);
    for(int j=0;j<k;j++)cin>>a[j];
    sort(a.begin(), a.end());
    set_intersection(a.begin(), a.end(), ans.begin(), ans.end(),
                     inserter(tmp, tmp.end()));
    ans=tmp;
  }
  cout << ans.size() << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main()
{
	cout << fixed << setprecision(10);

	int n, m;
	cin >> n >> m;
	vector<vector<int>> to;
	to.resize(n);

	vector<int> f(n, -1);

	REP(i, m)
	{
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		to[a].push_back(b);
		to[b].push_back(a);
	}

	queue<int> q;
	q.push(0);
	while (q.empty() == false)
	{
		int i = q.front();

		q.pop();

		for (auto fac : to[i])
		{
			if (f[fac] == -1)
			{
				f[fac] = i;
				q.push(fac);
			}
		}
	}

	for (int i = 1; i < n; i++)
	{
		if (f[i] == -1)
		{
			cout << "No";
			return 0;
		}
	}


	cout << "Yes" << endl;
	for (int i = 1; i < n; i++)
	{

		cout << f[i]+1 << " ";
	}

	return 0;
}

Measured memory_bytes: 10276
import math

def main():
    n, m = [int(x) for x in input().split(" ")]
    gates = []
    mi = n
    ma = 0

    for x in range(m):
        l, r = [int(x) for x in input().split(" ")]
        gates.append((l, r))

    mi = gates[0][1]
    ma = gates[0][0]

    for gate in gates:
        # print(gate)
        if ma <= gate[0]:
            ma = gate[0]

        if mi >= gate[1]:
            mi = gate[1]

    res = 0
    if mi < ma:
        res = 0
    else:
        res = mi - ma + 1

    print(res)

if __name__ == "__main__":
    main()

Measured memory_bytes: 16608
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <map>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define pb(a) push_back(a)
#define MAX(a, b) ((a < b)?b:a)
#define MIN(a, b) ((a > b)?b:a)
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;

template<typename T> void cinpb(vector<T>& x) { T n; cin >> n; x.push_back(n); }
ull gcd(ull a, ull b) { return b ? gcd(b, a%b) : a; }
ull lcm(ull m, ull n) {	return ((0 == m) || (0 == n)) ? 0 : ((m / gcd(m, n)) * n); }
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

void yesno(bool f) { cout << (f ? "Yes" : "No") << endl; }

//

int main()
{
	int T, X;
	cin >> T >> X;

	cout << (double)T / X << endl;

	return 0;
}

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

#define INF INT_MAX
#define UINF UINT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef std::pair<int,int> pii;

using namespace std;

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

    ll n;
    cin >> n;

    ll ans = 100;
    ll aans = 0;
    while(n > ans){
        ans *= 1.01;
        aans++;
    }

    cout << aans << endl;
    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	char time[6];
	for(int i=0;i<n;i++){
		double a=0,b=0;
		cin >> time;
		for(int k=0;k<=9;k++){
			if(time[0]-'0' == k)
				a+= k*10;
			if(time[1]-'0' == k)
				a+= k;
			if(time[3]-'0' == k)
				b+= k*10;
			if(time[4]-'0' == k)
				b+= k;
		}
		double ans = max(a*30+b/2,b*6)-min(a*30+b/2,b*6);
		if((ans >= 0 && ans < 30) || (360 >= ans && ans > 330))
			cout << "alert" << endl;
		else if((ans >= 90 && ans <= 180) || (270 >= ans && ans >= 180))
			cout << "safe" << endl;
		else
			cout << "warning" << endl;
	}
	return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;
using TextReader = System.IO.TextReader;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var A = consoleReader.Int;
            var B = consoleReader.Int;

            return A<=8&& B<=8? "Yay!":":(";
        }

        static uint S(BigInteger n) => (uint)n.ToString().Sum(c => c - '0');


        #region いつもの
        private readonly ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader(Console.In)).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
        #endregion
    }

#pragma warning disable
    public class ConsoleReader
    {
        private string[] line = Array.Empty<string>();
        private int linePosition;
        private TextReader textReader;
        public ConsoleReader(TextReader tr) { textReader = tr; }
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
        public string String
        {
            get
            {
                if (linePosition >= line.Length)
                {
                    linePosition = 0;
                    line = textReader.ReadLine().Split();
                }
                return line[linePosition++];
            }
        }
        public class SplitLine
        {
            private string[] splited;
            public SplitLine(ConsoleReader cr) { splited = cr.textReader.ReadLine().Split(); }
            public int[] Int => String.Select(x => int.Parse(x)).ToArray();
            public long[] Long => String.Select(x => long.Parse(x)).ToArray();
            public double[] Double => String.Select(x => double.Parse(x)).ToArray();
            public string[] String => splited;
        }
        public SplitLine Split => new SplitLine(this);
        public class RepeatReader
        {
            ConsoleReader cr; int count;
            public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; }
            public IEnumerable<T> Select<T>(Func<ConsoleReader, T> func) { for (int i = 0; i < count; i++) yield return func(cr); }
            public IEnumerable<string> String { get { for (int i = 0; i < count; i++) yield return cr.String; } }
            public IEnumerable<int> Int { get { for (int i = 0; i < count; i++) yield return cr.Int; } }
            public IEnumerable<double> Double { get { for (int i = 0; i < count; i++) yield return cr.Double; } }
        }
        public RepeatReader Repeat(int count) => new RepeatReader(this, count);
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <numeric>
#include <math.h>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)

typedef long long ll;
typedef long long int lli;

int main() {
	int N, K;
	cin >> N >> K;
	if (N % K != 0) {
		cout << 1 << endl;
	}
	else {
		cout << 0 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] s = sc.next().toCharArray();
		sc.close();

		int mod = 1000000007;
		long[][] dp = new long[n][n];
		Arrays.fill(dp[0], 1L);
		for (int i = 0; i < n - 1; i++) {
			int end = n - i - 1;
			if (s[i] == '<') {
				long sum = dp[i][end];
				for (int j = end - 1; j >= 0; j--) {
					dp[i + 1][j] = sum;
					sum += dp[i][j];
					sum %= mod;
				}
			} else {
				long sum = 0;
				for (int j = 0; j < end; j++) {
					sum += dp[i][j];
					sum %= mod;
					dp[i + 1][j] = sum;
				}
			}
		}
		System.out.println(dp[n - 1][0]);
	}
}


Measured memory_bytes: 108060
#include<stdio.h>
int main(void)
{
    int a,b,i,keta;
    while(scanf("%d %d",&a,&b)!=EOF){
    keta=a+b;
    if(0<=keta&&keta<10){
        printf("1\n");
    }else if(10<=keta&&keta<100){
        printf("2\n");
    }else if(100<=keta&&keta<1000){
        printf("3\n");
    }else if(1000<=keta&&keta<10000){
        printf("4\n");
    }else if(10000<=keta&&keta<100000){
        printf("5\n");
    }else if(100000<=keta&&keta<1000000){
        printf("6\n");
    }else{
        printf("7\n");
    }
    }
    return 0;
}

Measured memory_bytes: 584
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
 
const ll mod = 1E9 + 7;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int N; cin >> N;
	int i, j;
	vector<int> a(N); for(i = 0; i < N; i++) cin >> a[i];
	int r = a[0];
	for(i = 0; i < N; i++) r = __gcd(r, a[i]);
	map<int, int> mp;
	for(i = 0; i < N; i++) mp[a[i]]++;
	int f = 0;
	int m = 1000000;
	for(i = 2; i <= m; i++){
		int cnt = 0;
		for(j = i; j <= m; j += i){
			if(mp.find(j) != mp.end())
				cnt += mp[j];
		}
		if(cnt >= 2){
			f = 1;
			break;
		}
	}
	if(f == 1){
		if(r == 1)
			cout<<"setwise coprime";
		else
			cout<< "not coprime";
	}
	else cout<<"pairwise coprime";
}


Measured memory_bytes: 53676
#include<cstdio>
#include<algorithm>
#include<cmath>
int n,d,a[15][15],ans; 
using namespace std;
int main()
{
	scanf("%d%d",&n,&d);
	for (int i=1;i<=n;i++)
		for (int j=1;j<=d;j++) scanf("%d",&a[i][j]);
	for (int i=1;i<=n;i++)
		for (int j=i+1;j<=n;j++)
		{
			int sum=0;
			for (int k=1;k<=d;k++) sum+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
			if ((int)sqrt(sum)*(int)sqrt(sum)==sum) ans++;
		}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

int main() {
    int n;
    std::cin >> n;
    if(n%10==9){
        std::cout << "Yes" << std::endl;
    }
    else if(n/10%10==9){
        std::cout << "Yes" << std::endl;
    }
    else{
        std::cout << "No" << std::endl;
    }

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rept(i,k,n) for(int i = (k); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())

typedef long long ll;

int main() {
    int a,b,c;
    cin>>a>>c>>b>>c;
    cout<<(a!=b)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#define MAX_V 100
#define INF 1e9
using namespace std;
int cost[MAX_V][MAX_V];
int d[MAX_V];
bool used[MAX_V];
int V;
void dijkstra(int s) {
	for (int i = 0; i < V; i++) {
		d[i] = INF;
		used[i] = false;
	}
	d[s] = 0;
	while (true) {
		int v = -1;
		for (int u = 0; u < V; u++) {
			if (!used[u] && ((v == -1) || d[u] < d[v])) {
				v = u;
			}
		}
		//全ての頂点が到達済み
		if (v == -1) {
			break;
		}
		//集合に新たに頂点を追加
		used[v] = true;
		for (int u = 0; u < V; u++) {
			if (cost[v][u] != -1) {
				d[u] = min(d[u], d[v] + cost[v][u]);
			}
		}
	}
}

int main() {
	for (int i = 0; i < MAX_V; i++) {
		for (int j = 0; j < MAX_V; j++) {
			cost[i][j] = -1;
		}
	}
	cin >> V;
	for (int i = 0; i < V; i++) {
		int u;
		cin >> u;
		int k;
		cin >> k;
		for (int j = 0; j < k; j++) {
			int v;
			cin >> v;
			int c;
			cin >> c;
			cost[u][v] = c;
		}
	}
	dijkstra(0);

	for (int i = 0; i < V; i++) {
		cout << i << " " << d[i] << endl;
	}
	return 0;
}



Measured memory_bytes: 3128
# define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;

# define INF ((int)(1<<30))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) (x).begin(),(x).end()
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<" :"<<x<<endl;
# define EPS 1e-12

template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
int dx[4] = { 0,-1,1,0 }, dy[4] = { 1,0,0,-1 };

int main()
{
	typedef pair<double,int> p;
	vector<p> a[3],ans,t;
	REP(i, 3)
	{
		REP(j, 8)
		{
			p x; cin >> x.second >> x.first;
			a[i].push_back(x);
		}
		sort(ALL(a[i]));
		ans.push_back(a[i][0]);
		ans.push_back(a[i][1]);
		for (int j = 2; j < 8; j++)
		{
			t.push_back(a[i][j]);
		}
	}
	sort(ALL(t));
	ans.push_back(t[0]); ans.push_back(t[1]);
	for (int i = 0; i < ans.size(); i++)
	{
		cout << ans[i].second << " " << ans[i].first << endl;
	}


}

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

using namespace std;

//int Size = 1e5;

int main(){
	int a,b;
	cin>>a>>b;
	string s1="" , s2="";
	for(int i=0;i<b;i++)
		s1+=(char)('0'+ a);
	for(int i=0;i<a;i++)
		s2+=(char)('0'+ b);	
	if((s1.compare(s2)) < 0)
		cout<<s1<<"\n";
	else
		cout<<s2<<"\n";
return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, k = map(int, input().split())
    P = sorted(list(map(int, input().split())))
    res = sum(P[:k])
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    string s,t;
    cin>>s>>t;
    int n=s.size();
    int m=t.size();
    int ans=m;
    for(int i=0; i<n-m+1; i++){
        int len=0;
        string p=s.substr(i,m);
        for(int j=0; j<m; j++){
            if(p[j]!=t[j])
                len++;
        }
        ans=min(ans,len);
    }
cout<<ans;
return 0;
    
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  string s;
  int a = 0, b = 0, c = 0;
  cin >> s;
  for (int i = 0; i < 3; ++i) {
    if (s[i] == 'a') a++;
    if (s[i] == 'b') b++;
    if (s[i] == 'c') c++;
  }
  cout << (a == b && b == c && c == 1 ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
static const int MAX = 200000;
int main(){
    int a, b;
    cin >> a >>  b;
    if ((a+b)%2==1){
        cout << "IMPOSSIBLE" <<endl;
    } else {
        cout << (a+b)/2 << endl; 
    }
}


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

using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);

    int A, B, C, D;
    cin >> A >> B >> C >> D;
    if ((A - 1) / D < (C - 1) / B)
        cout << "No\n";
    else
        cout << "Yes\n";
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;
typedef long long ll;

const ll INF = 1145141919810364364;

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

    int n, m, limit;
    cin >> n >> m >> limit;

    vector<vector<ll>> dis(n, vector<ll>(n, INF));
    for (int i = 0; i < m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        if (c > limit)continue;
        a--;
        b--;
        dis[a][b] = c;
        dis[b][a] = c;
    }

    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
            }
        }
    }

    vector<vector<int>> graph(n);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (dis[i][j] <= limit)graph[i].push_back(j);
        }
    }

    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int s, t;
        cin >> s >> t;
        s--;
        t--;

        queue<int> que;
        que.push(s);
        que.push(-1);
        int depth = 0;
        vector<int> ret(n, -1);
        while (ret[t] < 0) {
            int nowv = que.front();
            que.pop();

            if (nowv < 0) {
                if (que.empty())break;
                que.push(-1);
                depth++;
            } else {
                for (auto nextv:graph[nowv]) {
                    if (ret[nextv] < 0) {
                        que.push(nextv);
                        ret[nextv] = depth;
                    }
                }
            }
        }

        cout << ret[t] << "\n";
    }
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

bool IsPrime(ll num)  //素数判定
{
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;  // 偶数はあらかじめ除く

  double sqrtNum = sqrt(num);
  for (ll i = 3; i <= sqrtNum; i += 2) {
    if (num % i == 0) {
      // 素数ではない
      return false;
    }
  }
  // 素数である
  return true;
}

int main() {
  ll n, ans = LLONG_MAX;
  cin >> n;
  if (IsPrime(n)) {
    cout << n - 1 << endl;
    return 0;
  } else {
    for (int i = 1; i <= (int)sqrt(n); i++) {
      if (n % i == 0) {
        ans = min(ans, i + n / i - 2);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<string>v;
vector<int>ansl;
string s;
int ary[100005] = {0};
int mp[51][51];
int cnt = 0;
int d_x[] = {0,1,0,-1};
int d_y[] = {1,0,-1,0};
int W,H;

void dfs(int x,int y){
  mp[y][x] = 0;
  for(int dx = -1;dx<2;dx++){
    for(int dy = -1;dy<2;dy++){
    int nx = x+dx,ny = y+dy;
    if((nx>=0)&&(ny>=0)&&(ny<H)&&(nx<W)&&(mp[ny][nx] == 1)){
      dfs(nx,ny);
    }
  }
}
}
int main(){
  int D,N;
  long long int ans;
  cin >>D>>N;

  if(D == 0){
    ans = 1;
    for(int i = 1;i<N;i++){
      ans++;
    }
    if(N ==100){
      ans++;
    }
  }
  if(D == 1){
    ans = 100;
    for(int i = 1;i<N;i++){
      ans += 100;
    }
    if(N==100){
      ans += 100;
    }
  }if(D == 2){
    ans = 10000;
    for(int i = 1;i<N;i++){
      ans += 10000;
    }
    if(N==100){
      ans += 10000;
    }
  }
  cout <<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
using namespace std;
const ll INF=1e13;
signed main()
{
	int n,W;
	cin>>n>>W;
	int weight[n+1]={0};
	int value[n+1]={0};
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		cin>>weight[i]>>value[i];
	}
	int dp[W+1]={0};
	for(int item=1;item<=n;item++)
	{
		int w=weight[item];
		int v=value[item];
		for(int i=W;i>=w;i--)
		{
			dp[i]=max(dp[i],v+dp[i-w]);
		}
	}
	int mx=INT_MIN;
	for(int i=0;i<=W;i++)
	{
		mx=max(dp[i],mx);
	}
	cout<<mx<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;
void swap(int &a, int &b);

int main()
{
	int n[1000], x[1000];
	int count = 0;
	while (true)
	{

		cin >> n[count] >> x[count];
		if (n[count] == 0 && x[count] == 0)
			break;
		count++;
	}

	int *combination = new int[count]();

	for (int i = 0; i < count; ++i)
	{

		for (int v1 = 1; v1 <= n[i]; ++v1)
		{
			for (int v2 = v1 + 1; v2 <= n[i]; ++v2)
			{
				for (int v3 = v2 + 1; v3 <= n[i]; ++v3)
				{
					int sum = v1 + v2 + v3;
					if (sum == x[i])
					{
						combination[i]++;
					}

				}
			}
		}
	}

	for (int i = 0; i < count; ++i)
	{
		cout << combination[i] << endl;
	}

	return 0;
}




Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define N 100005
using namespace std;

int q;
bool prime[N + 5] = {0};
int sum[N] = {0};

void sprime() {
  int i, j;
  prime[0] = 1;
  prime[1] = 1;
  for(i = 2; i < sqrt(N); ++i)
    if(!prime[i])
      for(j = 2; i * j <= N; ++j) prime[i * j] = 1;
}

int main() {
  sprime();
  for(int i = 3; i <= N; i += 2) {
    sum[i] = sum[i - 2];

    if(!prime[i] && !(prime[(i + 1) / 2])) ++sum[i];
  }
  cin >> q;
  for(int i = 0; i < q; ++i) {
    int l, r;
    cin >> l >> r;

    cout << sum[r] - sum[l - 2] << endl;
  }
  return 0;
}

Measured memory_bytes: 1152
#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 {
  	cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
	int a, b, x;

	cin >> x >> a >> b;

	if (abs(x - a) < abs(x - b)) {
		cout << "A" << endl;
	}
	else {
		cout << "B" << endl;
	}
	
	
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main{
    static MyReader in = new MyReader();

    public static void main(String[] args){
        int A, B; {int[] a = in.ii(); A = a[0]; B = a[1];}
        double ar = Math.floor((A+1)/0.08);
        double al = Math.ceil(A/0.08);
        double br = Math.floor((B+1)/0.1);
        double bl = Math.ceil(B/0.1);
        int ans = -1;
        if(ar-al >= 1 && br-bl >= 1){
            int tmp = (int)Math.max(al, bl);
            if(tmp < (int)Math.min(ar, br)){
                ans = tmp;
            }
        }
        out.println(ans);
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        ArrayList<Integer> li(){
            String[] ss = ss();
            ArrayList<Integer> li = new ArrayList<>();
            for(int j = 0; j < ss.length; j++) li.add(Integer.parseInt(ss[j]));
            return li;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


Measured memory_bytes: 23252
#include <stdio.h>

int main() {
	int h, w, n;
	
	scanf("%d %d %d", &h, &w, &n);
	
	if(h>w){
		for(int i=0; i<=h; i++){
			if(i*h>=n){
				printf("%d", i);
				break;
			}
		}
	}
	
	else if(h<w){
		for(int i=0; i<=w; i++){
			if(i*w>=n){
				printf("%d", i);
				break;
			}
		}
	}
	
	else if(h=w){
		for(int i=0; i<=h; i++){
			if(i*h>=n){
				printf("%d", i);
				break;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 1704
#include <bits/stdc++.h>
using namespace std;
int main(){
   int a,b,c;
   cin>>a>>b>>c;
   vector<int> vec={a,b,c};
  vector<int> vec1={5,5,7};
   sort(vec.begin(),vec.end());
   if(vec==vec1){
     cout<<"YES"<<endl;
   }else{
     cout<<"NO"<<endl;
   }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
unordered_map <long long, long long>dp;
long long fun (long long n){
	if (dp[n]) return dp[n];
	else return dp[n] = (fun(n / 2) + fun((n - 1) / 2) + fun((n - 2) / 2)) % 1000000007;
}
int main() {
	dp[0] = 1, dp[1] = 2;
	long long n;
	cin >> n;
	cout << fun(n);
}

Measured memory_bytes: 3572
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define pb(x) push_back(x)
#define eb(x,y) emplace_back(x,y)
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
#define EPS 1e-9
#define DEBUG 0
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};

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

    rep(n){
        cin >> cnt[i+1];
    }

    auto iter = cnt.begin();
    rep(h){
        if(i % 2 == 0){
            repp(j, w){
                cout << iter->first << " ";
                (iter->second)--;
                if(iter->second == 0) iter++;
            }
        }else{
            vector<int> v(w);
            for(int j=w-1;j>=0;j--){
                v[j] = iter->first;
                (iter->second)--;
                if(iter->second == 0) iter++;
            }
            repp(j, w){
                cout << v[j] << " ";
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int n,a[111111],b[111111];
long long int inc;
int main(){
	scanf("%d",&n);
	for(int i=1; i<=n; i++)
		scanf("%d%d",&a[i],&b[i]);
	inc = 0;
	for(int i=n; i>=1; i--){
		long long int now = a[i] + inc;
		long long int nex = now == 0 ? 0 : ((now - 1) / b[i] + 1) * b[i];
		inc += nex - now;
	}
	cout << inc << endl;
	return 0;
}


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

int main() {
  float n, t, a, tmp, ans; cin >> n >> t >> a;
  vector<int> h(n);
  ans = 0; tmp = 1000000;

  rep (i, n) {
    cin >> h[i];
  }

  rep (i, n) {
    if (abs(a - (t - h[i] * 0.006)) < tmp) {
      tmp = abs(a - (t - h[i] * 0.006));
      ans = i+1;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <math.h>
#include <bitset>

#define X first
#define Y second
#define vsort(v) sort(v.begin(), v.end())
#define vrev(v) reverse(v.begin(), v.end())
#define vmax_p(v) max_element(v.begin(), v.end())
#define vmin_p(v) min_element(v.begin(), v.end())
#define vmax_idx(v) distance(v.begin(), vmax_p(v))
#define vmin_idx(v) distance(v.begin(), vmin_p(v))
#define vcopy(src, dst) copy(src.begin(), src.end(), back_inserter(dst))
#define P pair

// stoi(s): string to int
// stod(s): string to double

// INT_MAX
// INT_MIN
// LLONG_MAX
// LLONG_MIN
// DBL_MIN
// DBL_MAX
// LDBL_MIN
// LDBL_MAX

// A-Z: 65~90
// a-z: 97~122
// |a-z| = 26

// 2進数変換
// string s = bitset<20>(x).to_string();

using namespace std;
using ll = long long;

void display_vec(vector<int> v)
{
    for (int i = 0; i < v.size(); i++)
    {
        cout << v[i] << endl;
    }
    cout << endl;
}

int main(int argc, const char *argv[])
{
    int n, k;
    string s;
    cin >> n >> s >> k;

    char c = s[k - 1];
    for (int i = 0; i < n; i++)
    {
        if (s[i] != c)
        {
            s[i] = '*';
        }
    }
    cout << s << endl;
}


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

typedef long long ll;
typedef double ld;
typedef pair <ll, ll> pll;

#define pb push_back
#define mp make_pair
#define all(_c) _c.begin(), _c.end()

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

    ll k, a, b;
    cin >> k >> a >> b;

    if (a >= b or b - a == 1) {
        cout << k + 1 << '\n';
    } else {
        if (k < a - 1)
            cout << k + 1 << '\n';
        else {
            ll bis = 0;
            if (k >= a + 1) {
                bis = b, k -= a + 1;
                bis += (b - a)*(k/2) + (k&1);
            } else
                bis = k + 1;
            cout << bis << '\n';
        }
    }
    return 0;
}


Measured memory_bytes: 256