akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int x = sc.nextInt();

        ArrayList<int[]> a = new ArrayList<>();
        int[] cost = new int[n];
        for(int i = 0; i < n; i++){
            cost[i] = sc.nextInt();
            int[] ai = new int[m];
            for(int j = 0; j < m; j++){
                ai[j] = sc.nextInt();
            }
            a.add(ai);
        }

        int out = -1;
        int[] bilis = new int[n];
        for(int i = 0; i < pow2n(n); i++){
            int c = 0;
            int[] sum = new int[m];
            for(int j = 0; j < n; j++){
                if(bilis[j] == 1){
                    c += cost[j];
                    for(int k = 0; k < m; k++){
                        sum[k] += a.get(j)[k];
                    }
                }
            }
            if(bigger(sum, x)){
                if(out == -1){
                    out = c;
                } else {
                    out = Math.min(out, c);
                }
            }
            bilis = gene(bilis);
        }

        System.out.println(out);
        sc.close();

        
    }
    static int[] gene(int[] bilis){
        ArrayList<Integer> al = new ArrayList<>();
        for(int i = 0; i < bilis.length; i++) al.add(bilis[i]);
        if(al.contains(0)) {
            int i = al.lastIndexOf(0);
            bilis[i] += 1;
            for(int j = i + 1; j < al.size(); j++){
                bilis[j] = 0;
            }
        } 
        return bilis;
    }
    static int pow2n(int n){
        int out = 1;
        for(int i = 0; i < n; i++){
            out *= 2;
        }
        return out;
    }
    static boolean bigger(int[] ia, int x){
        boolean b = true;
        for(int i = 0; i < ia.length; i++){
            if(ia[i] < x) b = false; 
        }
        return b;
    }
}

Measured memory_bytes: 39948
/*
ID: usaco.t3
TASK: test
LANG: C++14
*/

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _CRT_SECURE_NO_WARNINGS
/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define intt long long

#define pii pair<intt,intt>
#define vi vector<intt>
#define vii vector<pii>

#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

#define F first
#define S second
#define pb push_back

#define IO ios_base::sync_with_stdio(false);cin.tie();
#define endl '\n'

#define wtfis(x) cerr << "at line " << __LINE__ << ": " << #x << " = " << (x) << endl

const intt max3 = 1003;
const intt max4 = 10004;
const intt maxx = 100005;
const intt max6 = 1000006;
const intt max7 = 10000007;

const intt lg4 = 13;
const intt lg5 = 17;
const intt lg6 = 20;

const intt INF = 2LL * 1000000000;
const intt INFLL = 9LL * 1000000000 * 1000000000;
/***************/

intt powmod (intt a, intt b, intt mod) {
    intt res = 1;
    a %= mod;
    for (; b; b >>= 1) {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

intt gcd (intt a, intt b) {
    while (b > 0) {
        intt t = a % b;
        a = b, b = t;
    }
    return a;
}

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

intt is_prime (intt n) {
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (intt i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}

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

int arr[maxx];
int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    IO;
    int n;
    cin >> n;
    for (int i =1; i <= n; i++) {
        cin >> arr[i];
    }
    sort(arr + 1, arr + n + 1);
    cout << arr[n] - arr[1] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;


void solve(long long A, long long B){
  int ans = 0;
  int m = 1;
  while (m < B) {
    m += A-1;
    ans++;
  }
  std::cout << ans << std::endl;
}

int main(){
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
  solve(A, B);
  return 0;
}


Measured memory_bytes: 256
import sys
n,y = map(int,input().split())
y_ = y/1000

for i in range(0,n+1,1):
    for j in range(0,n-i+1,1):
        tmp = 10*i+5*j+1*(n-i-j)
        if tmp == y_:
            print(str(i)+' '+str(j)+' '+str(n-i-j)+' ')
            sys.exit()
print(str(-1)+' '+str(-1)+' '+str(-1)+' ')


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

namespace AtCoder
{
	public class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());

			int[] h = Console.ReadLine().Split().Select(int.Parse).ToArray();

			int[] dp = new int[n];
			dp[0] = 0;
			dp[1] = Math.Abs(h[0] - h[1]);
			for (int i = 2; i < n; i++) {
				int cost1 = dp[i - 1] + Math.Abs(h[i - 1] - h[i]);
				int cost2 = dp[i - 2] + Math.Abs(h[i - 2] - h[i]);

				dp[i] = Math.Min(cost1, cost2);
			}
			Console.WriteLine(dp[n - 1]);

		}
	}
}


