akhauriyash/Code-Regression huggingface dataset:
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val inputMatrix = List(n) {
        val input = readLine()?.split(" ".toRegex())?.map(String::toInt) ?: return
        return@List input[0] to input[1]
    }
    val matrixChain = inputMatrix.map { it.first }.plus(inputMatrix.last().second)
    val multiplicater = MatrixChainMultiplicater(matrixChain)
    println(multiplicater.getMatrixChainOrder())
}

class MatrixChainMultiplicater(private val matrixData: List<Int>) {
    private val memo = Array(matrixData.size - 1){IntArray(matrixData.size - 1)}
    init {
        for (i in memo.indices) {
            memo[i][i] = 0
        }
    }

    fun getMatrixChainOrder(): Int {
        for (i in 1..memo.lastIndex) {
            for (j in 0..memo.lastIndex - i) {
                val row = j
                val column = j + i
                val costs = arrayListOf<Int>()
                for (k in row until column) {
                    costs.add(memo[row][k] + memo[k + 1][column] + matrixData[row] * matrixData[k + 1] * matrixData[column + 1])
                }
                memo[row][column] = costs.min() ?: 0
            }
        }
        return memo.first().last()
    }
}


Measured memory_bytes: 36340
import java.io.*;
import java.util.*;

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        int k=Integer.parseInt(bu.readLine());
        while(k!=0)
        {
            sb.append("ACL");
            k--;
        }
        System.out.print(sb);
    }
}


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

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

	int t = N, fX = 0;

	while (t > 0) {
		fX = fX + (t % 10);
		t = t / 10;
	}
	
	if (N % fX == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
n = int(input())
cnt = []
for i in range(1, n + 1):
    for j in range(1, n + 1):
        for k in range(1, n + 1):
            s = str(i) + str(j) + str(k)
            if s not in cnt:
                cnt.append(s)
#print(cnt)
print(len(cnt))

Measured memory_bytes: 3060
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<cstring>

using namespace std;

int main()
{
	int n, m, k;
	vector<string> arr;

	scanf("%d %d %d", &n, &m, &k);

	for (int i = 0; i < n; i++)
	{
		char input[1001];
		string str;

		scanf("%s", input);
		str = input;

		arr.push_back(str);
	}

	int ub;

	ub = (int)pow(2.0, n - 1);

	int lmin = 1000000;

	for (int i = 0; i < ub; i++)
	{
		int bits;
		int add[10];
		int temp;

		temp = i;
		int cnt = 0;

		add[0] = 0;

		int cand = 0;

		for (int j = 1; j < n; j++)
		{
			cnt += temp % 2;

			cand += temp % 2;

			add[j] = cnt;
			
			temp /= 2;
		}

		int acc[10] = { 0, };

		bool valid = true;

		for (int l = 0; l < m; l++)
		{
			bool reset = false;

			for (int j = 0; j < n; j++)
			{
				acc[add[j]] += arr[j][l] - '0';

				if (acc[add[j]] > k)
				{
					if (!reset)
					{
						reset = true;

						cand++;
					}
				}
			}

			if (reset)
			{
				for (int j = 0; j < n; j++)
				{
					acc[add[j]] = 0;
				}

				for (int j = 0; j < n; j++)
				{
					acc[add[j]] += arr[j][l] - '0';
				}

				for (int j = 0; j < n; j++)
				{
					if (acc[add[j]] > k)
					{
						valid = false;

						break;
					}
				}
			}

			if (!valid)
			{
				break;
			}
		}

		if (valid && cand < lmin)
		{
			lmin = cand;
		}
	}

	printf("%d\n", lmin);

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include<stdio.h>

using namespace std;

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


int main(){
    double n, m, d;
    cin >> n >> m >> d;

    double x;
    if(d == 0){
        x = (n - d) / n / n * (m-1);
    }
    else {
        x = 2 * (n - d) / n / n * (m - 1);
    }

    printf("%.10f\n", x);

    return 0;
}

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

using namespace std;

int gcd(int a,int b){
  if(a % b == 0){
    return b;
  }else
  {
    return(gcd(b,a % b));
  }
}
int main(){
  string S;
  cin >> S;
  vector<string> dp(S.size());
  for(int i = 0; i < S.size(); i++){
    dp[i] = S[i];
  }
  
  int count = 0;
  for(int i = 0; i < S.size() - 1; i++){
    if(dp[i] == dp[i + 1] && dp[i] == "0"){ count++; dp[i + 1] = '1'; }
    else if(dp[i] == dp[i + 1] && dp[i] == "1"){ count++; dp[i + 1] = '0'; }
  }

  cout << count;


    return 0;
}



Measured memory_bytes: 5760
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

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

	int count = 0;
	for (int i = 0; i < 3; i++) {
		if (S[i] == T[i]) {
			count++;
		}
	}
	cout << count << endl;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main() {
  long double A, B, H, M;
  cin >> A >> B >> H >> M;
  cout << fixed << setprecision(30);
  long double angle = 6 * M - (60 * H + M) / 2;
  long double power_2 = A * A + B * B - 2 * A * B * cos(angle * M_PI /180);
  cout << sqrt(power_2) << endl;
}


Measured memory_bytes: 4140
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

int n;
vector<int> vec;

int main()
{
	cin >> n;
	vec.resize(n);
	rep(i,n){
		cin >> vec[i];
	}
	sort(vec.begin(), vec.end());
	int ok = 1;
	rep(i,n-1){
		if(vec[i]==vec[i+1]){
			ok = 0;
			break;
		}
	}
	if(ok) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template<typename T>
int partition(vector<T>&a, int l, int r) {
	T x = a[r];
	int i(l - 1);
	rep(j, l, r) {
		if (a[j] <= x)swap(a[++i], a[j]);
	}
	swap(a[++i], a[r]);
	return i;
}
template<typename T>
void quicksort(vector<T>&a, int l, int r) {
	dump(l, r);
	if (l < r) {
		int p = partition(a, l, r);
		quicksort(a, l, p - 1);
		quicksort(a, p + 1, r);
	}
}
template<typename T>
void merge(vector<T>&a, int l, int r) {
	int mid = (l + r) / 2;
	int n1 = mid - l, n2 = r - mid;
	vector<T>L(n1 + 1), R(n2 + 1);
	rep(i, 0, n1)L[i] = a[l + i];
	L[n1] = T(INF);
	rep(i, 0, n2)R[i] = a[mid + i];
	R[n2] = T(INF);
	int i(0), j(0);
	rep(k, l, r) {
		if (L[i] <= R[j])a[k] = L[i++];
		else a[k] = R[j++];
	}
}
template<typename T>
void mergesort(vector<T>&a, int l, int r) {
	if (r - l > 1) {
		int mid = (l + r) / 2;
		mergesort(a, l, mid);
		mergesort(a, mid, r);
		merge(a, l, r);
	}
}
struct Card {
	char c;
	int v;
	Card() {}
	Card(int v, char c = -1) :v(v), c(c) {}
	bool operator<=(const Card &p) {
		return v <= p.v;
	}
	bool operator!=(const Card &p) {
		return !(c == p.c&&v == p.v);
	}
};
istream &operator >> (istream &is, Card &p) {
	is >> p.c >> p.v;
	return is;
}
ostream &operator<<(ostream &os,const Card &p) {
	os << p.c << " " << p.v;
	return os;
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	vector<Card>cs(N);
	rep(i, 0, N)cin >> cs[i];
	vector<Card>m(cs);
	mergesort(m, 0, N);
	quicksort(cs, 0, N - 1);
	auto f = [&](vector<Card>&a, vector<Card>&b) {
		rep(i, 0, a.size())if(a[i] != b[i])return false;
		return true;
	};
	dump(m, cs);
	dump(!f(m, cs));
	if (!f(m, cs)) {
		cout << "Not stable" << endl;
	}
	else cout << "Stable" << endl;
	rep(i, 0, N)cout << cs[i] << endl;
	return 0;
}

Measured memory_bytes: 5096
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define deb(x) cout << #x << " " << x << endl;
#define PI 3.14159265358979323846264338327950L
#define fi(i,a,b) for(int i = a; i<b; i++)
#define ll long long int
#define ld long double
#define pii pair<int, int>
#define F first
#define S second
#define vi vector<int>
#define N 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
using namespace std;

//*************************************************************************************

void solve() {

	double a, b, h, m; cin >> a >> b >> h >> m;

	double ah = 2 * PI / 12 * h + 2 * PI / 12 / 60 * m;
	double am = 2 * PI / 60 * m;
	double rad = abs(ah - am);
	double ans = (a * a + b * b - 2 * a * b * cos(rad));
	printf("%0.12lf\n", sqrt(ans));
}
int main() {

// #ifndef ONLINE_JUDGE
// 	freopen("input1.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif

	IOS;

	int t = 1;
	fi(i, 0, t) {solve();}
	return 0 ;
}


Measured memory_bytes: 4212
n = gets.chomp.to_i
l = gets.chomp.split.map(&:to_i)
l.sort!

ans = 0

def ok2?(a,b,c)
  # p 'called'
  # p ['ok2',a,b,c,c<a+b]
  return false if c.nil?

  if c<a+b
    true
  else
    false
  end
end

0.upto(n-3).each do |i|
  k = i
  (i+1).upto(n-2).each do |j|
    while k < n && ok2?(l[i],l[j],l[k])
      k+=1
    end
    # p [i,j,k]
    # p ['---------', i, j, '', left, right]
    # p ['---------', l[i], l[j], '', l[left], l[right]]
    ans += k - j-1
  end
end

puts ans


Measured memory_bytes: 1916
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>

typedef long long ll;

using namespace std;

int main()
{
	int n;
	cin >> n;
	cin.get();
	while (n--)
	{
		string s;
		getline(cin, s);
		int i;
		while ((i = s.find("Hoshino")) != string::npos)
			s[i + 6] = 'a';
		cout << s << endl;
	}

	return 0;
}

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

const int MOD = (int)1e9+7;

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

	for(int i=0;i<S.size();i++){
		char ans=(S.at(i)-'A'+N)%26+'A';
		cout << ans;
	}
	cout << endl;
	
	return 0;
}


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

//数え上げ 要素の数が多いので連想配列(map)を使う

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

    int ans = 0;
    for (auto p: mp) {
		int x = p.first;
		int n = p.second;
		if(n < x){
            ans += n;
        }else{
            ans += n-x;
        }
	}
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4736
package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var in int
	for scanner.Scan() {
		in, _ = strconv.Atoi(scanner.Text())
		break
	}

	n := big.NewInt(1)
	for i := 1; i < in; i++ {
		n.Mul(n, big.NewInt(int64(i+1)))
	}

	ans := big.NewInt(0)
	ans.Mod(n, big.NewInt(1000000007))
	fmt.Println(ans)
}


Measured memory_bytes: 7552
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.DDCC2019_qual
{
    class B
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            long[] array = ReadLongs();
            long[] sums = new long[n];
            sums[0] = array[0];
            long all = array[0];
            for(int i = 1; i < n; i++)
            {
                sums[i] = sums[i - 1] + array[i];
                all += array[i];
            }
            long res = long.MaxValue;
            for(int i = 0; i < n - 1; i++)
            {
                long left = sums[i];
                long right = all - sums[i];
                res = Min(res, Abs(left - right));
            }
            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

int main(){
    using namespace std;
    constexpr unsigned long MOD{998244353};
    unsigned long N, K, s{0}, t{0};
    cin >> N >> K;
    --N;
    vector<pair<unsigned long, unsigned long>> intervals(K);
    for(auto&& [i, j] : intervals){
        cin >> i >> j;
        ++j;
    }
    vector<unsigned long> dp_impl(2 * N + 10);
    const auto& dp{dp_impl.begin() + N + 5};
    dp[0] = 1;
    for(long i{1}; i <= N; ++i){
        for(const auto& [j, k] : intervals){
            s += dp[i - j];
            t += dp[i - k];
        }
        s %= MOD;
        t %= MOD;
        dp[i] = (s + MOD - t) % MOD;
    }
    cout << dp[N] << endl;
}


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

const int  mod = 1000000007;
struct mint{
    ll x;
    mint (ll x=0) : x((x%mod+mod)%mod){}//カッコの中で初期化している
    mint& operator+=(const mint a){//operatorは構造体同士の比較に用いられる
        if((x +=a.x)>=mod) x-=mod;
        return *this;//thisとは現在のオブジェクトのこと
    }
    mint& operator-=(const mint a){
        if((x +=mod-a.x)>=mod) x-=mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x*=a.x)%=mod;
        return *this;
    }
    mint operator+(const mint a){
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a){
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a){
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const{
        if(!t) return 1;
        mint a=pow(t>>1);
        a*=a;
        if(t&1) a*=*this;
        return a;
    }
    mint inv() const{
        return pow(mod-2);//逆元
    }
    mint&operator/=(const mint a) {
        return (*this)*=a.inv();
    }
    mint&operator/(const mint a) const{
    mint res(*this);
    return res/=a;
    }
};
 
int main(void){
    int n;
    cin>>n;
    vector<ll> v(n);
    rep(i, n) cin>>v[i];
    mint ans = 0;
    ll nowpow=1;
    rep(idx, 60){
        mint nowsum=0;
        vector<ll>s0(n);
        vector<ll>s1(n);
        ll now0=0;
        ll now1=0;
        for(int i = n-1;i>=0;i--){
            if(v[i]%2) now1++;
            else now0++;
            s1[n-1-i] = now1;
            s0[n-i-1] = now0;
        }
        rep(i, n-1){
            if(v[n-1-(i+1)]%2) nowsum+=s0[i];
            else nowsum+=s1[i];
        }
        rep(i, n) v[i]/=2;
        ans+=nowsum*nowpow;
        nowpow*=2;
    }
    cout<<ans.x<<endl;
    return 0;
}

Measured memory_bytes: 7392
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  vector<int> P(N);
  rep(i, N) cin >> P[i];
  int a = 0, b = 0, c = 0;
  rep(i, N) {
    if (P[i] <= A)
      a++;
    else if (P[i] <= B)
      b++;
    else
      c++;
  }
  cout << min({a, b, c}) << endl;
  return 0;
}

Measured memory_bytes: 256
import math
N,M=map(int,input().split())
K=int(math.sqrt(M))+1
D=set()
for i in range(1,K+10):
    if M%i==0:
        D.add(M//i)
        D.add(i)
X=[]
for d in D:
    if M//d>=N:
        X.append(d)
print(max(X))


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

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

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------


int main(){
    std::cout << std::fixed << std::setprecision(10);
ll n;
cin>>n;
cout<<(double)(n/2+n%2)/n<<endl;
}









Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int64;
typedef pair< int, int > Pi;

int N;
Pi Bugs[300000];

int Justin()
{
  priority_queue< Pi, vector< Pi >, greater< Pi > > que;
  int64 sum = 0, ret = 0;
  for(int i = 0; i < N; i++){
    que.push( make_pair( Bugs[i].second, Bugs[i].first));
    sum += Bugs[i].first;
    while(!que.empty() && (int64)que.top().first * que.size() < sum){
      sum -= que.top().second;
      que.pop();
    }
    ret = max< int >( ret, que.size());
  }
  return(ret);
}

int main()
{
  scanf("%d", &N);
  for(int i = 0; i < N; i++){
    scanf("%d %d", &Bugs[i].first, &Bugs[i].second);
  }
  sort( Bugs, Bugs + N);
  printf("%d\n", Justin());
  return(0);
}

Measured memory_bytes: 8516
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i=0;i<n;i++)
const long long MOD = 1000000007;
typedef pair<int,int> P;
typedef long long ll;
ll n,m,k,ans;
string s;

int main(){
  cin >> n >> k;
  int a[n]; rep(i,n) cin >> a[i];
  int ans = a[0];
  int l = a[0];
  rep(i,n-1) {
    ans = __gcd(ans,a[i+1]);
    l = max(l, a[i+1]);
  }
  if(ans == 1 || ((k % ans) == 0 && l >= k )){
    cout << "POSSIBLE\n";
  }else{
    cout << "IMPOSSIBLE\n";
  }
}

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

int main(){
    int a = 0;
    int b = 0;
    int c = 0;
    double S;
    double L;
    double h;
    
    scanf( "%d%d%d", &a, &b, &c );
    
    S = ( a * b * sin((M_PI * c) / 180 )) / 2;
    L = sqrt(( a * a ) + ( b * b ) - ( 2 * a * b * cos((M_PI * c) / 180 ))) + a + b;
    h = ( S * 2 ) / a;
    
    printf( "%lf %lf %lf\n", S, L, h );
    return 0;
}


Measured memory_bytes: 2040
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>

using namespace std;

#define gettime printf("\nTime : %0.3lf\n",clock()*1.0/CLOCKS_PER_SEC);
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repp(i,a,b) for(int i=a;i>=b;i--)
#define Set(x,a) memset(x,a,sizeof(x));

#define vs vector<string>
#define vi vector<int>
#define ll long long
#define ff first
#define ss second

struct comp {
       bool operator() (int a,int b) {
            return a>b;
       }
};

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //std::ios::sync_with_stdio(false);
    int data[105][2] = {}, n, ans = 0;
    scanf("%d", &n);
    rep (i,1,n) scanf("%d", &data[i][0]);
    rep (i,1,n) scanf("%d", &data[i][1]);
    rep (i,1,n) {
        data[i][0] += data[i-1][0];
        data[i][1] += data[i-1][1];
    }
    rep (i,1,n) {
        ans = max (ans, data[i][0] + data[n][1] - data[i-1][1]);
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string a;
int main()
{
	cin>>a;
	int l=a.size();
	if(a[0]==a[l-1])
		if(l&1) printf("Second\n");
		else printf("First\n");
	else 
		if(l&1) printf("First\n");
		else printf("Second\n");
	return 0;
}

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

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

  string N; cin >> N;
  string ans = "No";
  for (ll i = 0; i < 3; i++) {
    if (N[i] == '7') ans = "Yes";
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3612
import java.util.*;
class Main{
    int dx[]={-1,0,1,0};
    int dy[]={0,1,0,-1};
    boolean[][][] map;
    class P{
	int y,x;
	P(int y,int x){
	    this.y=y;this.x=x;
	}
    }
    void run(){
	Scanner sc=new Scanner(System.in);
	while(true){
	    int w=sc.nextInt();
	    int h=sc.nextInt();
	    map=new boolean[h][w][4];
	    if((w|h)==0)break;
	    for(int i=0;i<h+h-1;i++){
		if(i%2==0){
		    for(int j=0;j<w-1;j++){
			if(sc.nextInt()==0)setWidth(i/2,j);
		    }
		}
		else{
		    for(int j=0;j<w;j++){
			if(sc.nextInt()==0)setHeight(i/2,j);
		    }
		}
	    }
	    System.out.println(BFS(w,h)+1);
	}
    }
    int BFS(int w,int h){
	LinkedList<P> queue=new LinkedList<P>();
	int[][] visited=new int[h][w];
	queue.offer(new P(0,0));
	while(!queue.isEmpty()){
	    P p=queue.poll();
	    int y=p.y;int x=p.x;
	    for(int i=0;i<4;i++){
		int ny=y+dy[i];int nx=x+dx[i];
		if(map[y][x][i]&&visited[ny][nx]==0){
		    queue.offer(new P(ny,nx));
		    visited[ny][nx]=visited[y][x]+1;
		    if(ny==h-1&&nx==w-1)return visited[ny][nx];
		}
	    }
	}
	return -1;
    }
    void setWidth(int a,int b){
	map[a][b][2]=true;
	map[a][b+1][0]=true;
    }
    void setHeight(int a,int b){
	map[a][b][1]=true;
	map[a+1][b][3]=true;
    }
    void printWidth(int w,int h){
	for(int i=0;i<h;i++){
	    for(int j=0;j<w;j++){
		if(map[i][j][0])System.out.print(1+" ");
		else System.out.print(0+" ");
		if(map[i][j][2])System.out.print(1);
		else System.out.print(0);
	    }
	    System.out.println();
	}
    }
    void printHeight(int w,int h){
	for(int i=0;i<h+h-1;i++){
	    for(int j=0;j<w;j++){
		if(i%2==0){
		    if(map[i/2][j][3])System.out.print(1+" ");
		    else System.out.print(0+" ");
		}
		else{
		    if(map[i/2][j][1])System.out.print(1+" ");
		    else System.out.print(0+" ");
		}
	    }
	    System.out.println();
	    if(i%2==0)System.out.println();
	}
    }
    public static void main(String[] args){
	new Main().run();
    }
}

Measured memory_bytes: 13000
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    x, y, a, b, c = map(int, input().split())
    p = [int(i) for i in input().split()]
    q = [int(i) for i in input().split()]
    r = [int(i) for i in input().split()]
    p.sort(reverse=True)
    q.sort(reverse=True)
    r.sort(reverse=True)
    ansList = []
    ansList.extend(p[:x])
    ansList.extend(q[:y])
    ansList.extend(r)
    ansList.sort(reverse=True)
    ansList = ansList[:x+y]
    sum = 0
    for i in ansList:
        sum +=i
    print(sum)



Measured memory_bytes: 23260
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 998244353;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

ll mod_pow(ll a, ll n) {
	if(n == 0) return 1;
	ll res = mod_pow(a, n / 2);
	if(n % 2 == 0) return res * res % mod;
	else return a * res % mod * res % mod;
}


int N;
ll A[MAX_N];

void solve() {
	cin >> N;
	int mv = 0;
	rep(i, 0, N) {
		int a; cin >> a; A[a]++;
		if(i == 0 && a != 0) {
			cout << 0 << "\n";
			return;
		}
		MAX(mv, a);
	}
	if(A[0] != 1) {
		cout << 0 << "\n";
	}
	else {
		ll ans = 1;
		for(int i = 1; i <= mv; i++) {
			MUL(ans, mod_pow(A[i - 1], A[i]));
		}
		cout << ans << "\n";
	}
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    int n,m;
    cin >> n >> m;
    vi d(n),c(m);
    rep(i,n)cin >> d[i];
    rep(i,m)cin >> c[i];
    int dp[1005][1005];//i日目に都市jにいるときの最小値
    rep(i,1005)rep(j,1005)dp[i][j] = LINF;
    dp[0][0] = 0;
    rep(i,m)rep(j,n+1)if(dp[i][j] < LINF){
        dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
        dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + c[i]*d[j]);
    }
    cout << dp[m][n] << endl;
}



Measured memory_bytes: 11008
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        long x = long.Parse(input[0]);
        long k = long.Parse(input[1]);
        long d = long.Parse(input[2]);

        if (x < 0)
        {
            x *= -1;
        }

        long n = x / d;
        if (n > k)
        {
            x -= k * d;
            k = 0;
        }
        else
        {
            x -= n * d;
            k -= n;
        }

        
        if (k % 2 == 0)
        {
            Console.WriteLine(x);
        }
        else if (x == 0)
        {
            Console.WriteLine(d);
        }
        else
        {
            Console.WriteLine(d - x);
        }
    }
}

