akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  int ret = 0;
  for(int a = 1; a <= N; a++) {
    for(int b = 1; a * b < N; b++) {
      ++ret;
    }
  }
  cout << ret << "\n";
}



Measured memory_bytes: 3660
s = [input() for i in range(3)]
dex = 0
next = 'a'
while True:
    if next == 'a': dex = 0
    elif next == 'b': dex = 1
    else: dex = 2
    if s[dex] == "":
        print(next.upper())
        exit()
    next = s[dex][0]
    s[dex] = s[dex][1:]

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

int main(){
    int n, k;
    cin >> n >> k;

    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());

    int m = 1;
    vector<int> count;
    for(int i=1; i<n; i++){
        if(a[i] == a[i-1]) m += 1;
        if(a[i] != a[i-1]){
            count.push_back(m);
            m = 1;
        }
    }
    count.push_back(m);
    sort(count.begin(),count.end());

    int ans = 0;
    for(int i=0; i< (int)count.size() - k; i++){
        ans += count[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2168
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> vec(2*N);
  for(int i=0; i<2*N; i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  
  int ans = 0;
  for(int j=0; j<2*N; j += 2){
    ans += vec.at(j);
  }
  cout << ans << endl;
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)


int main()
{
    long long A, B, N;
    cin >> A >> B >> N;

    cout << A*min(N, B-1)/B << endl;

    return 0;
}

Measured memory_bytes: 3192
#include<iostream>
#include<stdio.h>
#define MAX 500000
#define INFTY 2000000000

int L[MAX / 2 + 2], R[MAX / 2 + 2];
int cnt;

void merge(int A[], int left, int mid, int right){
	int n1 = mid - left;
	int n2 = right - mid;
	int i;
	int L[n1], R[n2];
	for (i = 0; i < n1; i++){
		L[i] = A[left + i];
	}
	for (i = 0; i < n2; i++){
		R[i] = A[mid + i];
	}
	L[n1] = INFTY;
	R[n2] = INFTY;
	i = 0;
	int j = 0;
	for (int k = left; k < right; k++){
		cnt++;
		if (L[i] <= R[j]){
			A[k] = L[i];
			i = i + 1;
		}
		else{
			A[k] = R[j];
			j = j + 1;
		}
	}
}

void mergeSort(int 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, left, mid, right);
	}
}

int main(){
	int A[MAX],n,i;
	cnt = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%d", &A[i]);
	}
	mergeSort(A, n, 0, n);
	for (int i = 0; i < n; i++){
		if (i)
			printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
	printf("%d\n", cnt);
	return 0;
}

Measured memory_bytes: 7060
S = input()
if S == "SUN":
  print(7)
elif S == "MON":
  print(6)
elif S == "TUE":
  print(5)
elif S == "WED":
  print(4)
elif S == "THU":
  print(3)
elif S == "FRI":
  print(2)
else:
  print(1)

