akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int a = 0, b = 0;
    char c;
    cin >> c;
    a = a * 10 + c - '0';
    cin >> c;
    a = a * 10 + c - '0';
    cin >> c;
    b = b * 10 + c - '0';
    cin >> c;
    b = b * 10 + c - '0';
    if (a <= 12 && a >= 1 && b >= 1 && b <= 12)
    {
        cout << "AMBIGUOUS";
    }
    else if (a >= 1 && a <= 12)
    {
        cout << "MMYY";
    }
    else if (b >= 1 && b <= 12)
    {
        cout << "YYMM";
    }
    else
    {
        cout << "NA";
    }
    
    getchar(); getchar();
    return 0;
}

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

ll modpow(ll a, ll n){
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

ll fact(ll N){
	ll ret = 1;
	rep2(i, 1, N + 1) ret = (ret * i) % INF;
	return ret;
}

void Main(){
	
	ll N, M;
	cin >> N >> M;
	ll ans;
	if(N == M){
		ans = 2 * fact(N) * fact(M);
		ans %= INF;
	}
	else if(abs(N - M) == 1){
		ans = fact(N) * fact(M);
		ans %= INF;
	}
	else ans = 0;
	print(ans);
	
}

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





Measured memory_bytes: 3604
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public int[] Sarray() { return ReadLine().Split().Select(int.Parse).ToArray(); }
        static public List<int> Slist() { return ReadLine().Split().Select(int.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;
        static void Main(string[] args)
        {
            var N = Sarray()[0];
            var H = Sarray();
            var A = Sarray();
            var dp = new SegmentTree<long>(N + 1, Max, 0);

            for (var i = 0; i < N; ++i)
            {
                var pre = dp.query(0, H[i] + 1);
                dp.update(H[i], pre + A[i]);
            }
            WriteLine(dp.query(1, N + 1));
        }
        
        class SegmentTree<Monoid>
        {
            int sz;
            Monoid[] seg;
            readonly Func<Monoid, Monoid, Monoid> f;
            readonly Monoid M1;
            public SegmentTree(int n, Func<Monoid, Monoid, Monoid> f, Monoid M1)
            {
                this.f = f;
                this.M1 = M1;
                sz = 1;
                while (sz < n) sz <<= 1;
                seg = new Monoid[sz * 2].Select(_ => M1).ToArray();
            }
            public void set(int k, Monoid x) => seg[k + sz] = x;
            public void build()
            {
                for (var k = sz - 1; 0 < k; --k)
                    seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
            }
            public void update(int k, Monoid x)
            {
                k += sz;
                seg[k] = x;
                while (0 != (k >>= 1))
                    seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
            }
            //区間[a,b)に対して
            public Monoid query(int a,int b)
            {
                Monoid L = M1, R = M1;
                for (a += sz, b += sz; a < b; a >>= 1,b>>=1)
                {
                    if (0 != (a & 1)) L = f(L, seg[a++]);
                    if (0 != (b & 1)) R = f(seg[--b], R);
                }
                return f(L, R);
            }
            Monoid this[int k] => seg[k + sz];
        }
    }
}

Measured memory_bytes: 47572
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Pi = pair<P, int>;
#define FF first.first
#define FS first.second

int main(void){
    int h, w;
    cin >> h >> w;

    bool map[1001][1001];
    fill(map[0], map[1001], true);

    int ch, cw, dh, dw;
    cin >> ch >>  cw >> dh >> dw;
    --ch; --cw; --dh; --dw;

    string s[h];
    rep(i, h) cin >> s[i];

    deque<Pi> dfs;
    dfs.push_front(Pi(P(ch, cw), 0));

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

    while(!dfs.empty()){
        auto v = dfs.front(); dfs.pop_front();
        int y = v.FF, x = v.FS, cost = v.second;

        if(!map[y][x]) continue;
        map[y][x] = false;

        if(y == dh && x == dw){
            cout << cost << endl;
            return 0;
        }

        for(int i = 0; i < 24; ++i){
            int to_x = x + dx[i], to_y = y + dy[i];

            if(to_x < 0 || to_x >= w || to_y < 0 || to_y >= h) continue;

            if(map[to_y][to_x] && s[to_y][to_x] == '.'){
                if(i < 4)
                    dfs.push_front(Pi(P(to_y, to_x), cost));
                else
                    dfs.push_back(Pi(P(to_y, to_x), cost + 1));
            }

        }
    }

    cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 6964
using System;
using System.IO;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Linq;

namespace atcoder_past_problem
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new Input(Console.In));
        }

        public void Solve(Input input)
        {
            var a = input.ReadLong;
            var b = input.ReadLong;
            var k = input.ReadLong;

            a = a - k;
            if (a < 0)
            {
                k = -1 * a;
                a = 0;
            }
            else
            {
                Console.WriteLine($"{a} {b}");
                return;
            }

            b = b - k;
            if (b < 0)
            {
                b = 0;
            }
            Console.WriteLine($"{a} {b}");
        }
    }

    public class Input
    {
        private TextReader Stream { get; }
        private char Separator { get; }
        private Queue<string> InputStream { get; }

        public Input(TextReader stream, char separator = ' ')
        {
            Stream = stream;
            Separator = separator;
            InputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if (InputStream.Count != 0) return InputStream.Dequeue();
                string[] tmp = Stream.ReadLine().Split(Separator);
                for (int i = 0; i < tmp.Length; ++i)
                    InputStream.Enqueue(tmp[i]);
                return InputStream.Dequeue();
            }
        }

        public string ReadLine => Stream.ReadLine();
        public int ReadInt => int.Parse(Read);
        public long ReadLong => long.Parse(Read);
        public double ReadDouble => double.Parse(Read);
        public int[] ReadIntArray => Stream.ReadLine().Split(Separator).Select(i => int.Parse(i)).ToArray();
        public long[] ReadLongArray => Stream.ReadLine().Split(Separator).Select(l => long.Parse(l)).ToArray();
    }
}


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