Measured memory_bytes: 17900
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef pair<int, int> P;
int main(){
    int n, k;
    cin >> n >> k;
    int m = (n-1)*(n-2)/2;
    //最大超えてるかどうか
    if(k>m){
        cout << "-1" << endl;
        return 0;
    }
    //スター作る
    vector<P> ans;
    rep(i,n-1){
        ans.push_back(P(i+1,n));
    }
     //辺を張っていく
    vector<P> edge;
    rep(i,n-1){
        rep(j,i){
            edge.push_back(P(i+1, j+1));
        }
    } 
    //辺を足す回数
    int add = m - k;
    rep(i, add){
        ans.push_back(edge[i]);
    }
    
    cout << ans.size() << endl;
    rep(i,ans.size()){
        cout << ans[i].first << " " << ans[i].second << endl;
    }


    return 0;
}

Measured memory_bytes: 384
/*
ID: rchalam1
LANG: C++14
TASK:
*/
// For train.usaco.org, fill the template above.

// Competitive Coding Template

// GCC OPTIMIAZTION FLAGS
#ifdef ONLINE_JUDGE
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#endif

#include <bits/stdc++.h>

/*
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
*/
// All Includes for Competitive Coding Template

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

using vi = std::vector<int>;
using vll = std::vector<long long>;
using vull = std::vector<unsigned long long>;