Measured memory_bytes: 2940
"use strict";
function main(input) {
    let line = input.split("\n");
    let arr = line[0].split(" ");
    const X = arr[0];
    const Y = arr[1];
    const Z = arr[2];
    console.log(Z, X, Y);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include <cstring>
#include <functional>
//#include<unordered_map>
//#include<unordered_set>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P; 
const int N = 100005;
//////////////////////////////

int n, k;
Int r, s, p;
string t;
Int dp[N][3];//r-0, s-1, p-2

Int points(char c)
{
	if (c == 'r') return p;
	if (c == 's') return r;
	if (c == 'p') return s;
}

int toInd(char c)
{
	if (c == 'r') return 2;
	if (c == 's') return 0;
	if (c == 'p') return 1;
}

void solve()
{
	cin >> n >> k;
	cin >> r >> s >> p;
	cin >> t;

	for (int i = 0; i < n; i++) {
		if (i - k < 0) {
			dp[i][toInd(t[i])] = points(t[i]);
		}
		else {//r-0, s-1, p-2
			if (t[i] == 'p') {//2
				dp[i][0] = max(dp[i - k][1], dp[i - k][2]);
				dp[i][1] = s + max(dp[i - k][0], dp[i - k][2]);
				dp[i][2] = max(dp[i - k][0], dp[i - k][1]);
			}
			if (t[i] == 'r') {//0
				dp[i][0] = max(dp[i - k][1], dp[i - k][2]);
				dp[i][1] = max(dp[i - k][0], dp[i - k][2]);
				dp[i][2] = p + max(dp[i - k][0], dp[i - k][1]);
			}
			if (t[i] == 's') {//1
				dp[i][0] = r + max(dp[i - k][1], dp[i - k][2]);
				dp[i][1] = max(dp[i - k][0], dp[i - k][2]);
				dp[i][2] = max(dp[i - k][0], dp[i - k][1]);
			}
		}
	}

	Int ans = 0;
	for (int i = 0; i < k; i++) {
		ans += max(dp[n - 1 - i][0], max(dp[n - 1 - i][1], dp[n - 1 - i][2]));
	}
	cout << ans << endl;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(13);
	solve();
	return 0;
}


Measured memory_bytes: 2896
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
 
#define pii pair<int, int>
#define F first
#define S second
#define pb push_back
 
const int N = 2e5 + 5;
const int mod = 1e9+7;
const ll INF = (ll)1e18;

inline int mul(int a, int b){
    return ((ll)a * b) % mod;
}

inline int add(int a, int b){
    int ans = a + b;
    if(ans >= mod) ans -= mod;
    return ans; 
}

int main(){
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
 
    int n;
    string s;
    cin >> n >> s;
    vector<int> pre_dp(n+1, 0);
    pre_dp[1] = 1;
    for(int j = 1; j <= n; j++)
        pre_dp[j] = add(pre_dp[j-1], pre_dp[j]);

    for(int j = 2; j <= n; j++){
        vector<int> new_pre_dp(n+1, 0);
        for(int cur = 1; cur <= j; cur ++){
            if(s[j-2] == '<'){
                 new_pre_dp[cur] = pre_dp[cur - 1];
            }
            else{
                new_pre_dp[cur] = (pre_dp[j-1] - pre_dp[cur-1] + mod) % mod;
            }
            /*
            for(int prv = 1; prv <= j-1; prv ++){
                if(s[j-2] == '<'){
                    if(prv >= cur) continue;
                    new_dp[cur] = add(new_dp[cur], dp[prv]);
                }
                else if(s[j-2] == '>'){
                    if(prv < cur) continue;
                    new_dp[cur] = add(new_dp[cur], dp[prv]);
                }
            }
            */
        }
        pre_dp = new_pre_dp;
        for(int j = 1; j <= n; j++)
            pre_dp[j] = add(pre_dp[j], pre_dp[j-1]);
        // for(auto i : pre_dp) cout << i << " "; cout << endl;
    }
    int ans = 0;
    // for(int j = 1; j <= n; j++) ans = (ans + pre_dp[j]) % mod;
    cout << pre_dp[n] << '\n';
    return 0;
}


Measured memory_bytes: 256
/*
Educational DP Contest - D - Knapsack 1
https://atcoder.jp/contests/dp/tasks/dp_d
*/

#include <bits/stdc++.h>
using namespace std; 
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)
typedef long long ll; 
 
int main()  
{ 
    FAST_INP;
    ll n,W,w,v;
    cin >> n >> W;
    ll dp[100005];
    memset(dp,0,sizeof(dp));
    for(int i=0;i<n;i++){
    	cin >> w >> v;
    	for(int j=W;j>=w;j--){
    		dp[j]=max(dp[j],dp[j-w]+v);
		}	
	}
	cout << dp[W] << endl;
    return 0;
} 


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

int a, b;

