akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){
    cout<<setprecision(5);
    double r;
    cin>>r;
    cout<<2*r*M_PI<<endl;






return 0;
}


Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define repin(a,n) vector<ll> a(n);rep(i,n){cin>>a[i];}
#define repins(a,n) vector<string> a(n);rep(i,n){cin>>a[i];}
#define repind(a,n) vector<double> a(n);rep(i,n){cin>>a[i];}
#define in(a) ll a;cin>>a;
#define ins(a) string a;cin>>a;
#define ind(a) double a;cin>>a;
template<class T>
inline void out(T a){cout<<a<<endl; }
inline void out(double a){ printf("%.10f\n", a);} 
#define all(x) (x).begin(),(x).end()
#define rep2(i,a,b) for(ll i=(a);i<(b);++i)
using vell = vector<ll>;
using ves = vector<string>;
using ved = vector<double>;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main()
{
	in(n);
	in(blue);
	in(red);
	if(blue==0){
		out(0);
		return 0;
	}
	out(n/(blue+red)*blue+min(blue,n%(blue+red)));
}

Measured memory_bytes: 384
import math
K=int(input())
ans=0

for i in range(1,K+1):
    for j in range(i,K+1):
        for k in range(j,K+1):
            a=math.gcd(i,j)
            a=math.gcd(a,k)
            if i==j and i==k:
              ans=ans+a
            elif i==j or i==k or j==k:
              ans=ans+3*a
            else:
              ans=ans+6*a
print(ans)


Measured memory_bytes: 70380
#include<iostream>
#include<bits/stdc++.h>
#define ll long long int 
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define md 1000000007
#define fat 998244353 
#define INF 1e9
double PI=3.1415926535;
const int N =  (int)(1 * 1e6 + 10);
using namespace std;
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
}
ll fun(ll n)
{   
    map<ll,ll> mp;
    for(ll i = 2 ; i*i<=n ; i++)
    {
        while(n%i==0)
        {
            n = n/i;
            mp[i]++;
        }
    }

    if(n!=1)mp[n]++;
    ll ans = 1;
    for(auto it:mp)ans = ans*(it.second+1);

    return ans;
}

int main()

{
    ll n;
    cin>>n;
    ll res = 0;
    for(ll i = 1 ; i < n ; i++)
    {
        ll x = n-i;
        res+=fun(x);
    }

    cout<<res<<endl;

}

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

using namespace std;

int main(){
    int N;
    cin >> N;
    map<int, int> e, o;
    for(int i = 0; i < N; i++){
        int x;
        cin >> x;
        if(i % 2 == 0){
            e[x]++;
        }else{
            o[x]++;
        }
    }

    vector< pair<int, int> > E(2), O(2);
    for(auto p:e){
       E.push_back(make_pair(p.second,p.first));
    }
    for(auto p:o){
       O.push_back(make_pair(p.second,p.first));
    }
    sort(E.begin(), E.end(), greater<pair<int, int>>());
    sort(O.begin(), O.end(), greater<pair<int, int>>());

    int ans;
    if(E[0].second != O[0].second){
        ans = N - (E[0].first + O[0].first);
    }else{
        ans = N - max(E[0].first+O[1].first, E[1].first+O[0].first);
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 6136
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 100001
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<int,ll>Pil;
typedef pair<P1,ll> P2;
typedef list<int> li;
typedef list<li> lli;
typedef pair<string,string> Ps;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	// 1 変数を入れる;
	ll a;
	int b;
};

int main(){

	int n;
	cin>>n;

	int ma=0,z=0;
	rep(i,n){
		int d1,d2;
		cin>>d1>>d2;
		if(d1!=d2)z=0;
		else z++;
		ma=max(ma,z);
	}
	if(ma>=3)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;

	return 0;
}


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


int main() {
  ll n;
  cin >> n;
  
  vector<ll> a(n);
  ll ans = 0;
  REP(i,n) {
    cin >> a[i];
    if (i != 0 && a[i] < a[i-1]) { 
      ans += a[i-1] - a[i];
      a[i] = a[i-1];
    }
  }
    
  cout << ans << endl;
}


Measured memory_bytes: 4804
// 22
#include <bits/stdc++.h>
using namespace std;
#define coutc "\033[48;5;196m\033[38;5;15m"
#define endc "\033[0m"
#define endl '\n'
#define M(_1, _2, _3, _4, NAME, ...) NAME
#define rep(...) M(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rep4(_, x, n, s) for (int _ = x; (s < 0) ? _ > n : _ < n; _ += s)
#define rep3(_, x, n) rep4(_, x, n, (x < n ? 1 : -1))
#define rep2(_, n) rep3(_, 0, n)
#define rep1(n) rep2(i, n)
#define fi first
#define se second
#define pb push_back
#define pairii pair<int, int>
#define all(x) x.begin(), x.end()
#define len(x) int(x.size())
#define lli __int128_t
#define li long long int
#define ld long double
// 4
template <class A, class B>
ostream &operator<<(ostream &o, const pair<A, B> &p) {
  return o << "(" << p.fi << ", " << p.se << ")";
}
// 5
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v) {
  rep(i, len(v)) o << setw(7) << left << v[i];
  return o << endc << endl << coutc;
}
// 5
template <class A, class B>
ostream &operator<<(ostream &o, const map<A, B> &m) {
  for (auto &kv : m) o << kv;
  return o;
}
// 7
template <class T, class... Ts>
void debug(const T &e, const Ts &... r) {
#ifdef DEBUG
  cerr << coutc << e;
  ((cerr << " " << r), ..., (cerr << endc << endl));
#endif
}
// 3
void _main(int tc) {
  int n;
  cin >> n;
  vector<vector<int>> adj(n);
  auto addEdge = [&](int u, int v) { adj[u].pb(v); };
  rep(n - 1) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    addEdge(u, v);
    addEdge(v, u);
  }
  const int mod = 1e9 + 7;
  function<pairii(int, int)> f = [&](int u, int p) -> pairii {
    int ifwhitecnt = 1, ifblackcnt = 1;
    for (int v : adj[u]) {
      if (v == p) continue;
      auto ans = f(v, u);
      ifwhitecnt = ((li)ifwhitecnt * ((ans.fi + ans.se) % mod)) % mod;
      ifblackcnt = ((li)ifblackcnt * ans.fi) % mod;
    }
    return {ifwhitecnt, ifblackcnt};
  };
  auto ans = f(0, 0);
  cout << ((ans.fi + ans.se) % mod) << endl;
}
// 7
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  _main(0), exit(0);
  int tc;
  cin >> tc;
  rep(i, tc) _main(i + 1);
}