#define FOR(i, a, b) for (auto i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (auto i = (a); i >= (b); --i)
#define R0F(i, a) ROF(i, a, 0)
#define ITR(a, x) for (auto& a: x)

#define FSRT(set) sort((set).begin(),(set).end())
#define RSRT(set) sort((set).rbegin(),(set).rend())
#define CSRT(set, function) sort((set).begin(),(set).end(), (function))
#define TRS(set) sort((set).begin(),(set).end(), greater<>())
#define REV(set) reverse((set).begin(),(set).end());

#define ALL(set) (set).begin(), (set).end()

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// For stdio, call setIO() or setIO("").
void setIO(std::ifstream &readFile, std::ofstream &writeFile, const std::string &name = "", bool stdIO = false)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	if(!name.empty() && !stdIO)
	{
		readFile.open(name + ".in");
		if(readFile.fail()) return;
		writeFile.open(name + ".out");
		std::cin.rdbuf(readFile.rdbuf());
		std::cout.rdbuf(writeFile.rdbuf());
	}
}

// To time program, create object Timer  to start timing, and call Timer.elapsed().
#include <chrono>

class Timer
{
	std::chrono::time_point<std::chrono::high_resolution_clock> m_beg;
public:
	Timer() : m_beg(std::chrono::high_resolution_clock::now())
	{}