int main() {
  cin >> a >> b;
  if(a == b)
    cout << "Draw" << endl;
  else if(a == 1 || (a > b && b != 1))
    cout << "Alice" << endl;
  else
    cout << "Bob" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int s[366][26];
int main() {

	int d;
	cin >> d;
	int c[26];
	int i, j, j2;
	for (i = 0; i < 26; i++) {
		cin >> c[i];
	}

	for (i = 0; i < d; i++) {
		for (j = 0; j < 26; j++) {
			cin >> s[i][j];
		}
	}
	int last[26];
	for (i = 0; i < 26; i++) {
		last[i] = 0;
	}
	int jmax, jindex, jindex2;
	for (i = 1; i <= d; i++) {

		jmax = 0;
		jindex = -1;
		jindex2 = -1;
		/*for (j = 0; j < 26; j++) {
			if (c[j] *(i - last[j]) > jmax) {
				jmax = c[j] *(i - last[j]);
				jindex = j;
			}
			else if (c[j] *(i - last[j]) == jmax) {
				if (s[i - 1][j] > s[i - 1][jindex]) {
					jindex = j;
				}
			}
		}*/
		for (j = 0; j < 26; j++) {
			for (j2 = 0; j2 < 26; j2++) {
				if (j != j2) {
					if (s[i - 1][j] + 5 * c[j] * (i - last[j]) + s[i][j2] + 4 * c[j2] * (i + 1 - last[j2]) > jmax) {
						jmax = s[i - 1][j] + 5 * c[j] * (i - last[j]) + s[i][j2] + 4 * c[j2] * (i + 1 - last[j2]);
						jindex = j;
						jindex2 = j2;
					}
				}
				else {
					if (s[i - 1][j] + 5 * c[j] * (i - last[j]) + s[i][j2] + 4 * c[j2] > jmax) {
						jmax = s[i - 1][j] + 5 * c[j] * (i - last[j]) + s[i][j2] + 4 * c[j2];
						jindex = j;
						jindex2 = j2;
					}
				}
			}
		}
		/*for (j = 0; j < 26; j++) {
			if (s[i - 1][j] + 15 * c[j] * (i - last[j]) >= jmax) {
				jmax = s[i - 1][j] + 15 * c[j] * (i - last[j]);
				jindex = j;
			}
		}*/
		last[jindex] = i;
		cout << jindex + 1 << endl;
		


	}
	return 0;


}

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

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

  if (S.size()<=K) {
    cout << S;
  }
  else {
    for (int i = 0; i < K; i++) {
      cout << S.at(i);}
    cout << "...";
  }
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <cmath>
#include <map>
#include <algorithm>
#include <vector>
#define ll long long int
using namespace std;
 
int main(){
	ll n;
	ll a[100000];
	ll b = 1, c = 2;
	ll ans = 1;
 
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
 
	if (n % 2 == 0) {
		for (int i = 0; i < n; i += 2) {
			if (a[i] == a[i + 1] && a[i] == b) {
				b += 2;
			}
			else {
				ans = 0;
				break;
			}
		}
		
	}
	else {
		if (a[0] != 0) {
			ans = 0;
		}
		else {
			for (int i = 1; i < n; i += 2) {
				if (a[i] == a[i + 1] && a[i] == c) {
					c += 2;
				}
				else {
					ans = 0;
					break;
				}
			}
			
		}
	}
	if (ans != 0) {
		for (int i = 0; i < n / 2; i++) {
			ans *= 2;
                        ans = ans % 1000000007;
		}
	}
	cout << ans << endl;
	return 0;
}
 

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    String s = sc.next();
    Map<Integer, String> ans = new HashMap<>();
    ans.put(0, s);
    boolean forward = true;
    int min = 0;
    int max = 0;
    int q = sc.nextInt();
    while (q-- > 0) {
      int t = sc.nextInt();
      if (t == 1) {
        forward = !forward;
        continue;
      }
      int f = sc.nextInt();
      String c = sc.next();
      if ((forward && f == 2) || (!forward && f == 1)) {
        ans.put(max + 1, c);
        max++;
      } else {
        ans.put(min - 1, c);
        min--;
      }
    }
    StringBuilder sb = new StringBuilder();
    if (max == min) {
      sb.append(ans.get(0));
    } else if (forward) {
      for (int i = min; i <= max; i++) {
        sb.append(ans.get(i));
      }
    } else {
      for (int i = max; i >= min; i--) {
        if (i == 0) {
          StringBuilder revS = new StringBuilder(s);
          sb.append(revS.reverse().toString());
        } else{
          sb.append(ans.get(i));
        }
      }
    }
    System.out.println(sb.toString());
  }
}

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

const int INF = 1 << 30;
int A[12][12];

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

    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);

    REP(i, n) {
        cin >> c[i];
        REP(j, m) {
            cin >> A[i][j];
        }
    }

    int ans = INF;
    REP(s, 1 << n) {
        int cost = 0;
        vector<int> a(m);
        REP(i, n) {
            if (s >> i & 1) {
                cost += c[i];
                REP(j, m) {
                    a[j] += A[i][j];
                }
            }
        }
        bool ok = true;
        REP(j, m) {
            if (a[j] < x) {
                ok = false;
            }
        }
        if (ok) {
            ans = min(ans, cost);
        }
    }

    if (ans == INF) {
        cout << -1 << '\n';
    } else {
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 3644
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author AnandOza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AFiveVariables solver = new AFiveVariables();
        solver.solve(1, in, out);
        out.close();
    }

    static class AFiveVariables {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int[] x = in.readIntArray(5);
            for (int i = 0; i < 5; i++) {
                if (x[i] == 0) {
                    out.println(i + 1);
                    return;
                }
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int[] readIntArray(int n) {
            int[] x = new int[n];
            for (int i = 0; i < n; i++) {
                x[i] = nextInt();
            }
            return x;
        }

    }
}



Measured memory_bytes: 25552
declare var require: (x: string) => any;

const MOD = 1000000007;

