akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for ( int i=1; i<=int(n); i++ )  
#define MP make_pair
#define PB push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define X first
#define Y second
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

template <class T>  
inline bool RD(T &ret) {  
        char c; int sgn;  
        if (c = getchar(), c == EOF) return 0;  
        while (c != '-' && (c<'0' || c>'9')) c = getchar();  
        sgn = (c == '-') ? -1 : 1 , ret = (c == '-') ? 0 : (c - '0');  
        while (c = getchar(), c >= '0'&&c <= '9') ret = ret * 10 + (c - '0');  
        ret *= sgn;  
        	return 1;  
}  
template <class T>  
inline void PT(T x) {  
        if (x < 0) putchar('-') ,x = -x;  
        if (x > 9) PT(x / 10);  
        putchar(x % 10 + '0');  
}
typedef unsigned long long LL;
typedef pair<int, int> pii;
typedef long double LD;
const int INF = 0x3f3f3f3f;


const int N = 12;
char s[12];

int main() {
	scanf("%s", s);
	int n = strlen(s);
	LL ans = 0;
	for(int l = 0; s[l]; l ++) {
		LL cur = 0;
		for(int r = l; r < n; r ++) {
			cur = cur * 10 + s[r] - '0';
			ans += cur * (1 << max(0, (l - 1))) * (1 << max(0, (n - r - 2)));
		}
	}
	printf("%lld\n", ans);
}


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

using namespace std;

vector<int> AdjList[100005];

int c[100005];
int p[100005];

int dist[100005];

int main(){
	int N;
	scanf("%d", &N);
	
	for(int i = 1; i < N; i ++){
		int a, b;
		scanf("%d%d", &a, &b);
		AdjList[a].push_back(b);
		AdjList[b].push_back(a);
	}
	
	for(int i = 0; i < N; i ++){
		scanf("%d", &c[i]);
	}
	sort(c, c+N);
	reverse(c, c+N);
	
	memset(dist, -1, sizeof(dist));
	queue<int> q;
	q.push(1);
	dist[1] = 0;
	while(!q.empty()){
		int u = q.front(); q.pop();
		for(int v: AdjList[u]){
			if(dist[v] == -1){
				dist[v] = dist[u]+1;
				q.push(v);
			}
		}
	}
	
	int temp = 0;
	int res = 0;
	for(int i = 0; i < N; i ++){
		if(dist[i]>temp){
			res=i;
			temp=dist[i];
		}
	}
	
	memset(dist, -1, sizeof(dist));
	q = queue<int>();
	q.push(res);
	dist[res] = 0;
	p[res] = -1;
	while(!q.empty()){
		int u = q.front(); q.pop();
		for(int v: AdjList[u]){
			if(dist[v] == -1){
				dist[v] = dist[u]+1;
				p[v] = u;
				q.push(v);
			}
		}
	}
	
	
	temp = 0;
	int res2 = 0;
	for(int i = 0; i < N; i ++){
		if(dist[i]>temp){
			res2=i;
			temp=dist[i];
		}
	}
	
	for(int i = 0; i < temp/2; i ++){
		res2 = dist[res2];
	}
	
	
	int indx = 1;
	memset(dist, -1, sizeof(dist));
	q = queue<int>();
	q.push(res);
	dist[res] = c[0];
	while(!q.empty()){
		int u = q.front(); q.pop();
		for(int v: AdjList[u]){
			if(dist[v] == -1){
				dist[v] = c[indx++];
				q.push(v);
			}
		}
	}
	
	int ans = 0;
	for(int i = 1; i <= N; i ++){
		for(int j: AdjList[i]){
			ans += min(dist[i], dist[j]);
		}
	}
	
	printf("%d\n", ans/2);
	for(int i = 1; i <= N; i ++){
		printf("%d", dist[i]);
		if(i != N){
			printf(" "); 
		}
	}
	
	return 0;
}


Measured memory_bytes: 3456
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(NULL));

int const mod = 1e9 + 7;
namespace {
	ll mul(ll a, ll b) {
		ll val = a * b - (ll)((ld)a * b / mod) * mod;
		if (val < 0) val += mod;
		if (val >= mod) val -= mod;
		return val;
	}
	ll poww(ll a, ll b){
		ll val = 1;
		a %= mod;
		while (b > 0) {
			if (b % 2) val = mul(a, val);
			a = mul(a, a);
			b >>= 1;
		}
		return val % mod;
	}
	ll inv(ll a) {
		return poww(a, mod - 2);
	}
}

int const maxn = 2e5 + 5;


signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll k, x; cin >> k >> x;
	for (ll i = -1000000; i <= 1000000; i++) {
		if (abs(i - x) < k) {
			cout << i << " ";
		}
	}
	return 0;
}
/*

*/

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

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef long double ld;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

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

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





int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int a,b;
    cin>>a>>b;
    --a;--b;

    cout<<"80 80"<<endl;

    char g[80][80];


    rep(i,80){
        char c;

        if(i<40)c='#';
        else c='.';

        rep(j,80)g[i][j]=c;
    }


    bool br=false;
    for(int i=0; i<40; i+=2){
        
        for(int j=0;j<80;j+=2){
            if(a==0){br=true;break;}
            g[i][j] = '.';
            --a;
        }

        if(br)break;
    }

    br=false;
    for(int i=41;i<80;i+=2){
        
        for(int j=0;j<80;j+=2){
            if(b==0){br=true;break;}
            g[i][j] = '#';
            --b;
        }

        if(br)break;
    }


    rep(i,80){
        rep(j,80){
            cout<<g[i][j];
        }
        ln;
    }


    //cout <<fixed<<setprecision(16)<< << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


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