Measured memory_bytes: 18016
#include <iostream>
using namespace std;
long long mod = 1e9 + 7;
int main(void){
	long long N;
	int i;
	cin >> N;
	long long ans = 1;
	for(i=1;i<=N;i++){
		ans *= i;
		ans %=mod;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
import math

n,m=[int(i) for i in input().split()]
ab=[]
cd=[]
for i in range(n):
    x,y=[int(i) for i in input().split()]
    ab.append([x,y])
for i in range(m):
    x,y=[int(i) for i in input().split()]
    cd.append([x,y])


for i in range(n):
    dist=1000000000
    point=0
    for j in range(m):
        temp=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        if temp<dist:
            dist=temp
            point=j+1
    print(point)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int INF=1e9+7;
int dp[2][105],dat[2][105];
int main(){
	int n;
	cin>>n;
	rep(i,2)rep(j,n)cin>>dat[i][j];
	rep(i,2)rep(j,n){
		if(i)dp[i][j]=max(dp[i][j],dp[i-1][j]);
		if(j)dp[i][j]=max(dp[i][j],dp[i][j-1]);
		dp[i][j]+=dat[i][j];
	}
	printf("%d\n",dp[1][n-1]);
	return 0;
}

Measured memory_bytes: 256
/************************************************
 * Au: Hany01
 * Date: Oct 11th, 2018
 * Prob: agc002b
 * Email: hany01dxx@gmail.com & hany01@foxmail.com
 * Inst: Yali High School
************************************************/

#include<bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
#define Rep(i, j) for (register int i = 0, i##_end_ = (j); i < i##_end_; ++ i)
#define For(i, j, k) for (register int i = (j), i##_end_ = (k); i <= i##_end_; ++ i)
#define Fordown(i, j, k) for (register int i = (j), i##_end_ = (k); i >= i##_end_; -- i)
#define Set(a, b) memset(a, b, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define X first
#define Y second
#define PB(a) push_back(a)
#define MP(a, b) make_pair(a, b)
#define SZ(a) ((int)(a).size())
#define ALL(a) a.begin(), a.end()
#define INF (0x3f3f3f3f)
#define INF1 (2139062143)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define y1 wozenmezhemecaia

template <typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }

template <typename T> inline T read() {
	static T _, __; static char c_;
    for (_ = 0, __ = 1, c_ = getchar(); c_ < '0' || c_ > '9'; c_ = getchar()) if (c_ == '-') __ = -1;
    for ( ; c_ >= '0' && c_ <= '9'; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
    return _ * __;
}
//EOT


const int maxn = 1e5 + 5;

int n, m, mk[maxn], x, y, cnt, a[maxn];

int main()
{
#ifdef hany01
	freopen("agc002b.in", "r", stdin);
	freopen("agc002b.out", "w", stdout);
#endif

	n = read<int>(), m = read<int>(), mk[1] = 1;
	For(i, 1, n) a[i] = 1;
	For(i, 1, m) {
		x = read<int>(), y = read<int>();
		if (a[x] == 1) {
			if (mk[x]) mk[y] = 1, mk[x] = 0;
		} else if (a[x] > 1) {
			if (mk[x]) mk[y] = 1;
		}
		-- a[x], ++ a[y];
	}
	For(i, 1, n) cnt += mk[i];
	printf("%d\n", cnt);

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)

class mod {
public:
    mod() {m_n = 0;}
    mod(ll n) {if (n >= 0) m_n = n % MOD; else m_n = n % MOD + MOD;}
    friend bool operator== (const mod& a, const mod& b) {return a.m_n == b.m_n;}
    friend bool operator!= (const mod& a, const mod& b) {return !(a == b);}
    friend mod operator+ (const mod& a, const mod& b) {return (a.m_n + b.m_n) % MOD;}
    friend mod& operator+= (mod& a, const mod& b) {return a = a + b;}
    friend mod operator- (const mod& a) {return -a.m_n;}
    friend mod operator- (const mod& a, const mod& b) {return (a.m_n + (-b.m_n)) % MOD;}
    friend mod& operator-= (mod& a, const mod& b) {return a = a - b;}
    friend mod operator* (const mod& a, const mod& b) {return (a.m_n * b.m_n) % MOD;}
    friend mod& operator*= (mod& a, const mod& b) {return a = a * b;}
    friend mod pow(const mod& n, ll r) {
        if (r == 0) {
            return 1;
        } else if (r < 0) {
            return pow(n, (MOD - 2) * (-r));
        } else if (r % 2 == 0) {
            mod tmp = pow(n, r / 2);
            return tmp * tmp;
        } else {
            return n * pow(n, r - 1);
        }
    }
    friend mod operator/ (const mod& a, const mod& b) {return a * pow(b, -1);}
    friend mod& operator/= (mod& a, const mod& b) {return a = a / b;}
    friend ostream& operator<< (ostream& os, const mod& n) {os << n.m_n; return os;}
    friend istream& operator>> (istream& is, mod& n) {ll tmp; is >> tmp; n = mod(tmp); return is;}
private:
    ll m_n;
};

int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    
    int N;
    cin >> N;
    vector<int> A(N);
    for (int n = 0; n < N; ++n) {
        cin >> A[n];
    }
    vector<int> B(N+1);
    B[0] = 0;
    for (int n = 1; n <= N; ++n) {
        B[n] = B[n-1]^A[n-1];
    }
    map<int, vector<int>> Map;
    for (int n = 1; n <= N; ++n) {
        Map[B[n]].push_back(n);
    }
    vector<int> ZeroCnt(N+1);
    ZeroCnt[0] = 0;
    for (int n = 1; n <= N; ++n) {
        ZeroCnt[n] = ZeroCnt[n-1] + (B[n]==0);
    }
    
    if (B[N] == 0) {
        mod Res = 0;
        for (auto m : Map) {
            if (m.first == 0) continue;
            auto pos = m.second;
            mod z = 1, p = 0;
            int now = 0;
            for (int next : pos) {
                int nZero = ZeroCnt[next] - ZeroCnt[now];
                z += p*nZero;
                p += z;
                now = next;
            }
            Res += p;
        }
        Res += pow(mod(2), ZeroCnt[N]-1);
        cout << Res << endl;
        return 0;
    } else {
        mod z = 1, p = 0;
        for (int n = 1; n <= N; ++n) {
            if (B[n] == 0) z += p;
            else if (B[n] == B[N]) p += z;
        }
        cout << z << endl;
        return 0;
    }
}


Measured memory_bytes: 38900
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    ll n, m;
    ll ans = 0;

    cin >> n >> m;

    priority_queue<P, vector<P>, greater<P>> d;

    for (int i = 0; i < n; i++)
    {
        int x, y;

        cin >> x >> y;

        d.push(P(x, y));
    }

    while (d.size())
    {
        P p = d.top();
        d.pop();

        m -= p.second;

        if (m >= 0)
        {
            ans += p.first * p.second;
        }
        else
        {
            ans += p.first * (m + p.second);
            break;
        }
    }

    cout << ans << endl;
}

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

