akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card {
	char suit;
	int value;
};

struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void merge(struct Card A[], int n, int left, int mid, int right) {
	int i, j, k;
	int n1 =  mid - left;
	int n2 =  right - mid;
	for(int i = 0; i < n1; i++) L[i] = A[left + i];
	for(int i = 0; i < n2; i++) R[i] = A[mid + i];
    L[n1].value = SENTINEL;
    R[n2].value = SENTINEL;
    i = j = 0;
    for(k = left; k < right; k++) {
    	if(L[i].value <= R[j].value) {
	    	A[k] = L[i++];
	    } else{
    		A[k] = R[j++];
    	}
    } 		
}

void mergeSort(struct Card A[], int n, int left, int right) {
	int mid;
	if( left + 1 < right) {
		mid = (left + right) / 2;
		mergeSort(A, n, left, mid);
		mergeSort(A, n, mid, right);
		merge(A, n, left, mid, right);
	}	
}

int partition(struct Card A[], int n, int p, int r) {
    int i, j;
	struct Card t, x;
	x = A[r];
	i = p - 1;
	for(j = p; j < r ;j++) {
		if(A[j].value <= x.value) {
			i++;
			t = A[i]; A[i] = A[j]; A[j] = t;
		}
	}
	t = A[i + 1]; A[i + 1] = A[r]; A[r] = t;	
    return i+1;
}

void quickSort(struct Card A[], int n, int p, int r) {
	int q;
	if(p < r) {
		q = partition(A, n, p, r);
		quickSort(A, n, p, q - 1);
		quickSort(A, n, q + 1, r);
	}
}

int main() {
	int n, i, v;
	struct Card A[MAX], B[MAX];
	char S[10];
	int stable = 1;
	
	scanf("%d", &n);
	
	for(i = 0; i < n; i++) {
		scanf("%s %d", S, &v);
		A[i].suit = B[i].suit = S[0];
	    A[i].value = B[i].value = v;		
	}
	
	mergeSort(A, n, 0, n);
	quickSort(B, n, 0, n-1);
	
	for(i = 0; i < n; i++) {
		if(A[i].suit != B[i] .suit) stable = 0;
	} 
	
	if(stable == 1) printf("Stable\n");
	else printf("Not stable\n");
	for(int i = 0; i < n; i++ ) {
		printf("%c %d\n", B[i].suit, B[i].value);
	}
	
	return 0;	
	
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using vec_b = vector<bool>;
using vec_str = vector<string>;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back
#define mp make_pair

int main()
{
    ll A;
    string B;
    cin >> A >> B;
    ll C = (B[0]-'0')*100 + (B[2]-'0')*10 + (B[3]-'0');
    _PR(A*C/100);

    return 0;
}

/*



*/

Measured memory_bytes: 3624
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	x := 0
	if a > b {
		x += a
		a--
	} else {
		x += b
		b--
	}
	if a > b {
		x += a
		a--
	} else {
		x += b
		b--
	}
	fmt.Print(x)
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void){
    int days;
    int sum;
    int fee1, fee2;
    int k;

    scanf("%d\n%d\n%d\n%d", &days, &k, &fee1, &fee2);

    if (days <= k)
    sum = fee1 * days;
    else
    sum = fee1 * k + fee2 * (days - k);

    printf("%d", sum);

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>
#include <queue>
#include <bitset>
#include <cassert>

using namespace std;


int main() {

    int x;
    cin >> x;
    if (x == 0) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;

}

Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <iomanip>
#include <cassert>
#include <complex>
 
using namespace std;
 
typedef long long ll;
 
const int Inf = 1e9;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  int k;
  cin >> k;
  vector <vector <pair <int, int>>> g(k);
  for (int i = 0; i < k; ++i) {
    g[i].push_back({(10 * i) % k, 0});
    g[i].push_back({(i + 1) % k, 1});
  }
  vector <int> d(k, Inf);
  d[0] = 0;
  deque <int> q;
  q.push_back(0);
  while (!q.empty()) {
    int u = q.front();
    q.pop_front();
    for (auto pr : g[u]) {
      int v = pr.first;
      int w = pr.second;
      if (d[v] > d[u] + w) {
        d[v] = d[u] + w;
        if (w == 0) q.push_front(v);
        else q.push_back(v);
      }
    }
  }
  int ans = Inf;
  for (int i = 1; i < k; ++i) {
    for (auto pr : g[i]) {
      int v = pr.first;
      int w = pr.second;
      if (v == 0) ans = min(ans, d[i] + w);
    }
  }
  cout << ans << '\n';
}


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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
  int64_t n;
  cin >> n;

  vector<int64_t> a(n);
  for (auto&& aa : a) {
    cin >> aa;
  }

  vector<array<int64_t, 2>> dp(n + 4);
  for (auto i : irange(0L, n)) {
    if (i % 2 == 0) {
      dp[i + 4][0] = max({dp[i + 2][0] + a[i]});
      dp[i + 4][1] = max({dp[i + 3][0], dp[i + 2][0], dp[i + 2][1] + a[i],
                          dp[i + 1][0] + a[i], dp[i][0] + a[i]});
    } else {
      dp[i + 4][0] =
          max({dp[i + 3][0], dp[i + 2][0] + a[i], dp[i + 1][0] + a[i]});
      dp[i + 4][1] = max({dp[i + 3][1], dp[i + 2][0], dp[i + 2][1] + a[i],
                          dp[i + 1][0], dp[i + 1][1] + a[i], dp[i][0] + a[i]});
    }
  }

  cout << (n % 2 == 0 ? dp.back()[0] : dp.back()[1]) << endl;
}