using namespace std;

int main() {
  string Sa, Sb, Sc;
  cin >> Sa >> Sb >> Sc;
  int ia = 0;
  int ib = 0;
  int ic = 0;
  int Na = Sa.size();
  int Nb = Sb.size();
  int Nc = Sc.size();
  char t = 'a';
  while (true) {
    if (t == 'a') {
      while (ia < Na && Sa[ia] == 'a') {
        ++ia;
      }
      if (ia >= Na) {
        printf("A\n");
        return 0;
      }
      t = Sa[ia++];
    }
    if (t == 'b') {
      while (ib < Nb && Sb[ib] == 'b') {
        ++ib;
      }
      if (ib >= Nb) {
        printf("B\n");
        return 0;
      }
      t = Sb[ib++];
    }
    if (t == 'c') {
      while (ic < Nc && Sc[ic] == 'c') {
        ++ic;
      }
      if (ic >= Nc) {
        printf("C\n");
        return 0;
      }
      t = Sc[ic++];
    }
  }
}

Measured memory_bytes: 3000
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<set>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<queue>
#define mem(x) memset(x,0,sizeof(x)) 
#define sca(x) scanf("%d",&x)
#define scaa(x,y) scanf("%d%d",&x,&y)
#define inf 0x7f7f7f7f
#define io ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#pragma GCC optimize(2)
using namespace std;
const double pi=acos(-1); 
const double eps=1e-6;
typedef pair<long,long> pll;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<char,char> pcc;
int main()
{
	int n;
	cin>>n;
	cout<<(1000-n%1000)%1000<<endl;
} 

Measured memory_bytes: 3612
// Ho-kago Tea Time

#include <bits/stdc++.h>