ll c[1010][3];

ll calc(int id, int k){
    ll res = 0;
    for(int i = 0; i < 3; i++){
        if(k & (1<<i)) res += c[id][i];
        else res -= c[id][i];
    }
    return res;
}

int main(){
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 3; j++){
            cin >> c[i][j];
        }
    }
    ll ans = 0;
    for(int k = 0; k < (1<<3); k++){
        vector<ll> d(n);
        for(int i = 0; i < n; i++){
            d[i] = calc(i, k);
        }
        sort(d.rbegin(), d.rend());
        ll sum = 0;
        for(int i = 0; i < m; i++){
            sum += d[i];
        }
        ans = max(ans, sum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
using namespace std;
int main(){
    char c[1000];
    int now=0;
    for(int i=0;i<1000;i++)c[i]='\0';
    cin.getline(c,1000);
    for(int i=0;c[i]!='\0';i++){
        if(c[i]=='p'&&c[i+1]=='e'&&c[i+2]=='a'&&c[i+3]=='c'&&c[i+4]=='h'){
            c[i]='a';
            c[i+1]='p';
            c[i+2]='p';
            c[i+3]='l';
            c[i+4]='e';
        }
        else if(c[i]=='a'&&c[i+1]=='p'&&c[i+2]=='p'&&c[i+3]=='l'&&c[i+4]=='e'){
            c[i]='p';
            c[i+1]='e';
            c[i+2]='a';
            c[i+3]='c';
            c[i+4]='h';
        }
        printf("%c",c[i]);
    }
    printf("\n");
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n;
  cin >> n;
  vl sum(n + 1, 0);
  rep(i, n) {
    int a;
    cin >> a;
    sum[i + 1] = sum[i] + a;
  }
  ll ans = 1e18;
  rep2(i, 1, n) {
    ll now = abs(sum[n] - 2 * sum[i]);
    ans = min(ans, now);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
n, k = map(int, input().split())
s = list(map(int, input().split()))  # r, s, p
t = list(map(str, input()))

ans = 0
for i in range(n):
    if i-k >= 0:
        if t[i] == t[i-k]:
            t[i] = 'change'
        else:
            continue

for j in range(n):
    if t[j] == 'r':
        ans += s[2]
    elif t[j] == 's':
        ans += s[0]
    elif t[j] == 'p':
        ans += s[1]
    else:
        continue
print(ans)

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

int main(){
  char letter;
  string line;

  getline(cin, line);

  for(int i = 0; i <= 1200; i++){
    letter = line[i];
    if(letter == '\0') break;
    if(isalpha(letter)){
      if(isupper(letter)) letter = tolower(letter);
      else letter = toupper(letter);
    }
    cout << letter;
  }
  cout << endl;
  return 0;
}

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

using namespace std;

int main(void)
{
    ios::sync_with_stdio(false);
    double w;
    while(cin>>w) {
        if(w <= 48.00) {
            cout << "light fly" << endl;
        } else if(48.00 < w && w <= 51.00) {
            cout << "fly" << endl;
        } else if(51.00 < w && w <= 54.00) {
            cout << "bantam" << endl;
        } else if(54.00 < w && w <= 57.00) {
            cout << "feather" << endl;
        } else if(57.00 < w && w <= 60.00) {
            cout << "light" << endl;
        } else if(60.00 < w && w <= 64.00) {
            cout << "light welter" << endl;
        } else if(64.00 < w && w <= 69.00) {
            cout << "welter" << endl;
        } else if(69.00 < w && w <= 75.00) {
            cout << "light middle" << endl;
        } else if(75.00 < w && w <= 81.00) {
            cout << "middle" << endl;
        } else if(81.00 < w && w <= 91.00) {
            cout << "light heavy" << endl;
        } else {
            cout << "heavy" << endl;
        }
    }

    return 0;
}

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

public class UnionFind
{
    private int[] data;
    public UnionFind(int size)
    {
        data = new int[size];
        for (int i = 0; i < size; i++) data[i] = -1;
    }
    public bool Unite(int x, int y)
    {
        x = Root(x);
        y = Root(y);
        if (x != y)
        {
            if (data[y] < data[x])
            {
                var tmp = y;
                y = x;
                x = tmp;
            }
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    public bool IsSameGroup(int x, int y) => Root(x) == Root(y);
    public int Root(int x) => data[x] < 0 ? x : data[x] = Root(data[x]);
    public int getMem(int x) => -data[Root(x)];
}


public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        var uf = new UnionFind(n);
        for (int i = 0; i < m; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            uf.Unite(int.Parse(line[0]) - 1, int.Parse(line[1]) - 1);
        }
        var d = new Dictionary<int, int>();
        for (int i = 0; i < n; i++)
        {
            var r = uf.Root(i);
            if (d.ContainsKey(r)) d[r]++;
            else d[r] = 1;
        }
        getAns(d);
    }
    static void getAns(Dictionary<int, int> d)
    {
        var d2 = new List<int>();
        foreach (var x in d) d2.Add(x.Value);
        var a = d2.Distinct().OrderBy(x => x).ToArray();
        var aL = a.Length;
        var ans = a[0];
        for (int i = 1; i < aL; i++)
            ans += a[i] - a[i - 1];
        Console.WriteLine(ans);
    }
}


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

string s[10001];
int a_end, b_start, both;
int ans;

int main() {
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        if (s[i][0] == 'B' && s[i][s[i].size() - 1] == 'A') both++;
        else if (s[i][0] == 'B') b_start++;
        else if (s[i][s[i].size() - 1] == 'A') a_end++;

        for (int j = 0; j < s[i].size() - 1; j++) {
            if (s[i][j] == 'A' && s[i][j + 1] == 'B') ans++;
        }
    }


    if (both >= 2) {
        ans += (both - 1);
        both = 1;
    }
    if (both == 1) {
        if (a_end) {
            ans++; a_end--;
        }
        if (b_start) {
            ans++; b_start--;
        }
    }

    ans += min(a_end, b_start);
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define endl "\n"
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORR(x,arr) for(auto& x:arr)
#define PII pair<int, int>
#define FI first 
#define SE second
#define ALL(x) (x).begin(), (x).end()
const int INF=1<<30; const ll LINF=1LL<<60 ; const ll mod=1e9+7 ;
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//-------------------

int main(){
	ll s; cin >> s;
	ll n =0;
	ll cnt = s;
	while(cnt>=1){
		cnt /= 10;
		n += 1;
	}
	//int num = int(s);
	//cout << num;
	ll ans = 0;
	//cout << pow(9,int(n/2));
	FOR(i,0,n/2-1) ans += 9*pow(100,i);
	//cout << ans;
	if(n%2==1){
		if(n>1){
			ll cur = 1;
			FOR(i,1,n-2) {cur *= 10; cur += 1;}
			//cout << cur << endl;
			ans += s-cur*9; 
		}else{
			ans = s;
		}
	}
	cout << ans << endl;
    return 0;
}


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

int main() {
	// your code goes here
	int x;
	int i=0,s=0;
	while(true){
		s=s+i;
		i=i+1;
		cin >> x;
		if ( x == 0 ){
    		break;
    	}
		cout<<"Case"<<" "<<i<<": "<<x<<endl;
	}
}

Measured memory_bytes: 2984
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;

public class Main {
	static BigDecimal A;
	static BigDecimal B;
	
	public static void main(String[] args) throws NumberFormatException, IOException {
		read();
	}

	private static void read() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] word = br.readLine().split(" ");
		A = BigDecimal.valueOf(Double.valueOf(word[0]));
		B = BigDecimal.valueOf(Double.valueOf(word[1]));
		A = A.multiply(B);
		System.out.println(A.longValue());
		br.close();
	}

}


Measured memory_bytes: 33556
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;

typedef pair <int, int> pii;
typedef pair <pii, int> piii;

vector <int> from[100010];
int vis[100010][3];
queue <piii> q;

int main(){
	int n, m; scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++){
		int u, v; scanf("%d%d", &u, &v);
		from[u].push_back(v);
	}
	int S, T; scanf("%d%d", &S, &T);
	memset(vis, -1, sizeof(vis));
	q.push(mp(mp(S, 0), 0)), vis[S][0] = 0;
	while (!q.empty()){
		piii t = q.front(); q.pop();
		int x = t.fi.fi, p = (t.fi.se + 1) % 3, dist = t.se + 1;
		for (int i = 0; i < from[x].size(); i++){
			int v = from[x][i];
			if (~vis[v][p]) continue;
			vis[v][p] = dist, q.push(mp(mp(v, p), dist));
		}
	}
	printf("%d\n", vis[T][0] == -1 ? -1 : vis[T][0] / 3);
	return 0;
}


Measured memory_bytes: 6912
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <climits>
#include <sstream>
 
using namespace std;
 
int main(){
    char c;
    
    cin >> c;

    bool flag = false;
    if(c == 'a') flag = true;
    else if(c == 'i') flag = true;
    else if(c == 'u') flag = true;
    else if(c == 'e') flag = true;
    else if(c == 'o') flag = true;

    if(flag) cout << "vowel" << endl;
    else cout << "consonant" << endl;

    return 0;
}

Measured memory_bytes: 256
N,M,X,Y =map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))

