akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string.h>

int main(void){

int n;

scanf("%d",&n);

int ac=0,wa=0,tle=0,re=0;

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

  char s[4];

scanf("%s",s);

  if(strcmp(s,"AC")==0){ac++;}
    if(strcmp(s,"WA")==0){wa++;}
      if(strcmp(s,"TLE")==0){tle++;}
        if(strcmp(s,"RE")==0){re++;}
}

printf("AC x %d\n",ac);
printf("WA x %d\n",wa);
printf("TLE x %d\n",tle);
printf("RE x %d\n",re);


return 0;
}

Measured memory_bytes: 1728
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    	int a = scanner.nextInt();
    	int b = scanner.nextInt();
    	int c = scanner.nextInt();
    	int d = scanner.nextInt();
    	int e = scanner.nextInt();
    	int k = scanner.nextInt();
   	if (e - a <= k) {
      System.out.print("Yay!");
    }
    else {
      System.out.print(":(");
    }
  }
}

Measured memory_bytes: 23124
N, M = map(int, input().split())
A = set(int(input()) for _ in range(M))
mod = 10 ** 9 + 7

dp = [0] * (N+1)
dp[0] = 1
for i in range(1, N+1):
    if i in A:
        continue
    if i == 1:
        dp[i] = 1
        continue
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= mod