function mul(x: number, y: number){
  if (x == 1) return y;
  if (y == 1) return x;
  if (x == 0 || y == 0) return 0;
  let ans = 0;
  while(y > 0){
    ans += x * (y%10) % MOD;
    ans %= MOD;
    x = x * 10 % MOD;
    y = Math.floor(y/10);
  }
  return ans;
}

function Main(input: string[]) {
  const s = input[0];
  const n = s.length;

  let aa = new Uint32Array(n);
  let cc = new Uint32Array(n);
  let qq = new Uint32Array(n);

  let totalq = s[0]=='?' ? 1 : 0;

  aa[0] = s[0]=='A' ? 1 : 0;
  qq[0] = s[0]=='?' ? 1 : 0;
  for(let i = 1; i < n; i++){
    if (s[i] == 'A'){
      aa[i] = aa[i-1] + 1;
    } else {
      aa[i] = aa[i-1];
    }

    if(s[i] == '?'){
      qq[i] = qq[i-1] + 1;
      totalq++;
    } else {
      qq[i] = qq[i-1];
    }
  }

  cc[n-1] = s[n-1]=='C' ? 1 : 0;
  for(let i = n - 2; i >= 0; i--){
    if (s[i] == 'C'){
      cc[i] = cc[i+1] + 1;
    } else {
      cc[i] = cc[i+1];
    }
  }

  let pow3 = new Uint32Array(n);
  pow3[0] = 1;
  for(let i = 1; i < n; i++) {
    pow3[i] = pow3[i-1]*3;
    while(pow3[i] >= MOD) pow3[i] -= MOD;
  }

  let ans = 0;
  for (var i = 1; i < n-1; i++) if(s[i]=='?' || s[i]=='B'){
    let lv = mul(aa[i-1], pow3[qq[i-1]]);
    if(qq[i-1] > 0) lv += mul(qq[i-1], pow3[qq[i-1]-1]);
    lv %= MOD;

    let rq = totalq - qq[i];
    let rv = mul(cc[i+1], pow3[rq]);
    if(rq > 0) rv += mul(rq, pow3[rq - 1]);
    rv %= MOD;

    // console.log(i, aa[i], qq[i], cc[i], lv, rv, rq, n, totalq);

    ans += mul(lv, rv);
    ans %= MOD;
  }

  console.log(ans);
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8').split('\n'));


Measured memory_bytes: 10060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;  // 1e9+7
const int INF = 100100100;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define debug(x) cerr << #x << ": " << x << '\n'

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N);
  REP(i, N) cin >> A[i];
  double ans;
  double d = 0;
  REP(i, N) d += 1.0 / A[i];
  ans = 1 / d;
  cout << setprecision(15) << ans << '\n';
}

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

int main() {
	int ame[3];
	cin >> ame[0] >> ame[1] >> ame[2];
	sort(ame, ame + 3, greater<int>());
	if (ame[0] == ame[1] + ame[2])cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<(n);i++)
const int MOD = 1e9 + 7 ;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=1e5+3;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);

      int m,k;
      cin>>k>>m;
      if(m==0)
      {
            for(int i=0;i<(1<<k);i++) cout<<i<<" "<<i<<" ";
            return 0;
      }
      if(m>=(1<<k))
      {
            cout<<"-1";
      }
      else{
            vector<int> ans;
            int o=0;
            for(int i=0;i<(1<<k);i++)
            {
                  if(i!=m)
                  {
                        ans.pb(i);
                        o^=i;
                  }
            }
            if(o!=m)
            {
                  cout<<"-1\n";
                  return 0;
            }
            for(auto x:ans) cout<<x<<" ";
            cout<<m<<" ";
            reverse(all(ans));
            for(auto x:ans) cout<<x<<" ";
            cout<<m<<" ";
      }
}     



Measured memory_bytes: 2932
x1, y1, x2, y2 = map(int, input().split())

dx = abs(x1 - x2)
dy = abs(y1 - y2)

if y1 < y2:
  x3 = x2 - dy
  x4 = x1 - dy
else:
  x3 = x2 + dy
  x4 = x1 + dy
if x1 < x2:
  y3 = y2 + dx
  y4 = y1 + dx
else:
  y3 = y2 - dx
  y4 = y1 - dx
  
print(x3, y3, x4, y4)

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <string>
#include <random>
#include <map>
#include <math.h>
#pragma warning(disable : 4996)

#define MAX_N 50

char A[MAX_N][MAX_N+1];
char B[MAX_N][MAX_N+1];