xmax = max(x)
ymin = min(y)

flag = 0
for z in range(xmax+1,ymin+1):
    if X < z and z <= Y:
        flag = 1
if flag == 0:
    print("War")
else:
    print("No War")

Measured memory_bytes: 38384
import sys
def yakusu(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
N=int(input())
K=int(input())
if N==K:
  print(N+1)
  exit()
if N<K:
  print(-1)
  exit()
L=list()
setL=set()
#N-Kはa-1の倍数
L=yakusu(N-K)
L=[i+1 for i in L]
for i in L:
  ans=0
  m=N
  while True:
    if m<i:
      ans+=m
      break
    else:
      ans+=m%i
      m=m//i
  if ans==K:
    print(i)
    exit()
print(-1)

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i < (n)i++)
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
#define pii pair<int, int>
#define abs(a) llabs(a)
#define int long long
#define re(s) reverse((s).begin(), (s).end())
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
const long long mod = 1e9 + 7;

signed main()
{

   cin.tie(0);
   ios::sync_with_stdio(false);

   int n;
   cin >> n;
   string s;
   cin >> s;
   int cnt = 0, ans = 0;

   rep(i, s.size())
   {
      if (char(s[i] + n) > 'Z')
         s[i] = (s[i] - ('Z' - ('A' - 1)));
      cout << char(s[i] + n);
   }
   cout << '\n';
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(){
    int K; 
    char str[100];
    scanf("%d", &K);
    scanf("%s", str);
   int len = strlen(str);
    if(len > K){
        for(int i = 0; i < K; i++){
            printf("%c", str[i]);
        }
        printf("...\n");
    } else {
        printf("%s", str);
    }
    return 0;
}

Measured memory_bytes: 1716
#include <iostream>

 

using namespace std;

 

int main() 
{
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    
    if(x-r >= 0 && y-r >= 0 && x+r <= w && y+r <= h)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 3116
#include<iostream>
using namespace std;
int main(){
int n,all=0,ans;
cin >> n;
int a[n+2];
a[0]=0;
a[n+1]=0;
for(int i=1;i<=n;i++){
cin >> a[i];
if(a[i]>a[i-1])all+=a[i]-a[i-1];
else all+=a[i-1]-a[i];
}
if(a[n+1]>a[n])all+=a[n+1]-a[n];
else all+=a[n]-a[n+1];
for(int i=1;i<=n;i++){
ans=all;
for(int j=i;j<i+2;j++){
if(a[j]>a[j-1])ans-=a[j]-a[j-1];
else ans-=a[j-1]-a[j];
}
if(a[i+1]>a[i-1])ans+=a[i+1]-a[i-1];
else ans+=a[i-1]-a[i+1];
cout << ans << endl;
}
return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int t = 0;
  rep(i, n) if (t + 1 == a[i]) { t++; }
  if (t == 0)
    cout << "-1" << endl;
  else
    cout << n - t << endl;
}


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

int main() {
  
  long long N;
  cin >> N;
  
  long long sum = 0;
  for(long long i=1; i<=N; i++){
    if(i%3 != 0 && i%5 != 0){
      sum += i;
    }
  }

  cout << sum << endl;
}

Measured memory_bytes: 3576
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

// conversion
//------------------------------------------
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

// math
//-------------------------------------------
template <class T> inline T sqr(T x) { return x * x; }

// typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c)                                                             \
  for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

// clear memory
#define CLR(a) memset((a), 0, sizeof(a))

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                                               \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"                       \
       << " " << __FILE__ << endl;

void solve(long long r) {cout<<3*r*r<<endl;}

int main() {
  long long r;
  scanf("%lld", &r);
  solve(r);
  return 0;
}


Measured memory_bytes: 256
def check_otosidama(n, y)
  for i in 0..n do
    for j in 0..n-i do
      k = n - i - j
      return "#{i} #{j} #{k}" if (i * 10000 + j * 5000 + k * 1000 == y) && (i + j + k == n)
    end
  end
  "-1 -1 -1"
end

inputs = gets.split(' ').map(&:to_i)
n = inputs[0]
y = inputs[1]

puts check_otosidama(n, y)

Measured memory_bytes: 1788
#include<stdio.h>
#include<string.h>

long long dp[2010][2010];
#define mod 1000000007
int main(){
	int n, m;
	int s[2010], t[2010];
	scanf("%d%d", &n,&m);	
	for(int i = 0; i < n; i++) scanf("%d", s+i);
	for(int i = 0; i < m; i++) scanf("%d", t+i);

	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= m; j++){
			if(i == 0 || j == 0){
				dp[i][j] = 1;
				continue;
			}
			dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % mod;
			if(s[i-1] != t[j-1]){
				// dp[i-1][j-1] を mod の世界で引く
				dp[i][j] -= dp[i-1][j-1];
				dp[i][j] = dp[i][j] % mod;
				if(dp[i][j] < 0) {
					dp[i][j] += mod;
				}
			} 	
		}
	}
	printf("%lld\n", dp[n][m]);
	//cout << dp[n][m] << endl;
}