using namespace std;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getchar());
	for(; !isdigit(ch); ch = getchar()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getchar()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

typedef long long LL;
typedef pair<int, int> pii;

const int MAXN = (int) 2e5;

int n;

int p[MAXN + 5];

inline void input()
{
	n = read<int>();
	for(int i = 1; i <= n; ++i) p[i] = read<int>();
}

struct RMQ
{
	static const int MAX_LOG = 20;

	int lg2[MAXN + 5], mn[MAX_LOG + 1][MAXN + 5];

	inline int min_id(int u, int v) { return !u || !v ? u | v : (p[u] < p[v] ? u : v); }

	inline void build(int t)
	{
		lg2[1] = 0;
		for(int i = 2; i <= n; ++i) lg2[i] = lg2[i >> 1] + 1;

		for(int i = 1; i <= n; ++i) mn[0][i] = (i & 1) == t ? i : 0;
		for(int k = 1; k <= lg2[n]; ++k)
			for(int i = 1; i + (1 << k) - 1 <= n; ++i)
				mn[k][i] = min_id(mn[k - 1][i], mn[k - 1][i + (1 << (k - 1))]);
	}

	inline int query(int l, int r)
	{
		int k = lg2[r - l + 1];
		return min_id(mn[k][l], mn[k][r - (1 << k) + 1]);
	}
};

struct seg
{
	int l, r, mn;

	inline bool operator > (const seg &rhs) const { return this->mn > rhs.mn; }

	seg() { }
	seg(int _l, int _r, int _mn): l(_l), r(_r), mn(_mn) { }
};

inline void solve()
{
	static RMQ S[2];
	for(int i = 0; i < 2; ++i) S[i].build(i);

	static priority_queue<seg, vector<seg>, greater<seg> > Q;
	static vector<int> ans;

	Q.emplace(1, n, p[S[1].query(1, n)]);
	while(!Q.empty())
	{
		int l = Q.top().l, r = Q.top().r;
		Q.pop();
		if(l + 1 == r)
		{
			ans.push_back(p[l]);
			ans.push_back(p[r]);
			continue;
		}

		int x = S[l & 1].query(l, r), y = S[(l + 1) & 1].query(x + 1, r);
		ans.push_back(p[x]);
		ans.push_back(p[y]);

		if(l < x) Q.emplace(l, x - 1, p[S[l & 1].query(l, x - 1)]);
		if(x + 1 < y) Q.emplace(x + 1, y - 1, p[S[(x + 1) & 1].query(x + 1, y- 1)]);
		if(y < r) Q.emplace(y + 1, r, p[S[(y + 1) & 1].query(y + 1, r)]);
	}

	for(auto i : ans) printf("%d ", i);
	puts("");
}

int main()
{
#ifdef K_ON // K-ON!
	freopen("E.in", "r", stdin);
	freopen("E.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}



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

// low以上high以下のbaseの倍数の数
ll baisu(ll base, ll low, ll high){
    ll bt = (low + base - 1) / base;
    ll up = high / base;
    return up - bt + 1;
}

int main(){
    ll a, b, x;
    cin >> a >> b >> x;
    cout << baisu(x, a, b) << endl;
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  int ans = 0;
  for(int i=1; i<=N; i=i+2){
    int flag=0;
    for(int j=1; j<=i; j++){
      if(i%j==0) flag++;
    }
    if(flag==8) ans++;
  }
  cout << ans << endl;
}

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

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static long LINF = 1L << 55;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long a = 0;
			long ab = 0;
			long abc = 0;
			long all = 1;

			char[] s = in.nextString().toCharArray();

			for (char c : s) {
				if (c == 'A') {
					a += all;
				} else if (c == 'B') {
					ab += a;
				} else if (c == 'C') {
					abc += ab;
				} else if (c == '?') {
					long da = all;
					long dab = a;
					long dabc = ab;
					a *= 3;
					ab *= 3;
					abc *= 3;
					all *= 3;
					a += da;
					ab += dab;
					abc += dabc;
					a %= MOD;
					ab %= MOD;
					abc %= MOD;
					all %= MOD;
				}
			}
			out.println(abc % MOD);
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

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

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

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

		public int[] nextIntArrayDec(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt() - 1;
			}
			return res;
		}

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

		public long[] nextLongArrayDec(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong() - 1;
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


Measured memory_bytes: 22996
A, B = map(int, input().split())

#GCD
def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

#List of divisors

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


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

n = gcd(A, B)
x = divisor(n)
count = 0
for i in x:
    prim_list = factrization(i)
    if len(prim_list) == 1:
        count += 1
print(count)

Measured memory_bytes: 3884
/*input
12345678 87654321 12345678 87654321
123456789
*/

#include <iostream>
#include <limits>
using namespace std;
#define ll long long
ll db(ll q, ll h, ll s, ll d, ll n) {
	//Fill with doubles
	if(n%2 == 0) return (n/2) * d;
	else {
		ll ans = ((n-1)/2) * d;
		ans += min(4*q,min(2*h, s));
		return ans;
	}
}

int main() {
	long long q,h,s,d,n;
	cin >> q >> h >> s >> d >> n;
	ll m = numeric_limits<ll>::max();
	if(m > 4*n*q) m = 4*n*q;
	if(m > 2*n*h) m = 2*n*h;
	if(m > n*s) m = n*s;
	if(m > db(q,h,s,d,n)) m = db(q,h,s,d,n);
	cout << m << endl;
}

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

#define For(i, j, k) for(int i = j; i <= k; i++)

using namespace std;

const int N = 1e5 + 10;

int r, c, n, m;

struct Segment{
	int L, R;

	bool operator < (const Segment& B) const{
		return L < B.L;
	}
}A[N];

int check(int x, int y){
	if(x == 0) return y;
	if(y == c) return x + c;
	if(x == r) return 2 * c + r - y;
	if(y == 0) return 2 * (r + c) - x;
	return -1;
}

int stk[N], top;

int main(){
	scanf("%d%d%d", &r, &c, &n);
	For(i, 1, n){
		int a, b, c, d;
		scanf("%d%d%d%d", &a, &b, &c, &d);
		A[m].L = check(a, b), A[m].R = check(c, d);
		if(A[m].L >= 0 && A[m].R >= 0){
			if(A[m].L > A[m].R) swap(A[m].L, A[m].R);
			++m;
		}
	}

	sort(A, A + m);
	For(i, 0, m - 1){
		while(top && stk[top] < A[i].L) --top;
		if(top && stk[top] < A[i].R){
			puts("NO");
			return 0;
		}
		stk[++top] = A[i].R;
	}

	puts("YES");
	return 0;
}

Measured memory_bytes: 1280
# -*- coding: utf-8 -*-

def main():
    p_cnt = int(input())
    all_height = list(map(lambda x: int(x), input().split(' ')))
    max_height = 0
    sum_height = 0

    for i in range(p_cnt):
        if i == 0:
            max_height = all_height[i]
        else:
            if max_height > all_height[i]:
                sum_height += max_height - all_height[i]
            else:
                max_height = all_height[i]

    print(sum_height)

if __name__ == '__main__':
    main()

Measured memory_bytes: 32192
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

    private static PrintWriter out;

    private static <T> void mprintln(T ... ar){
        for(T i: ar) out.print(i + " ");
        out.println();
    }

    public static void main(String[] args) throws FileNotFoundException{

        // Input from file
        // File inputFile = new File("JavaFile.txt");
        // File outputFile = new File("JavaOutputFile.txt");
        // FileReader fileReader = new FileReader(inputFile);
        // Here it ends

        MyScanner sc = new MyScanner();
        // MyScanner sc = new MyScanner(fileReader);

        out = new PrintWriter(new BufferedOutputStream(System.out)); // Output to console
        // out = new PrintWriter(new PrintStream(outputFile)); // Output to file

        getAns(sc);

        out.close();
    }

    /*
     *Don't use builtin function (Math.ceil)
     */
    private static void getAns(MyScanner sc){
        int[] ar = sc.niArr0(3);
        int five = 0 , seven = 0;
        for(int in: ar) if(in == 5) five++; else if(in == 7) seven++;

        out.println(five == 2 && seven == 1? "YES": "NO");
    }

    static class MyScanner{
        BufferedReader br;
        StringTokenizer st;

        MyScanner(FileReader fileReader){
            br = new BufferedReader(fileReader);
        }

        MyScanner(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nn(){
            while(st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch(IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine(){
            String ans = "";
            try {
                ans = br.readLine();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            return ans;
        }

        char nc(){
            return nn().charAt(0);
        }

        int ni(){
            return Integer.parseInt(nn());
        }

        long nl(){
            return Long.parseLong(nn());
        }

        double nd(){
            return Double.parseDouble(nn());
        }

        int[] niArr0(int n){
            int[] ar = new int[n];
            for(int i = 0; i < n; i++) ar[i] = ni();
            return ar;
        }

        int[] niArr1(int n){
            int[] ar = new int[n + 1];
            for(int i = 1; i <= n; i++) ar[i] = ni();
            return ar;
        }

        long[] nlArr0(int n){
            long[] ar = new long[n];
            for(int i = 0; i < n; i++) ar[i] = nl();
            return ar;
        }

        long[] nlArr1(int n){
            long[] ar = new long[n + 1];
            for(int i = 1; i <= n; i++) ar[i] = nl();
            return ar;
        }
    }
}

Measured memory_bytes: 21076
import itertools
n = int(input())
count ={'M':0,'A':0,'R':0,'C':0,'H':0}

for _ in range(n):
  temp = input()
  init = temp[0]
  if init in ('M','A','R','C','H'):
    count[init]+=1

ans=0

for x,y,z in list(itertools.combinations(count,3)):
  ans+=count[x]*count[y]*count[z]
else:
  print(ans)

Measured memory_bytes: 3064
from math import factorial

n,k = map(int,input().split())
mod = 10**9+7

def cmb(n,r):
    return factorial(n) // (factorial(r) * factorial(n-r))

for i in range(1,k+1):
    if n-k+1 < i or k-1 < i-1:
        print(0)
    else:
        x = cmb(k-1,i-1) % mod
        y = cmb(n-k+1,i) % mod
        ans = (x*y) % mod
        print(int(ans))

Measured memory_bytes: 3316
/*我是萌新*/
#include<iostream>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include <iomanip> 
typedef long long ll;
const int mod = 1e9+7;
using namespace std;
ll gcd(ll a, ll b){
    return b?gcd(b,a%b):a;
}
ll lcm(ll a, ll b){
    return a/gcd(a,b)*b;
}
bool cmp(int x, int y)
{
    return x > y;
}
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    ll n,m;
    while (cin >> n>>m)
    {
        ll *p=new ll[n+5],ans=0;
        for(ll i=0;i<n;i++)
        {
            cin>>p[i];
            ans+=p[i];
            }
       sort(p,p+n,cmp);
       double mm=1.0*ans/(4*m);ll res=0;
       for(ll i=0;i<m;i++)
       {
          if(double(p[i])>=mm)res++;
       }
       if(res==m)cout<<"Yes\n";
       else cout<<"No\n";
    }
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define pb push_back
#define fi first
#define se second
const int INF = 1e9;
using namespace std;
const int MOD = 998244353;
const int MX = 777777 + 5;
int fac[MX+5],inv[MX+5];
 
int power(int x,int y){
	int res=1;
	x=x%MOD;
	while(y){
		if(y&1)res=(res*x)%MOD;
		y=y>>1;
		x=(x*x)%MOD;
	}
	return res;
}

signed main() {
    int N; cin >> N;
    int A[N+10] = {0};
    bool frag = false;
    int b;
    int ans = 1;
    int pos = 1;
    rep(i,N){
        int a; cin >> a;
        if(!i) b=a; 
        A[a]++;
    }
    if(b!=0) {cout << 0 << endl; return 0;}
    rep(i,N){
        if(!i) {if(A[i]!=1){ans=0; break;}}
        else {
            if(!frag && pos>0) ans = (ans*power(pos,A[i]))%MOD;
            else if(A[i]==0) frag = true;
            else {ans=0; break;}
            pos = A[i];
        } 
    }
    cout << ans << endl;
}


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

void Main() {
  long long w, h, x, y;
  cin >> w >> h >> x >> y;

  cout << double(w) * double(h) / 2 << " " << (x + x == w && y + y == h) << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
N = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(N-1):
    if p[i] == i+1:
        p[i], p[i+1] = p[i+1], p[i]
        ans += 1
if p[N-1] == N:
    ans += 1
print(ans)


Measured memory_bytes: 14008
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;
const int MOD = 1000000007;

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

    int a,b; cin >> a >> b;

    rep(i,3){
        if(i+1 !=  a  && i+1 != b)  cout << i+1 << endl;
    }

    return 0;
}

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

int main() {
	string s;
	cin >> s;
	if(s.substr(0,4) == "YAKI")
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
	cout <<endl;
	return 0;
}


Measured memory_bytes: 256
X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

K=min(K,3000)

AB=[a+b for a in A for b in B]
AB.sort(reverse=True)

ABC=[ab+c for ab in AB[:K] for c in C[:K]]
ABC.sort(reverse=True)

for k in range(K):
	print(ABC[k])


Measured memory_bytes: 206192
s=input()[::-1]
n=len(s)
cnts=[0]*2019
cnts[0]=1
num=0
for i in range(n):
  num+=int(s[i])*pow(10,i,2019)
  num%=2019
  cnts[num]+=1

ans=0
for cnt in cnts:
  ans+=cnt*(cnt-1)//2
  
print(ans)


Measured memory_bytes: 9264
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

s, t = read().decode().rstrip().split()
ans = 'No'
for i in range(len(s)):
    s = s[-1]+s[:-1]
    if s == t:
        ans = 'Yes'
        continue
print(ans)


Measured memory_bytes: 9104
#include <iostream>
#include <algorithm>

using namespace std;


int main()
{
	int n,score[101];
	while (cin >> n, n){

		//初期化
		for (int i = 0; i < 101; i++)
			score[i] = 0;
		int sum = 0;
		int maxs = 0;
		int mins = 1001;


		//入力
		for (int i = 0; i < n; i++){
			cin >> score[i];
			sum += score[i];
		}

		//最大，最小
		for (int i = 0; i < n; i++){
			maxs = max(maxs, score[i]);
			mins = min(mins, score[i]);
		}

		cout << (sum - maxs - mins) / (n - 2) << endl;

	}

	return 0;
}

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

ll a[200005];

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  ll n;cin>>n;
  ll p = 0;
  for(ll i=0;i<n;i++){
    cin>>a[i];
    if(i==0) p=a[i];
    else p=p^a[i];
  }
  for(ll i=0;i<n;i++){
    if(i)cout<<' ';
    cout<<(p^a[i]);
  }
  cout<<endl;

  
  return 0;
}


Measured memory_bytes: 5096
A, B, C, X = map(int, [input() for _ in range(4)])
count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if a * 500 + b * 100 + c * 50 == X:
                count += 1
print(count)

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


#define int long long int 

#define PI 3.14159265358979323846264338327950L

int32_t main()
{
    int a,b,h,m;
    cin>>a>>b>>h>>m;

    long double rad=2*PI*((long double)h/12.0 + ((long double)m/60.0)/12.0 - (long double)m/60.0);
    long double c=(long double)(a*a+b*b)-(long double)(2*a*b)*cos(rad);
    cout<<setprecision(20)<<fixed<<(long double)(sqrtl(c))<<endl;
}

Measured memory_bytes: 4024
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <cmath>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int count(int N)
{
        int cnt = 0;
        while (N % 2 == 0)
        {
                cnt++;
                N /= 2;
        }
        return cnt;
}

int main()
{
        int N, T, A;
        cin >> N >> T >> A;
        vector<int> H(N + 1);
        rep(i, N) cin >> H[i];
        int temp = 10000000;
        int ans = 0;
        rep(i, N)
        {
                if (temp >= abs(1000 * T - 6 * H[i] - A * 1000))
                {
                        ans = i + 1;
                        temp = abs(1000 * T - 6 * H[i] - A * 1000);
                }
        }

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


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

/*int stoi(string a){
	int ret;
	stringstream ss;
	ss<<a;
	ss>>ret;
	return ret;
	}*/

int main(){
	string s;
	while(getline(cin,s)&&s!="0"){
		s.push_back(' ');
		int one=0;
		int sum=0;
		
		string a;
		for(int i=0;i<s.size();i++){
			if(s[i]==' '){
				int b=stoi(a);
				if(b==1)one++;
				else if(b>10)sum+=10;
				else sum+=b;
				a.clear();
				}
			else a.push_back(s[i]);
			}
			sum+=one;
			for(int i=0;i<one;i++){
				if(sum<12)sum+=10;
				}	
				
			if(sum>21)sum=0;	
			cout<<sum<<endl;	
		}
	return 0;
	}

Measured memory_bytes: 3044
# -*- coding: utf-8 -*-
n = int(input())
an = list(map(int, input().split()))

dic = {}

for i, a in zip(range(0, n), an):
    dic[a] = i + 1

l = []
for i in range(0,n):
    l.append(str(dic[i+1]))

print(' '.join(l))

Measured memory_bytes: 24924
#include <iostream>
#include<string>

using namespace std;

int isFlag(string S, int N, int start) {
	for (int i = 0; i < N; i++) {
		switch (S[i + start]) {
		case '0':return 0;
		case '1':return 0;
		case '2':return 0;
		case '3':return 0;
		case '4':return 0;
		case '5':return 0;
		case '6':return 0;
		case '7':return 0;
		case '8':return 0;
		case '9':return 0;
		}
	}
	return 1;
}

int main() {
	int A, B;
	string S;
	int flag = 0;

	cin >> A >> B >> S;

	if (S.size() != A + B + 1) flag += 1;

	else {
		flag += isFlag(S, A, 0);
		if (S[A] != '-') flag += 1;
		flag += isFlag(S, B, A + 1);
	}

	if (flag == 0) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;

int h, w;
char mp[22][22];

const int nx[] = { 1, 0,-1, 0};
const int ny[] = { 0, 1, 0,-1};

int dfs(int y, int x);

int main(){
  ios_base::sync_with_stdio(false);

  int sx, sy;

  while(true){

    cin >> w >> h;

    if(w == 0 && h == 0){
      break;
    }

    for(int i=0;i<h;i++){
      cin >> mp[i];
      for(int j=0;j<w;j++){
        if(mp[i][j] == '@'){
          sy = i;
          sx = j; 
        } 
      }
    }

    cout << dfs(sy, sx) << endl;

  }
  return 0;
}

int dfs(int y, int x){
  if(y >= 0 && x >= 0 && y < h && x < w && mp[y][x] != '#'){
    mp[y][x] = '#';
    int t = 0;
    for(int i=0;i<4;i++){
      t += dfs(y + ny[i], x + nx[i]);
    }
    return t+1;
  }
  return 0;
}



Measured memory_bytes: 3192
object Main {
  def main(args: Array[String]): Unit = {
    val Seq(n, m): Seq[Int] = io.StdIn.readLine().split(' ').map(_.toInt)

//    import scala.collection.mutable.IndexedSeq
    val ans = collection.mutable.IndexedSeq.fill(n)(0)
    for(_ <- 0 until m) {
      val Seq(a, b): Seq[Int] = io.StdIn.readLine().split(' ').map(_.toInt - 1)
      ans(a) += 1
      ans(b) += 1
    }

    ans.foreach(println)
  }
}

Measured memory_bytes: 27200
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #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 REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

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

int n,m;
struct edge{ int u,v,d; };
vector<edge> edges;
vi dist;
vi nega;

int BellmanFord(int source){
    REP(i,n){
        if(i == 0) {
            dist[i] = 0;
        } else {
            dist[i] = 1e+14;
        }
        nega[i] = 0;
    }

    REPS(i,n-1){
        for(auto uv: edges){
            auto u = uv.u;
            auto v = uv.v;
            if ( dist[v] > dist[u] + uv.d){
                dist[v] = dist[u] + uv.d;
            }
        }
    }

    REPS(i,n-1) for(auto uv: edges){
        auto u = uv.u;
        auto v = uv.v;
        if (dist[u] + uv.d < dist[v]) nega[v] = 1;
        if (nega[u]) nega[v] = 1; 
    }
    return -dist[n-1];
}

signed main(){
    I(n); I(m);
    int a,b,c;
    REP(i,m){
        I(a); I(b); I(c);
        edges.pb(edge({a-1,b-1,-c}));
    }
    dist.resize(n);
    nega.resize(n);

    int r = BellmanFord(0);
    if(nega[n-1]){
        cout << "inf" << endl;
    } else {
        cout << r << endl;
    }
}

Measured memory_bytes: 384
N, K = map(int, input().split())

if K > (N-2)*(N-1)/2:
    print(-1)
    quit()

ans = ''
M = 0
for i in range(N-1):
    tmp = str(i+1) + ' ' + str(N) + '\n'
    ans += tmp
    M += 1
counter = (N-2) * (N-1) // 2

for i in range(N-1):
    for j in range(i+1, N-1):
        if counter > K:
            tmp = str(i+1) + ' ' + str(j+1) + '\n'
            ans += tmp
            M += 1
            counter -= 1

print(M)
print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define yes(n) cout << ((n) ? "yes" : "no") << endl

using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;
const vector<int> di = {-1,  0, 1, 0};
const vector<int> dj = { 0, -1, 0, 1};

void chmin(int &a, int b) { if (a > b) a = b; }

ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll LCM(ll a, ll b) {
    ll g = GCD(a, b);
    return a / g * b;
}


int main() {
    int n, q;
    ll k;
    cin >> n >> k >> q;
    vector<ll> p(n, k - q);
    rep(i, q) {
        int a;
        cin >> a;
        a--;
        p[a]++;
    }
    rep(i, n) {
        Yes(p[i]>0);
    }
}

Measured memory_bytes: 1408
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
sat = 0
pre_a = 0
for i, a in enumerate(A):
    sat += B[a-1]
    if i > 0 and pre_a == a -1:
        sat += C[pre_a-1]
    pre_a = a
print(sat)

Measured memory_bytes: 3064
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def SI(): return input()
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')

def main():
    N, M = LI()
    demands = []
    for i in range(M):
        demands.append(LI())

    demands = sorted(demands, key=lambda x: x[1])
    demands_met_flag = [False]*len(demands)

    counter = 0
    deleting_bridge = 0
    for i in range(len(demands)):
        if demands_met_flag[i] == True: continue
        if demands[i][0] <= deleting_bridge:
            demands_met_flag[i] = True
            continue
        demand = demands[i]
        demands_met_flag[i] = True
        counter += 1
        deleting_bridge = demand[1]-1

    print(counter)

main()


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

using namespace std;

int main()
{
    string str;
    long long n;
    cin >> str;
    cin >> n;

    long long i = 0;
    while (n > 0 && i < str.size()) {
        if (str[i] == 'a') {
            i++;
            continue;
        }
        if ('z' - str[i] < n) {
            n -= 'z' - str[i] + 1;
            str[i] = 'a';
        }
        i++;
    }
    if (n > 0) {
        long long l = str.size();
        str[l-1] = 'a' + (str[l-1] - 'a' + n) % 26;
    }

    cout << str << endl;
    return 0;
}

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF   = 1e9;
const ll  INFLL = 1e18;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

struct Node { int id, x, y; };
bool cmp1(const Node &lhs, const Node &rhs) { return lhs.x < rhs.x; }
bool cmp2(const Node &lhs, const Node &rhs) { return lhs.y < rhs.y; }

int N;

struct Edge {
    int u, v, cost;
    Edge(int _u, int _v, int _c) : u(_u), v(_v), cost(_c) {}
    bool operator<(const Edge &rhs) const { return cost < rhs.cost; }
};

class UnionFind {
private:
    vector<int> union_size, rank;

public:
    vector<int> par;
    UnionFind(int n) : union_size(vector<int>(n)), rank(vector<int>(n)), par(vector<int>(n)) { init(n); }

    void init(int n)
    {
        for (int i=0; i<n; i++) {
            par[i]=i;
            rank[i]=0;
            union_size[i] = 1;
        }
    }
    
    int find(int x)
    {
        if (par[x] == x) {
            return x;
        } else {
            return par[x] = find(par[x]);
        }
    }

    void merge(int x, int y)
    {
        x = find(x);
        y = find(y);
        if (x == y) return;

        union_size[x] += union_size[y];
        union_size[y] = union_size[x];

        if (rank[x] < rank[y]) {
            par[x] = y;
        } else {
            par[y] = x;
            if (rank[x] == rank[y]) rank[x]++;
        }
    }
    
    bool same(int x, int y) { return find(x) == find(y); }
    int getUnionSize(int x) { return union_size[find(x)]; }
};

vector<Edge> G;
ll kruskal()
{
    UnionFind UF(N);
    sort(G.begin(), G.end());
    UF.init(N);
    ll res=0;
    for (Edge e : G) {
        if (!UF.same(e.u, e.v)) {
            UF.merge(e.u, e.v);
            res += e.cost;
        }
    }
    return res;
}

int main()
{
    ios::sync_with_stdio(false);

    cin >> N;
    vector<Node> VS(N);
    rep(i, N) {
        int X, Y;
        cin >> X >> Y;
        VS[i] = {i, X, Y};
    }

    sort(VS.begin(), VS.end(), cmp1);
    rep(i, N-1) {
        int cost = min(abs(VS[i].x - VS[i+1].x), abs(VS[i].y - VS[i+1].y)); 
        G.push_back(Edge(VS[i].id, VS[i+1].id, cost));
    }

    sort(VS.begin(), VS.end(), cmp2);
    rep(i, N-1) {
        int cost = min(abs(VS[i].x - VS[i+1].x), abs(VS[i].y - VS[i+1].y)); 
        G.push_back(Edge(VS[i].id, VS[i+1].id, cost));
    }

    cout << kruskal() << endl;
}

Measured memory_bytes: 6132
N, *XY = map(int, open(0).read().split())

XY = [(x, y) for x, y in zip(*[iter(XY)] * 2)]
XY = list(set(XY))

Ax, Ay = max(XY, key=lambda t: t[0] + t[1])
Bx, By = max(XY, key=lambda t: -t[0] + t[1])
Cx, Cy = max(XY, key=lambda t: t[0] - t[1])
Dx, Dy = max(XY, key=lambda t: -t[0] - t[1])

print(max(
    max(abs(x - Ax) + abs(y - Ay),
        abs(x - Bx) + abs(y - By),
        abs(x - Cx) + abs(y - Cy),
        abs(x - Dx) + abs(y - Dy),
    ) for x, y in XY
))

Measured memory_bytes: 54960
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		if(A > 8 || B > 8) {
			System.out.println(":(");
		} else {
			System.out.println("Yay!");
		}
		
	}
}


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

class Program
{
    static void Main()
    {
        int w = Enumerable.Range(0, 10)
            .Select(_ => int.Parse(Console.ReadLine()))
            .OrderByDescending(x => x)
            .Take(3)
            .Sum();

        int k = Enumerable.Range(0, 10)
            .Select(_ => int.Parse(Console.ReadLine()))
            .OrderByDescending(x => x)
            .Take(3)
            .Sum();

        (w + " " + k).Print();
    }
}

static class Extensions
{
    public static void Print(this object obj)
    {
        Console.WriteLine(obj);
    }
}

Measured memory_bytes: 10112
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

int main(void)
{
    int n, p[20];
    int ans = 0;
    scanf("%d", &n);
    rep(i, n)
        scanf("%d", &p[i]);

    rep(i, n - 2) 
        if (p[i + 1] != min(p[i], min(p[i + 1], p[i + 2])) && p[i + 1] != max(p[i], max(p[i + 1], p[i + 2])))
            ans++;

    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
package main

import (
	"fmt"
	"math"
)

var X, A, B, ans int

func main() {
	fmt.Scan(&X, &A, &B)
	var t int = X - A - B*((X-A)/B)
	fmt.Println(t)
}

/*  ----------------------------------------  */

func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }

type XY struct {
	x int
	y int
}
type SortBy []XY

func (a SortBy) Len() int      { return len(a) }
func (a SortBy) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool {
	if a[i].x == a[j].x {
		return a[i].y > a[j].y
	}
	return a[i].x > a[j].x
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String S = scan.next();

		String anser = "No";

		if(S.contains("A") && S.contains("B")) {
			anser = "Yes";
		}
		System.out.println(anser);
	}

}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
 
#define ll long long
#define X first
#define Y second
#define MP make_pair
#define ld long double
 
using namespace std;
 
const int N = 5e5 + 123;
const ll mod = 1e9 + 7;

int n;
bool ps[20];
ll a[20][20], dp[N];

void rec(int mask, int newmask=0, int v=0){
	if(v == n){
		dp[mask + newmask] = max(dp[mask + newmask], dp[mask] + dp[newmask]);
		return;
	}
	rec(mask, newmask, v + 1);
	if(ps[v] == 0){
		rec(mask, newmask + (1 << v), v + 1);
	}
}

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

	cin >> n;
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			cin >> a[i][j];
		}
	}

	for(int mask = 0;mask < (1 << n);mask++){
		for(int i = 0;i < n;i++){
			for(int j = i + 1;j < n;j++){
				if(((mask >> i) & 1) && ((mask >> j) & 1)){
					dp[mask] += a[i][j];
				}
			}
		}
	}

	for(int mask = 0;mask < (1 << n);mask++){
		for(int i = 0;i < n;i++){
			if((mask >> i) & 1)
				ps[i] = 1;
		}

		rec(mask);

		for(int i = 0;i < n;i++){
			if((mask >> i) & 1)
				ps[i] = 0;
		}
	}
	                                                   
	cout << dp[(1 << n) - 1];
}


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

int main() {
    int x, a;
    cin >> x >> a;
    if (x < a) cout << 0 << endl;
    else cout << 10 << endl;
    return 0;
}


Measured memory_bytes: 3552
import java.util.Scanner;

public class  Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in); //
        String c = sc.nextLine();

        if (c.equals("a")) {
            System.out.println("vowel");
        } else if (c.equals("i")) {
            System.out.println("vowel");
        } else if (c.equals("u")) {
            System.out.println("vowel");
        } else if (c.equals("e")) {
            System.out.println("vowel");
        } else if (c.equals("o")) {
            System.out.println("vowel");
        } else {
            System.out.println("consonant");
        }
    }

}

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