int main(void) {
	int N, M;
	scanf("%d %d", &N, &M);
	for (int i = 0; i < N; ++i) {
		scanf("%s", &A[i]);
	}
	for (int i = 0; i < M; ++i) {
		scanf("%s", &B[i]);
	}
	for (int oy = 0; oy <= N - M; ++oy) {
		for (int ox = 0; ox <= N - M; ++ox) {
			bool match = true;
			for (int y = 0; y < M; ++y) {
				for (int x = 0; x < M; ++x) {
					if (A[oy + y][ox + x] != B[y][x]) {
						match = false;
						goto NOT_MATCH;
					}
				}
			}
		NOT_MATCH:
			if (match == true) {
				printf("Yes");
				return 0;
			}
		}
	}
	printf("No");
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
int main(void)
{
	int a,b,c,temp;
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);

	if (a > b) {
		temp = b;
		b = a;
		a = temp;
	}
		
	if (b > c) {
		temp = c;
		c = b;
		b = temp;
	}

	if (a > b) {
		temp = b;
		b = a;
		a = temp;
	}

	printf("%d %d %d\n", a, b, c);
    return 0;
}


Measured memory_bytes: 2104
import sys
input = sys.stdin.readline

n = int(input())
H = []
for i in range(n):
    a,b = input().split()
    H += [[int(a)+int(b),int(a),int(b)]]
H.sort(reverse=True)
ans = 0
for i in range(n):
    if i%2 == 0:
        ans += H[i][1]
    else:
        ans -= H[i][2]
print(ans)

Measured memory_bytes: 23284
import sys
s = input()
n = len(s)
t = s
t = t[::-1]
if s!=t:
    print("No")
    exit()
t = s[:(n-1)//2]
t = t[::-1]
if s[:(n-1)//2]!=t:
    print("No")
    exit()
t = s[(n+3)//2-1:]
t = t[::-1]
if s[(n+3)//2-1:]!=t:
    print("No")
    exit()
print("Yes")

Measured memory_bytes: 3064
using System;
using System.Linq;

namespace ABC113A
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            int[] ints = Input.IntArray();
            int X = ints[0];
            int Y = ints[1];
            
            Console.WriteLine(X + Y / 2);
        }
    }
    
    internal static class Input
    {
        public static string String()
        {
            return Console.ReadLine();
        }

        public static int Int()
        {
            return int.Parse(Console.ReadLine());
        }

        public static int[] IntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        public static long Long()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] LongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] DoubleArray()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<string>
#include<vector>
#include<algorithm> // sort

using namespace std;

void Main()
{
    int A1, A2, A3;
    cin >> A1 >> A2 >> A3;
    if (A1 + A2 + A3 >= 22) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }

}

int main()
{
    Main();
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] temp = sc.nextLine().split(" ");
		int a = Integer.parseInt(temp[0]);
		int b = Integer.parseInt(temp[1]);
		int ans = 0;
		int sum = 1;

		while(sum < b) {

			sum += a - 1;
			ans ++;
		}

		System.out.println(ans);
	}

}


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

using namespace std;
using ll = long long;

using Field = vector<vector<int>>;
using Graph = vector<vector<int>>;
using VI = vector<int>;
using VC = vector<char>;
using PI = pair<int, int>;

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

const long long INF = 1LL<<60;
const int mod = 1000000007;

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

int S, W;

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

    cin >> S >> W;

    if (S <= W) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    
    return 0;
}

Measured memory_bytes: 3452
#include <stdio.h>
#include <stdlib.h>
#define N 2000001
#define AMAX 10005