Measured memory_bytes: 14080
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;
 
class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().Solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
 
    
    void Solve()
    {
        int N = cin.Nextint;
        int M = cin.Nextint;
        var G = new Edge[M];
        var D = Enumerable.Repeat(long.MaxValue, N).ToArray();
        for (int i = 0; i < M; i++)
        {
            G[i] = new Edge(cin.Nextint - 1, cin.Nextint - 1, -cin.Nextint);
        }
        D[0] = 0;
        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j < M; j++)
            {
                var e = G[j];
                if (D[e.from] != long.MaxValue && D[e.to] > D[e.from] + e.cost)
                {
                    D[e.to] = D[e.from] + e.cost;
 
                    if (i == N - 1 && e.to == N - 1)
                    {
                        WriteLine("inf");
                        return;
                    }
                }
            }
        }
        
        WriteLine(-D[N - 1]);
    }
 
}
 
class Edge
{
    public int from, to; public long cost;
    public Edge(int a, int b, int c)
    {
        from = a;
        to = b;
        cost = c;
    }
}
 
class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

Measured memory_bytes: 13392
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 100000007

int main() {
	int n;
	set<int>s;
	cin >> n;
	rep(i, n)
	{
		int r;
		cin >> r;
		s.insert(r);
	}
	cout << s.size();
}

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

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

    for (int o = N; o >= 0; o--)
    {
        bool satisfied = true;
        for (int i = 0; i < o; i++)
        {
            if (s.at(N - o + i) != t.at(i))
            {
                satisfied = false;
            }
        }
        if (satisfied)
        {
            cout << 2 * N - o << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <array>
#include <deque>
#include <bitset>
typedef long long ll;
using namespace std;
#define trace(x) cerr << #x << " is " << x << endl;

void f(int n) {
    if (n % 10 == 7 || (n / 10) % 10 == 7 || (n / 100) % 10 == 7) cout << "Yes" <<endl;
    else cout << "No" << endl;
}
int main() {
    
    int N;
    cin >> N;
    f(N);
    return 0;
}

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

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String str[] = br.readLine().split(" ");
            long x = Long.parseLong(str[0]);
            long t = Long.parseLong(str[1]);
            if (x - t < 0) {
                System.out.println(0);
            } else {
                System.out.println(x - t);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


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


const double EPS = 1e-8;
const double INF = 1e12;
const double PI = acos(-1);

using Point = complex<double>;
using Polygon = vector<Point>;

inline int sgn(const double &a) { return (a < -EPS ? -1 : (a > EPS ? 1 : 0)); }

inline bool eq(const Point &a, const Point &b) { return abs(a - b) < EPS; }

namespace std {
inline bool operator<(const Point &a, const Point &b) {
    if (sgn(a.real() - b.real()))
        return sgn(a.real() - b.real()) < 0;
    return sgn(a.imag() - b.imag()) < 0;
}
} // namespace std

double dot(const Point &a, const Point &b) { return real(conj(a) * b); }

double det(const Point &a, const Point &b) { return imag(conj(a) * b); }

struct Line {
    Point p1, p2;

    Line(Point p1 = Point(), Point p2 = Point()) : p1(p1), p2(p2) {}

    bool operator<(const Line &rhs) const {
        if (eq(p2, rhs.p2))
            return p1 < rhs.p1;
        return p2 < rhs.p2;
    }
    bool operator==(const Line &rhs) const {
        return (eq(p1, rhs.p1) && eq(p2, rhs.p2)) ||
               (eq(p1, rhs.p2) && eq(p2, rhs.p1));
    }
};

Point intersection(Line a, Line b){
    Point v1 = a.p2 - a.p1, v2 = b.p2 - b.p1;
    return a.p1 + v1 * det(v2, b.p1-a.p1) / det(v2, v1);
}

int main(){
    int q;
    cin >> q;
    for(int i=0;i<q;++i){
        double x0, y0, x1, y1, x2, y2, x3, y3;
        cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        Point p0 = Point(x0, y0), p1 = Point(x1, y1), p2 = Point(x2, y2), p3 = Point(x3, y3);
        Line s1 = Line(p0, p1), s2 = Line(p2, p3);
        Point cp = intersection(s1, s2);
        printf("%.10f %.10f\n", cp.real(), cp.imag());
    }

    return 0;
}



Measured memory_bytes: 3280
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
int main()
{
	int n,i;
	ll ans=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		int ni;
		scanf("%d",&ni);
		ans += ni-1;
	}
	printf("%d\n",ans);
	return 0;
}

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

int main(){
  ll X; cin>>X;
  ll ans=X/500*1000;
  X=X%500;
  ans+=X/5*5;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
 string s1,s2;
  cin>>s2;
  cin>>s1;
  int m=0,n2=s2.size();
  for(int i=0;i<n2;i++)
  {
    if(s1[i]!=s2[i])
    {
      m=1;
      break;
    }
  }
  if(m==1)
    cout<<"No"<<endl;
  else
      cout<<"Yes"<<endl;
   
  return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
long long deg(long long i) {
	long long tmp = i;
	long long sum = 0, deg = 0;
	while(tmp != 0) {
		deg = tmp % 10;
		sum += deg;
		tmp /= 10;
	}
	return sum;
}
int main() {
	long long A, N, M;
	cin >> A >> N >> M;
	int ans = 0;
	long long X = 1;
	for (int y = 1; y <= 72; y++) {
		X = 1;
		for (int i = 0; i < N; i++) {
			X *= (y + A);
		}
		if (X <= M && deg(X) == y) {
			ans++;
		}
	}
	cout << ans << endl; 
}


Measured memory_bytes: 3088
#include <iostream>
#include <algorithm>
#define inf 1000000000

using namespace std;

int N, M, R;
int r[10];
int G[205][205];
int dist[205][205];

void WarshallFloyd()
{
	for(int i = 1; i <= N; i++){
		for(int j = 1; j <= N; j++){
			dist[i][j] = G[i][j];
		}
	}
	
	for(int k = 1; k <= N; k++){
		for(int i = 1; i <= N; i++){
			for(int j = 1; j <= N; j++){
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
			}
		}
	}
}

int main(void)
{
	cin >> N >> M >> R;
	for(int i = 0; i < R; i++) cin >> r[i];
	for(int i = 1; i <= N; i++){
		for(int j = 1; j <= N; j++){
			G[i][j] = inf;
		}
	}
	int a, b, c;
	for(int i = 0; i < M; i++){
		cin >> a >> b >> c;
		G[a][b] = G[b][a] = c;
	}
	
	WarshallFloyd();
	
	int perm[8];
	for(int i = 0; i < R; i++) perm[i] = i;
	int ans = inf;
	do{
		int sum = 0;
		for(int i = 0; i < R-1; i++) sum += dist[r[perm[i]]][r[perm[i+1]]];
		ans = min(ans, sum);
	}while(next_permutation(perm, perm + R));
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int i,j,k,l,p,mx,n=1,x;
    set<long long int >st;
    set<long long int >:: iterator it;
    for(i=2; i<=10; i++)
    {
        n=1;
        for(j=0; j<36; j++)
        {
            p=j+1;
            n=1;
            for(k=1; k<=i; k++)
            {
                n=n*p;
            }
            if(n<=1000)
                st.insert(n);

        }
    }
    cin>>x;
    for(it=st.begin(); it!=st.end(); it++)
       {
           if(x>=*it)
           {
               mx=*it;
           }

       }
       cout<<mx<<endl;

}


Measured memory_bytes: 256
//#define NDEBUG
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <vector>

namespace n91 {

using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

struct rep {
  struct itr {
    usize i;
    constexpr itr(const usize i) noexcept : i(i) {}
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  const itr f, l;
  constexpr rep(const usize f, const usize l) noexcept
      : f(std::min(f, l)), l(l) {}
  constexpr auto begin() const noexcept { return f; }
  constexpr auto end() const noexcept { return l; }
};
struct revrep {
  struct itr {
    usize i;
    constexpr itr(const usize i) noexcept : i(i) {}
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  const itr f, l;
  constexpr revrep(const usize f, const usize l) noexcept
      : f(l - 1), l(std::min(f, l) - 1) {}
  constexpr auto begin() const noexcept { return f; }
  constexpr auto end() const noexcept { return l; }
};
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) noexcept {
  return a < b ? b - a : a - b;
}
template <class T> void chmin(T &a, const T &b) noexcept {
  if (b < a)
    a = b;
}
template <class T> void chmax(T &a, const T &b) noexcept {
  if (a < b)
    a = b;
}
template <class T> T scan() {
  T ret;
  std::cin >> ret;
  return ret;
}

} // namespace n91

#include <algorithm>
#include <array>
#include <functional>
#include <iomanip>
#include <iostream>
#include <utility>

namespace n91 {

void main_() {
  /*
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  //*/
  const usize n = scan<usize>();
  usize arbit = 0;
  std::array<usize, 8> count;
  std::fill(count.begin(), count.end(), static_cast<usize>(0));
  for (const usize i : rep(0, n)) {
    const usize a = scan<usize>();
    if (a < 3200) {
      count[a / 400] += 1;
    } else {
      arbit += 1;
    }
  }
  usize base = 0;
  for (const auto e : count) {
    if (e > 0) {
      base += 1;
    }
  }
  std::cout << std::max(base, static_cast<usize>(1)) << ' ' << base + arbit << std::endl;
}

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define BUF_SIZE 30
#define DIVISOR 1000000007

// size: specify sizeof(str)
int get_str(char *str, int size) {
    if(!fgets(str, size, stdin)) return -1;
    return 0;
}

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

void swap(int *a, int *b) {
    int tmp = *a;
    *a = *b;
    *b = tmp;
}

struct pair {
    int x;
    int y;
};

struct pair gcdext(int a, int b) {
    if(a==0) { return (struct pair){0, 1}; }
    struct pair p = gcdext(b%a, a);
    return (struct pair){p.y - (b/a)*p.x, p.x};
}


int main(void) {
    int a, b;
    get_int2(&a, &b);
    int swapped = 0;
    // for (1,1) => ans(0,1)
    if(a>=b) {
        swap(&a, &b);
        swapped = 1;
    }

    struct pair p = gcdext(a, b);
    if(swapped) swap(&p.x, &p.y);
    printf("%d %d\n", p.x, p.y);

    return 0;
}


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

using namespace std;

const int N = 3005;
int n;
double dp[N][N], arr[N];

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

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

    dp[1][0] = arr[1];
    dp[0][1] = 1 - arr[1];
    for(int i = 2; i <= n; i++){

        for(int j = i; j >= 0; j--){
            double a = 0;
            if(j - 1 >= 0){
                a += dp[j - 1][i - j] * arr[i];
            }
            if(i - j - 1 >= 0){
                a += dp[j][i - j - 1] * (1 - arr[i]);
            }
            dp[j][i - j] = a;
        }
    }
    double ans = 0;
    for(int i = n; i >= n / 2 + 1; i--){
        ans += dp[i][n - i];
    }
    cout << fixed << setprecision(10) << ans << '\n';
    return 0;
}

Measured memory_bytes: 49864
n, m = map(int, input().split())

acList = [False] * n
waList = [0] * n
waCount = 0
for i in range(m):
  p, s = map(str, input().split())
  p = int(p) - 1 # インデックスの調整
  if acList[p]:
    continue
  if s == 'WA':
    waList[p] += 1
    continue
  waCount += waList[p]
  acList[p] = True

print(sum(acList), waCount)


Measured memory_bytes: 4596
#ifndef CLion
#pragma GCC optimize ("O3")
#endif

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/numeric>

#define F first
#define S second
#define pb push_back
#define ll long long
#define all(x) x.begin() , x.end()
#define rep(i,s,e) for (int i = s; i < e; ++i)
#define rev(i,s,e) for (int i = s; i > e; --i)
#define mem(a,v) memset(a , v , sizeof a)
//#define mod(x,m) ((x%m + m)%m)
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
        tree_order_statistics_node_update>;

void Main(int cse , bool last){
    string s;
    cin >> s;

    ll cnt = 0;
    for ( char i : s )
        cnt += i - '0';
    cout << (cnt%9 == 0 ? "Yes" : "No");
}

int main(){
#ifndef CLion
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif
#ifdef CLion
    freopen( "in.txt" , "r" , stdin  );
//    freopen( "out.txt", "w" , stdout );
    clock_t st = clock();
#endif

    int t = 1;
//    cin >> t;
    for ( int cse = 1; cse <= t; ++cse ) Main(cse, cse == t);

#ifdef CLion
    clock_t en = clock();
    cout << "\n\nTime: " << fixed << (en - st - 0.0) / CLOCKS_PER_SEC;
#endif
    return 0;
}


Measured memory_bytes: 3724
n,d=list(map(int,input().strip().split(' ')))
cnt=0
for i in range(n):
    x,y=list(map(int,input().strip().split(' ')))
    dist = x**2
    dist = dist + y**2
    dist = dist**(0.5)
    if(dist<=d):
        cnt+=1 
print(cnt)

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

class E {
    public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        int R = -1;
        int B = -1;
        final Random r = new Random();
        while (R < 0 || B < 0) {
            final int k = r.nextInt(2 * N);
            System.out.println(query1(N, k));
            if (read(sc) == 'R')
                R = k;
            else
                B = k;
        }
        while (Math.abs(R - B) > 1) {
            final int k = (R + B) / 2;
            System.out.println(query1(N, k));
            if (read(sc) == 'R')
                R = k;
            else
                B = k;
        }
        final char[] ans = new char[2 * N];
        final int K = Math.min(R, B);
        if(K == R) {
            ans[K] = 'R';
            ans[(K + N) % (2 * N)] = 'B';
        } else {
            ans[K] = 'B';
            ans[(K + N) % (2 * N)] = 'R';
        }
        for(int i = (K + N + 1) % (2 * N); i != K; i = (i + 1) % (2 * N)) {
            System.out.println(query2(N, K, i));
            ans[i] = read(sc);
        }
        for(int i = K + 1; i != (K + N) % (2 * N); i = (i + 1) % (2 * N)) {
            System.out.println(query2(N, (K + N) % (2 * N), i));
            ans[i] = read(sc);
        }
        System.out.println("! " + new String(ans));
    }

    static String query1(int N, int k) {
        final StringBuilder sb = new StringBuilder().append('?');
        for (int i = 0; i < N; i++)
            sb.append(' ').append((i + k) % (2 * N) + 1);
        return sb.toString();
    }

    static String query2(int N, int K, int idx) {
        final StringBuilder sb = new StringBuilder().append('?');
        sb.append(' ').append(idx + 1);
        for (int i = 1; i < N; i++)
            sb.append(' ').append((i + K) % (2 * N) + 1);
        return sb.toString();
    }

    static char read(Scanner sc) {
        final char c = sc.next().charAt(0);
        if(c == '-')
            throw null;
        return c;
    }
}
public class Main {
    public static void main(String... args) {
        E.main();
    }
}


Measured memory_bytes: 27296
#include <bits/stdc++.h>
using namespace std;  
#define rep(i, a, b) for(ll i = a; i < b; i++)
#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 _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
// const ll INF = 1LL << 60;
const ll INF = 100000000000;
#define pp pair<ll, pair<ll, ll>> 
// #define fi first
// #define se second
 
/*--------------------------------------------------------------------------------

--------------------------------------------------------------------------------*/


int main(){
    Vp ans;
    ll n; cin >> n;
    Rep(i, 1, n-1) Rep(j, i+1, n){
        if(n%2 == 0){
            if(i+j != n+1) ans.push_back({i, j});
        }else{
            if(i+j != n) ans.push_back({i, j});
        }
    }
    co(sz(ans));
    for(auto it : ans) co(it.first << " " << it.second);

    return 0;
}


Measured memory_bytes: 3720
process.stdin.resume();
process.stdin.setEncoding('utf8');
     
process.stdin.on('data', function (chunk) {
    var numbers = chunk.toString().split(" ");
	//var alice = parseInt(numbers.pop()), bob = parseInt(numbers.pop());
	var alice = parseInt(numbers[0]), bob = parseInt(numbers[1]);
	
	//process.stdout.write(alice.toString() + " "	);
	//process.stdout.write(bob.toString());
	//process.exit();
	
	if (alice == 1) alice += 13;
	if (bob == 1) bob += 13;
	
	if (alice > bob){
		process.stdout.write("Alice");    
	} else if (alice < bob){
		process.stdout.write("Bob");    
	} else {
		process.stdout.write("Draw");    
	}
     
    process.exit();
});

Measured memory_bytes: 20936
import java.awt.Frame;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import javax.sql.rowset.FilteredRowSet;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.stream.events.EndDocument;
import java.math.BigInteger;
import java.time.chrono.MinguoChronology;
import java.util.Scanner;

public class Main {
  static InputReader in;
  static PrintWriter out;
  
  static class Solution {
    void solve() throws IOException {
      String s = in.next();
      String p = in.next();
      int slength = s.length();
      int plength = p.length(); 
      boolean flg = false;
      
      for (int i  = 0; i < slength; i++) {
        if (slength - i >= plength) {
          if (s.substring(i , plength + i).equals(p)) {
            flg = true;
          }
        } else {
          if (p.equals(s.substring(i, slength) + s.substring(0, plength - slength + i))) {
            flg = true;
          }
        } 
      }
      
      
      if (flg) {
        out.println("Yes");
      } else {
        out.println("No");
      }
//      End solve()
    }
    
//  End solution
  } 
  

  public static void main(String[] args) throws IOException {
    in = new InputReader(System.in);
    out = new PrintWriter(System.out);
    Solution solver = new Solution();
    solver.solve();
    out.close();
}

  static class InputReader {
    public BufferedReader br;
    public StringTokenizer st;
    
    public InputReader(InputStream stream) {
      br = new BufferedReader(new InputStreamReader(stream));
    }
   
    public int nextInt() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Integer.parseInt(st.nextToken());
    }
    
    public long nextLong() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Long.parseLong(st.nextToken()); 
    }
    
    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return st.nextToken();
    }
    
    public double nextDouble() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Double.parseDouble(st.nextToken());
    }
    
  }
  
}

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