int main(void)
{
	int b;
	char a[5];
	scanf("%s",&a);
	b=strlen(a);
	if(b==2){
		printf("%s",a);
	}else{
		printf("%c%c%c",a[2],a[1],a[0]);
	}
	return 0;
}

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

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

using namespace std;

int main() {
	int N,t,i,j;
	vector<int> A(100), B(200000);
	cin >> N;
	REP(i, N) {
		cin >> t;
		A.at(i) = t;
	}
	long long MAX = -1;
	REP(i, N) {
		FOR(j, i, N)
			MAX = max(int(MAX), abs(A[i] - A[j]));
	}
	cout << MAX << endl;
}

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

using namespace std ;

const int MAX = 2e5 + 10 ;

long long arr[MAX] , L[MAX] , R[MAX] ;
int n ;

int main()
{
	memset(L , -1 , sizeof(L)) ;
	memset(R , -1 , sizeof(R)) ;
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n ;
	for(int i = 0 ; i < n ; ++i)
		cin>>arr[i] ;
	stack<int>s ;
	for(int i = 0 ; i < n ; ++i)
	{
		while(s.size() > 0 && arr[s.top()] > arr[i])
		{
			R[s.top()] = i-1 ;
			s.pop() ;
		}
		if(!s.size())
			L[i] = 0 ;
		else
			L[i] = s.top()+1 ;
		s.push(i) ;
	}
	for(int i = 0 ; i < n ; ++i)
	{
		if(L[i] == -1)
			L[i] = 0 ;
		if(R[i] == -1)
			R[i] = n-1 ;
	}
	long long ans = 0ll ;
	for(int i = 0 ; i < n ; ++i)
	{
		long long x = i - L[i] + 1ll ;
		long long y = R[i] - i + 1ll ;
		ans += x * y * arr[i] ;
	}
	return cout<<ans<<"\n" , 0 ;
}		

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