int main() {
  string S;
  cin >> S;

  int len = S.size();
  int ans_0 = 0;
  rep(i, len) {
    if ((i % 2 == 0 && S[i] == '1') || (i % 2 != 0 && S[i] == '0'))
      ans_0++;
  }
  int ans_1 = 0;
  rep(i, len) {
    if ((i % 2 == 0 && S[i] == '0') || (i % 2 != 0 && S[i] == '1'))
      ans_1++;
  }
  cout << min(ans_0, ans_1) << endl;
}

Measured memory_bytes: 512
n, l = map(int, input().split())

if l+n-1<=-1:
  print(int((n-1)*l + (n-2)*(n-1)/2))
  
elif l>=1:
  print(int((n-1)*l + n*(n-1)/2))
  
else:
  print(int(l*n + (n-1)*n/2))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define print(v) cout<<v<<endl;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;

ll F(ll x){
    if(x<=0)return 1;
    if(x==1)return 2;
    if(x==2)return 3;
    if(x==3)return 5;
    if(x==4)return 8;
    if(x==5)return 13;
    if(x==6)return 21;
    if(x==7)return 34;
    if(x==8)return 55;
}


int main(){
    ll H;
    cin >> H;
    ll W;
    cin >> W;
    ll h;
    cin >> h;
    ll w;
    cin >> w;
    print((H-h)*(W-w))
    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

bool f[1000000][50];

signed main(){
    int K;cin>>K;
    f[0][0]=1;
    queue<pint>que;
    que.push({0,0});
    while(que.size()){
        int v,d;
        tie(v,d)=que.front();
        que.pop();
        rep(i,10){
            int vv=v+K*i;
            int dd=d+vv%10;
            vv/=10;
            if(dd>=50)continue;
            if(f[vv][dd])continue;
            f[vv][dd]=1;
            que.push({vv,dd});
        }
    }

    for(int j=1;j<50;j++)if(f[0][j]){
            cout<<j<<endl;
            return 0;
    }
    return 0;
}


Measured memory_bytes: 40208
import sys
# from collections import defaultdict
# from collections import Counter
# from queue import Queue

def main():
    # N = int(input())

    A_, B_ = [ch for ch in input().split()]
    A = int(A_)
    Bint = int(float(B_[0]))
    Bfloat = int(B_[2:])

    # print(A)
    # print(Bint)
    # print(Bfloat)

    ans = A * Bint + (A * Bfloat // 100)

    # ans = A + int(A * (B - 1.0))
    print(ans)

    # As = []
    # for i in range(N):
    #     tmp = int(input())
    #     As.append(tmp)

    return 0

if __name__ == '__main__':
    sys.exit(main())


Measured memory_bytes: 9176
#pragma GCC optimize "-O3"
#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define NumberOfOnes __builtin_popcount
#define LSOne(S) (S & (-S))
#define ll long long
#define two pair<int,int>
#define twoll pair<ll,ll>
#define four pair<two,two>
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define y1 y1922
#define INF 1000000000000000000
#define P 1000000007
#define lmax 1000000000
#define nn 1000003
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define vi vector<int>
#define vll vector<ll>
#define vtwo vector<two>
#define ALL(container) (container).begin(), (container).end()
#define sz(container) (int)(container.size())
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define mid(a,b) (a+b>>1)
#define minN 0
#define maxN 10000000
#define na(x) ((x)<P?(x):(x)-P)
#define ab(a) (-(a)<(a)?(a):-(a))
#define FAST std::ios::sync_with_stdio(false)
#define xRand mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define rnd rng
#define IT iterator
typedef
tree<
  int,// aq pair<int,int> shegidzlia
  null_type,
  less/*_equal*/<int>,// aqac
  rb_tree_tag,
  tree_order_statistics_node_update>
ordered_set;
// '_equal' mashin ginda roca multiset gchirdeba
template<class key, class value,class cmp = std::less<key>>
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;
ordered_map<int, int> my_map;
inline int rin(){
	int x=0,w=1;char ch=getchar();
	while ((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if (ch=='-') w=0,ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
inline int bin(){
	int x=0;char ch=getchar();
	while (ch<'0'||ch>'9') ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x;
}
int n,ans,c,O,x,l;
vector<two>v;
int main(){FAST;xRand;
cin>>n;
for(int i=1;i<=n;i++){
	cin>>x>>l;
	v.pb({x+l,x-l});
}
sort(ALL(v));
O=-lmax;
for(int i=0;i<sz(v);i++){
	if(O<=v[i].s){
		c++;
		O=v[i].f;
	}
}
cout<<c<<endl;
	// you should actually read the stuff at the bottom
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?), slow multiset operations
	* do smth instead of nothing and stay organized
	* unordered_map, hash_map, scanf, calculate answer instead of ans*K
*/
/*


                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
                 *   *   * *   *
                  *   *   *   *
                   *   * *   *
                     *  *   *
					   *  *


*/




Measured memory_bytes: 1400
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int height = sc.nextInt();
		int width = sc.nextInt();
		int num = sc.nextInt();

		long dist[][] = new long[height][width];
		dist[0][0] = 0;
		for(int i = 1; i < height; i ++) {
			dist[i][0] = dist[i - 1][0] + i;
		}
		for(int i = 1; i < width; i ++) {
			dist[0][i] = dist[0][i - 1] + i;
		}
		for(int i = 1; i < height; i ++) {
			for(int j = 1; j < width; j ++) {
				dist[i][j] = dist[i - 1][j] + dist[i][j - 1] - dist[i - 1][j - 1] + i + j;
				dist[i][j] = mod(dist[i][j]);
			}
		}
		long sum = 0;
		long sumHeight = 0;
		long sumWidth = 0;
		for(int i = 0; i < height; i ++) {
			for(int j = 0; j < width; j ++) {
				sum += dist[i][j];
				sum = mod(sum);
			}
		}
		for(int i = 0; i < height; i ++) {
			sumHeight += dist[i][0];
			sumHeight = mod(sumHeight);
		}
		sumHeight = mod(sumHeight * width);
		for(int i = 0; i < width; i ++) {
			sumWidth += dist[0][i];
			sumWidth = mod(sumWidth);
		}
		sumWidth = mod(sumWidth * height);


		long ans = mod(sum * 2 - sumHeight - sumWidth);
		ans = mod(ans * combiMod(width * height - 2, num - 2));
		System.out.println(ans);
	}

	static long MOD = (long)Math.pow(10, 9) + 7;
	public static long mod(long i) {
		return i % MOD + ((i % MOD) < 0 ? MOD : 0);
	}

	static long powerMod(long x, long y) {
		if (y == 0) {
			return 1;
		} else if (y == 1) {
			return x;
		} else if (y % 2 == 0) {
			long tmp = powerMod(x, y / 2);
			return mod(tmp * tmp);
		} else {
			long tmp = powerMod(x, y / 2);
			return mod(mod(tmp * tmp) * x);
		}
	}
	
	static long divMod(long x, long y) {
		return mod(x * powerMod(y, MOD - 2));
	}

	static long combiMod(int n, int r) {
		if(n <= 0 || n < r) { return 0; }
		r = Math.min(n - r, r);
		if(r == 0) { return 1; }
		long ans = 1;
		for (int i = 1; i <= r; i ++) {
			ans = mod(ans * (n - i + 1));
			ans = divMod(ans, i);
		}
		return mod(ans);
	}
}

Measured memory_bytes: 28244
#include <bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define mp make_pair
#define int long long
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
const int MOD=998244353;
int a,b,c,d;
int dp[3010][3010];//
signed main(){
	memset(dp,0,sizeof dp);
	cin>>a>>b>>c>>d;
	dp[a][b]=1;
	for(int i=a;i<=c;i++)
		for(int j=b;j<=d;j++)if(i!=a||j!=b){
			dp[i][j]=(dp[i-1][j]*j+dp[i][j-1]*i+MOD-dp[i-1][j-1]*(i-1)*(j-1)+MOD)%MOD;
//			cerr<<i<<' '<<j<<' '<<dp[i][j]<<endl;
			if(dp[i][j]<0)dp[i][j]+=MOD;
		}
	cout<<dp[c][d]<<endl;
	return 0;
}


Measured memory_bytes: 74408
from fractions import gcd
def fun():
    nx = input()
    N, X = nx.split(' ')
    N = int(N)
    X = int(X)
    cities = [int(c) for c in input().split(' ')]
    cities.append(X)
    x = sorted(cities)
    nx = x[1:]
    dist = [nn - x[i] for i, nn in enumerate(nx)]
    if N==1:
        print(dist[0])
        return
    min_gcd = 10000000000
    for i, d in enumerate(dist[:-1]):
        dp = dist[i+1]
        gc = gcd(d, dp)
        if gc < min_gcd:
            min_gcd = gc
    print(min_gcd)

fun()


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

using namespace std;

int cnt[3];

int main() {
    int ans = 0;
    
    int n; cin >> n;
    for (int i = 1; i <= n; ++i) {
        string s; cin >> s;
        
        for (int j = 0; j + 1 < (int) s.length(); ++j) {
            if (s[j] == 'A' && s[j + 1] == 'B') {
                ++ans;
            }
        }
        
        if (s.front() == 'B' && s.back() == 'A') {
            ++cnt[2];
        } else if (s.front() == 'B') {
            ++cnt[0];
        } else if (s.back() == 'A') {
            ++cnt[1];
        }
    }

    if (cnt[2] == 0) {
        ans += min(cnt[0], cnt[1]);
    } else {
        ans += cnt[2] - 1;
        cnt[2] = 1;
        if (cnt[0] > 0 || cnt[1] > 0) {
            ans += 1;
            ans += min(cnt[0], cnt[1]);
        }
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cout << v << " ";                                                          \
  }                                                                            \
  cout << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template < class T > bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
typedef long long ll;
const int MOD = 1000000007, INF = 1061109567;
const double EPS = 1e-10, PI = acos(-1.0);
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N, K;
  cin >> N >> K;
  K--;
  print((int)ceil((N - 1.0) / K));
  return 0;
}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = 1e9+7; typedef vector<ll> VL;

void dbg(){ cerr << "\n"; } template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n,k;
	cin >>n >>k;
	
	
	cout << n+1-k << endl;
	return 0;
}


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

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

    map<int , int> chk;
    for(int i = 0; i<N; i++) {
        chk[A[i]]++;
    }
    for(auto x : chk) {
        if(x.second % 2 == 0) chk[x.first] = 0;
    }
    int res;
    for(auto x : chk) {
        if(x.second > 0) res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    int a[2*n];
    for(int i = 0; i < 2*n; i++){
        cin >> a[i];
    }
    sort(a,a+2*n);
    int ans = 0;
    for(int i = 0; i < 2*n; i += 2){
        ans += a[i];
    }
    cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main(){
    int d, t, s;
    cin >> d >> t >> s;
    cout << (s * t >= d ? "Yes" : "No");
}

Measured memory_bytes: 3636
// ----- In the name of ALLAH, the Most Gracious, the Most Merciful -----

#include<bits/stdc++.h>
using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define deb(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define memo(a,val) memset(a,val,sizeof(a))
#define NINJA ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(a) a.begin(),a.end()
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define dloop(i,n) for(int i=n-1;i>=0;i--)
#define iii tuple<int,int,int>
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define int long long
#define ld long double
#define pb push_back
#define endl "\n"
#define setbits __builtin_popcountll
#define mp map<int,int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007
#define inf (int)1e18

const int mxn = 1e5+10;
int dp[mxn];

int32_t main(){
	NINJA;

	int n,k; cin >> n >> k;
	vi a(n);
	for(int&x:a) cin >> x;

	dp[0] = 0;

	for1(i,k){
		for(int x : a){
			if(i>=x and dp[i-x]==0) {
				dp[i] = 1;
				break;
			}
		}
	}

	if(dp[k]==1) cout << "First" << endl;
	else cout << "Second" << endl;
	
	return 0;
}

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

int main() {
  long long int A, V, B, W, T;
  cin >> A >> V >> B >> W >> T;
  if (V <= W) cout << "NO" << endl;
  else {
    if (abs(A - B) <= (V - W) * T) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

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

int main()
{
	int x[3];

	std::cin >> x[0] >> x[1] >> x[2];

	std::sort(x, x + 3);

	std::cout << x[0] << " " << x[1] << " " << x[2] << std::endl;

	return 0;
}

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

//#define INF 1e9
const ll INF = 1LL << 61;
vector<ll> A;
ll N, K;
ll isOK(ll x){
  ll cnt = 0;
  REP(i, N){
    int ok = -1, ng = N;
    if(A[i] < 0){
      ok = N, ng = -1;
    }
    while(abs(ok-ng) > 1){
      int mid= (ok+ng)/2;
      if(A[i] * A[mid] < x){
        ok = mid;
      }
      else{
        ng = mid;
      }
    }
    if(A[i] < 0){
      cnt += N-ok;
    }
    else{
      cnt += ok+1;
    }
    if(A[i] * A[i] < x){
      cnt--;
    }
  }
  return cnt/2 < K;
}
ll binary_search(){
  ll ng = INF, ok = -INF;
  while(abs(ok-ng) > 1){
    ll mid = (ng+ok) / 2;
    if(isOK(mid)){
      ok = mid;
    }
    else{
      ng = mid;
    }
  }
  return ok;
}
int main(){
  cin >> N >> K;
  A.resize(N);
  REP(i, N){
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  cout << binary_search() << endl;
  return 0;
}


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

struct dice
{
	int _1, _2, _3, _4, _5, _6;
};

int main(int argc, char const *argv[])
{
	dice d;
	int temp;
	string cmd;

	cin >> d._1 >> d._2 >> d._3 >> d._4 >> d._5 >> d._6;
	cin >> cmd;

	for (int i = 0; i < cmd.size(); ++i)
	{
		switch(cmd[i]){
			case 'N':
				temp = d._1;
			    d._1 = d._2;
			    d._2 = d._6;
			    d._6 = d._5;
			    d._5 = temp; 
			break;
			case 'E':
				temp = d._1;
	      		d._1 = d._4;
	      		d._4 = d._6;
	      		d._6 = d._3;
	      		d._3 = temp;
			break;
			case 'W':
			    temp = d._1;
			    d._1 = d._3;
			    d._3 = d._6;
			    d._6 = d._4;
			    d._4 = temp;
		    break;
		    case 'S':
		      	temp = d._1;
		      	d._1 = d._5;
		      	d._5 = d._6;
		      	d._6 = d._2;
		      	d._2 = temp;
		    break;
		}
	}
	cout << d._1 << endl;
	return 0;
}

Measured memory_bytes: 3132
S = str(input())
n = S.count('N')
w = S.count('W')
s = S.count('S')
e = S.count('E')
if (n == 0 and 0 < s) or (s == 0 and 0 < n) or (e == 0 and 0 < w) or (w == 0 and 0 < e):
    print('No')
else:
    print('Yes')

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

int main() {
  int a, b;
  
  cin >> a >> b;
  
  if((a+b) % 2 == 0){
    cout << (a+b)/2 <<endl;
  }
  else{
    cout << (a+b)/2 + 1 << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
typedef long long ll;
using namespace std;
ll a[6310]={0};
ll n=6310;
int main(void)
{
	ll x;
	scanf("%lld",&x);
	for(ll i=0;i<=n;i++)
	{
		a[i]=i*i*i*i*i;
	}
	for(ll i=0;i<=n;i++)
	{
		for(ll j=0;j<=n;j++)
		{
			if(a[j]-a[i]==x)
			{
				printf("%lld %lld",j,i);
				return 0;
			}
			if(a[j]+a[i]==x)
			{
				printf("%lld %lld",j,-i);
				return 0;
			}
		}
	}
}

Measured memory_bytes: 3876
#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pie (3.141592653589)
using namespace std;

const int N = 2e5 + 10;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout << fixed;
	cout.precision(10);
	
	int n;
	cin >> n;
	bool sol = false;
	int cnt = 0;
	for(int i = 0; i < n; i++)
	{
		int a, b;
		cin >> a >> b;
		if(a == b)
			cnt++;
		else 	cnt = 0;
		if(cnt >= 3)
			sol = true;
	}
	cout << (sol ? "Yes" : "No");
	
	return 0;
}


Measured memory_bytes: 3648
#[allow(unused_imports)]
use proconio::{input, marker::*};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

fn main() {
    input! {
        mut n: usize,
    }
    let mut s = Vec::new();
    while n > 0 {
        s.push((((n - 1) % 26) as u8 + 'a' as u8) as char);
        n = (n - 1) / 26;
    }
    for e in s.into_iter().rev() {
        print!("{}", e);
    }
    println!();
}


Measured memory_bytes: 2180
s = input()
invs = s[::-1] # 逆向きの方がdpとの対応的にしっくりくるんやけど 

MOD = 10 ** 9 + 7
 
dp = [[0]*13 for _ in range(len(s))] #dp[桁][あまり] 

if invs[0]=='?':
    for i in range(10): # 0~9までは1 10~12は0のまま
        dp[0][i] = 1
else:
    dp[0][int(invs[0])] = 1

mul = 10 # 桁数のための変数 mul = 10 ** order
for order in range(1,len(s)):
    for j in range(13):
        if invs[order] == '?':
            for number in range(10):
                dp[order][ (j+number * mul )%13  ]  += dp[order-1][j]%MOD #いわゆる貰うdpで書いた
        else:
            number = int(invs[order])
            dp[order][(j+number * mul )%13 ]  += dp[order-1][j]%MOD
        dp[order][(j+number * mul )%13 ] %= MOD
    mul *= 10
    mul %= 13
print(dp[-1][5]%MOD)

# dpは基本的にpythonだと通らないからpypy3で提出するのを忘れないようにしよう...

Measured memory_bytes: 62920
#include<iostream>
#include<algorithm>
using namespace std;
const int MAX=100005;
int n,A[MAX];
int partition(int a[],int p,int r){
	int x=a[r];
	int i=p-1,j;
	for(j=p;j<r;j++){
		if(a[j]<=x){
			i++;
			swap(a[i],a[j]);
		}
	}
	swap(a[i+1],a[j]);
	return i+1;
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++)cin>>A[i];
	int q=partition(A,0,n-1);
	for(int i=0;i<n;i++){
		if(i)cout<<" ";
		if(i==q){
			cout<<"["<<A[i]<<"]";
		}else cout<<A[i];
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 3452
#include<stdio.h>

int check_cake(int a, int b);

int main(void) {

  int a = 0;
  int b = 0;
  int check = -1;

  scanf("%d %d", &a, &b);
  check = check_cake(a,b);

  if (check == 1) {
    printf("Yay!");
  } else {
    printf(":(");
  }
  
  return 0;
  
}

int check_cake(int a, int b) {

  if (a > 8 || b > 8) {
    return 0;
  }

  return 1;
}

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

int main(){
  int N,j=0;
  cin>>N;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    for(;a%2==0;a/=2)
      j++;
  }
  cout<<j<<endl;
}

Measured memory_bytes: 256
from itertools import combinations

x = int(input())
num = [i**5 for i in range(1000)]

for a, b in combinations(num, 2):
    if a - b == x:
        print(int(a**0.2), int(b**0.2))
    elif a + b == x:
        print(int(a**0.2), -int(b**0.2))
    elif b - a == x:
        print(int(b**0.2), int(a**0.2))
    else:
        continue
    break


Measured memory_bytes: 9484
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define all(x) (x).begin(),(x).end()
using namespace std;
using P=pair<int,int>;
using G=vector<vector<int>>;
using ll=long long;

string subsum(int* A,int n,int m){
  bitset<2010> E(1);

  rep(i,0,n){
    E |= (E<<A[i]);
  }

  if(E.test(m)) return "yes";
  else return "no";
}

vector<bool> seen;
vector<int> d;
vector<int> f;

int H,W;
vector<vector<int>> grid;

void dfs(int h, int w){
  grid[h][w]=0;

  for(int dh=-1;dh<=1;dh++){
    for(int dw= -1;dw<=1;dw++){
      int nh=h+dh; int nw=w+dw;

      if(nh<0||nw<0||nh>=H||nw>=W) continue;
      //探索済みまたは海
      if(grid[nh][nw]==0) continue;

      dfs(nh,nw);
    }
  }
}

int main(int argc,char **argv){
  while(1){
    cin>>W>>H;
    if(W==0 && H==0) break;

    grid.assign(H,vector<int>(W,0));
    rep(h,0,H){
      rep(w,0,W) cin>>grid[h][w];
    }

    int cnt=0;
    rep(h,0,H){
      rep(w,0,W){
        if(grid[h][w]==0) continue;
        dfs(h,w);
        cnt++;
      }
    }

    cout<<cnt<<endl;


  }
  }


Measured memory_bytes: 3268
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
 
using namespace std;
using std::cout;
using ll =long long;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int ab(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int main(){
  ll n;
  cin>> n;
  
  cout << n*(n-1)/2 <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
using namespace std;
int main() {
    int a, t, n;
    cin >> n;
    cin >> t >> a;
    vector<int> h(n);
    for(int i = 0; i < n; i++) {
        cin >> h[i];
    }
    double g = 1000000;
    int ans;
    for(int i = 0; i < n; i++) {
        double temp = t - h[i] * 0.006 - a;
        if(temp < 0) temp = -temp;
        if(g > temp) {
            ans = i + 1;
            g = temp;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>

using int64=long long;
using uchar=unsigned char;

constexpr int maxn(100000);

namespace IOManager{
	constexpr int FILESZ(131072);
	char buf[FILESZ];
	const char*ibuf=buf,*tbuf=buf;

	struct IOManager{
		inline char gc()
			{return(ibuf==tbuf)&&(tbuf=(ibuf=buf)+fread(buf,1,FILESZ,stdin),ibuf==tbuf)?EOF:*ibuf++;}

		template<class _Tp>
			inline operator _Tp(){
				_Tp s=0u;char c=gc();
				for(;c<48;c=gc());
				for(;c>47;c=gc())
					s=(_Tp)(s*10u+c-48u);
				return s;
			}
	};
}IOManager::IOManager io;

int a[maxn+1],
	b[maxn+1];

int main(){
	const int n=io;
	for(int i=0;i!=n;++i)
		a[i]=io;
	for(int i=0;i!=n;++i)
		a[i]-=(int)io;

	int64 s=0;
	for(int i=0;i!=n;++i)
		s+=a[i];
	if(s<0)
		return puts("-1"),0;

	s=0;
	int cnt=0,cntb=0;
	for(int i=0;i!=n;++i)
		if(a[i]<0)
			s-=a[i],++cnt;
		else if(a[i]>0)
			b[++cntb]=a[i];

	std::sort(b+1,b+cntb+1);
	for(;0<s;--cntb)
		s-=b[cntb],++cnt;
	printf("%d",cnt);

	return 0;
}


Measured memory_bytes: 896
k = int(input()) + 1

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

ans = 0

for a in range(1,k):
    for b in range(1,k):
        for c in range(1,k):
            ans += gcd(a,b,c)

print(ans)


Measured memory_bytes: 69560
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
struct Graph {
	int s;
	int t;
	int cost;
	Graph() {}
	Graph(int s, int t, int cost) :s(s), t(t), cost(cost) {}
};
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	ll N, M, L, K, A, H;
	while (cin >> N >> M >> L >> K >> A >> H) {
		if ((N | M | L | K | A | H) == 0)break;
		vector<vector<Graph>> G(N);

		vector<ll> reitou(N, 0);
		for (int i = 0; i < L;i++) {
			int r; cin >> r;
			reitou[r] = 1;
		}
		reitou[A] = 1, reitou[H] = 1;

		for (int i = 0; i < K;i++) {
			int s, t, cost; cin >> s >> t >> cost;
			G[s].push_back(Graph(s, t, cost));
			G[t].push_back(Graph(t, s, cost));
		}

		vector<vector<ll>> dist(N, vector<ll>(M + 1, (1 << 30)));
		dist[A][M] = 0;
		queue<pair<ll, ll>> q;
		q.push({ A,M });
		while (!q.empty()) {
			auto p = q.front(); q.pop();
			int n = p.first, c = p.second;
			for (auto e : G[n]) {
				if (reitou[n] == 0) {
					if (c < e.cost) continue;
					if (dist[e.t][c - e.cost] > dist[n][c] + e.cost) {
						dist[e.t][c - e.cost] = dist[n][c] + e.cost;
						q.push({ e.t,c - e.cost });
					}
				}
				else {
					for (int i = c; i <= M;i++) {
						if (i < e.cost) continue;
						if (dist[e.t][i - e.cost] > dist[n][c] + e.cost + (i - c)) {
							dist[e.t][i - e.cost] = dist[n][c] + e.cost + (i - c);
							q.push({ e.t,i - e.cost });
						}
					}
				}
			}
		}

		ll ans = (1 << 30);
		for (int i = 0; i <= M;i++) {
			ans = min(ans, dist[H][i]);
		}
		if (ans == (1 << 30)) cout << "Help!" << endl;
		else cout << ans << endl;
	}
}

Measured memory_bytes: 3300
/*input
9
*/
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define sz(a) int((a).size())
#define pb push_back
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())     
#define rep(i,j,n) for(ll i=j;i<n;i++)
#define mp make_pair
#define N 998244353
#define PI acos(-1.0)
//if (s.find('R') != std::string::npos)
//s.replace(s.find("10"), sizeof("10") - 1, "");
using namespace std;
bool comp(pair<string,ll>a,pair<string,ll>b){
  if(a.first==b.first) return a.second>b.second;
  return a.first<b.first;
}
int main()
{
  // added the two lines below 
  ios_base::sync_with_stdio (false); 
  cin.tie(NULL);
  cout.tie(0);
 
  ll a,b;
  cin>>a>>b;
  cout<<max(a+b,max(2*a-1,2*b-1));

}

Measured memory_bytes: 256
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque




def main():
    num = int(input())
    data = list(map(int, input().split()))
    ans = 0
    for i in range(num):
        if i + 1 == data[data[i] - 1]:
            ans += 1
    print(ans // 2)



if __name__ == '__main__':
    main()



Measured memory_bytes: 57960
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const int MOD = 1000000007;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue

//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge {
	int u, v;
	ll cost;
};

bool comp(const edge& e1, const edge& e2) {
	return e1.cost < e2.cost;
}

#define N 100010

int par[N];
int urank[N];

void init(int n) {
	REP(i, n) {
		par[i] = i;
		urank[i] = 0;
	}
}

int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}

void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y) return;

	if (urank[x] < urank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (urank[x] == urank[y]) urank[x]++;
	}
}

bool same(int x, int y) {
	return find(x) == find(y);
}

edge es[N];

bool used[N];
int V, E;

ll kruskal() {
	sort(es, es + E, comp);
	init(V);
	ll res = 0;
	REP(i, E) {
		edge e = es[i];
		if (!same(e.u, e.v) && !used[e.u] && !used[e.v]) {
			unite(e.u, e.v);
			res += e.cost;
			used[e.u] = used[e.v] = true;
		}
	}
	return res;
}

int main() {
	int a, b;
	cin >> a >> b;
	if (a + b >= 10) {
		cout << "error" << endl;
	}
	else {
		cout << a + b << endl;
	}
}


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

int main()
{
	long long InVal = 100;
	long long x;
	long long years= 0;
	cin>>x;
	while(InVal<x){
		InVal= floor(InVal*1.01);
		++years;
	}
	cout<< years<< endl;
	return 0;
}

Measured memory_bytes: 3256
import Data.List
main :: IO ()
main = do
    n:p <- input <$> getContents
    let (a,b) = answer $ map snd $ sortOn fst $ zip p [1..]
    putStrLn $ showans a
    putStrLn $ showans b

input :: String -> [Int]
input = fmap read . words

answer :: [Int] -> ([Int],[Int])
answer p = let a = map (\n -> sum $ take n p) [1..length p]
               b = map (\n -> last a - n) $ take (length p) (0:a)
           in (a,b)

showans :: [Int] -> String
showans [] = ""
showans (x:xs) = (show x) ++ " " ++ (showans xs)


Measured memory_bytes: 9212
#include <iostream>
using namespace std;
static const int N = 36;

struct Card
{
    char suit, value;
};

void bubble(struct Card A[], int n)
{
    for (int i = 0; i < n; i++)
    {
        for (int j = n-1; j > i ; j--)
        {
            if (A[j].value < A[j-1].value)
            {
                Card t = A[j]; A[j] = A[j-1]; A[j-1] = t;
            }
        }
    }
}

void selection(struct Card A[], int n)
{
    for (int i = 0; i < n; i++)
    {
        int minv = i;
        for (int j = i; j < n; j++)
        {
            if (A[j].value < A[minv].value)
                minv = j;
        }
        Card t = A[minv]; A[minv] = A[i]; A[i] = t;
    }
}

bool is_stable(struct Card C1[], struct Card C2[], int n)
{
    for (int i = 0; i < n; i++)
    {
        if (C1[i].suit != C2[i].suit)
            return false;
    }
    return true;
}

void print(struct Card A[], int n)
{
    for (int i = 0; i < n; i++)
    {
        if (i) cout << " ";
        cout << A[i].suit << A[i].value;
    }
    cout << endl;
}

int main()
{
    int n;
    struct Card C1[N], C2[N];

    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> C1[i].suit >> C1[i].value;
        C2[i] = C1[i];
    }
    bubble(C1, n);
    selection(C2, n);
    print(C1, n);
    cout << "Stable" << endl;
    print(C2, n);
    if (is_stable(C1, C2, n))
        cout << "Stable" << endl;
    else
        cout << "Not stable" << endl;
    return 0;
}



Measured memory_bytes: 3100
def main():
    lower_limit, upper_limit = map(int, input().split(" "))
    answer = 0
    for i in range(lower_limit, upper_limit + 1):
        num = str(i)
        if num[0] == num[-1] and num[1] == num[-2] and num[2] == num[-3]:
            answer += 1
    print(answer)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;

int main(void){
    int n;
    cin>>n;
    for(int i=0;i<=n;i++){
        int x=(int)i*108/100;
        if(x==n){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<":("<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#include<iomanip>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

int main() {
	double L;
	cin >> L;

	double x = L / 3;
	double y = x;
	double z = x;

	double ans = x * y * z;
	cout << fixed << setprecision(13) << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<algorithm>
using namespace std;
#define ll long long
int main() {
	cin.tie(0);ios::sync_with_stdio(false);
	int N; cin >> N;
	vector<int> L(N + 2);
	vector<pair<int, int>> v(N + 2, { 1,1 });
	int ans = 0;
	for (int i = 1; i <= N; i++) {
		cin >> L[i];
		if (i == 1) L[i - 1] = L[i];
		if (i == N) L[N + 1] = L[N];
	}
	for (int i = 2; i <= N;i++) {
		if (L[i] != L[i - 1]) { 
			v[i].first = v[i - 1].first + 1; 
			ans = max(ans, v[i].first);
		}
	}
	for (int i = N - 1; i >= 1; i--) {
		if (L[i] != L[i + 1]) {
			v[i].second = v[i + 1].second + 1;
			ans = max(ans, v[i].second);
		}
	}
	v[0].first = 0; v[N + 1].second = 0;

	int l = 1, r = 1;
	while (true) {
		if (L[r] == L[r + 1]) {
			if ((r - l + 1) % 2 == 1) {
				if (L[l] == L[r]) {
					ans = max(ans, v[l - 1].first + (r - l + 1) + v[r + 1].second);
				}
			}
			else {
				if (L[l] != L[r]) {
					ans = max(ans, v[l - 1].first + (r - l + 1) + v[r + 1].second);
				}
			}
			l = r + 1;
		}
		r++;
		if (r == N) {
			break;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 4116
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
from functools import reduce
import sys
import math
import bisect
import random
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return list(map(float, sys.stdin.readline().split()))
def LS():return sys.stdin.readline().split()
def SR(n): return [list(sys.stdin.readline())[:-1] for i in range(n)]
def IR(n): return [int(sys.stdin.readline()) for i in range(n)]
def LIR(n): return [list(map(int, sys.stdin.readline().split())) for i in range(n)]
def LSR(n): return [list(map(list, sys.stdin.readline().split())) for i in range(n)]
_gcd = lambda x, y: _gcd(y, x%y) if (x%y) else y
_lcm = lambda x, y: x*y // _gcd(x, y)
def gcd(*numbers):
    return reduce(_gcd, numbers)
def lcm(*numbers):
    return reduce(_lcm, numbers)
sys.setrecursionlimit(1000000)
INF = float('inf')
mod = 1000000007
dire4 = [(1,0), (0,1), (-1,0), (0,-1)]
dire8 = [(1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)]

N = I()
p = LI()

n = [i for i in range(1, N+1)]
tmp = 0
for pi, i in zip(p, n): 
    tmp += (not pi==i)
print("YES" if tmp<=2 else "NO")

Measured memory_bytes: 39280
#![allow(dead_code, unused_variables, unused_macros, unused_imports)]

// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes .by_ref() .map(|r|r.unwrap() as char) .skip_while(|c|c.is_whitespace()) .take_while(|c|!c.is_whitespace()) .collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

fn main() {
    input! {
        mut a: i32,
        mut b: i32,
    }

    let mut ans = 0;
    if a > b {
        ans += a;
        a -= 1;
    } else {
        ans += b;
        b -= 1;
    }
    if a > b {
        ans += a;
    } else {
        ans += b;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef long long LL;

int main(){
  int N;
  cin >> N;
  vector<LL>a(N);
  for(int i=0;i<N;i++){
	cin >> a[i];
  }
  
  LL K=0;
  while(1){
	LL sum=0;
	for(int i=0;i<N;i++){
	  sum+=a[i]/N;
	  K+=a[i]/N;
	}
	for(int i=0;i<N;i++){
	  a[i]=sum-a[i]/N+a[i]%N;
	}
	for(int i=0;i<N;i++){
	  if(a[i]>=N){
		break;
	  }else if(i==N-1){
		cout << K << endl;
		return 0;
	  }
	}
	
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define va first
#define vb second
#define lb lower_bound
#define pb push_back
#define all(v) v.begin(),v.end()
#define fio ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
using ll = long long;
using lf = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

lf D[303][303][303];
bool v[303][303][303];
int n;

lf dp(int i, int j, int k){
    if(i < 0 || j < 0 || k < 0) return 0;
    lf &d = D[i][j][k];
    if(v[i][j][k]) return d;
    v[i][j][k] = 1;
    lf S = i + j + k;
    return d = lf(n) / (i+j+k) + lf(i)/S * dp(i-1,j+1,k) + lf(j)/S * dp(i,j-1,k+1) + lf(k)/S * dp(i,j,k-1);
}

int c[3];
int main(){
    fio;
    cout << fixed;
    cout.precision(12);
    cin >> n;
    for(int i = 0, x; i < n; i++){
        cin >> x;
        ++c[x-1];
    }
    v[0][0][0] = 1;
    cout << dp(c[2],c[1],c[0]) << '\n';
}

Measured memory_bytes: 459008
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    a, b, c = list(map(int, readline().split()))
    dif = max([a, b, c]) * 3 - (a + b + c)
    print(dif // 2 if dif % 2 == 0 else (dif + 3) // 2)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int main() {
 long long a,b,c,d,ans1,ans2,ans3,ans4;
 cin >> a >> b >> c >>d;
 ans1=a*c;
 ans2=b*d;
 ans3=a*d;
 ans4=b*c;
 if(a>=0){
    if(ans3>=ans2){
      cout << ans3;
    }else{
      cout << ans2;
    }
 }else if(a<0&&b>=0){
    if(ans2>=ans1){
        cout << ans2;
    }else{
        cout << ans1;
    }
 }else{
    if(ans4>=ans1){
        cout << ans4;
    }else{
        cout << ans1;
    }
 }
}

Measured memory_bytes: 3604
n = gets.to_i
a = gets.split(' ').map{|n| n.to_i}
b = Array.new

n.times do |i|
  if i % 2 == (n - 1) % 2
    b.unshift(a[i])
  else
    b.push(a[i])
  end
end

puts b.join(' ')

Measured memory_bytes: 25440