Measured memory_bytes: 7944
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int A = ni();
        int B = ni();
        if(A>=13) out.println(B);
        else if(A>=6) out.println(B/2);
        else out.println(0);
    }

    final int mod = 1000000007;
    final BigInteger MOD = BigInteger.valueOf(mod);
    int upperBound(ArrayList<Long> list, Long target){
        int i = Collections.binarySearch(list, target, new UpperBoundComparator<Long>());
        return ~i;
    }
    class UpperBoundComparator<T extends Comparable<? super T>> implements Comparator<T>{
        public int compare(T x, T y){
            return (x.compareTo(y) > 0) ? 1 : -1;
        }
    }
    int lowerBound(ArrayList<Long> list, Long target){
        int i = Collections.binarySearch(list, target, new LowerBoundComparator<Long>());
        return ~i;
    }
    class LowerBoundComparator<T extends Comparable<? super T>> implements Comparator<T>{
        public int compare(T x, T y){
            return (x.compareTo(y) >= 0) ? 1 : -1;
        }
    }
    int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    }
    int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

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

int N;
map<int, int> c;

int main() {
  scanf("%d", &N);
  for(int i = 0; i < N; ++i) {
    int a; scanf("%d", &a); ++c[a];
  }
  int a = c.begin()->first, n = c.begin()->second;
  if(c.size() == 1) {
    printf("%s\n",
      a == N - 1 || a <= N / 2 ? "Yes" : "No");
  } else {
    auto it = c.begin(); ++it;
    if(c.size() >= 3 || it->first != a + 1) {
      printf("No\n");
    } else {
      int k = (N - n) / 2;
      int b = a + 1 - n;
      printf("%s\n",
        k > 0 && b > 0 && b <= k ? "Yes" : "No");
    }
  }
  return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    VI x(n), y(n), h(n);
    REP(i,n){
        cin >> x[i] >> y[i] >> h[i];
    }

    int s = 0;
    REP(i,n) if (h[i] != 0) s = i;

    FOR(a,0,100) FOR(b,0,100){
        int p = h[s] + abs(x[s] - a) + abs(y[s] - b);
        bool ok = true;
        REP(i,n){
            if (h[i] != max(0, p - abs(x[i] - a) - abs(y[i] - b))) ok = false;
        }
        if (ok){
            cout << a << " " << b << " " << p << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void main_sub(void);
int main(int argc, char* argv[]) {
    main_sub();
    return 0;
}
// int を int64_t にする
// g++ に -DUSE_STRICT_INT をつけるか、
// 下のコメントアウトを外すと無効化
// #define USE_STRICT_INT
using i64 = int64_t;
#ifndef USE_STRICT_INT
#define int i64
#endif
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF = (1 << 30);
constexpr i64 INFL = (1LL << 62);
constexpr i64 MOD = 1000000007;

void main_sub(void) {
    int n;
    cin >> n;
    vector<int> s(n);
    rep(i, n) cin >> s[i];
    sort(all(s));
    int q;
    cin >> q;
    int cnt = 0;
    rep(i, q) {
        int t;
        cin >> t;
        if (binary_search(all(s), t)) ++cnt;
    }
    cout << cnt << endl;

    return;
}


Measured memory_bytes: 3520
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <cstdlib>
using namespace std;

#define print_container(ct,sep) cout<<*ct.begin();for(auto it=ct.begin()+1; it != ct.end(); it++) cout << sep << *it; cout << endl;
#define MOD (pow(10, 9) + 7)

#define endl '\n'
#define decimal_places(x, d) int(round(x * pow(10, d))) / double(pow(10, d))

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


    string s;
    cin >> s;

    int m = 1000;
    int t;
    for (int i=0; i < s.length()-2; i++) {
        t = stoi(s.substr(i, 3));
        m = min(m, abs(753 - t));
    }
    cout <<  m << endl;
}



Measured memory_bytes: 256
(defun main ()
  (let ((n (read))
        (m (read)))
    (let ((a (make-array n)) 
          (b (make-array n))
          (c (make-array m)) 
          (d (make-array m)))
      (loop for i from 0 to (- n 1) do
            (setf (aref a i) (read))
            (setf (aref b i) (read)))
      (loop for j from 0 to (- m 1) do
            (setf (aref c j) (read))
            (setf (aref d j) (read)))
      (loop for i from 0 to (- n 1) do
            (let ((min 999999999)
                  (index 0))
              (loop for j from 0 to (- m 1) do
                    (let ((distance 
                            (+ (abs (- (aref a i) (aref c j)))
                               (abs (- (aref b i) (aref d j))))))
                      (if (> min distance)
                        (progn 
                          (setf min distance)
                          (setf index j)))))
              (print (+ index 1)))))))
(main)


Measured memory_bytes: 10976
#include <stdio.h>

int main(void)
{
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  
  if (a < b && b < c){
    printf("Yes");
  }
  else {
    printf("No");
  }
  printf("\n");
  return (0);
}

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

#define f first
#define s second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
                                           	
const int N = 5e5 + 123, M = 3e3 + 123, inf = 1e9 + 123, mod = 1e9 + 7;
const ll INF = 1e18;

ll dp[3][M][M];

int main() {
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	int a[n + 1];
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	for (int i = 1; i <= n; i++) {
		for (int l = 1; l + i - 1 <= n; l++) {
			int r = l + i - 1;
			dp[1][l][r] = max(dp[2][l + 1][r] + a[l], dp[2][l][r - 1] + a[r]);
			dp[2][l][r] = min(dp[1][l + 1][r] - a[l], dp[1][l][r - 1] - a[r]);
		}   	
	}
	cout << dp[1][1][n];
	return 0;   	
}                                                         

Measured memory_bytes: 149760
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
#include <string.h>
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;

int main()
{
  fio;
  string s,t;
  cin>>s>>t;
  int c=0;
  int l  = s.size();
  for (int i=0 ; i<l ; i++)
  {
  	if(s[i]!=t[i])
  	{
  		c++;
  	}
  }
  cout<<c<<endl;
  return 0;
}

Measured memory_bytes: 3816
import java.util.Scanner;

public class Main {
	static int intN =0;
	static int sosuCnt =0;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.nextLine();
		//String[] h1 = sc.nextLine().split(" ");

		//int intK = Integer.parseInt(h1[1]);


		int intN = Integer.parseInt(n);
		String[] ans = new String[intN];

		String[] a = sc.nextLine().split(" ");

		int sum=0;

		for (int i = 0;i < intN;i++) {
			ans[Integer.parseInt(a[i])-1]=String.valueOf(i+1) + " ";

		}

		String answer = String.join("", ans);
		/*for (int i = 0;i < intN;i++) {
			answer=answer+ans[i];
		}*/

		System.out.println(answer);


		//int a = Integer.parseInt("");
		//for (int i = 0;i < intN;i++) {
		//sum=sum+i;
	//}

	}
}


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

using namespace std;

typedef long long ll;

int main(){
  ll S,i,j;
  cin >> S;
  ll dp[2222] = {0};
  dp[0] = 1;
  dp[1] = 0;
  dp[2] = 0;
  for(i=3;i<=S-3;i++)
    for(j=0;j<=i-3;j++){
      dp[i] += dp[j];
      if(dp[i] > 1000000007) dp[i] %= 1000000007;
       }
  ll ans = 0;
  for(i=0;i<=S-3;i++)
    ans = (ans + dp[i]) % 1000000007;
  cout << ans << endl;
}

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

using namespace std;


int main(){
  int a, b, x;
  cin >> x >> a >> b;
  int da = abs(x-a);
  int db = abs(x-b);

  if( da < db )
    cout << "A\n";
  else
    cout << "B\n";
  return 0;
}


Measured memory_bytes: 256
// INCLUDES
#include <bits/stdc++.h>
#include<assert.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//DEFINES
#define MAX 1000001
#define pii pair<int, int>
#define c1 __builtin_popcount
#define F first
#define S second
#define all(s) begin(s),end(s)
#define MIN3POS(a, b, c) (a) =< (b) ? ((a) =< (c) ? 1 : 3) : ((b) =< (c) ? 2 : 3)
#define MAX3POS(a,b,c) (a) >= (b) ? ((a) >= (c) ? 1 : 3) : ((b) >= (c) ? 2:3)
#define endl '\n'
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define FOR(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define IOS   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
//NAMESPACES
using namespace __gnu_pbds; 
using namespace std;
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
//HELPERS

vector<int> powers2(32,0);void initialize(){ for(int i=1;i<powers2.size();i++) powers2[i] = powers2[i-1]*2;}
int32_t main()
{
IOS
string s;
cin>>s;
int cnt = 0,ans =0 ;
FOR(i,0,s.size()) {
    if(s[i] == 'W') ans+=i-cnt,cnt++;
}
cout<<ans;
return 0;
}
// Use emplace back in place of pushback
// Use tie function , for object destructuring

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007

using namespace std;
 
typedef long long int ll;

const ll INF=(ll)1e18;

#define MAX 99999

int s[MAX+3];

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

    REP(i,MAX+3)s[i]=0;

    REP(i,N){
        int a;
        cin >> a;


        s[a]++;
        s[a+1]++;
        s[a+2]++;

    }

    int ans = 0;

    REP(i,MAX+3)ans = max(ans, s[i]);

    cout << ans << endl;
}

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

const int MAXN=110;
int pp[MAXN]={0};
int main(){
	int n;
	while(cin>>n){
		for(int i=0;i<n;i++) cin>>pp[i];
		int t=0;
		for(int i=0;i<n-1;i++){
			int res=i;
			for(int j=i+1;j<n;j++){
				if(pp[res]>pp[j]) res=j;
			}
			if(res!=i){
				int temp=pp[res];
				pp[res]=pp[i];
				pp[i]=temp;
				t++;
			}		
		}				
		
		for(int i=0;i<n;i++){
			if(i<n-1) cout<<pp[i]<<" ";
			else cout<<pp[i]<<endl;
		}
		cout<<t<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define in(x, S) (S & (1 << (x - 1)))
using namespace std;

const int MAXN = 15 + 10, MAXSTATUS = (1 << 15) + 10;

int n, m, e[MAXN][MAXN], g[MAXSTATUS], f[MAXN][MAXSTATUS], num;

int main() {
    scanf("%d %d", &n, &m);
    for (int i = 1, u, v, w; i <= m; ++i) {
        scanf("%d %d %d", &u, &v, &w), num += w;
        e[u][v] = e[v][u] = w;
    } 
    int MAXS = 1 << n;
    for (int S = 0; S < MAXS; ++S) {
        for (int i = 1; i <= n; ++i) {
            for (int j = i + 1; j <= n; ++j) {
                if (in(i, S) && in(j, S) && e[i][j]) g[S] += e[i][j];
            }
        }
    }
    memset(f, -1, sizeof f);
    f[1][1] = 0;
    for (int S = 1; S < MAXS; ++S) {
        for (int i = 1; i <= n; ++i) if (in(i, S) && f[i][S] != -1) {
            for (int j = 1; j <= n; ++j) {
                if (!in(j, S) && e[i][j]) {
                    f[j][S | (1 << (j - 1))] = max(f[j][S | (1 << (j - 1))], f[i][S] + e[i][j]);
                }
            }
            for (int tmp = (MAXS - 1) ^ S, T = tmp; T; T = (T - 1) & tmp) {
                f[i][S | T] = max(f[i][S | T], f[i][S] + g[T | (1 << (i - 1))]);
            }
        }
    }
    printf("%d\n", num - f[n][MAXS - 1]);
    return 0;
}

Measured memory_bytes: 3584
N, T = list(map(int, input().split()))
c_min = 1001
for i in range(N):
    cost, time = list(map(int, input().split()))
    if time <= T:
        c_min = min(c_min, cost)
if c_min == 1001:
    print("TLE")
else:
    print(c_min)


Measured memory_bytes: 2940
N=int(input())
C=[0]*N
S=[0]*N
F=[0]*N

def solve(n):
    ans=0
    for i in range(n,N):
        if ans < S[i]:
            ans = S[i]
        a = ans % F[i]
        if a > 0:
            ans += F[i] - a
        ans += C[i]
    return ans

for i in range(1,N):
    C[i],S[i],F[i]=map(int,input().split())
for i in range(1,N+1):
    print(solve(i))


Measured memory_bytes: 40304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    int N,K;
    cin >> N >> K;
    string S;
    cin >> S;
    S[K-1]=S[K-1]+32;
    cout << S;
    


}

/*



 */



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n, x, mn = 1e+16;
  cin >> n;
  for(int i=0;i<5;i++){
    cin >> x;
    mn = min(x, mn);
  }
  cout << n / mn + (n % mn == 0?4:5) << endl;
}

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

int main(){
	int N;
  	cin >> N;
  	int L[N];
  	for(int i = 0; i < N ; i++)cin >> L[i];
	sort(L,L+N,greater<int>());
  	int sum = 0;
	for(int i = 0; i < N ; i++){
    	sum += L[i];
    }
  	int max = L[0];

	if(max < sum-max){
    	cout <<"Yes"<<endl;
    }else{
    	cout <<"No"<<endl;
    }

}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X,i) ((X>>i)&1)
#define REP(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()
#define ina(x,n) rep(x_i,n) cin>>x[x_i]
#define outa(x,n) rep(x_i,n) cout<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<28);
const ll INFL = (1L<<61);