	void reset()
	{ m_beg = std::chrono::high_resolution_clock::now(); }

	[[nodiscard]] long double elapsed() const
	{
		return std::chrono::duration_cast<std::chrono::duration<long double, std::ratio<1> >>(
				std::chrono::high_resolution_clock::now() - m_beg).count();
	}
};

// Defines datatype
using dt = int;
// Defines MAXN value
constexpr dt MAXN = 1e5 + 1;
// Defines Modulus
constexpr dt MOD = 1e9 + 7;
// Defines Floating Point Correction
constexpr long double EPS = 1e-9;

//*****
//START CODE BELOW
//*****

int main(int argc, char *argv[])
{
	static std::ifstream readFile;
	static std::ofstream writeFile;
	setIO(readFile, writeFile);
	int n;
	cin >> n;
	vector<int> times(n);
	int total = 0;
	for(auto &time : times)
	{
		cin >> time;
		total += time;
	}
	int m;
	cin >> m;
	while(m--)
	{
		int p, x;
		cin >> p >> x;
		cout << total - (times[p - 1] - x) << '\n';
	}
}

Measured memory_bytes: 3636
# -*- coding: utf-8 -*-
import sys
import collections

def main():
	#A, B, Q = map(int, input().split(" "))
	S = input()
	
	tmp = S[0]
	tmp2 = S[1]
	tmp3 = S[2]
	tmp4 = S[3]
	
	if tmp == tmp2 and tmp2 == tmp3 and tmp3 == tmp4:
		print("No")
		sys.exit()
	
	if tmp == tmp2 and tmp3 == tmp4:
		print("Yes")
	elif tmp2 == tmp3 and tmp == tmp4:
		print("Yes")
	elif tmp == tmp3 and tmp2 == tmp4:
		print("Yes")
	else:
		print("No")
	
		
	
	