int main(){
  int i,j,num,*A,*B,C[AMAX];
  scanf("%d",&num);

  A = (int *)malloc(sizeof(int)*num+1);
  B = (int *)malloc(sizeof(int)*num+1);
 
  for(i=0; i<AMAX; i++) C[i] = 0;
  for(j=1; j<=num; j++){
    scanf("%d",&A[j]);
    C[A[j]]++;
  }

  for(i=0; i<AMAX; i++) C[i] = C[i] + C[i-1];

  for(j=num; j>0; j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  for(i=1; i<=num; i++){
    printf("%d",B[i]);
    if(i!=num) printf(" ");
  }
    printf("\n");
 

  return 0;

}

Measured memory_bytes: 16276
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MAX=200005;
const ll INF=0x3f3f3f3f;
const ll MOD=1000000007;
ll n,m,a[MAX],d[MAX],tilt=0,now=0,u[MAX],ans=INF;
vector<pll> slope;
int main()
{
    scanf("%lld%lld",&n,&m);
    for(ll i=0;i<n;i++) scanf("%lld",&a[i]),a[i]--;
    for(ll i=0;i<n-1;i++){
        d[i]=(a[i+1]-a[i]+m)%m-1;
        if(a[i+1]-d[i]<0) tilt--;
        u[a[i+1]]+=d[i];

        slope.push_back(make_pair(a[i+1],1));
        slope.push_back(make_pair((a[i+1]-d[i]+m)%m,-1));
        now+=min(d[i],a[i+1])+1;
    }
    ll idx=0;
    sort(slope.begin(),slope.end());
    ans=now;
    for(ll i=1;i<m;i++){
        for(;idx<slope.size();idx++) {
            if(slope[idx].first>=i) break;
            tilt+=slope[idx].second;
        }
        //printf("%lld %lld\n",now,tilt);
        now+=tilt+u[i-1];
        ans=min(now,ans);
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 9072
#include <stdio.h>

int main(void){
    int n, x;
    int sum;
    int j, q, k, a;
    
    while(1){
        a = 0;
        scanf(" %d %d", &n, &x);
        if(n == 0 && x == 0)
            break;
        for(j = 1; j <= n; j++){
            sum = 0;
            for(q = 1; q <= n; q++){
                if(q == j)
                    continue;
                for(k = 1; k <= n; k++){
                    if(k == j || k == q)
                        continue;
                    sum = j + q + k;
                    if(sum == x)
                        a += 1;
                }
            }
        }
        printf("%d\n", a / 6);
    }
    return 0;
}


Measured memory_bytes: 2052
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
private:
  ll *fac,*finv,*inv;
public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

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

int main(){
  int a,b;
  cin >> a >> b;
  int ans = -1;
  for(int i=0;i<1000000;i++){
    if(int(0.08*i) == a && int(0.1*i) == b){
      ans = i;
      break;
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    string g;
    int y,m,d;
    while(cin >> g >> y >> m >> d,g != "#"){
        cout << ( y <= 30 or (y == 31 and ((m == 4 and d <= 30) or m < 4))? "HEISEI " + to_string(y) : "? " + to_string(y -30)) << " "<< m << " " << d << endl;
    }
}






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

using namespace std;

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

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

    vector<int> balls(200000, 0);
    rep(i, N){
        int tmp;
        cin >> tmp;
        balls.at(tmp)++;
    }
    sort(balls.begin(), balls.end());
    
    int ans = 0;
    bool flag = true;

    int diff_num = 0;
    for(int ball : balls){
        if(ball) diff_num++;
    }
    if(diff_num > K){
        for(int i=0; i<balls.size(); i++){
            if(balls.at(i)){
                ans += balls.at(i);
                diff_num--;
                if(diff_num == K){
                    break;
                }
            }
        }
    }
    cout << ans << endl;
}

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

int main() {
  vector<vi> c(3,vi(3));
  rep(i,3)rep(j,3) cin >> c[i][j];
  bool ok = true;
  int h[3][2];
  int v[3][2];
  rep(i,3)rep(j,2) h[i][j] = c[i][j+1]-c[i][j];
  rep(i,3)rep(j,2) v[i][j] = c[j+1][i]-c[j][i];
  rep(i,2) {
    if(h[0][i]!=h[1][i]) ok = false;
    if(h[1][i]!=h[2][i]) ok = false;
    if(h[2][i]!=h[0][i]) ok = false;
  }
  rep(i,2) {
    if(v[0][i]!=v[1][i]) ok = false;
    if(v[1][i]!=v[2][i]) ok = false;
    if(v[2][i]!=v[0][i]) ok = false;
  }
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (s.length() == 26) {
            if (s.equals("zyxwvutsrqponmlkjihgfedcba")) {
                System.out.println("-1");
                return;
            }
            int pos = 0;
            out: for (int k = 0; k < 26; k++) {
                for (int i = 0; i < 26; i++) {
                    for (int j = i + 1; j <= k; j++) {
                        if (s.charAt(26 - 1 - i) > s.charAt(26 - 1 - j)) {
                            StringBuilder sb = new StringBuilder();
                            sb.append(s);
                            sb.insert(26 - 1 - j, s.charAt(26 - 1 - i));
                            s = new String(sb).substring(0, 26 - j);
                            pos = j - 1;
                            break out;
                        }
                    }
                }
            }
            System.out.println(s);
            return;
        } else {
            for (int i = 'a'; i <= 'z'; i++) {
                if (!s.contains(String.valueOf((char) i))) {
                    s += String.valueOf((char) i);
                    break;
                }
            }
            System.out.println(s);
            return;
        }
    }
}

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

//i = 0~n-1
//1000000000, 1

int main(void) {

	int n;
	cin >> n;
	int R[n];
	cin >> R[0];
	int minv = R[0];
	int maxv = -1000000000;
	//10^9??§?????¨?????????

	for (int j = 1; j < n; j++) {
		cin >> R[j];
		maxv = max(maxv, R[j]-minv);
		minv = min(minv, R[j]);
	}

	cout << maxv << endl;


	return 0;
}

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

int main(void) {                                                                
    int n;                                                                      
    double xa, ya, ra, xb, yb, rb;                                              
                                                                                
    scanf("%d", &n);                                                            
    while (n-- > 0) {                                                           
        scanf("%lf%lf%lf%lf%lf%lf", &xa, &ya, &ra, &xb, &yb, &rb);              
                                                                                
        double d = hypot(xb - xa, yb - ya);                                     
        if (d < ra - rb)                                                        
            printf("2\n");                                                      
        else if (d < rb - ra)                                                   
            printf("-2\n");                                                     
        else if (d > ra + rb)                                                   
            printf("0\n");                                                      
        else                                                                    
            printf("1\n");                                                      
    }                                                                           
    return 0;                                                                   
}

Measured memory_bytes: 632
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

using namespace __gnu_pbds;
using namespace std;

using ll = long long;
using ld = long double;

#define mp make_pair

typedef tree<
        pair<int, int>,
        null_type,
        less<pair<int, int>>,
        rb_tree_tag,
        tree_order_statistics_node_update>
        ordered_set;


const int p = 1000000007;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}


mt19937 rnd(time(0));

/*
const int N = 1200000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{*
    if (n<k) return 0;
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}
*/

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

    int n;
    cin>>n;
    vector<int> a(n);
    for (int i = 0; i<n; i++) cin>>a[i];
    vector<int> b(a);
    sort(b.begin(), b.end());
    int med = b[n/2 - 1];
    int med2 = b[n/2];
    for (int i = 0; i<n; i++)
    {
        if (a[i]<=med) cout<<med2<<endl;
        else cout<<med<<endl;
    }


}


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

int main(){

    int N;
    cin >> N;
    vector<int> a(N);
    for(int i = 0; i < N; i++) cin >> a[i];

    sort(a.rbegin(), a.rend());

    int ans = 0;
    for(int i = 0; i < N; i++){
        if(i % 2 == 0) ans += a[i];
        else ans -= a[i];
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	A, B, N = getlist()
	if N < B:
		ans = int(A * N // B)
	else:
		ans = int(A * (B - 1) // B)
	print(ans)

if __name__ == '__main__':
	main()

Measured memory_bytes: 64832
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		
		while(true) {
			int H = s.nextInt();
			int W = s.nextInt();
			if(H==0 && W==0) {
				break;
			}
			
			for(int i=1; i<=H; i++) {
				for(int j=1; j<=W; j++) {
					if((i+j)%2 == 0) {
						System.out.print("#");
					} else {
						System.out.print(".");
					}
				}
				System.out.println();
			}
			System.out.println();
		}
		s.close();
	}

}

Measured memory_bytes: 33028
months, d = map(int, input().split())

ans_count = 0

for month in range(4, months + 1):
    for i in range(1, d + 1):
        if i <= 9:
            continue

        a, b = map(int, str(i))

        if a >= 2 and b >= 2 and a * b == month:
            ans_count += 1

print(ans_count)

Measured memory_bytes: 9176
#include <stdio.h>
#include <stdlib.h>

int main(){
    int x, n;
    int min, k, l; 
    
    min = 200;
    l = 100;

    scanf("%d", &x);
    scanf("%d", &n);

    int p[n+1];

    for(int i=1; i<n+1; i++){
         scanf("%d", &p[i]);
    }   
    
    
    for(int i=-1; i<=101; i++){

        int f = 0;
        
            for(int j=1; j<n+1; j++){
                if(i == p[j]){
                    f = 1;
                    break;    
                }
            }

            if(f == 0){
                k = abs(i - x);
                if(min > k){
                     min = k;
                     l = i;
                }
            }
        
    }   

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

return 0;

}


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

typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vec> mat;

const int INF = 1 << 28;
int N, M, R;

void solve() {
    mat dps(N, vec(N, INF));
    mat dpl(N, vec(N, INF));
    for (int i = 0; i < M; i++) {
        int x, y, t;
        char c;
        cin >> x >> y >> t >> c;
        x--, y--;
        if (c == 'L') dpl[x][y] = dpl[y][x] = min(dpl[x][y], t);
        if (c == 'S') dps[x][y] = dps[y][x] = min(dps[x][y], t);
    }

    for (int i = 0; i < N; i++) dpl[i][i] = dps[i][i] = 0;

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            for (int k = 0; k < N; k++) {
                dpl[j][k] = min(dpl[j][k], dpl[j][i] + dpl[i][k]);
                dps[j][k] = min(dps[j][k], dps[j][i] + dps[i][k]);
            }
        }
    }

    cin >> R;
    vec z(R);
    for (auto& i : z) cin >> i, i--;

    mat dp(R, vec(N, INF));
    dp[0][z[0]] = 0;
    for (int i = 0; i < R-1; i++) {
        for (int j = 0; j < N; j++) {
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]+dpl[z[i]][z[i+1]]);
            for (int k = 0; k < N; k++) {
                dp[i+1][k] = min(dp[i+1][k],
                                 dp[i][j]+dpl[z[i]][j]+dps[j][k]+dpl[k][z[i+1]]);
            }
        }
    }

    int ans = INF;
    for (int i = 0; i < N; i++) {
        ans = min(ans, dp[R-1][i]);
    }

    cout << ans << endl;
}