int main() {
  int n; cin >> n;
  vector<double> x(n), y(n);
  rep(i,n) cin >> x[i] >> y[i];
  vl ord(n);
  iota(all(ord), 0);
  double sum = 0, count = 0;
  do {
    REP(i,1,n) {
      sum += sqrt(pow(x[ord[i]]-x[ord[i-1]], 2.0) + pow(y[ord[i]]-y[ord[i-1]], 2.0));
    }
    count++;
  } while (next_permutation(all(ord)));
  printf("%.6lf\n", sum/count);
  return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;


int main(){
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    
    ll l = 0;
    ll r = 200005;
    ll cr = 0;
    ll cl = 0;
    rep(ti, 50) {
        ll x = (l+r)/2;
        ll cnt = 0;
        rep(i, n) {
            auto it = lower_bound(a.begin(), a.end(), x-a[i]);
            cnt += (a.end()-it);
        }
        if (cnt<m) {
            r = x;
            cr = cnt;
        }
        else {
            l = x;
            cl = cnt;
        }
    }
    //cout << l << " " << r << endl;
    
    vector<ll> sum(n+1);
    rep(i, n+1) {
        if (i==0) sum[i] = 0;
        else sum[i] = sum[i-1] + a[n-i];
    }
    
    
    ll ans = 0;
    rep(i, n) {
        ll num = a.end() - lower_bound(a.begin(), a.end(), l-a[i]);
        //cout << "a " << num << endl;
        //cout << "ans " << ans << endl;
        ans += (a[i]*num);
        //cout << "ans " << ans << endl;
        ans += sum[num];
        //cout << "ans " << ans << endl;
    }
    if (cl>m) {
        ans -= l*(cl-m);
    }
    
    
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 140_A
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
	    // Scannerクラスのインスタンスをクローズ
		sc.close();
		// 出力
		System.out.println((int) Math.pow(N,3));
	}
}