if __name__ == "__main__":
	main()
	

Measured memory_bytes: 3436
using System;
using System.Linq;
class Program
{
    static void Main()
    {
        //int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray(); 
        //int a=int.Parse(Console.ReadLine());
        string a = Console.ReadLine();

        Console.WriteLine("2018" + a.Substring(4, a.Length-4));
        Console.ReadLine();
    }
}

Measured memory_bytes: 13140
#include<stdio.h>
long long n,srx[101];
long long lgx(long long n) {
    if(srx[n]) return srx[n];
    if(n > 0) srx[n] = lgx(n - 1) * 2 + 2;
}
int main()
{
    scanf("%d",&n);
    srx[0] = 2;
    lgx(n);
    printf("%lld\n",srx[n]);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pb push_back
#define ss second
#define ff first 
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
const ll M=1000000007;
ll power(ll x,ll n){if(n==0)return 1;else if(n%2==0)return (power((x*x)%M,n/2))%M;else return ((x%M)*power(x,n-1)%M);}
ll ncr(int n,int r){if(r>n)return 0;if(r > n - r) r = n - r;ll ans = 1;
int i;for(i = 1; i <= r; i++){ans *= n - r + i;ans /= i;}return ans;}
ll nCrModpDP(ll n, ll r, ll p){ 
    ll C[r+1]; 
    memset(C, 0, sizeof(C)); 
    C[0] = 1;
    for (ll i = 1; i <= n; i++){ 
        for (ll j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
} 
ll ncrmod(ll n, ll r, ll p){ 
   if (r==0) 
      return 1; 
   ll ni = n%p, ri = r%p; 
   return (ncrmod(n/p, r/p, p) * 
           nCrModpDP(ni, ri, p)) % p;  
} 
ll modInverse(ll a,ll m) 
{ 
   ll m0 = m; 
   ll y = 0, x = 1; 
  
    if (m == 1) 
      return 0; 
  
    while (a > 1) 
    { 
       ll q = a / m; 
       ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    } 
    if (x < 0) 
       x += m0; 
  
    return x; 
} 
const ll m=1000000009;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string str,ptr;
// cin>>str>>ptr;
// int l1=str.length();
// int l2=ptr.length();
// ll ans=0;
// for(int i=0; i<l2; i++){
// for(int j=0; j<l1; j++){

// }
// }
// cout<<ans;
ll n;
cin>>n;
ll num[n],sum[n],jum=0,ans=0;
for(int i=0; i<n; i++){
cin>>num[i];
jum+=num[i];
sum[i]=jum;
// cout<<sum[i]<<" ";
}
for(int i=0; i<n-1; i++){
// cout<<sum[n-i-1]<<" ";/
ans=((((num[i]%M)*((sum[n-1]-sum[i])%M))%M)+(ans%M))%M;
// cout<<ans<<" ";
}
cout<<ans;
return 0;
}

Measured memory_bytes: 6744
def abc061_c():
    n, k = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in range(n)]

    ab.sort()
    count = 0
    for v in ab:
        count += v[1]
        if count >= k:
            print(v[0])
            break


abc061_c()

Measured memory_bytes: 27872
//This is getting accepted!
#include<bits/stdc++.h>
#define ll long long
#define oo 1000000009
#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define INARR(a,n) for (int i = 1; i <= (n); ++i) cin >> a[i];
#define ITE(x) for(auto it = (x).begin(); it != (x).end(); ++it)
#define isset(x, i) (((x)>>(i))&1)
#define setbit(x, i) ((x)^(1ll<<(i)))
#define clearbit(x, i) ((x)&(~(1ll<<(i))))
#define twoexp(i) (1ll<<(i))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define FI first
#define SE second
#define son1 (id*2)
#define son2 (id*2+1)

using namespace std;

const int MOD = 1000000007;
const double EPS = 1e-8;
const double PI = 2 * acos(0);
const int MAXN = 1e6 + 6;

string s;
int n;
int dp[MAXN][3];

void input() {
	int u, v, w, x, y, qtype;
	
	cin >> s;
	n = s.size();
	s = ' ' + s;
	
}


void preprocess() {
	
	
	
}

void process(int itest) {
	int u, v, w, x, y, qtype;
	
	dp[1][1] = 1;
	FOR(i, 2, n) {
		if (s[i] != s[i-1])
			dp[i][1] = MAX(dp[i][1], dp[i-1][1] + 1);
		dp[i][1] = MAX(dp[i][1], dp[i-1][2]+1);
		
		if (i < 4 || (s[i] != s[i-2] || s[i-1] != s[i-3]))
			dp[i][2] = MAX(dp[i][2], dp[i-2][2]+1);
		dp[i][2] = MAX(dp[i][2], dp[i-2][1]+1);
		
	}
	
	cout << MAX(dp[n][1], dp[n][2]) << endl;
	
}

void oneTest() {
	
	input();
	preprocess();
	process(0);
	
}

void multiTest() {
	
	int t;
	cin >> t;
	
	for (int it = 1; it <= t; ++it) {
		input();
		preprocess();
		process(it);
	}
}

int main(){
    #ifndef ONLINE_JUDGE
//    freopen("../out.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	oneTest();
//	multiTest();

    return 0;

}


Measured memory_bytes: 4688
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

	static Scanner scanner;

	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    int N=gi();
        int K=gi();
        int[] L=new int[N];
        for(int i=0; i<N;i++) {
           L[i]=gi();
        }
        
        Arrays.sort(L);
        int s=0;
        for(int i=0; i<K;i++) {
            s+=L[N-i-1];
         }

	   
	    System.out.print(s);

//        if (t.equals("Sunny")) {
//        	System.out.print("Cloudy");
//        }else if(t.equals("Cloudy")){
//        	System.out.print("Rainy");
//        } else {
//        	System.out.print("Sunny");
//        }


	}
	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35604
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
char s[105],t[105];
int cmp(const char &x,const char &y) {return x>y;}
int main()
{
	scanf("%s",s);scanf("%s",t);
	int ls=strlen(s),lt=strlen(t);
	sort(s,s+ls);sort(t,t+lt,cmp);
	int f=0;
	for(int i=0;i<min(ls,lt);i++)
	{
		if(s[i]==t[i]) continue;
		f=(s[i]<t[i])?1:-1;
		break;
	}
	if(!f&&ls!=lt) f=(ls<lt)?1:-1;
	if(f==1) printf("Yes\n");else printf("No\n");
	return 0;
}