int main() {
    while (cin >> N >> M, N || M) solve();

    return 0;
}

Measured memory_bytes: 3852
#include<bits/stdc++.h>
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 ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
const ll mod = 1e9+7;

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main(){
    int n; cin >> n;
    vector<ll> x(n);
    rep(i,n) cin >> x[i];
    ll ans = 0;
    vector<ll> d(n);
    rep(i,n) d[i] = x[n-1] - x[i];
    ll pro = 1;
    FOR(i,1,n) {
        pro *= i;
        pro %= mod;
    } 
    rep(i,n) {
        ll tmp = (((d[i] * pro) % mod) * modinv((ll)i+1, mod)) % mod;
        ans += tmp;
        ans %= mod;
    }
    cout << ans << endl;
}

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

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;

#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))

int F()
{
	char ch;
	int x, a;
	while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
	if (ch == '-') ch = getchar(), a = -1;
	else a = 1;
	x = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9')
		x = (x << 1) + (x << 3) + ch - '0';
	return a * x;
}

int main()
{
	int n,k;
	gii(n,k);
	n++,n>>=1;
	if (k <= n) puts("YES"); else puts("NO");
}


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

using namespace std;

typedef long long ll;

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

	int n, l;
	cin >> n >> l;

	vector<string> v(n);
	rep(i, n) cin >> v[i];

	sort(v.begin(), v.end());

	rep(i, n){
		cout << v[i];
	}

	cout << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip> 