Measured memory_bytes: 35568
#include<stdio.h>

int main() {
	int i, r, d, k;
	int res[11];

	scanf("%d%d%d", &r, &d, &i);
	res[0] = i;

	for (k = 0; k < 10; ++k) 
		res[k + 1] = res[k] * r - d;

	for (k = 1; k < 11; ++k)
		printf("%d\n", res[k]);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    int n = s.length();
    int ans = 0;
    for(int i=0;i<n;i++){
    	if(s[i] != t[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3748
//--- pB ---//
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}
class Solution {
	Reader reader;
	PrintWriter out;
	public Solution() {
		reader = new Reader();
		out = new PrintWriter(System.out);
		while (reader.hasNext()) {
			run_case();
		}
		out.flush();
	}

	private void run_case() {
		int n = reader.ni();
		int m = reader.ni();
		long sum = 0;
		for (int i=0; i<m; i++) {
			long t = reader.nl();
			sum += t;
		}
		if (sum > n) {
			out.println("-1");
		} else {
			out.println(n - sum);
		}
		return;
	}
}


class Reader {
	BufferedReader br;
	StringTokenizer st;
	public Reader(){
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public String next() {
		if (st.hasMoreTokens()) return st.nextToken();
		try {
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return st.nextToken();
	}
	public boolean hasNext() {
		try {
			if (!st.hasMoreTokens() && !br.ready()) return false;
			else return true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	public int ni() {return Integer.parseInt(this.next());}
	public long nl() {return Long.parseLong(this.next());}
	public String ns() {return this.next();}
}


Measured memory_bytes: 33988
///                                                     ببِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
#include <bits/stdc++.h>
#define off  exit( 0 )
#define cn   continue
#define rt   return
#define sc   scanf
#define pr   printf
#define pb   push_back
#define pf   push_front
#define p_f  pop_front
#define p_b  pop_back
#define ff   first
#define ss   second
#define vec  vector
#define gcd  __gcd
#define pi   acos( -1 )
#define ll   long long
#define ld   long double
#define N    300256
#define M    1000000007
#define I    1000000000000000000
#define pdd  pair < ld, ld >
#define pll  pair < ll, ll >
#define pii  pair < int, int >
#define rep( a, b, c, d )  for( int a = b; a <= c; a += d )
#define rvv( a, b, c, d )  for( int a = b; a >= c; a -= d )
#define en                 printf( "\n" )
#define sqr( a )           a * a
#define all( c )           c.begin(), c.end()
#define srt( c )           sort( all( c ) )
#define rev( c )           reverse( all( c ) )
#define srtr( c )          sort( c.rbegin(), c.rend() )
#define numcounts          __builtin_popcount
#define mxn( x, y, z )     max( x, min( y, z ) )
#define mnx( x, y, z )     min( x, max( y, z ) )
const int dx[ ] = { 1, -1, 0, 0 };
const int dy[ ] = { 0, 0, -1, 1 };
using namespace std;
ll ttt = 1;
ll n, a[N], ans, cnt;
void solve()
{
    cin >> n;
    for( ll i = 0; i < n; i ++ )
        cin >> a[i];
    for( ll i = 0; i < 61; i ++ )
    {
        cnt = 0;
        for( ll j = 0; j < n; j ++ )
            if( a[j] & (1LL << i) )cnt ++;
        ans += (((cnt*(n - cnt))%M)*((1LL << i)%M))%M;
        ans %= M;

    }
    cout << ans;
}
int main()
{
    //sc( "%I64d", &ttt );
    for( int i = 0; i < ttt; i ++ )
        solve();
}


Measured memory_bytes: 2560
N, K = [int(v) for v in input().split()]
indexs = [i for i in range(N+1)]
mod = int(1e9) + 7

max_n = 0
min_n = 0

for i in range(K):
    max_n += indexs[N-i]
    min_n += indexs[i]

ans = (max_n-min_n+1) % mod
for k in range(K,N+1):
    max_n += indexs[N-k]
    min_n += indexs[k]
    ans = (ans + (max_n-min_n+1)) % mod

print(ans)


Measured memory_bytes: 16900
numbers = []
n = raw_input()
numbers = n.split(" ")
for i in range(3):
	numbers[i] = int(numbers[i])
flag = 1
while flag:
	flag = 0
	for i in range(2, 0, -1):
		if numbers[i] < numbers[i - 1]:
			numbers[i], numbers[i - 1] = numbers[i - 1], numbers[i]
			flag = 1
print ' '.join([str(a) for a in numbers])

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

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N;
  cin >> N;

  for (int i = 0; i < 10; ++i) {
    for (int j = i; j < 10; ++j) {
      if (i * j == N) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define int long long
#define N 100002
using namespace std;
int n,i,a[N],b[N],c[N*2],sum[N],l=0,r,mid,ans;
int read()
{
	char c=getchar();
	int w=0;
	while(c<'0'||c>'9') c=getchar();
	while(c<='9'&&c>='0'){
		w=w*10+c-'0';
		c=getchar();
	}
	return w;
}
int lowbit(int x)
{
	return x&(-x);
}
void add(int x,int y)
{
	for(int i=x;i<=200000;i+=lowbit(i)) c[i]+=y;
}
long long ask(int x)
{
	long long ans=0;
	for(int i=x;i>=1;i-=lowbit(i)) ans+=c[i];
	return ans;
}
bool check(int x)
{
	sum[0]=100000;
	for(int i=1;i<=n;i++){
		if(a[i]>=x) sum[i]=sum[i-1]+1;
		else sum[i]=sum[i-1]-1;
	}
	memset(c,0,sizeof(c));
	long long ans=0;
	for(int i=0;i<=n;i++){
		ans+=ask(sum[i]);
		add(sum[i],1);
	}
	return (ans>=1LL*n*(n+1)/4);
}
signed main()
{
	n=read();
	for(i=1;i<=n;i++){
		a[i]=read();
		r=max(r,a[i]);
	}
	while(l<=r){
		mid=(l+r)/2;
		if(check(mid)) ans=mid,l=mid+1;
		else r=mid-1;
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

#define MAX_N 1001
#define INF 1e9
#define all(x) (x).begin(),(x).end()

struct P{
  int a,b;
  bool operator < (const P &p)const{
    if(b != p.b){
      return b < p.b;
    }else{
      return a < p.a;
    }
  }
};

int N,dp[MAX_N][MAX_N];
vector<P> p;

int main(){
  cin >> N;
  p.resize(N);
  for(int i = 0 ; i < N ; i++){
    cin >> p[i].a >> p[i].b;
  }
  sort(all(p));
  fill(dp[0],dp[0]+MAX_N*MAX_N,INF);
  dp[0][0] = 0;
  for(int i = 0 ; i < N ; i++){
    for(int j = 0 ; j < N ; j++){
      if(dp[i][j] == INF){ continue; }
      dp[i+1][j] = min(dp[i+1][j],dp[i][j]);
      if(dp[i][j] + p[i].a <= p[i].b){
        dp[i+1][j+1] = min(dp[i+1][j+1],dp[i][j]+p[i].a);
      }
    }
  }
  for(int i = N ; i >= 0 ; i--){
    if(dp[N][i] != INF){
      cout << i << endl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 5132
#include <iostream>

bool GoodPrice(int price, int a, int b)
{
    return (price * 8 / 100 == a)
        && (price * 10 / 100 == b);
}

int main()
{
    int a, b;
    std::cin >> a >> b;

    auto price_limit = std::max(a * 100 / 8, b * 100 / 10);
    for (int i = 1; i <= 2 * price_limit; i += 1) {
        if (GoodPrice(i, a, b)) {
            std::cout << i << "\n";
            return 0;
        }
    }

    std::cout << "-1\n";
    return 0;
}


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

#define ll long long
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x << endl
#define N 200005

#define newLine	printf("\n");

#define sll(X) scanf("%lld", &X);
#define pll(X) printf("%lld", X);
#define printAll(X, n)	for(int i=0;i<n;i++)	printf("%lld ", X[i]); newLine;
#define scanAll(X, n)	for(int i=0;i<n;i++)	scanf("%lld", &X[i]);

ll x[100005];
int main() {
	ll n, a, b;
	sll(n); sll(a); sll(b);
	for(int i=0;i<n;i++) {
		sll(x[i]);
	}
	ll last = x[0], cost = 0;
	for(int i=1;i<n;i++) {
		ll curr = min(b, (x[i] - last) * a);
		cost += curr;
		last = x[i];
	}
	pll(cost);
	newLine
	return 0;
}

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

constexpr int MAX=25;
constexpr int NIL=-1;

struct Node{
   int parent;
   int left;
   int right;
};

Node node[MAX];

void preorder(int u){
   if(u==NIL) return;
   cout << " " << u;
   preorder(node[u].left);
   preorder(node[u].right);
}

void inorder(int u){
   if(u==NIL) return;
   inorder(node[u].left);
   cout << " " << u;
   inorder(node[u].right);
}

void postorder(int u){
   if(u==NIL) return;
   postorder(node[u].left);
   postorder(node[u].right);
   cout << " " << u;
}

int main(){
   int n, id, l, r;
   cin >> n;
   for(int i=0; i<n; i++) node[i].parent=NIL;
   for(int i=0; i<n; i++){
      cin >> id >> l >> r;
      node[id].left=l;
      node[id].right=r;
      if(l!=NIL) node[l].parent=id;
      if(r!=NIL) node[r].parent=id;
   }
   int root;
   for(int i=0; i<n; i++) if(node[i].parent==NIL) root=i;

   cout << "Preorder" << endl;
   preorder(root);
   cout << endl;
   cout << "Inorder" << endl;
   inorder(root);
   cout << endl;
   cout << "Postorder" << endl;
   postorder(root);
   cout << endl;

}


Measured memory_bytes: 3136
#include <stdio.h>

int main(){
    long long int A,B,C,K;

    scanf("%lld %lld %lld %lld", &A, &B, &C, &K);

    if(K <= A){
        printf("%lld", K);
    }else if(K > A && K <= A+B){
        printf("%lld", A);
    }else if(K > A+B){
        printf("%lld", 2*A-K+B);
    }else{
        printf("-1");
    }

}

Measured memory_bytes: 1732
n = int(input())
s = input()

def z_algorythm(s):
    n = len(s)
    LCP = [0]*n
    c = 0
    for i in range(1, n):
        if i + LCP[i-c] < c + LCP[c]:
            LCP[i] = LCP[i-c]
        else:
            j = max(0, c+LCP[c]-i)
            while i+j < n and s[j] == s[i+j]:
                j += 1
            LCP[i] = j
            c = i
    LCP[0] = n
    return LCP

ans = 0
for i in range(n):
    LCP = z_algorythm(s[i:])
    for j, l in enumerate(LCP):
        if j >= l:
            ans = max(ans, l)
print(ans)

Measured memory_bytes: 79500
#include<bits/stdc++.h>
using namespace std;
int main()
    {
    	cin.tie(0);
        ios::sync_with_stdio(0);
        string s,S;cin>>s;
    	for (int i = 0; i <s.size() ; ++i)
    	{
    		if(i%2==0){S+=s[i];}
 
    	}
        cout<<S;
    	return 0;
    }

Measured memory_bytes: 592
#include<stdio.h>
#include<stdlib.h>
int result = 0;
int i, j;
int n, m, k;
int s[100005] = {};
int memo=0;

int main() {
	
	scanf("%d%d", &n,&m);

	if (n % 2 == 1 && m % 2 == 1) {
		printf("Yes");
	}
	else {
		printf("No");
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int D;
  cin>>D;
  vector<int> c(26);
  for(int &i:c)
    cin>>i;
  vector<vector<int>> s(D,vector<int>(26));
  for(vector<int> &v:s)
    for(int &i:v)
      cin>>i;
  vector<int> t(D);
  vector<int> A(26,0);
  int mzint=0;
  for(int i=0;i<D;i++){
    int mzi=mzint,mzin=0,k;
    for(int j=0;j<26;j++)
      mzi-=(i+1-A[j])*c[j];
    for(int j=0;j<26;j++){
      int l=mzi+s[i][j]-(i+1-A[j])*c[j];
      if(l>mzin){
        k=j;
        mzin=l;
      }
    }
    A[k]=i+1;
    mzint=mzin;
    t[i]=k+1;
  }
  int M=7750000,ans=mzint;
  while(M--){
    vector<pair<int,int>> AAA={make_pair(rand()%D,rand()%26),make_pair(rand()%D,rand()%26)};
    vector<int> BBB={t[AAA[0].first],t[AAA[1].first]};
    int ans2=ans;
    for(int aaa=0;aaa<2;aaa++){
    int d=AAA[aaa].first,q=AAA[aaa].second;
    ans+=s[d][q]-s[d][t[d]-1];
    int mae=-1,ato=D;
    for(int i=d-1;i>=0;i--){
      if(t[i]==t[d]){
        mae=i;
        break;
      }
    }
    for(int i=d+1;i<D;i++){
      if(t[i]==t[d]){
        ato=i;
        break;
      }
    }
    ans-=(ato-d)*(d-mae)*c[t[d]-1];
    mae=-1,ato=D;
    for(int i=d;i>=0;i--){
      if(t[i]==q+1){
        mae=i;
        break;
      }
    }
    for(int i=d;i<D;i++){
      if(t[i]==q+1){
        ato=i;
        break;
      }
    }
    ans+=(ato-d)*(d-mae)*c[q];
    t[d]=q+1;
    }
    if(ans2>ans){
      ans=ans2;
      t[AAA[0].first]=BBB[0];
      t[AAA[1].first]=BBB[1];
    }
  }
  for(int i:t)
    cout<<i<<endl;
}

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

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
        String line = buffer.readLine();
        int x = Integer.parseInt(line);

        int mod1 = x % 10;
        int x1 = x / 10;
        int mod2 = x1 % 10;
        int x2 = x1 / 10;
        int mod3 = x2 % 10;
        int x3 = x2 / 10;
        int mod4 = x3 % 10;

        boolean flag = false;

        if (mod1 == mod2 && mod2 == mod3){
          flag = true;
        } else if (mod2 == mod3 && mod3 == mod4){
          flag = true;
        }

        if(flag){
          System.out.println("Yes");
        } else {
          System.out.println("No");
        }
    }

}


Measured memory_bytes: 23252
use proconio::*;
use proconio::marker::Usize1;
use itertools::*;

fn run() {
    input! {
        n: usize,
        m: usize,
        q: usize,
        e: [(Usize1, Usize1, usize, u32); q],
    }
    let mut ans = 0;
    for a in (0..m).combinations_with_replacement(n) {
        let mut sum = 0;
        for &(x, y, z, w) in e.iter() {
            if a[y] - a[x] == z {
                sum += w;
            }
        }
        ans = std::cmp::max(ans, sum);
    }
    println!("{}", ans);
}

fn main() {
    run();
}

Measured memory_bytes: 2108
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<set>
using namespace std;
#define N 500002
typedef long long ll;
const int p=1e9+7;
int n,k,f[2010][2012],bin[2012],s[2012][2012];
int main()
{
	scanf("%d%d",&n,&k);bin[0]=1;
	for(int i=1;i<=2000;i++)bin[i]=2ll*bin[i-1]%p;	
	f[0][n+1]=1;
	for(int i=n+1;i;i--)s[0][i]=(s[0][i+1]+f[0][i])%p;
	for(int i=1;i<=k;i++)
	{
		for(int j=1;j<=n-i+1;j++)f[i][j]=s[i-1][j];
		for(int j=n+1;j;j--)s[i][j]=(s[i][j+1]+f[i][j])%p;
	}
	int ans=(f[k][1]-f[k-1][1]+p)%p;if(n^k)ans=1ll*ans*bin[n-k-1]%p;
	printf("%d\n",ans);
}


Measured memory_bytes: 31360
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    string S;
    cin>>S;
    if(S=="Sunny")cout<<"Cloudy"<<endl;
    else if(S=="Cloudy")cout<<"Rainy"<<endl;
    else cout<<"Sunny"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define two(x) (1<<(x-1))
using namespace std;
#define N 20
int n,m,w[N][N],f[(1<<16)+10][N],p[(1<<16)+10],ans;
int main(){
	scanf("%d%d",&n,&m);int Max=(1<<n)-1;
	rep (i,1,m){
		int x,y,z;scanf("%d%d%d",&x,&y,&z);
		ans+=z;w[x][y]=w[y][x]=z;
	}
	p[0]=0;
	rep (i,1,Max){
		int now;
		rep (j,1,n) if (i>>j-1&1){now=j;break;}
		p[i]=p[i^(1<<now-1)];
		rep (j,1,n) if (i>>j-1&1) p[i]+=w[now][j];
	}
	memset(f,0xc0,sizeof(f));
	f[1][1]=0;
	int tmp=-1e9;
	rep (s,1,Max) rep (i,1,n){
		for (int t=s;t;t=(t-1)&s)
			if (t>>i-1&1)
				f[s][i]=max(f[s][i],f[(s-t)|(1<<i-1)][i]+p[t]);
        rep (j,1,n)
			if (!(s>>j-1&1)&&w[i][j])
				f[s|(1<<j-1)][j]=max(f[s|(1<<j-1)][j],f[s][i]+w[i][j]);
	}
	ans-=f[Max][n];
	printf("%d\n",ans);
	return 0;
}

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

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;
 
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;

int main() {
  
  int n,k;
  cin >> n >> k;
  
  int count = 0;
  
  while(n > 0){
    n /= k;
    count++;
  }
  
  cout << count << endl;
  
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
    N = int(readline())
    if N == 0:
        return False
    x = N//2; y = x+1
    P = [[-1]*N for i in range(N)]
    c = 0
    N2 = N*N
    while c < N2:
        if P[y][x] == -1:
            c += 1
            P[y][x] = c
            x = (x + 1) % N; y = (y + 1) % N
        else:
            x = (x - 1) % N; y = (y + 1) % N
    for line in P:
        write("".join(map("{:4d}".format, line)))
        write("\n")
    return True
while solve():
    ...


Measured memory_bytes: 5624
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned int ui;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
#define All(v) (v).begin(),(v).end()
#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 For(i,m,n) for(int i = m; i < n; i++)
#define Fors(i,m,n) for(int i = m; i <= n; i++)
#define Inf 2e9
#define F first
#define S second
#define pb push_back
#define mp make_pair
struct speed{speed(){cin.tie(); ios::sync_with_stdio(false); cout << fixed << setprecision(18);}}speed;

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

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

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


int main (){
    int n,k;
    cin >> n >> k;
    if(k == 1) cout << 0 << endl;
    else cout << n - k << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x*f;
}
#define MN 100005
int v[MN],nm[2][MN],mx[2],ans=-10000000;
int main(){
	register int i,n;
	n=read();
	for(i=1;i<=n;i++) v[i]=read();
	for(i=1;i<=n;i++)
		nm[i&1][v[i]]++;
	for(i=1;i<MN;i++){
		if(!nm[0][v[i]]) nm[0][v[i]]=-100000000;
		if(!nm[1][v[i]]) nm[1][v[i]]=-100000000;	
	}
	mx[0]=mx[1]=-111111111;
	for(i=1;i<MN;i++){
		ans=max(ans,mx[0]+nm[1][i]);
		ans=max(ans,mx[1]+nm[0][i]);
		mx[0]=max(mx[0],nm[0][i]);
		mx[1]=max(mx[1],nm[1][i]);
	}
	printf("%d\n",n-ans);
	return 0;
}

Measured memory_bytes: 1408
N = int(input())
a = input().split()
ans = 0
for i in range(0,N):
	for j in range(i,N):
		if int(a[i]) < int(a[j]):
			b = a[i]
			a[i] = a[j]
			a[j] = b
for i in range(0,N,2):
	ans += int(a[i])
for i in range(1,N,2):
	ans -= int(a[i])
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()

int main() {
	int a[3],ans = 1;
	REP(i, 3) cin >> a[i];
	sort(a, a + 3);
	if (a[1] != a[2]) ans++;
	if (a[0] != a[1]) ans++;
	cout << ans << endl;
}

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

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {

			//出力の都度更新をやめる
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);


			Ans();

			//更新する
			Console.Out.Flush();
			
		}
public static void Ans() {

			var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];

			_tree = new List<Tuple<long, long>>[N];

			for (int i = 0; i < N; i++) {
				_tree[i] = new List<Tuple<long, long>>();
			}

			for (int i = 0; i < N-1; i++) {
				var inp = retreiveLongArray();
				var u = inp[0]-1;
				var v = inp[1]-1;
				var w = inp[2];

				_tree[u].Add(new Tuple<long, long>(v, w));
				_tree[v].Add(new Tuple<long, long>(u, w));
			}

			_color = new int[N];
			_color[0] = 0;
			DFS(-1,0, true);
			for (int i = 0; i < N; i++) {
				Console.WriteLine(_color[i]);
			}


		}
		/// <summary>
		/// DFS (循環はない想定)
		/// </summary>
		/// <param name="from"></param>
		/// <param name=""></param>
		private static void DFS(long from,long now,bool isWhite) {

			var roots = _tree[now];

			foreach (var root in roots) {

				if (root.Item1==from) {
					continue;
				}

				if (root.Item2%2==0) {
					_color[root.Item1] = isWhite ? 0 : 1;
					DFS(now,root.Item1, isWhite);
				}
				else {
					_color[root.Item1] = isWhite ? 1 : 0;
					DFS(now,root.Item1, !isWhite);
				}
			}
		}

		private static int[] _color;
		private static List<Tuple<long, long>>[] _tree;

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}


		/// <summary>
		/// 2組みずつの入力データ(数値)からTuppleListを作成する
		/// </summary>
		/// <param name="N"></param>
		/// <returns></returns>
		private static List<Tuple<long, long>> createLongTuppleList(long N) {
			var inpList = new List<Tuple<long, long>>();

			for (int i = 0; i < N; i++) {
				var inp = retreiveLongArray();
				var item1 = inp[0];
				var item2 = inp[1];
				inpList.Add(new Tuple<long, long>(item1, item2));
			}
			return inpList;
		}
	}
}


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

int main(){
  string s;
  cin >> s;
  int cnt=0;
  for (int i=0; i<s.length(); i++){
    if (s[i]=='o') cnt++;
  }
  cout << 700+ cnt*100 << endl;
  return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::{cmp::Reverse, collections::*};

#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Chars, Usize1},
};

#[allow(unused_imports)]
use itertools::Itertools;

#[allow(unused_imports)]
use num::Integer;

#[fastout]
pub fn main() {
    input! {
        mut s: Chars,
    }

    s.pop();
    s.pop();
    while s[0..s.len() / 2] != s[s.len() / 2..s.len()] {
        s.pop();
        s.pop();
        if s.len() == 0 {
            break;
        }
    }
    println!("{}", s.len());
}


Measured memory_bytes: 2144