Measured memory_bytes: 128
public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        long n = scanner.nextLong();
        long k = scanner.nextLong();
        long a = n / k, b = a * a * a;
        if ((k & 1) == 0) {
            a = (n + k / 2) / k;
            b += a * a * a;
        }
        System.out.println(b);
    }
}

Measured memory_bytes: 21844
n, m = map(int, input().split())
ab=[list(map(int, input().split())) for i in range(m)]
e=[[0]*10 for i in range(10)]
for abi in ab:
    e[abi[0]][abi[1]]=1
    e[abi[1]][abi[0]]=1
ans=0
def dfs(l, v):
    l.append(v)
    if len(l)==n:
        global ans
        ans+=1
        return
    for i in range(10):
        if e[v][i]==1 and i not in l:
            ll=[i for i in l]
            dfs(ll, i)
    return
dfs([],1)
print(ans)


Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <random>
#include <bitset>
#include <time.h>
#include <string>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
//#define endl '\n'
#define mp make_pair
#define pbc push_back
#define pob pop_back()
#define empb emplace_back
#define sp system("pause")
#define queuel queue<long long>
#define all(x) (x).begin(),(x).end()
#define matrix vector<vector<ll>>
#define pin(p) cin >> p.first >> p.second;
#define rev(v) reverse(v.begin(),v.end());
#define mx(v) max_element(v.begin(), v.end());
#define mn(v) min_element(v.begin(), v.end());
#define sout(s, c) for(auto i : s) cout << i << c;
#define pout(p) cout << p.first << " " << p.second;
#define er(v, l, r) erase(v.begin() + l, v.begin() + r);
#define vin(v) for(ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vout(v, c) for(int i = 0; i < v.size(); ++i) cout << v[i] << c;
#define pushi(v, a) for(int i = 0; i < a.size(); ++i) v.push_back(a[i]);
#define sin(s, n) for(int i = 0; i < n; ++i){int a; cin >> a; s.insert(a);}
#define fastio() ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);srand(time(NULL));
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
using namespace std;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
const ll INF = 1000LL * 1000 * 1000 * 1000 * 1000 * 1000;
const int inf = 1000 * 1000 * 1000;
const ld PI = acos(-1.0);
const ll mod1 = inf + 7;
const ll mod2 = inf + 9;
const int MAXN = 500001;
const ld EPS = 1e-9;
int hp = 179;
#define int long long