print(dp[N] % mod)


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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define RFOR(i,a,b) for(long i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;

char a, b;
int main() {
    std::cin >> a >> b;
    std::cout << (a < b ? '<' : a == b ? '=' : '>') << std::endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)
#define test(a) cout << "*" << a << endl
#define ll long long
int main(){
  string s;
  
  cin >> s;
  
  if(s=="ABC")
    cout << "ARC" << endl;
  else if(s=="ARC")
    cout << "ABC" << endl;
  
}

Measured memory_bytes: 3628
import Data.Maybe
import Data.Array
import qualified Data.ByteString.Char8 as C

parseInt :: C.ByteString -> Int
parseInt = fst . fromJust . C.readInt

main :: IO ()
main = do
  n <- parseInt <$> C.getLine
  line <- C.getLine
  let s = C.unpack line
      a = array (1, n) $ zip [1..] s
      count m = length $ filter (\i -> a!(m-i) /= a!m && a!m /= a!(m+i) && a!(m-i) /= a!(m+i)) [1..min (m-1) (n-m)]
      f c = length $ filter (==c) s
      ans = (f 'R') * (f 'G') * (f 'B') - sum (map count [1..n])
  putStrLn $ show ans


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

int main(){
    int h,w;
    for (;;) {
        scanf("%d %d",&h,&w);
        if (h==0 && w==0) break;
        for (int i=0;i<h;i++) {
            for (int j=0;j<w;j++) {
                if (j<w-1) printf("%c",((i+j)%2==0)?'#':'.');
                else printf("%c\n",((i+j)%2==0)?'#':'.');
            }
        }
        puts("");
    }
    return 0;
}



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

int main()
{
    int n;
    std::cin >> n;
    std::string s, t;
    std::cin >> s >> t;

    for (int i = 0; i < n; i++) {
        printf("%c%c", s[i], t[i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <tchar.h>
//#include <intrin.h>

#define F first
#define S second
#define LL long long
#define MOD 1000000007
#define INF 200000000
#define LINF 1000000000000000000

using namespace std;

const int N = 2e5 + 10;


int main()
{
	
	char c;
	cin >> c;
	if (c >= 'A'&&c <= 'Z')
		puts("A");
	else puts("a");
}

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

int main() {
	int n, m; cin >> n >> m;
	scc_graph g(n);
	for (int i = 0; i < m; ++i) {
		int a, b; cin >> a >> b;
		g.add_edge(a, b);
	}
	vector<vector<int>> scc = g.scc();
	cout << scc.size() << "\n";
	for (vector<int> l : scc) {
		cout << l.size();
		for (int v : l) {
			cout << " " << v;
		}
		cout << "\n";
	}
	return 0;
}

Measured memory_bytes: 40100
n = int(input())
prime = [1]*55556
prime_num = []
for i in range(2,55556):
    if prime[i] and i%5 == 1:
        prime_num.append(i)
    t = 1
    while (t*i <= 55555):
        prime[t*i] = 0
        t += 1
print(*prime_num[:n])

Measured memory_bytes: 3444
/*
       Hi there <3 
──────▄▀▄─────▄▀▄
─────▄█░░▀▀▀▀▀░░█▄
─▄▄──█░░░░░░░░░░░█──▄▄
█▄▄█─█░░▀░░┬░░▀░░█─█▄▄█

*/
#include <bits/stdc++.h>
#define MOD 1000000007
#define re return
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define y0 y32479
#define y1 y95874
#define next next239
#define prev prev239
#define fill(x, y) memset(x, y, sizeof(x))
#define sqr(x) ((x) * (x))
#define sqrt(x) sqrt(abs(x))
#define unq(x) (x.resize(unique(all(x)) - x.begin()))
#define ba back()
#define popcount __builtin_popcountll
#define fastIO()                 \
    {                            \
        ios::sync_with_stdio(0); \
        cin.tie(0);              \
        cout.tie(0);             \
    }
#define in(x) \
    int x;    \
    cin >> x;
#define in1(x) \
    int x;     \
    cin >> x;  \
    x--;
#define inll(x) \
    ll x;       \
    cin >> x;
#define ins(x) \
    string x;  \
    cin >> x;

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef pair<double, double> pdd;
typedef long double LD;
typedef double D;

void Solve()
{
    int n;
    cin >> n;
    vll v(n, 0);
    ll count = 1;
    rep(i, n)
    {
        cin >> v[i];
        v[i] -= count;
        count++;
    }
    ll ans = 0;
    ll ans3 = 0, ans4 = 0;
    ll ans2 = 0;
    sort(all(v));
    ll total1;
    ll total2, total3, total4;
    if (n % 2 == 0)
    {
        total1 = v[n / 2];
        total2 = v[(n / 2) - 1];
        total3 = (total1 + total2) / 2;
    }
    else
    {
        total4 = v[(n-1 )/ 2];
    }

    if (n % 2 == 0)
    {
        rep(i, n)
        {
            ll temp = abs(v[i] - total1);
            ans += temp;
        }

        rep(i, n)
        {
            ll temp = abs(v[i] - total2);
            ans2 += temp;
        }

        rep(i, n)
        {
            ll temp = abs(v[i] - total3);
            ans3 += temp;
        }

        ll final;
        final = min(ans, ans2);
        final = min(final, ans3);
        cout << final << endl;
    }
    else
    {
        rep(i, n)
        {
            ll temp = abs(v[i] - total4);
            ans4 += temp;
        }
        cout << ans4 << endl;
    }
}

int main()
{
    fastIO();
    int t;
    t = 1;
    while (t--)
    {
        Solve();
    }
    return 0;
}

Measured memory_bytes: 1792
#include <cstdlib>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <stack>
#include <utility>
#include <unordered_set>
#include <unordered_map>

#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/multi_array.hpp>

using namespace std;

#if 0
// memo
abs()

start_with(str, "hoge");
ends_with(str, "hoge");

std::sort(d.begin(), d.end());
d.erase(std::unique(d.begin(), d.end()), d.end());
#endif

using namespace boost;
using namespace boost::algorithm;

/**

   @retuen msb pos + 1,
   @retval 0 not found
 */
template<size_t SZ>
size_t msb(const std::bitset<SZ>& s) {
    for (size_t i = SZ; i != 0; --i) {
        if (s[i-1]) {
            return i;
        }
    }
    return 0;
}


static inline bool isOdd(int v)
{
    return v & 0x01;
}

int main()
{
    uint64_t N, Y;
    std::cin >> N >> Y;

    // 10000
    // 5000
    // 1000

    for (size_t i = 0; i <= N; ++i) {
        for (size_t j = 0; j <= N - i; ++j) {
            size_t k = N - (i + j);
            if (10000 * i + 5000 * j + 1000 * k == Y) {
                std::cout << i << " " << j << " " << k << std::endl;
                return 0;
            }
        }
    }
    std::cout << "-1 -1 -1" << std::endl;
    return 0;
}



Measured memory_bytes: 256
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = list(inputs[0])
    ACGT = {"A", "C", "G", "T"}

    max_length = 0
    for i in range(0, len(S)):
        length = 0
        j = i
        while j < len(S) and S[j] in ACGT:
            length += 1
            j += 1
        max_length = length if length > max_length else max_length
    return max_length


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Measured memory_bytes: 3316
N = int(input())
#言われた数字を1つの配列にまとめて昇順にする
A = []
for i in range(N):
    A.append(int(input()))
A.sort()
index = 0
n = 0
while index < N:
    s = A[index]
    count = 0
    while index < N and A[index] == s:
        count += 1
        index += 1
    n += count % 2
print(n)

Measured memory_bytes: 7444
def p_k():
    n, k = map(int, input().split())
    *a, = map(int, input().split())

    dp = [False] * (k + 1)
    for i in range(1, k + 1):
        for j in a:
            if i - j >= 0:
                dp[i] |= not dp[i - j]
    print("First" if dp[k] else "Second")


if __name__ == '__main__':
    p_k()


Measured memory_bytes: 40248
/*
ID: y1197771
PROG: test
LANG: C++
*/
#include<bits/stdc++.h>
#define pb push_back
#define FOR(i, n) for (int i = 0; i < (int)n; ++i)
#define dbg(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1e5 + 10;
int a[maxn];
vector<int> e[maxn];
int dp[maxn];
int n;
void dfs(int u) {
    vector<int> t;
    for (int v : e[u]) {
        dfs(v);
        t.pb(dp[v]);
    }
    sort(t.begin(), t.end(), greater<int>());
    if(t.size() == 0) return;
    dp[u] = t[0] + 1;
    for (int i = 1; i < t.size(); i++) {
        if(t[i] + i + 1 > dp[u])
            dp[u] = t[i] + i + 1;
    }
}
void solve() {
    cin >> n;
    int x;
    for (int i = 2; i <= n; i++) {
        cin >> x;
        a[i] = x;
        e[x].pb(i);
    }
    dfs(1);
    cout << dp[1] << endl;
}
int main() {
    //freopen("test.in", "r", stdin);
    //freopen("test.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 14336
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)

int main(void){
	// string s;	cin >> s;
	int N; cin >> N;
	int H[N];
	rep(i,N)	cin >> H[i];
	int ans = 1;
	reps(i,N-1)	{
		rep(j,i)	{
			if (H[j] > H[i])	break;
			if (j==i-1)	ans++;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();
        long p = sc.NextLong();
        long[] aa = sc.LongArray();

        long odd = 0;
        long even = 0;
        foreach (var a in aa)
        {
            if (a % 2 == 0)
            {
                even++;
            }
            else
            {
                odd++;
            }
        }

        decimal answer = 0;

        for (int e = 0; e <= even; e++)
        {
            for (int o = 0; o <= odd; o++)
            {
                if (o % 2 == p)
                {
                    answer += comb(even, e) * comb(odd, o);
                }
            }
        }

        Console.WriteLine(answer);
    }

    private static long comb(long a, long b)
    {
        long b2 = a - b;
        b = Math.Min(b, b2);

        if (b == 0)
        {
            return 1;
        }

        long answer = 1;

        List<long> divList = new List<long>();
        for (int i = 1; i <= b; i++)
        {
            divList.Add(i);
        }

        for (int i = 0; i < b; i++)
        {
            answer *= (a - i);
            List<long> removeList = new List<long>();
            foreach (var d in divList)
            {
                if (answer % d == 0)
                {
                    answer /= d;
                    removeList.Add(d);
                }
            }
            foreach (var r in removeList)
            {
                divList.Remove(r);
            }
        }
        foreach (var d in divList)
        {
            answer /= d;
        }
        return answer;
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 28676
#include <iostream>
#include <cstring>

using namespace std;

typedef long long ll;
#define x first
#define y second
#define mp make_pair

int h, w, k, br[15], cur[15];
string s[15];

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> h >> w >> k;
for(int i = 0 ; i < h ; ++i){
	cin >> s[i];
}
int sol = h * w;
for(int i = 0 ; i < (1 << (h - 1)) ; ++i){
	bool p = 1;
	int val = __builtin_popcount(i);
	memset(br, 0, sizeof(br));
	for(int j = 0 ; j < w ; ++j){
		int sad = 0;
		memset(cur, 0, sizeof(cur));
		for(int v = 0 ; v < h ; ++v){
			cur[sad] += (s[v][j] - '0');
			if(i & (1 << v)){
				sad++;
			}
		}
		bool da = 0;
		for(int v = 0 ; v <= sad ; ++v){
			if(br[v] + cur[v] > k){
				da = 1;
			}
			if(cur[v] > k){
				p = 0;
				break;
			}
		}
		if(!p)
			break;
		if(da){
			val++;
			memset(br, 0, sizeof(br));
		}
		for(int v = 0 ; v <= sad ; ++v){
			br[v] += cur[v];
		}
	}
	if(p){
		sol = min(sol, val);
	}
}
cout << sol << endl;

return 0;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
template <typename T> using posteriority_queue = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
// const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
template <typename T> void unique(vector<T> &a) { a.erase(unique(ALL(a)), a.end()); }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n, m; cin >> n >> m;
  vector<int> d(n); REP(i, n) cin >> d[i];
  vector<int> u(m), v(m), s(n, 0), c(m, -1);
  vector<vector<pair<int, int> > > graph(n);
  queue<int> que;
  REP(i, m) {
    cin >> u[i] >> v[i]; --u[i]; --v[i];
    if (d[u[i]] > d[v[i]]) swap(u[i], v[i]);
    if (d[u[i]] == d[v[i]]) {
      c[i] = d[u[i]];
      if (s[u[i]] != 0) {
        if (s[v[i]] != 0) continue;
        s[v[i]] = (s[u[i]] == -1 ? 1 : -1);
        que.emplace(v[i]);
      } else if (s[v[i]] != 0) {
        s[u[i]] = (s[v[i]] == -1 ? 1 : -1);
        que.emplace(u[i]);
      } else {
        s[u[i]] = -1;
        s[v[i]] = 1;
        que.emplace(u[i]);
        que.emplace(v[i]);
      }
    } else {
      graph[u[i]].emplace_back(v[i], i);
    }
  }
  while (!que.empty()) {
    int ver = que.front(); que.pop();
    for (auto pr : graph[ver]) {
      int e, idx; tie(e, idx) = pr;
      if (s[e] == 0) {
        s[e] = s[ver];
        c[idx] = d[e] - d[ver];
        que.emplace(e);
      }
    }
  }
  REP(i, n) {
    if (s[i] == 0) {
      cout << "-1\n";
      return 0;
    }
  }
  REP(i, n) cout << (s[i] == -1 ? 'B' : 'W');
  cout << '\n';
  REP(i, m) cout << (c[i] == -1 ? 1000000000 : c[i]) << '\n';
  return 0;
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;
  
  if(N%2==1){
    cout << "No" << endl;
    return 0;
  }
  
  for(int i=0;i<N/2;i++){
    if(S[i]!=S[i+N/2]){
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os << *i << (i==end(v)-1 ? "" : "\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is >> *i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    string s;
    cin>>s;
    cout<<(s[0]==s[2]?"Yes":"No")<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
#define INF (1 << 30)
using namespace std;
 
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a == 7 && b == 5 && c == 5){
        cout << "YES" << endl;
    }else if(a == 5 && b == 7 && c == 5){
        cout << "YES" << endl;
    }else if(a == 5 && b == 5 && c == 7){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

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

int main(){
  double x, s, d;
  double pai = 3.141592653589;

  cin >> x;

  s = pai * x * x;
  d = 2 * pai * x;
  printf("%.5lf %.5lf\n", s, d);

  return 0;
}

Measured memory_bytes: 1240
open System
open System.Text;
open System.Linq
open System.Collections.Generic

[<EntryPoint>]
let main _ = 
    let ab = Console.ReadLine().Split() |> Array.map int
    Console.WriteLine(if (ab.[0] * ab.[1]) % 2 = 0 then  "Even" else "Odd")
    0


Measured memory_bytes: 27928
#include <bits/stdc++.h>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
typedef pair<int,int>P;
bool used[21];
vector<P>v[21];
int ans;
int dfs(int a){
  int res=0;
  used[a]=1;
  r(i,v[a].size())
    if(!used[v[a][i].first]&&v[v[a][i].first].size()!=1){
      res+=v[a][i].second;
      res+=dfs(v[a][i].first);
    }
  return res;
}
void dfs2(int a,int b){
  ans=max(ans,b);
  used[a]=1;
  r(i,v[a].size())
    if(!used[v[a][i].first]&&v[v[a][i].first].size()!=1)
      dfs2(v[a][i].first,b+v[a][i].second);
}
main(){
  int n;
  while(cin>>n,n){
    r(i,21)used[i]=0,v[i].clear();
    int x,y,z,a=0;
    r(i,n-1){
      cin>>x>>y>>z;a+=z;
      v[--x].push_back(P(--y,z));
      v[y].push_back(P(x,z));
    }
    int p=dfs(0);ans=0;
    r(i,21)used[i]=0;
    dfs2(0,0);
    cout<<(p-ans)*2+ans<<endl;
  }
}

Measured memory_bytes: 2972
#include<stdio.h>
int main(void){

	int r,c,i=0,j=0,k=0,l=0,A[101][101],n[100],m[100],p=0;
	
	scanf("%d %d",&r,&c);
	
		for(i=1;i<=r;i++){
			for(j=1;j<=c;j++){
				scanf("%d",&A[i][j]);
				printf("%d ",A[i][j]);
				n[i] += A[i][j];
			}
			printf("%d\n",n[i]);
		}
	
	for(l=1;l<=c;l++){
		for(k=1;k<=r;k++){
		m[l] += A[k][l];
		}
		printf("%d ",m[l]);
	}
	for(l=1;l<=c;l++){
		p += m[l];
	}
	printf("%d\n",p);
	
	return 0;
}



Measured memory_bytes: 2028
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  int n;
  cin >> n;
  vector<string> data(n);
  rep(i,n) cin >> data.at(i);
  sort(data.begin(),data.end());
  vector<long> cnt(5,0);
  rep(i,n){
    if(data.at(i).at(0) == 'M') cnt.at(0)++;
    if(data.at(i).at(0) == 'A') cnt.at(1)++;
    if(data.at(i).at(0) == 'R') cnt.at(2)++;
    if(data.at(i).at(0) == 'C') cnt.at(3)++;
    if(data.at(i).at(0) == 'H') cnt.at(4)++;
  }
  long ans = 0;
  rep(i,5){
    rep(j,5){
      if(j <= i) continue;
      rep(k,5){
        if(k <= j) continue;
        ans += cnt.at(i)*cnt.at(j)*cnt.at(k);
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 6144
data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(input())
for i in range(n):
    b,f,r,v = [int(i) for i in input().split()]
    data[b-1][f-1][r-1] += v
for b in range(4):
    for f in range(3):
        for r in range(10):
            print("",data[b][f][r],end="")
        print() 
    if b < 3:
        print("#"*20)

Measured memory_bytes: 7700
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<memory.h>
#include<vector>
#include<functional>
using namespace std;

int main()
{
	int dp[2001];
	int n, k, a, b;
	vector<int> c[11], g[11];
	memset(dp, 0, sizeof(dp));
	cin >> n >> k;
	for (int i = 0; i<n; i++){
		cin >> a >> b; b--;
		g[b].push_back(a);
	}
	for (int i = 0; i<10; i++){
		sort(g[i].begin(), g[i].end(), greater<int>());
		if (!g[i].empty()){
			c[i].push_back(g[i].front());
		}
		else{
			c[i].push_back(0);
		}
		for (int i2 = 1; i2<g[i].size(); i2++){
			c[i].push_back(c[i][i2 - 1] + g[i][i2] + ((i2 + 1) - 1) * 2);
		}
	}
	for (int j = 0; j<10; j++){
		for (int i = k; i >= 0; i--){
			for (int i2 = 0; (i2<c[j].size()) && (i - i2 - 1 >= 0); i2++){
				dp[i] = max(dp[i], dp[i - i2 - 1] + c[j][i2]);
			}
		}
	}
	cout << dp[k] << endl;
}

Measured memory_bytes: 3180
# coding: utf-8
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(A[K-1])

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

using namespace std;

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

	string s;
	cin >> s;
	set<int> l, r;
	int n = s.size();
	vector<int> pos(n), ans(n);
	int j;
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'L') {
			pos[i] = j;
		}
		else {
			j = i;
		}
	}
	for (int i = n - 1; i >= 0; --i) {
		if (s[i] == 'L') {
			j = i;
		}
		else {
			pos[i] = j;
		}
	}
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'L') {
			++ans[pos[i] + (i - pos[i]) % 2];
		}
		else {
			++ans[pos[i] - (pos[i] - i) % 2];
		}
	}
	for (int i = 0; i < n; ++i) {
		if (i) {
			cout << ' ';
		}
		cout << ans[i];
	}

	return 0;
}


Measured memory_bytes: 1488
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(int (i)=(n)-1; (i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int N, K; cin >> N >> K;
	vector<double>vec(N);
	rep(i, N) {
		double a; cin >> a;
		double x = (a + 1)/ 2;
		vec[i] = x;
	}
	REP(i, 1, N) {
		vec[i] += vec[i - 1];
	}
	double ans = vec[K - 1];
	REP(i, K, N) {
		ans = max(ans, vec[i] - vec[i - K]);
	}
	cout << ans << "\n";

	return 0;
}

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

#define rep(i, a) for (int i = 0; i < (a); i++ )

 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

char next_char(char now, char pre, string &s, int k) {
    if (s[k]=='o') {
        if (now=='S') return pre;
        else if (pre=='W') return 'S';
        else return 'W';
    }
    else {
        if (now=='W') return pre;
        else if (pre=='W') return 'S';
        else return 'W';
    }
}

int main(){
    int N;
    cin >> N;
    string s;
    cin >> s;
    
    map<int,string> mp;
    mp[0] = "S";
    mp[1] = "W";

    rep(i,2) rep(j,2) {
        string ans = mp[i] + mp[j];
        rep(k,N-1) {
            char now = ans[k+1];
            char pre = ans[k];
            char next = next_char(now,pre,s,k+1);
            if (k==N-2) {
                if (next==ans[0]) {
                    pre = now;
                    now = ans[0];
                    next = next_char(now,pre,s,0);
                    if (next==ans[1]) {
                        cout << ans << endl;

                        return 0;
                    }
                }
            }
            else {
                ans += next;
            }
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3876
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		final Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		
		long[] As = new long[N];
		long[] Bs = new long[N];
		for(int i = 0; i < N; i++){
			As[i] = sc.nextLong();
			Bs[i] = sc.nextLong();
		}
		
		long added = 0;
		for(int i = N - 1; i >= 0; i--){
			final long A = As[i] + added;
			final long B = Bs[i];
			
			//System.out.println(added + " " + A + " " + B);
			
			added += (B - (A % B)) % B;
		}
		
		System.out.println(added);
	}
	
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}
 
		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		
		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 29880
#include <stdio.h>

int main(){
   int a, b;
   scanf("%d %d", &a, &b);
   if( a < b ){
      printf("a < b\n");
   }else if(a > b){
      printf("a > b\n");
   }else{
      printf("a == b\n");
   }

   return 0;

}



Measured memory_bytes: 2052
from itertools import groupby
from math import ceil

s = input()

res = []
a = [sum(1 for _ in it) for k, it in groupby(s)]
it = iter(a)
for r, l in zip(it, it):
    res.extend([0]*r)
    res[-1] += ceil(r/2) + l//2

    res.extend([0]*l)
    res[-l] += r//2 + ceil(l/2)

print(' '.join(map(str, res)))


Measured memory_bytes: 11388
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  int m=7;
  cin >> n;
  if(n%10==0 || n%10==2 || n%10==4 || n%10==5 || n%10==6 || n%10==8){
    cout << -1 << endl;
    return 0;
  }
  vector<bool>a(n);
  for (int i=0;i<100000000;i++) { 
    if(m%n==0){
      cout << i+1 << endl;
      return 0;
    }
    if(a.at(m%n-1)==true){
      cout << -1 << endl;
      return 0;
    }
    a.at(m%n-1)=true;
    m=(m*10+7)%n;
  }
  cout << -1 << endl;
}

Measured memory_bytes: 3592
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
// dfmt on

void main()
{
    long K, X;
    scan(K, X);
    write(X - K + 1);
    foreach (i; 1 .. K * 2 - 1)
    {
        write(" ", X - K + i + 1);
    }
    writeln();
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define INFLL (1LL << 60)
#define INF (1 << 30)
using namespace std;
typedef long long ll;

template<class T> inline void chmin(T& a, T b) { if (a > b) a = b; }
template<class T> inline void chmax(T& a, T b) { if (a < b) a = b; }

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

int main()
{
	int N; cin >> N;
	ll ans = 1;
	rep(i, N) {
		ll T; cin >> T;
		ans = lcm(ans, T);
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  int i;
  for (i = 0; i < n; i++) {
    cin >> h[i];
  }
  for (i = n - 2; i >= 0; i--) {
    if (h[i] > h[i + 1]) {
      h[i]--;
    }
    if (h[i] > h[i + 1]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
main(){
	int a,b;
	int answer;
	char op;

	while(1){
		scanf("%d %c %d",&a,&op,&b);
	if(op == '+'){
		answer = a + b;
		printf("%d\n",answer);
	}
	else if (op == '-'){
		answer = a - b;
		printf("%d\n",answer);
	}
	else if (op == '*'){
		answer = a * b;
		printf("%d\n",answer);
	}
	else if (op == '/'){
		answer = a / b;
		printf("%d\n",answer);
	}
	else break;
	}

	return 0;
}

Measured memory_bytes: 1028
def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

def primeFactrization(n):
    i = 2
    table = []
    while i*i <= n:
        if  n % i ==0:
            table.append(i)
            while n % i == 0:
                n /= i
        i += 1
    if n > 1:
        table.append(n)
    return table

a,b = map(int, input().split())
c = gcd(a,b)
d = primeFactrization(c)
print(len(d)+1)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <regex>

using namespace std;

int main()
{
    std::string s, t;
    std::cin >> s;
    std::cin >> t;
    std::regex re(s + "[a-z]");

    if(std::regex_match(t, re))
    {
        std::cout << "Yes" << std::endl;
    } else
    {
        std::cout << "No" << std::endl;
    }
    
    return EXIT_SUCCESS;
} 

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

template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    os << "{";
    for (int i = 0; i < (int)vec.size(); ++i) {
        os << vec[i] << (i + 1 == (int)vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
void dump_func() {
    cerr << "\n";
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail) {
    cerr << head;
    if (sizeof...(Tail) == 0) {
        cerr << " ";
    } else {
        cerr << ", ";
    }
    dump_func(std::move(tail)...);
}
#define dump(...) cerr << "[" << to_string(__LINE__) << "]"        \
                       << "    " << string(#__VA_ARGS__) << " = ", \
                  dump_func(__VA_ARGS__)

using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<double>;
using VVI = vector<VI>;
using VVL = vector<VL>;
using PI = pair<int, int>;
using PL = pair<ll, ll>;
using VPI = vector<PI>;
using VPL = vector<PL>;
using VS = vector<string>;

#define ln '\n'
#define REP(t, n) for (int t = 0; t < (n); ++t)
#define FOR(t, a, b) for (int t = (a); t <= (b); ++t)
#define FORR(t, a, b) for (int t = (a); t >= (b); --t)
#define ALL(c) (c).begin(), (c).end()
#define CAUTO const auto&

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

    int n, a, b;
    cin >> n >> a >> b;
    cout << (n * a > b ? b : n * a) << ln;

    return 0;
}


Measured memory_bytes: 256
import math

def read():
    N, K = list(map(int, input().strip().split()))
    A = list(map(int, input().strip().split()))
    F = list(map(int, input().strip().split()))
    return N, K, A, F

def solve(N, K, A, F):
    A = list(sorted(A))
    F = list(reversed(sorted(F)))
    mul = [A[i] * F[i] for i in range(N)]
    smul = list(sorted(mul)) + [9999999999]
    
    def f(x):
        k = 0
        for i in range(N):
            if x < mul[i]:
                k += math.ceil((mul[i] - x) / F[i])
        return k
    
    lb = 0
    ub = 10 ** 12
    while lb < ub:
        x = lb + (ub - lb) // 2
        if f(x) > K:
            # K回の修行では足りない
            lb = x+1
        else:
            ub = x
    return lb

if __name__ == '__main__':
    inputs = read()
    print("%d" % solve(*inputs))


Measured memory_bytes: 122572
# r = gets.to_i
# s = gets.chomp
s,t = gets.split.map(&:to_s)
a,b = gets.split.map(&:to_i)
u = gets.chomp
if u == s
    a -= 1
else
    b -= 1
end
# s = gets.chomp.chars.uniq
# puts gets.chomp.chars.uniq.size != 1 ? "Yes" : "No"
puts "#{a} #{b}"

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
using namespace std;
int main(){
    int a,ans=10,N;
    cin >> N;
    string s[N+5];
    for(int i=0;i<N;i++){
        cin >> s[i];
    }


    for(int i=0;i<N-1;i++){
        a = s[i].size();
        if(s[i][a-1]==s[i+1][0]){
            ans = 0;
        }else{
            ans = 1000;
            break;
        }
    }
    
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(i!=j){
                if(s[i]==s[j]){
                ans = 1000;
                }
            }
        }
    }
    
    if(ans == 0){
        cout << "Yes" << endl;
    }else if(ans == 1000){
        cout << "No" << endl;
    }
}

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

int main(){
  int A,B;
  int count=0;
  string a;
  cin>>A>>B;
  for(int i=A;i<B+1;i++){
    a=to_string(i);
    if(a.at(0)==a.at(4)&&a.at(1)==a.at(3)){
      count++;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
import           Control.Applicative
import           Control.Monad
import           Control.Monad.ST
import           Data.Array.MArray
import           Data.Array.ST
import           Data.STRef

print' :: Show a => [a] -> IO ()
print' = putStrLn . unwords . fmap show

selection :: [Int] -> ([Int], Int)
selection xs =
    runST $ do
        let n = length xs
        countRef <- newSTRef 0

        minjRef <- newSTRef 0
        a <- newListArray (0, length xs - 1) xs :: ST s (STUArray s Int Int)

        forM_ [0 .. n - 1] $ \i -> do
            writeSTRef minjRef i
            forM_ [i .. n - 1] $ \j -> do
                p <- readArray a j
                q <- readArray a =<< readSTRef minjRef
                when (p < q) $ writeSTRef minjRef j
            k <- readSTRef minjRef
            temp1 <- readArray a i
            temp2 <- readArray a k
            when (temp1 /= temp2) $ do
                writeArray a i temp2
                writeArray a k temp1
                modifySTRef' countRef (+ 1)

        c <- readSTRef countRef
        es <- getElems a
        return (es, c)

main :: IO ()
main = do
    getLine
    xs <- fmap read . words <$> getLine :: IO [Int]
    let (as, b) = selection xs
    print' as
    print b



Measured memory_bytes: 4056
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main(void){
    
    int N, R;
    cin >> N >> R;
    
    if(N >= 10){
        cout << R << endl;
    }
    else{
        cout << R + (100 *(10 - N)) << endl;
    }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<math.h>
//#include<vector>
//#include <iostream>
//#include <algorithm>
#include <limits>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
int max(int a,int b){
	if(a>b){
		return a;

	}else{
		return b;
	}
}
void printdp(ll **dp,int N,ll Vmax){
	rep(i,N+1){
		for(ll j=0;j<Vmax+1;j++){
			if(dp[i][j]==llMAX)continue;
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}
	cout << endl;
	return;
}
int main(void){
	int N;
	int m=0;
	ll W;
	int i,k;
	ll j;
	cin >> N>>W;
	int v[N+1];
	long long Vmax=0;
	ll w[N+1];
	rep(i,N){
		cin >> w[i+1]>>v[i+1];
		Vmax += v[i+1];
	}
	ll **dp = (ll**)malloc(sizeof(ll *)*(N+1));
	rep(i,N+1){
		dp[i]=(ll *)malloc(sizeof(ll)*(Vmax+1));
		if (dp[i] == NULL) {
        	printf("Memory cannot be allocated.");
    	}
	}
	
	rep(i,Vmax+1){
		dp[0][i]=llMAX;
	}
	rep(i,N+1){
		dp[i][0] = 0;
	}
	//cout << "fsdfssdf";
	for(i=1;i<N+1;i++){
		for(j=1;j<Vmax+1;j++){
			//printdp(dp,N,Vmax);
			if(v[i]>j){
				dp[i][j]=(ll)abs(dp[i-1][j]);
				continue;
			}
			if(W<(ll)abs(dp[i-1][j-v[i]]+w[i])){
				dp[i][j]=(ll)abs(dp[i-1][j]);
			}else{
				dp[i][j]=min(dp[i-1][j],dp[i-1][j-v[i]]+w[i]);
				m = max(j,m);
			}
		}
	}
	cout <<m;
	rep(i,N+1)free(dp[i]);
	free(dp);
	return 0;
}

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

#ifdef DEBUG
#define NDEBUG
#include "cout11.h"
#endif
#undef NDEBUG
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))

ll solve(int N) {
    return -1LL;
}

#define xxx "UNRESTORABLE"

string solve(string& s, string& t) {
    int ls = s.size(), lt = t.size();
    if (ls < lt) return xxx;

    set<string> cand;
    for (int i=0; i<ls-lt+1; ++i) {
        bool matched = true;
        rep(j, lt) {
            if (s[i+j] == '?') continue;
            if (s[i+j] == t[j]) continue;
            matched = false; break;
        }
        if (matched) {
            vector<char> ans(ls);
            rep(i, ls) ans[i] = (s[i] == '?')? 'a' : s[i];
            rep(j, lt) ans[i+j] = t[j];
            cand.insert(string(ALL(ans)));
        }
    }
    if (cand.size() == 0) return xxx;
    return *cand.begin();
}
int main() {
    string s, t;
    cin >> s;
    cin >> t;
    cout << solve(s, t) << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;
ll N,M;
int main(){
    cin>>N>>M;
    ll ans=0;
    ans+=max(4-N,0ll)*100000;
    ans+=max(4-M,0ll)*100000;
    if(N==1 && M==1)ans+=400000;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#pragma region header
#define _GLIBCXX_DEBUG 
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
using namespace std;
#define int long long
using ll = long long;
/* ----------------よく使う数字や配列----------------- */
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
constexpr ll mod = 1e9 + 7;
constexpr ll inf = INT32_MAX / 2;
constexpr ll INF = LLONG_MAX / 2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */
/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
bool isprime(ll a)//素数判定、primeならtrue,違うならfalse
{
    if (a < 2) return false;
    else if (a == 2) return true;
    else if (a % 2 == 0) return false;
    double m = sqrt(a);
    for (int i = 3; i <= m; i += 2)
    {
        if (a % i == 0)
        {
            return false;
        }
    }
    // 素数である
    return true;
}
ll keta(ll n) {        //桁数を求める
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    int N,K;
    cin>>N>>K;
    int ans=0;
    
    for(int i=0;;i++){
        if(pow(K,i)>N){
            ans=i;
            break;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4020