Measured memory_bytes: 33124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string btos(bool ans){
  return (ans?"Right":"Left");
}
int main() {
  int a,b,c,d;cin>>a>>b>>c>>d;
  int ans=a+b-(c+d);
  cout << ((ans==0)?"Balanced":btos(ans<0)) << endl;
  return 0;
}


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

int main(){
    ll l;
    ll r;
    cin >> l >> r;
    r = min(r,l+4019);
    ll ans = 1000000000;
    for(ll i = l;i < r;i++){
        for(ll j = i+1;j < r+1;j++){
            ans = min(ans,i*j%2019);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
s = input()
t = tuple(map(lambda x: 1 if x == 'L' else 0, s))

x = t[0]
region_count = 1
for tt in t:
    if tt ^ x == 1:
        region_count += 1
        x ^= 1

print(n - max(1, region_count - k * 2))


Measured memory_bytes: 4340
using System;
class Program{
	public static void Main(){
		string[] str = Console.ReadLine().Split(' ');
		string num = str[0] + str[1];
		int n = int.Parse(num);
		
		for (int i = 0 ; ;i++ ){
			if (Math.Pow(i, 2.0) == n){
				Console.WriteLine("Yes");
				break;
			}
			if (Math.Pow(i, 2.0) > n){
				Console.WriteLine("No");
				break;
			}
		}
	}
}

Measured memory_bytes: 13140
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=998244353 ;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
//17:00~

int main(void){
	cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);
	int n;cin>>n;
	cout<<((65<=n&&n<=90)?1:((97<=n&&n<=122)?2:0))<<endl;
	return 0;
}



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

int main(){
  int x,y,i;
  cin >> x >> y;
  for(;y!=x*2;x--){
    if(y<x*2||x==0){
      cout << "No" << endl;
      return 0;
    }
    y=y-4;
    if(y==0){
      break;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

int p[100000], d[100000];
bool b[100000];
queue<P>que;
int pos(int v) {
	if (b[v])return -1;
	b[v] = true;
	if (p[v] == 0)return v;
	return pos(v + p[v]);
}
int main() {
	int n; scanf("%d", &n);
	rep(i, n)scanf("%d", &p[i]);
	que.push(P(0, 0)); b[0] = true;
	while (!que.empty()) {
		P p = que.front(); que.pop();
		for (int i = 1; i <= 6; i++) {
			if (p.first + i >= n)break;
			int a = pos(p.first + i);
			if (a != -1) {
				d[a] = p.second + 1; que.push(P(a, d[a]));
			}
		}
	}
	printf("%d\n", d[n - 1]);
}

Measured memory_bytes: 4140
#include<bits/stdc++.h>
using namespace std;
#define itn int
#define int long long
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  itn n,sum=0;
  cin>>n;
  for(int i=1;i<=n;i++){
    if(i%3!=0&&i%5!=0) sum+=i;
  }
  cout<<sum<<"\n";
}

Measured memory_bytes: 3684
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int d = Integer.parseInt(sc.next());
        double x[][] = new double[n][d];
        for(int i = 0;i<n;i++){
            for(int j = 0;j<d;j++){
                x[i][j] = Double.parseDouble(sc.next());
            }
        }
        int ans = 0;
        for(int i = 0;i<n;i++){
            for(int i2 = i+1;i2<n;i2++){
                double tmp = 0;
                for(int j = 0;j<d;j++){
                    tmp += Math.pow(Math.abs(x[i][j] - x[i2][j]),2);
                }
                tmp = Math.sqrt(tmp);
                if(Math.floor(tmp) == tmp){
                    ans += 1;
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
#include<stdio.h>

int m,n;
int x[100];

int lower( int INF,int (*compare)(int) )
{
	int start = 0,end = INF,medi;
	while( start <= end )
	{
		medi = (start+end)/2;
		if( compare(medi) ){
			if( compare(medi-1) )
				end = medi-1;
			else
				break;
		}
		else{
			start = medi+1;
		}
	}
	return medi;
}

int compare( int size ){	//size:本棚の幅
	int i,cnt = 0;
	int rui = 0;
	
	for( i = 0;i < n;i++ ){
		if( size < x[i] )
			return 0;
		if( rui+x[i] > size ){
			rui = x[i];
			cnt++;
		}
		else{
			rui += x[i];
		}
	}
	if( cnt >= m )
		return 0;
	return 1;
}

int main(){
	while( scanf("%d%d",&m,&n) ){
		if( m == 0 )
			break;
		
		for( int i = 0;i < n;i++ ){
			scanf("%d",x+i);
		}
		printf("%d\n",lower( 1500000,compare ) );
	}
	return 0;
}

Measured memory_bytes: 1028
def generate_block(s):
    table = []
    j = 0
    for i in range(len(s)-1):
        if s[i] != s[i+1]:
            table.append(s[j:i+1])
            j = i + 1
    return table

def happy(s):
    count = 0
    ll = len(s)
    for i in range(ll):
        if i != ll-1 and s[i] == 'R' and s[i+1] == 'R': count += 1
        if i != 0 and s[i] == 'L' and s[i-1] == 'L': count += 1
    return count

n, k = map(int, input().split())
s = input() + '.'
x = 0
table = generate_block(s)[::-1]
while k > 0:
    pos = 2 * x + 1
    if pos >= len(table): break
    if 'L' in table[pos]: table[pos] = table[pos].replace('L', 'R')
    else: table[pos] = table[pos].replace('R', 'L')
    k -= 1
    x += 1
print(happy(''.join(table)))

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

int main() {
  int N;
  cin >> N;
  vector<int> L(N);
  for (int i = 0;i < N; i++) {
    cin >> L.at(i);
  }
  sort(L.begin(),L.end());
  reverse(L.begin(),L.end());
  
  int data = 0;
  for (int i = 1;i < N; i++) {
    data += L.at(i);
  }
  
  
  string Yes , No;
  if (L.at(0) < data) {
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
  
}


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

int main(){
    int H,W;
    cin >> H >> W;
    string S[H];
    for(int i=0;i<H;i++){ cin >> S[i]; }
    int count;
    
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            count = 0;
            
            if(S[i].at(j) == '.'){
                //上方向
                if(i != 0){    //上端でなければ
                    if(j != 0){    //左端でなければ
                        if(S[i-1].at(j-1) == '#'){ count++; }   //左上　判定
                    }
                    if(S[i-1].at(j) == '#'){ count++; } //真上　判定
                    if(j+1 < W){    //右端でなければ
                        if(S[i-1].at(j+1) == '#'){ count++; }   //右上判定
                    }
                }
                
                //横方向
                if(j != 0){    //左端でなければ
                    if(S[i].at(j-1) == '#'){ count++; } //左隣　判定
                }
                if(j+1 < W){    //右端でなければ
                    if(S[i].at(j+1) == '#'){ count++; } //右隣　判定
                }
                
                //下方向
                if(i+1 < H){    //下端でなければ
                    if(j != 0){    //左端でなければ
                        if(S[i+1].at(j-1) == '#'){ count++; }   //左下　判定
                    }
                    if(S[i+1].at(j) == '#'){ count++; } //真下　判定
                    if(j+1 < W){    //右端でなければ
                        if(S[i+1].at(j+1) == '#'){ count++; }   //右下　判定
                    }
                }
                cout << count;
            }
            else if(S[i].at(j) == '#'){ cout << "#"; }
        }
        cout << endl;
    }
}

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

double fabs (double n) {
    if (n < 0) return -n;
    else return n;
}

int main() {
    int n;
    cin >> n;
    vector<double> a(n);
    double sum = 0.0;
    for (int i=0; i<n; i++) {
        double num;
        cin >> num;
        a[i] = num;
        sum += num;
    }
    double ave = sum / n;
    double mind = 1000;
    int ans = -1;
    for (int i=0; i<n; i++) {
        if (fabs(a[i]-ave) < mind) {
            mind = fabs(a[i]-ave);
            ans = i;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N, L = map(int, input().split())
S = 0
T = 1000
ans = 0
flag = 1

S = N*(N+2*L-1)/2

for i in range(N):
    if T > abs(L+i) and L+i>=0:
        T = abs(L+i)
        flag = 1
    elif T > abs(L+i) and L+i<0:
        T = abs(L+i)
        flag = -1
        
ans = int(S-T*flag)
print(ans)    

Measured memory_bytes: 3064
<?php
fscanf(STDIN, "%d %d", $n, $m);
$p = trim(fgets(STDIN));
$point = array_map("intval", explode( " ", $p ) );

if( $n >= $m )
{
  echo 0;
  return;
}

rsort( $point );
for( $i=1; $i<$m; $i++ )
{ $distance[] = $point[$i-1] - $point[$i]; }
rsort( $distance );
array_splice( $distance, 0, $n-1 );

echo array_sum($distance);

Measured memory_bytes: 19700
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

//　T、S内の同じ文字の個数は一致する
int main(){
    string S, T;
    cin >> S >> T;
    VL v1(26, 0), v2(26, 0);
    for(auto s : S) v1[s-'a']++;
    for(auto t : T) v2[t-'a']++;
    sort(ALL(v1));
    sort(ALL(v2));
    rep(i, 0, v1.size()){
        if(v1[i] != v2[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

using namespace std;


typedef int32_t h_int32;
typedef int64_t h_int64;
typedef uint32_t uh_int32;
typedef uint64_t uh_int64;
typedef h_int64 h_int;

#define REP( i, n ) for(int i = 0; i < ( int )( n ); ++i )
#define REPR( i, n ) for(int i = ( int )( n ); i >= 0; --i)
#define FOR( i, a, n ) for(int i = ( int )( a ); i < ( int )( n ); ++i )
#define FORR( i, a, n ) for(int i = ( int )( n ); i >= ( int )( a ); --i)

#define VINIT( v, type, n )vector<type> v; v.resize( n );
#define VINIT2( v, type, n, a )vector<type> v; v.resize( n, a );
#define VCIN( v, type, n ) VINIT( v, type, n ) REP( i, n ) cin >> v[i];

#define DOUT( x ) cerr << #x << " = " << x << "\n";
#define COUT( x ) cout << ( x ) << "\n";

#define INF 999999999



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

        int a, b;
        cin >> a >> b;
        COUT( ( a - 1 ) * ( b - 1 ) );
        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <functional>
#include <queue>
#include <tuple>
#include <map>
using namespace std;

int main() {
	char c; cin >> c;
	if (c == 'A') cout << "T" << endl;
	if (c == 'T') cout << "A" << endl;
	if (c == 'G') cout << "C" << endl;
	if (c == 'C') cout << "G" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>

string s;
ll n;
ll k;
ll dp[200][2][5];//dp[桁][未満][0の個数]=パターン
ll keta[200];
int main(){
    cin>>s>>k;
    int n=s.size();
    rep(i,n)keta[i]=s[i]-'0';

    dp[0][0][0]=1;

    for(int i=0;i<n;i++){
        for(int smaller=0;smaller<2;smaller++){
            for(int cnt=0;cnt<=k;cnt++){
                for(int x=0;x<=(smaller?9:keta[i]);x++){
                    if(x!=0)dp[i+1][smaller || x < keta[i]][cnt+1] += dp[i][smaller][cnt];
                    else dp[i+1][smaller || x < keta[i]][cnt] += dp[i][smaller][cnt];
                }
            }
        }
    }

    cout<<dp[n][0][k]+dp[n][1][k]<<endl;
    return 0;
}


Measured memory_bytes: 256
using System;

namespace SoundHound2018A
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            int[] inp = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int a = inp[0];
            int b = inp[1];
            if (a * b == 15)
            {
                Console.WriteLine("*");
                return;
            }

            if (a + b == 15)
            {
                Console.WriteLine("+");
                return;
            }
            Console.WriteLine("x");
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <cstring>
using namespace std;
#define MAX 200015

struct book{
	string ss;
}g[MAX],p[MAX];

bool mycmp(struct book x, struct book y){
	return x.ss<y.ss;
}

int main(){
	int n;
	while(cin>>n){
		string a;
		int maxans=0;
    	map<string, int> mp;
		for(int i=0;i<n;++i){
			cin>>g[i].ss;
			if(mp[g[i].ss]==0)
				mp[g[i].ss]=1;
			else if(mp[g[i].ss]!=0)
				mp[g[i].ss]++;
			maxans=max(mp[g[i].ss],maxans);
		}
		sort(g, g+n,mycmp);
		for(int i=0;i<n;i++){
			if(g[i].ss!=g[i+1].ss&&mp[g[i].ss]==maxans){
				cout<<g[i].ss<<endl;
			}
		}
		
	}
	return 0;
}


Measured memory_bytes: 28288
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using vint = vector<int>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int main() {
    int n, a, b; cin >> n >> a >> b;
    if((b - a) % 2 == 0) {
        cout << "Alice" << endl;
    } else {
        cout << "Borys" << endl;
    }
    return 0;
}


Measured memory_bytes: 764
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		
		String ID = scanner.next();
		String newID = scanner.next();
		
		scanner.close();
		
		if (ID.equals(newID.substring(0, newID.length() - 1))) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}


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

int main()
{
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    cout << x2 - (y2-y1) << " " << y2 + (x2-x1) << " " << x1 - (y2-y1) << " " << y1 + (x2-x1);

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int a=9,i,j;
    for(i=1;i<=9;i++)
    {
        for(j=1;j<=9;j++)
        {
            printf("%dx%d=%d\n",i,j,i*j);
        }
    }
	return 0;
 }

Measured memory_bytes: 1672