signed main()
{
	fastio();
	string s, t;
	cin >> s >> t;
	for (int i = 0; i < s.size(); ++i)
	{
		if (s == t)
		{
			cout << "Yes";
			return 0;
		}
		rotate(s.begin(), s.begin() + 1, s.end());
	}
	cout << "No";
	system("pause");
}

Measured memory_bytes: 504
while gets
 a,b,c,d,e,f=$_.split.map(&:to_f)
  x=a*e-b*d
  printf"%.3f %.3f\n",(e*c-b*f)/x+0,(a*f-d*c)/x+0
end


#https://gist.github.com/kwatch/2814940


Measured memory_bytes: 6884
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
int main() {
    int K, X;
    cin >> K >> X;
    for(int i = -K + 1; i < K; i++) {
        cout << (i == (- K + 1) ? "" : " ") << X + i;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Control.Applicative
import Data.Functor
import Data.List
import Data.List.Split
import Data.Char

readInt = read :: String -> Int
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
-- end of templete

fact 0 = 1
fact n = n * fact (n-1)

main = getInt >>= print . fact

Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll a, b; cin >> a >> b;
    cout << a*b << endl;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);

#define ull unsigned long long int
#define ll long long int
#define ld double
#define ui unsigned int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second 

ll gcd(ll a, ll b) 
{ 
    if (a == 0)  return b; 
    return gcd(b % a, a); 
} 

int main(){

	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);      
    #endif
    fastio;

    ll t; t=1;
    while(t--){
    	ll n; cin>>n;
        ll ans=0;
        for(ll i=1;i<=n;i++){
            for(ll j=1;j<=n;j++){
                ll x=gcd(i,j);
                for(ll k=1;k<=n;k++){
                    ans += gcd(x,k);
                }
            }
        }
        cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 3644
n = int(input())
ln = []
for k in range(1,(int(n**0.5))+1):
    if n % k == 0:
        ln.append(k)
if not n**0.5 % 1 == 0:
    for k in reversed(range(0, len(ln))):
        ln.append(n // ln[k])
else:
    for k in reversed(range(0, len(ln)-1)):
        ln.append(n // ln[k])
if not n**0.5 % 1 == 0:
    i = ln[len(ln) // 2 - 1]
    j = ln[len(ln) // 2]
    ans = i + j -2
else:
    ans = int(2*n**0.5)-2
print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 1e9
typedef long long ll;

int main()
{
    char a,b,c,d;
    cin>>a>>b>>c>>d;
    int w=int(a-'0'),x=int(b-'0'),y=int(c-'0'),z=int(d-'0');

    int f;
    REP(i,0b1000){
        int v=w+((i/0b100%0b10)? x:-x)+((i/0b10%0b10)? y:-y)+((i%0b10)? z:-z);
        if(v==7){
            f=i;
            break;
        }
    }

    cout<<a<<((f/0b100%0b10)? '+':'-')<<b<<((f/0b10%0b10)? '+':'-')<<c<<((f%0b10)? '+':'-')<<d<<"=7"<<endl;

	return 0; 
}


Measured memory_bytes: 256