#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007

int main()
{
	fastIO;
	
	int n,m,q,i,j;
	cin>>n>>m>>q;
	int a[n+1]={0};
	vector < int > v[n+1];
	for(i=1;i<=m;i++)
	{
		int x,y;
		cin>>x>>y;
		v[x].pb(y);
	}
	for(i=1;i<=n;i++)
	{
		sort(v[i].begin(),v[i].end());
	}

	while(q--)
	{
		int s,e;
		cin>>s>>e;
		ll c=0;
		for(i=s;i<=e;i++)
		{
			c+=upper_bound(v[i].begin(),v[i].end(),e)-v[i].begin();
		}
		cout<<c<<"\n";
	}
	return 0;
}

Measured memory_bytes: 2176
#include<iostream>
using namespace std;
int dist[100005];
int main(){
  int N,X,Y;
  cin>>N>>X>>Y;
  int cycle=Y-X+1;
  for(int i=1; i<N; i++){
    for(int j=i+1; j<=N; j++){
      if(j<=X || i>=Y) dist[j-i]++;
      else if(i<=X && Y<=j) dist[(X-i)+(j-Y)+1]++;
      else{
        if(i<=X){
          dist[min(j,X+(cycle-(j-X)))-i]++;
        }
        else if(j>=Y){
          dist[j-max(i,Y-(cycle-(Y-i)))]++;
        }
        else{
          dist[min(j-i,cycle-(j-i))]++;
        }
      }
    }
  }
  for(int i=1; i<N; i++) cout<<dist[i]<<endl;
  return 0;
}


Measured memory_bytes: 256