int main() {
    string s,t,u;
    int a,b;
    cin >> s >> t >> a >> b >> u;
    if(u == s){
        cout << a-1 << " " << b << endl;
    }else{
        cout << a << " " << b-1 << endl;
    }

}

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

int Yakusu(int x) {
  int cnt = 0;

  for(int i=1; i<=x; ++i) {
    if(x%i==0) ++cnt;
  }

  return cnt;
}

int main() {
  int N, cnt = 0;
  cin >> N;

  for(int i=1; i<=N; i+=2) {
    if(Yakusu(i) == 8) ++cnt;
  }

  cout << cnt << "\n";

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int ctoi(char a){
    return a-'0';
}
int main(void){
    string s;cin>>s;
    int n=s.size()-1;
    long long output=0;
    for(int i=0;i<(1<<n);i++){
        long long now=0;
        for(int j=0;j<n;j++){
            now+=ctoi(s[j]);
            if((i>>j)%2==0){
                now=now*10;
            }else{
                output+=now;
                now=0;
            }
        }
        output=output+now+ctoi(s[n]);
    }
    cout<<output<<"\n";
}



Measured memory_bytes: 256
import sys
N=int(input())
for h in range(1,3501):
  for n in range(h,3501):
    if 4*h*n-N*n-h*N>0 and (N*h*n)%(4*h*n-N*n-h*N)==0:
      ans=[]
      ans.append(str(h))
      ans.append(str(n))
      ans.append(str((N*h*n)//(4*h*n-N*n-h*N)))
      print(' '.join(ans))
      sys.exit()

Measured memory_bytes: 67656
function main(input) {
  input = input.trim();
  const [a,b,c] = input.split(" ");
  let x = a.slice(0,1).toUpperCase() + b.slice(0,1).toUpperCase() + c.slice(0,1).toUpperCase();
  console.log(x);
 
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29536
#include <cstdio>
int main(){
	int n,m,a,p,i,x;
	for(;scanf("%d%d",&n,&m),n|m;printf("%d\n",x)){
		int a[2001]={},b[2001]={};
		for(x=p=i=0;i<n+m;++i)
			(i>=n)?scanf("%d",b+i-n):scanf("%d",a+i);
		for(;p<n-1;p+=a[p])
			p+=b[x++];
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
long long n,qs[200005],a,mn=1e18,sum=0;
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a);
		qs[i]=qs[i-1]+a;
		sum+=a;
	}
	for(int i=1;i<n;i++)
	{
		mn=min(mn,abs(qs[i]-(sum-qs[i])));
	}
	printf("%lld\n",mn);
}

Measured memory_bytes: 5328
#include<stdio.h>
#include<string.h>
int main(){
  int n, m, i, j;
  char translate[999];
  while(1){
    scanf("%d",&n);
    for(i = 0;i < 999;i++)translate[i]=i;
    if(n == 0)return 0;
    for(i = 0;i < n;i++){
      char a, b;
      scanf(" %c %c", &a, &b);
      translate[a] = b;
    }
    scanf("%d", &m);
    for(i = 0;i < m;i++){
      char c;
      scanf(" %c",&c);
      putchar(translate[c]);
    }
    puts("");
  }
}

Measured memory_bytes: 588
#include <iostream>
using namespace std;
typedef long long ll;
ll GCD(ll a, ll b) {
    return (a == 0) ? b : GCD(b % a, a);
}
ll LCM(ll a, ll b) {
    return a * b / GCD(a, b);
}
int main() {
    int a[3], m[3];
    while (1) {
        cin >> a[0] >> m[0] >> a[1] >> m[1] >> a[2] >> m[2];
        if (!a[0]) {
            break;
        }
        int val[3] = {1,1,1}, move[3] = {0};
        int cnt = 0;
        for (int i=1; ; ++i) {
            for (int j=0; j<3; ++j) {
                if (move[j]) continue;
                val[j] = a[j] * val[j] % m[j];
                if (val[j] == 1) {
                    move[j] = i;
                    cnt ++;
                }
            }
            if (cnt >= 3) break;
        }
        ll ans = LCM(LCM(move[0], move[1]), move[2]);
        cout << ans << endl;
    }
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t="",u="",v,w,x;
    cin>>s;
    v=s;
    reverse(v.begin(),v.end());
    for(int i=0;i<(s.size()-1)/2;i++)
    {
        t+=s[i];
    }
    w=t;
    reverse(w.begin(),w.end());
    for(int i=(s.size()/2)+1;i<s.size();i++)
    {
        u+=s[i];
    }
    x=u;
    reverse(x.begin(),x.end());
    if(s==v&&t==w&&u==x)
    {
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main() {
	string S[3];
	cin >> S[0] >> S[1] >> S[2];
	int i[3] = { 0,0,0 };
	int now = 0;
	while (i[now] < S[now].length()) {
		i[now]++;
		now = S[now][i[now] - 1] - 'a';
	}
	cout << (char)('A' + now) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;



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

	string s;
	cin >> s ;

	rep(i, s.length()) {
		s[i] = 'x';
	}

	cout << s << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
	
		String s = sc.next();
	int number = 0;	
      // スペース区切りの整数の入力
		int flag = 0;
      for(int i=0;i<3;i++){
      if(s.charAt(i)=='1'){
        number++;
      }}
		// 出力
    
		System.out.println(number);
	
      }
}

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

int main(){
  int H, W;

  while (1){
  	cin >> H >> W;
  	if ( H == 0 && W == 0) break;
  	
    for ( int i = 0; i < H; i++ ){
  	  for ( int j = 0; j < W; j++ ) cout << "#";
  	  cout << endl;
    }
    
    cout << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3088
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

constexpr int dx[] = {-1, 0, 1, 0};
constexpr int dy[] = {0, -1, 0, 1};

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

int main() {
	int x, y;
	cin >> x >> y;
	REP(i, x + 1) {
		if(2 * i + 4 * (x - i) == y) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


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

using namespace std;

int main()
{
    int n,i,a[10]={99,111,222,333,444,555,666,777,888,999};
    cin>>n;
    for(i=0;i<10;i++){
        if(a[i]==n){
            cout<<n;
            return 0;
        }

        if(a[i]<n && a[i+1]>n){
        cout<<a[i+1];
        return 0;
        }}
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
#include <cstring>
using namespace std;
int a,b,c,q,n,man,mix,mix1,ans,ans1,l,r,l1,r1,d[100000],dp[1000][1000];
string s,s1,s2,s3;
vector<int> v[100000],v1;
// deque<int> dq;
map<int,int> mp,mp1,mp2;
bool o[100000];                                                               
stack<long long> st;
// char h;
// long double ld;
pair<long long, long long> p[1000000];
int main(){
    cin>>a;
    for(int i = 0; i < a; i++){
        cin>>d[i];
    }
    for(int i = 0; i < a; i++){
        for(int j = i+1; j < a; j++){
            ans+=d[i]*d[j];
        }
    }
    cout<<ans;
}

Measured memory_bytes: 4352
from sys import stdin
input = stdin.readline

a, b, n = map(int, input().split())

x1 = max(n - n % b - 1, 0)
x2 = n
ans = max(((a * x1) // b) - (a * (x1 // b)), ((a * x2) // b) - (a * (x2 // b)))

#print(x1, x2)
print(ans)


Measured memory_bytes: 9220
#include<stdio.h>
int main(){
  int i,j,k,tmp,m[10];
  for(k=0;k<10;k++){
    scanf("%d",&m[k]);
  }
  for(i=0;i<10;++i){
    for(j=i+1;j<10;++j){
      if(m[i]<m[j]){
      tmp=m[i];
      m[i]=m[j];
      m[j]=tmp;
      }
    }
  }
  for(i=0;i<3;i++){
    printf("%d\n",m[i]);
  }
  return 0;
}

Measured memory_bytes: 600
import java.util.*;
public class Main {
	public static void main(String[] args) {
		
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s=sc.next();
		Echo(n,s);
	}
	
	static void Echo(int n, String s) {
		String mae=s.substring(0,n/2);
		String usiro=s.substring(n/2,n);
		if(mae.equals(usiro)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}		
	}
}


Measured memory_bytes: 23764
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<int> vec;

void solve(){
	int n; cin >> n;
	ld ans = 0;
	rep(i, n) {
		ld x; cin >> x;
		string s; cin >> s;
		if (s[0] == 'J')ans += x;
		else ans += 380000 * x;
	}
	cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(6);
	//init();
	solve();
	stop
		return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
 #define MAX 2000001

void Counting_Sort(int A[], int B[], int n, int k) {
    int i, j;
    int C[10001];
    for(i = 0; i <= k; ++i){
        C[i] = 0;
    }
    for(j = 1; j <= n; ++j){
        C[A[j]] = C[A[j]]+1;
    }
    for(i = 1; i <= k; ++i){
        C[i] = C[i] + C[i-1];
    }

    for(j = n; j >= 1; --j) {
        B[C[A[j]]] = A[j];
        C[A[j]] = C[A[j]]-1;
    }
}

int A[MAX], B[MAX];

int main() {
    int i, n;
    int k = 0;

    scanf("%d", &n);
    for(i = 1; i <= n; ++i) {
        scanf("%d", A + i);
        k = A[i] > k ? A[i] : k;
    }

    Counting_Sort(A, B, n, k);
    for(i = 1; i <= n; ++i) {
        if(i-1) printf(" ");
        printf("%d", B[i]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 16264
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)n; ++i)

ll table[1000000];
ll pollock[1000001];
ll dp[1000001];

int main() {
	//freopen("Text.txt", "r", stdin);
	
	ll size = 0;
	{
		ll i = 0;
		table[0] = 0;
		while (1000001 > table[i]) {
			i++;
			table[i] = i*(i + 1)*(i + 2) / 6;
		}
		size = i;
	}

	{
		pollock[0] = 0;
		ll current_i = 0;
		REP(i, 1000001) {
			if (i == 0) continue;
			if (table[current_i + 1] == i) {
				pollock[i] = 1; current_i++;
				continue;
			}

			ll minimum = 1000001;
			for (ll j = 1; j <= current_i; j += 1) {
				minimum = min(pollock[i - table[j]] + 1, minimum);
			}
			pollock[i] = minimum;
		}
	}

	{
		dp[0] = 0;
		ll current_i = -3;
		REP(i, 1000001) {
			if (i == 0) continue;
			if (table[current_i + 4] == i) {
				current_i += 4; dp[i] = 1;
				continue;
			}

			ll minimum = 1000001;
			for(ll j=1; j<=current_i; j+=4) {
				minimum = min(dp[i - table[j]]+1, minimum);
			}
			dp[i] = minimum;
		}
	}

	while (true) {
		int n;
		cin >> n;
		if (n==0) break;
		
		cout << pollock[n] << " " << dp[n] << endl;
	}

}

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

int main() {
    string s;
    cin >> s;
    int n = s.size();
    vector<int> colors(n);
    int sum = 0, ans = 0;
    for (int i = 0; i < n; i++)
    {
        colors[i] = (int)(s[i] - '0');
    }
    for (int i = 0; i < n; i++)
    {
        if (i == 0)
        {
            continue;
        }
        if (colors[i - 1] != colors[i])
        {
            colors.erase(colors.begin() + i);
            colors.erase(colors.begin() + i - 1);
            i = 0;
            n -= 2;
            ans += 2;
        }
    }
    cout << ans << endl;
}


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

P p[60];
int main(){
	int n;cin>>n;
	rep(i,n){
		cin>>p[i].first>>p[i].second;
	}
	if(n==1){
		puts("1");return 0;
	}
	sort(p,p+n);
	int Min=INT_MAX;
	rep(i,n){
		for(int j=i+1;j<n;j++){
			int x=p[j].first-p[i].first,y=p[j].second-p[i].second;
			set<P>se;
			rep(k,n)se.insert(p[k]);
			int cnt=0;
			while(!se.empty()){
				cnt++;
				auto p=*se.begin();
				int cx=p.first,cy=p.second;
				while(se.count(P(cx,cy))){
					se.erase(P(cx,cy));
					cx+=x;cy+=y;
				}
			}
			Min=min(Min,cnt);
		}
	}
	cout<<Min<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[])
{
    float x, y;
    float a, b, c, d, e, f;
    
    while (scanf("%f %f %f %f %f %f",&a, &b, &c, &d, &e, &f) != EOF){
        y = (a*f - c*d) / (a*e - b*d);
        x = (c - b*y) / a;
        printf("%.3f %.3f\n",x ,y);
    }
    return 0;
}

Measured memory_bytes: 648
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <math.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define INF 1001001
using namespace std;

int main(){
  int s, w;
  cin >> s >> w;
  if(s<=w){
    cout << "unsafe" << endl;
  }else{
    cout << "safe" << endl;
  }
  
  

  
}

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


struct UnionFind {
    vector<int> parent;

    UnionFind(int N = 1) {
        init(N);
    }

    void init(int N = 1) {
        parent.assign(N, -1);
    }

    int root(int x) {
        if (parent.at(x) < 0) return x;
        parent.at(x) = root(parent.at(x));
        return parent.at(x);
    }
 
    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    void merge(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (parent.at(x) < parent.at(y)) swap(x, y);
        parent.at(x) += parent.at(y);
        parent.at(y) = x;
    }

    int size(int x) {
        return -parent.at(root(x));
    }
};
 
int main() {
    long long N, M; cin >> N >> M;
    vector<pair<int, int>> edges(M);
    for (int i = 0; i < M; i++) {
        int A, B; cin >> A >> B; A--; B--;
        edges.at(i) = make_pair(A, B);
    }

    reverse(edges.begin(), edges.end());
    UnionFind uf(N);
    vector<long long> ans;

    long long disconnectivity = N * (N - 1) / 2; 
    for (int i = 0; i < M; i++) {
        ans.push_back(disconnectivity);
        if (uf.issame(edges.at(i).first, edges.at(i).second)) continue;
        long long a = uf.size(edges.at(i).first);
        long long b = uf.size(edges.at(i).second);
        disconnectivity -= a * b;
        uf.merge(edges.at(i).first, edges.at(i).second);
    }

    reverse(ans.begin(), ans.end());
    for (auto v : ans) cout << v << endl;
}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define INF 10000000000000009
#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl
typedef pair<int,int> Pp;
int Roundup(int a,int b){
    return (a+b-1)/b;
}


signed main(){
    int N,K;
    int x[57],y[57];
    cin >> N >> K;
    REP(i,N){
        cin >> x[i] >> y[i];
    }
    int Ans=INF;
    REP(i,N){
        REP(j,N){
            REP(l,i){
                REP(m,j){
                    int lx=min(x[i],x[l]),rx=max(x[i],x[l]);
                    int ly=min(y[j],y[m]),ry=max(y[j],y[m]);
                    int num=0;
                    REP(k,N){
                        if(lx<=x[k]&&x[k]<=rx && ly<=y[k]&&y[k]<=ry){
                            num++;
                        }
                    }
                    if(num>=K){
                        Ans=min(Ans,(rx-lx)*(ry-ly));
                    }
                }
            }
        }
    }
    cout << Ans << endl;
    return 0;
}   


Measured memory_bytes: 256
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
l=[A,B,C,D,E]
l0=[i%10 for i in l]
x=[]
for i in range(5):
    if l0[i]!=0:
        l[i]=(1+l[i]//10)*10 
        x.append(l0[i])
if x==[]:
    ans=sum(l)
else:
    ans=sum(l)-10+min(x)
print(ans)

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    ll r,D,x;
    cin >> r >> D >> x;
    REP(i,10) {
        x = r*x - D;
        cout << x << endl;
    }

    return 0;
}


Measured memory_bytes: 256