#include <bits/stdc++.h>
using namespace std;
double pi=3.14159265358979323846264338;
#include <bits/stdc++.h>
 
#ifndef LOCAL
#define cerr dolor_sit_amet
#endif
 
#define mp make_pair
#define sz(x) ((int)((x).size()))
#define X first
#define Y second
#define all(x) (x).begin(), (x).end()
 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int , int > ipair;
typedef pair < ll , ll > lpair;
const int IINF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const double DINF = numeric_limits<double>::infinity();
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int DX[] = { 1,  0, -1,  0,  1, -1,  1, -1};
const int DY[] = { 0,  1,  0, -1,  1, -1, -1,  1};
 
template<typename T> T& updMin(T& a, T const& b) { if (b < a) a = b; return a; }
template<typename T> T& updMax(T& a, T const& b) { if (a < b) a = b; return a; }
 
// ========================================================================= //
//999977 17 499998
const int ind=6000000;
double h,c,t;
double tem(double cur){
	if((2*cur+3)*labs(t*(2*cur+1)-(cur*(h+c)+h))>(2*cur+1)*fabs(t*(2*cur+3)-((cur+1)*(h+c)+h))){
		return (2*cur+3);
	
	}else {
		if((2*cur-1)*labs(t*(2*cur+1)-(cur*(h+c)+h))<(2*cur+1)*fabs(t*(2*cur-1)-((cur-1)*(h+c)+h))){
			return(2*cur+1);
			//cout<<fabs(t-(cur*(h+c)+h)/(2*cur+1))<<" "<<fabs(t-((cur-1)*(h+c)+h)/(2*cur-1))<<endl;
		}else {
			//cout<<fabs(t-(cur*(h+c)+h)/(2*cur+1))<<" "<<fabs(t-((cur-1)*(h+c)+h)/(2*cur-1))<<endl;
			return (2*cur-1);
			
		}
	}
}
long long culc(){
	long long fr=0;
	long long ls=ind;
	long long mid;
	while(ls>=fr){
		mid=(fr+ls)/2;
		if ((mid*(h+c)+h)/(2*mid+1)<t)ls=mid-1; else if((mid*(h+c)+h)/(2*mid+1)>t)fr=mid+1; else return mid;
	}
	return mid;
}
 
 
 
int main() {
	int a,b;
	cin>>a>>b;
	cout<<a*b<<endl;
	
	
  return 0;
}



Measured memory_bytes: 3632