akhauriyash/Code-Regression huggingface dataset:
import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')


def main():
	A=LI()
	print(15-sum(A))





if __name__ == "__main__":
	main()


Measured memory_bytes: 61948
def mid(x, y, z):
    if x <= y <= z or z <= y <= x:
        return y
    elif y <= x <= z or z <= x <= y:
        return x
    return z

def test():
    from random import shuffle
    for _ in range(5):
        arr = [i for i in range(1, 11 + 1)]
        shuffle(arr)
        print(arr, end=" : ")
        while len(arr) > 1:
            tmp = [mid(arr[i], arr[i+1], arr[i+2]) for i in range(len(arr)-2)]
            arr = tmp
        print(arr[0])

def main():
    n, x = map(int, input().split())
    if x == 1 or x == 2*n-1:
        print("No")
    else:
        print("Yes")
        if n == 2:
            for i in range(1, 4):
                print(i)
        else:
            ans = [None]*(2*n - 1)
            st = set(i for i in range(1, 2*n))
            ans[n-1] = x
            st.remove(x)
            if x == 2:
                ans[n-3] = 4
                ans[n-2] = 1
                ans[n] = 3
                st.remove(1)
                st.remove(3)
                st.remove(4)
            else:
                ans[n-3] = x-2
                ans[n-2] = x+1
                ans[n] = x-1
                st.remove(x-2)
                st.remove(x+1)
                st.remove(x-1)
            for i in range(2*n-1):
                if ans[i] is None:
                    ans[i] = st.pop()
            for v in ans:
                print(v)

if __name__ == "__main__":
    main()

Measured memory_bytes: 27732
package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"math"
	"fmt"
)

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_4_D>
 */

func init() {

}

func main() {
	var n int
	fmt.Scanf("%d",&n)

	var min float64 = 1 << 30
	var max float64 = -1 << 30
	var sum int = 0
	for i := 0; i < n; i++ {
		var a int
		fmt.Scanf("%d",&a)
		min = math.Min(min, float64(a))
		max = math.Max(max, float64(a))
		sum += a
	}

	fmt.Println(int(min), int(max), sum)
}

// ????????????1?????????
func StrStdin() (stringReturned string) {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	stringInput := scanner.Text()

	stringReturned = strings.TrimSpace(stringInput)
	return
}

// ??´??°???1?????????
func IntStdin() (int, error) {
	stringInput := StrStdin()
	return strconv.Atoi(strings.TrimSpace(stringInput))
}

// ?????????????????????????????????????????????Split()
func SplitWithoutEmpty(stringTargeted string, delim string) (stringReturned []string) {
	stringSplited := strings.Split(stringTargeted, delim)

	for _, str := range stringSplited {
		if str != "" {
			stringReturned = append(stringReturned, str)
		}
	}

	return
}

// ??????????????§??????????????????????????????????????????
func SplitStrStdin(delim string) (stringReturned []string) {
	// ???????????§1?????????
	stringInput := StrStdin()

	// ????????§??????
	// stringSplited := strings.Split(stringInput, delim)
	stringReturned = SplitWithoutEmpty(stringInput, delim)

	return
}

// ??????????????§??????????????´??°????????????????????????
func SplitIntStdin(delim string) (intSlices []int, err error) {
	// ??????????????????????????????
	stringSplited := SplitStrStdin(" ")

	// ??´??°?????????????????????
	for i := range stringSplited {
		var iparam int
		iparam, err = strconv.Atoi(stringSplited[i])
		if err != nil {
			return
		}
		intSlices = append(intSlices, iparam)
	}
	return
}

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

int main()
{
	int n;
	cin>>n;
	while(n-- > 0){
		double xa, ya, ra, xb, yb, rb;
		cin>>xa >>ya >>ra >>xb >>yb >>rb;
		double ab = sqrt( pow( (xb-xa),2) + pow( (yb-ya),2));
		
		if(ab > ra + rb){
			cout<< 0 <<endl;
		}else if(ab < fabs(ra-rb) && ra>rb){
			cout<< 2 <<endl;
		}else if(ab < fabs(ra-rb) && ra<rb){
			cout<<-2<<endl;
		}else{
			cout<< 1<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1232
#include <stdio.h>

int main(void){
  int i, number;
  int cnt[32]; //30ツづ慊づ?禿シツ療債つウツづェツづゥツづ個づ?堕スツづ淞づ可配ツ療アツづーツ確ツ陛?

  //cntツ配ツ療アツづ個渉可甘コツ可サ
  for(i = 1; i <= 30; i++){
    cnt[i] = 0;
  }

  for(i = 0; i < 28; i++){
    scanf("%d", &number);
    cnt[number]++; //ツ出ツ静按氾板債?つェnumberツづ個人ツづーツカツウツδ督ト
  }

  //1ツ嘉アツづ?カツウツδ督トツつウツづェツづ按つゥツづ?つスツ出ツ静按氾板債?づ個人ツづーツ出ツ療?
  for(i = 1; i <= 30; i++){
    if(cnt[i] == 0){
      printf("%d\n", i);
    }
  }

  return 0;
}

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

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

void main()
{
    string A, B, C;
    scan(A, B, C);
    string s = [A[0], B[0], C[0]];
    s.map!(c => cast(char)(c + ('A' - 'a'))).writeln();
}


Measured memory_bytes: 256
import sys
#input = sys.stdin.readline
from collections import Counter
from copy import deepcopy
from itertools import combinations
from operator import itemgetter

def main():
    n = int(input())
    a = []
    for _ in range(n):
        a.append(tuple(map(int, input().split())))

    # 二つめの要素＝各タスクの締め切り時刻でソート。
    a.sort(key = itemgetter(1))
    # タスク処理時間の積算値をいれる変数
    time = 0
    for i in range(n):
        time += a[i][0]
        if time > a[i][1]:
            print('No')
            exit()
    else:
        print('Yes')

if __name__ == '__main__':
    main()


Measured memory_bytes: 32324
#include <bits/stdc++.h>
#define int llint
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define PI (acos(-1))
#define EPS (1e-10)
#define INF INT_MAX
#define INFLL LLONG_MAX
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using Complex = std::complex<double>;
using namespace std;


int N, T;
int t;


signed main(){
	cin >> N >> T;

	int ans = 0;
	int prev = 0;

	cin >> t;
	rep(i, 1, N){
		cin >> t;
		if(t-prev <= T) ans += (t-prev);
		else ans += T;
		prev = t;
	}

	cout << ans+T << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstring>
#include <algorithm>
#include <map>
#include <stack>
#include <cassert>
#include <cmath>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <vector>
#include <iostream>
#include <set>
#define MP make_pair
#define F first
#define PB push_back
#define S second
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 50;
const int mod = 1e9 + 7;
const int inf = (1 << 30);
int a[maxn], b[maxn], c[maxn];
map <int, int> p;

int main() {
    ios_base::sync_with_stdio(false);
    int n, tmp1 = 0, tmp2 = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        if (i % 2)
            cin >> a[tmp1 ++];
        else
            cin >> b[tmp2 ++];
    }
    sort (a, a + tmp1);
    sort (b, b + tmp2);
    for (int i = 0; i < n; i++) {
        if (i % 2)
            c[i] = a[i / 2];
        else
            c[i] = b[i / 2];
    }
    sort (c, c + n);
    for (int i = 0; i < n; i++)
        p[c[i]] = i;
    ll ans = 0;
    for (int i = 0; i < tmp1; i++)
        if (p[a[i]] % 2 == 0)
            ans ++;
    cout << ans << endl;
}

Measured memory_bytes: 5760
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
    
		// 出力
		System.out.println(a > b ? a - 1 : a);
	}
}


Measured memory_bytes: 19924
import math
N=int(input())
for n in range(1,N+1):
    saidai=math.floor((abs(n-2))**0.5)
    saishou=math.ceil((n//6)**0.5)
    answer=0
    for z in range(saishou,saidai+1):
        if 3+z**2+2*z>n:
            break
        for y in range(1,z+1):
            if y**2+z**2+1+y+z+y*z>n:
                break
            for x in range(1,y+1):
                if x**2+y**2+z**2+x*y+y*z+z*x>n:
                    break

                if x**2+y**2+z**2+x*y+y*z+z*x==n:
                    if x==y==z:
                        answer+=1
                        break
                    elif x==y or y==z or z==x:
                        answer+=3
                        break
                    else:
                        answer+=6
                        break
    print(answer)



Measured memory_bytes: 72296
import java.util.Scanner;

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


		Scanner scanner = new Scanner(System.in);
		int gohyaku = scanner.nextInt();
		int hyaku = scanner.nextInt();
		int goju = scanner.nextInt();
		int goukei_input = scanner.nextInt();

		int toori = 0;

		for(int i = 0; i <= gohyaku; i++) {
			for(int j = 0; j <= hyaku; j++) {
				for(int k = 0; k <= goju; k++) {
					int goukei;
					goukei = i * 500 + j * 100 + k * 50;
					if(goukei_input == goukei) {
						toori++;
					}
				}
			}
		}
		System.out.println(toori);
	}
}


Measured memory_bytes: 21844
s = input()
a = int(s[:2])
b = int(s[2:])
if 1 <= a <= 12 and 1 <= b <= 12:
    print("AMBIGUOUS")
    exit()
if 1 <= a <= 12:
    print("MMYY")
    exit()
if 1 <= b <= 12:
    print("YYMM")
    exit()
print("NA")

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

#define N 2000001
#define V 10001

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

    int A[N], B[N];
    int C[V];

    for (int i = 0; i < V; i++) {
        C[i] = 0;
    }

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


    for (int i = 1; i < V; i++) {
        C[i] += C[i-1];
    }

    for (int i = n - 1; i >= 0; i--) {
        B[C[A[i]]] = A[i];
        C[A[i]]--;
    }

    for (int i = 1; i <= n; i++) {
        if (i != 1) cout << " ";
        cout << B[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 18736
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    string s; cin >> s;
    if(s[s.size()-1]=='s') cout<<s<<"es"<<endl;
    else cout<<s<<"s"<<endl;
}

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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef pair<ll, int> ll_i;

ll INF = LLONG_MAX / 10;

int main() {
	int N, M; cin >> N >> M;
	vector<ll> a(N), b(N), c(N);
	rep(i, N) cin >> a[i] >> b[i] >> c[i];
	ll ma = 0;
	rep(S, 1<<3) {
		vector<ll> v(N);
		rep(i, N) {
			ll x = 0;
			if (S>>0 & 1) x += a[i]; else x -= a[i];
			if (S>>1 & 1) x += b[i]; else x -= b[i];
			if (S>>2 & 1) x += c[i]; else x -= c[i];
			v[i] = x;
		}
		sort(v.rbegin(), v.rend());
		ll sum = 0;
		rep(i, M) sum += v[i];
		ma = max(ma, sum);
	}
	cout << ma << endl;
}


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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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

template<typename T>
void print1(T begin, T end) {
	while (begin != end) {
		cerr << (*begin) << " ";
		*begin++;
	}
	cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
	for (int i = 0; i < height; i++) {
		for (int j = 0; j < width; j++) {
			cerr << " " << Array[i][j];
		}
		cerr << endl;
	}
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	std::cerr << head << " ";
	print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

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

int N;

int calc(vector<int> A, vector<int> B) {
	int ans = 0;
	// 左端
	int dif1 = min(A[0], B[0]);
	ans += dif1;
	A[0] -= dif1;
	B[0] -= dif1;
	dif1 = min(A[1], B[0]);
	ans += dif1;
	A[1] -= dif1;
	B[0] -= dif1;
	// 右端
	dif1 = min(A[N], B[N-1]);
	ans += dif1;
	A[N] -= dif1;
	B[N-1] -= dif1;
	dif1 = min(A[N-1], B[N-1]);
	ans += dif1;
	A[N-1] -= dif1;
	B[N-1] -= dif1;


	for (int i = 1; i < N; i++) {
		int l = min(A[i], B[i]);
		ans += l;
		A[i] -= l;
		B[i] -= l;
		int r = min(A[i+1], B[i]);
		ans += r;
		A[i+1] -= r;
		B[i] -= r;
	}

	return ans;
}

signed main() {
	cin >> N;
	vector<int> A(N+1), B(N);
	rep (i, N+1) {
		cin >> A[i];
	}
	rep (i, N) {
		cin >> B[i];
	}

	int ans = calc(A, B);
	cout << ans << endl;

/*
	line()
	int a = calc(A, B);
	reverse(all(A));
	reverse(all(B));
	line()
	int b = calc(A, B);
	dbg2(a, b)
	cout << max(a, b) << endl;
	*/


	return 0;
}

Measured memory_bytes: 3328
n = int(input())
dp = [float("inf")] * (n+1)
dp[0] = 0

for i in range(n+1):
    a = 1
    while a <= i:
        dp[i] = min(dp[i], dp[i-a] + 1)
        a *= 6
    a = 9
    while a <= i:
        dp[i] = min(dp[i], dp[i-a] + 1)
        a *= 9

print(dp[n])


Measured memory_bytes: 3828
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<string.h>
#include<math.h>
#include<stdio.h>
#include<queue>
#include<utility>
#include<cstdio>
#include<cstring>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qui queue<int>
#define vit vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define prq priority_queue
#define pii pair<int,int>
#define mp make_pair
#define sz size()
#define em empty()
#define ct continue
#define ms multiset
#define all(a) (a).begin(),(a).end()
ll a[202020],n,ans=0;
using namespace std;
int main()
{
	cin>>n;
	fo(i,0,n){
		cin>>a[i];
		ans+=a[i]-1;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
// finish date: 2018/01/30
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;


vi fact;

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

//逆元(求めたい数とbigmodを渡す)
int gyakugen(int a, int p = bigmod, int b = -1) {
    if (b < 0) b = p - 2;  //int gyakugen(int a, int p, int b = p - 2とできなかったため。)
    if (b == 0) return 1;
    else if (b % 2 == 0) {
        int d = gyakugen(a, p, b / 2);
        return mul(d, d);
    } else {
        return mul(a, gyakugen(a, p, b - 1));
    }
}

int nCk_gyakugen(int n, int k, int p = bigmod) {
    if(n==0) return (k==0)?1:0;
    if(n<k) return 0;
    int denominator = fact[n];
    int molecule1 = fact[k];
    int molecule2 = fact[n - k];
    return mul(denominator, mul(gyakugen(molecule1), gyakugen(molecule2)));
}


int main() {
    int n;
    cin >> n;
    n++;
    vi a(n);
    map<int, int> mp;

    //入力および2回出現する数のindexの抽出
    int idx1, idx2;
    rep(i, n) {
        cin >> a[i];
        if (mp.count(a[i]) != 0) {
            idx1 = mp[a[i]];
            idx2 = i;
        }
        mp[a[i]] = i;
    }
    //1~n+1の階乗をあらかじめ求めておく
    fact = vi(n + 1, 1);
    FOR(i, 2, fact.size()) fact[i] = mul(fact[i - 1], i);


    //cout << n - 1 << endl;
    FOR(i, 1, n + 1) {
        cout << (nCk_gyakugen(n, i) - nCk_gyakugen(n - (idx2 - idx1 + 1), i - 1)+bigmod) % bigmod << endl;
    }
    return 0;
}



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

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

    string str=to_string(a)+to_string(b);
    int num=atoi(str.c_str());
    for(int i=1;i<num;i++){
        if(i*i==num){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let s: std::collections::HashSet<String> = sc.vec::<String>(n).iter().map(|x| x.clone()).collect();
    put!(if s.len() == 4 {
        "Four"
    } else {
        "Three"
    });
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


Measured memory_bytes: 4352
#include <stdio.h>
unsigned n, a[9], b[9], r;
void rec(unsigned x, int d) {
	if (d == 32) {
		r = x; return;
	}
	for (int i = 0; i < 2; i++) {
		unsigned res = 0;
		for (int j = 0; j < 9; j++) b[j] = a[j] ^ (x + (i << d));
		for (int j = 0; j < 8; j++) res += b[j];
		if ((res & (1 << d)) == (b[8] & (1 << d))) rec(x + (i << d), d + 1);
	}
}
int main() {
	scanf("%u", &n);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 9; j++) scanf("%x", a + j);
		rec(0, 0);
		printf("%x\n", r);
	}
}

Measured memory_bytes: 2604
#include<bits/stdc++.h>
#define ll long long
using namespace std;
#define OJ \
        freopen("input.txt","r",stdin); \
        freopen("output.txt","w",stdout);
using namespace std;

int main()
{
  //  OJ;
int n,sum=0;
cin>>n;
sum+=n+pow(n,2)+pow(n,3);
cout<<sum;
}


Measured memory_bytes: 4060
#include <iostream>

using namespace std;

int main() {
    long long s;
    cin >> s;

    long long x3 = (s % 1000000000 == 0 ? 0 : 1000000000 - s % 1000000000);
    long long y3 = (s + x3) / 1000000000;
    cout << "0 0 1000000000 1 " << x3 << " " << y3 << endl;
}


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

int main(){
    int N; cin >> N;
    int min = N+1;
    int ans = 0;
    rep(i,N){
        int p; cin >> p;
        if(min > p) ans++,min = p;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
def main():
    _,_,m = map(int,input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    res = [0]*(m+1)
    res[-1] = min(a)+min(b)
    for i in range(m):
        x,y,c = map(int,input().split())
        res[i] = a[x-1]+b[y-1]-c
    print(min(res))
if __name__ == '__main__':
    main()


Measured memory_bytes: 66156
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>
#include <functional>
#include <vector>
#include <stack>
#include <set>
#include <bitset>
using namespace std;
typedef  long long ll;
const int maxn=1e5+50;
const int inf=0x3f3f3f3f;
const int MOD=1e9+7;
const int HASH=131;


int main()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans=max(a*c,max(b*d,max(b*c,a*d)));
    cout<<ans<<endl;
}


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

map<ll,ll>dp;
ll a,b,c,d;

ll dfs(ll n)
{
    if(n==0)return 0;
    if(dp.count(n))return dp[n];
    if(n>4e18/d)dp[n]=4e18;
    else dp[n]=n*d;
    dp[n]=min(dp[n],dfs(n/2)+a+n%2*d);
    dp[n]=min(dp[n],dfs((n+1)/2)+a+n%2*d);
    dp[n]=min(dp[n],dfs(n/3)+b+n%3*d);
    dp[n]=min(dp[n],dfs((n+2)/3)+b+(3-n%3)%3*d);
    dp[n]=min(dp[n],dfs(n/5)+c+n%5*d);
    dp[n]=min(dp[n],dfs((n+4)/5)+c+(5-n%5)%5*d);
    return dp[n];
}

int main()
{
    ll T;
    scanf("%lld",&T);
    while(T--)
    {
        dp.clear();
        ll n;
        scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d);
        printf("%lld\n",dfs(n));
    }
    return 0;
}


Measured memory_bytes: 4468
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MAX_INT 10e9
int main()
{
   int a,b,c;
  cin>>a>>b>>c;
  	int remain=a-b;
  if(c>remain)
    cout<<c-remain;
    else
      cout<<0<<endl;
    return 0;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
const int MAXN = 15;
const int MAXP = (1 << MAXN);
 
int N, M;
int edge[MAXN][MAXN];
int cscore[MAXP];
int dp[MAXN][MAXP]; // last, cset
vector<int>Mask[MAXP];
int main()
{
    ios_base::sync_with_stdio(0);

    cin >> N >> M;
   	for(int i=0;i<(1<<N);i++){
   		for(int j=0;j<N;j++){
   			if(i&(1<<j))Mask[i].push_back(j);
		}
	}
    for (int i = 0; i < M; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        edge[a][b] = edge[b][a] = c;
    }
 
    for (int i = 0; i < (1 << N); i++)
    {
        cscore[i] = 0;
        for (int j = 0; j < N; j++)
        {
            for (int k = j + 1; k < N; k++)
            {
                if (i & (1 << j) && i & (1 << k))
                    cscore[i] += edge[j][k];
            }
        }
    }
 
    for (int i = 0; i < MAXN; i++)
        for (int j = 0; j < MAXP; j++)
            dp[i][j] = -1e9;
    for (int i = 1; i < (1 << N); i += 2)
        dp[0][i] = cscore[i];
 
    for (int i = 0; i < (1 << N); i++)
    {
        for (int j = 0; j < N; j++)
        {
            if (dp[j][i] < 0) continue;
            int mask = (1 << N) - 1 - i;
            for (int sub = mask; sub > 0; sub = (sub - 1) & mask)
            {
                for (auto k:Mask[sub])
                {
                    if (edge[j][k])
                        dp[k][i+sub] = max (dp[k][i+sub], dp[j][i] + cscore[sub] + edge[j][k]);
                }
            }
        }
    }
    ll ctot = 0;
    for (int i = 0; i < N; i++)
        for (int j = i + 1; j < N; j++)
            ctot += edge[i][j];
    cout << ctot - dp[N-1][(1<<N)-1] << "\n";
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int N; cin >> N;
  set<int> st;
  int count = 0;
  rep(i, N) {
    int a; cin >> a;
    if (a >= 3200) {
      count++;
    } else {
      st.insert(a / 400);
    }
  }

  if (st.size() == 0) {
    std::cout << "1 ";
  } else {
    std::cout << st.size() << " ";
  }
  std::cout << st.size() + count << "\n";
  
  return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <bitset>
#include <set>
const int maxlongint=2147483647;
const long long mo=1e9+7;	
const int N=3005;
using namespace std;
int n,k;
long long ans,mi[N],f[N][N];
int main()
{
	//freopen("068d.in","r",stdin);
	//freopen("068d.out","w",stdout);
	scanf("%d%d",&n,&k);
	mi[0]=1;
	for(int i=1;i<=n;i++) mi[i]=mi[i-1]*2%mo;
	for(int i=n;i>=2;i--) f[1][i]=1;
	for(int i=1;i<k-1;i++)
	{
		long long sum=f[i][n-i+1];
		for(int j=n-i;j>=2;j--)
		{
			sum=(sum+f[i][j])%mo;
			f[i+1][j]=(f[i+1][j]+sum)%mo;
		}
	}
	for(int j=2;j<=n-k+2;j++) ans=(ans+f[k-1][j])%mo;
	if(k==1) ans=1;
	if(n-1-k<0) printf("%lld",ans);
	else
		printf("%lld",ans*mi[n-1-k]%mo);
}

Measured memory_bytes: 46976
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
#define INFTY 3400000000

int main(){
  ll x,y,ans=INFTY;
  cin>>x>>y;
  if(x<y) ans=min(ans,y-x);
  ans=min(ans,abs(x+y)+1);
  if(x>y) ans=min(ans,-y+x+2);
  cout<<ans<<endl;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	N := ReadInt()
	fmt.Printf("ABC%d\n", N)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


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

#define mod      1e9+7;
#define INF      1e9+9;
#define ps(x,y)  fixed<<setprecision(y)<<x
# define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
#endif
	int n;
	cin>>n;
	int a,b,c;
	cin>>a>>b>>c;
	int dp[3],dpp[3];
	dp[0]=a; dp[1]=b; dp[2]=c;
	for(int i=1;i<n;i++){
		cin>>a>>b>>c;
		//cout<<dp[0]<<" "<<dp[1]<<" "<<dp[2]<<endl;
		dpp[0]=a+max(dp[1],dp[2]);
		dpp[1]=b+max(dp[0],dp[2]);
		dpp[2]=c+max(dp[1],dp[0]);
		dp[0]=dpp[0]; dp[1]=dpp[1]; dp[2]=dpp[2];
	}
	cout<<max(dp[0],max(dp[1],dp[2]))<<endl;
	return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>
#include <cstring>
#include <iomanip>
#include<queue>
#include<set>

using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF 1000000000
typedef long long  ll;

#define MOD 1000000007



int main()
{
    int N,M;

    cin >> N >> M;
    int s[N];
    int t[M];
    REP(i,0,N){
      cin >> s[i];
    }REP(i,0,M){
      cin >> t[i];
    }

    ll dp[N + 1][M + 1];
    REP(i,0,N+1){
      REP(j,0,M+1){
        dp[i][j] = 0;
      }
    }
    REP(i,0,N+1){
      dp[i][0] = 1;
    }
    REP(i,0,M+1){
      dp[0][i] = 1;
    }

    REP(i,0,N){
      REP(j,0,M){
        if(s[i]!=t[j]){
          dp[i + 1][j + 1] = (dp[i + 1][j] + dp[i][j + 1] - dp[i][j]+MOD)%MOD;
        }
        else{
          dp[i + 1][j + 1] = dp[i+1][j]+dp[i][j+1];
          dp[i + 1][j + 1] %= MOD;
        }
        //dp[i + 1][j + 1] %= MOD;
      }
    }
    dp[N][M] %= MOD;
    cout << dp[N][M] << endl;
}


Measured memory_bytes: 31488
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;

class Program
{
    static void Main()
    {
        int[] NK = ReadLine().Split(' ').Select(int.Parse).ToArray();
        string S = ReadLine();
        int changeCount = 0;
        char previous = S[0];
        int count = 0;
        for (int i = 1; i < S.Length; i++)
        {
            if (S[i] == previous) count++;
            else
            {
                changeCount++;
                previous = S[i];
            }
        }
        
        if (changeCount / 2 >= NK[1]) count += 2 * NK[1];
        else count += changeCount;
        WriteLine(count);
        ReadLine();
    }
}

Measured memory_bytes: 13536
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int a, b;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> a >> b;
    if(a <= 0 && 0 <= b) cout << "Zero\n";
    else if(0 < a) cout << "Positive\n";
    else{
        if((b - a + 1) % 2) cout << "Negative\n";
        else cout << "Positive\n";
    }
}


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

const int INF = 1001001001;

int a[12][12];
int main()
{
    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> d(m);
        rep(i, n)
        {
            if (s >> i & 1)
            {
                cost += c[i];
                rep(j, m) d[j] += a[i][j];
            }
        }
        bool ok = true;
        rep(j, m) if (d[j] < x) ok = false;
        if (ok)
            ans = min(ans, cost);
    }
    if (ans == INF)
        cout << -1 << endl;
    else
        cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N[3],K;
	ll A[3][1001];
	vll AB;
	scan(N[0]>>N[1]>>N[2]>>K);
	rep(i,3){
		rep(j,N[i]){
			scan(A[i][j]);
		}
	}
	rep(i,N[0]){
		rep(j,N[1]){
			AB.push_back(A[0][i]+A[1][j]);
		}
	}
	sort(AB.begin(),AB.end());
	int ABN=N[0]*N[1];
	vll ABC;
	for(int i=max(0,ABN-K);i<ABN;i++){
		rep(j,N[2]){
			ABC.push_back(AB[i]+A[2][j]);
		}
	}
	sort(ABC.begin(),ABC.end());
	int ABCN=ABC.size();
	for(int i=ABCN-1;i>=ABCN-K;i--){
		prin(ABC[i]);
	}
	return 0;
}


Measured memory_bytes: 43364
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
vector<ull> A;
void input(){
    fast_io();
    cin >> N;
    A = fetch_vec<ull>(N);
}

int solve(){
    ull ans = 1;
    sort(A.begin(),A.end());
    double chk = 0;
    for (int i = 0; i < N; i++)
    {       
        // ans *= A[i];
        chk += log10(A[i]);
        // if(ans>(ull)1e18) {cout << -1 << endl; return 0;}
        // if(ans==0) break;
        // DBG(ans)
    }
    if(chk>18) {cout << -1 << endl; return 0;}
    for (int i = 0; i < N; i++)
    {       
        ans *= A[i];
        if(ans==0) break;
        if(ans>(ull)1e18) {cout << -1 << endl; return 0;}
    }

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

int main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3996
import sys,heapq
input = sys.stdin.readline

n,m = map(int,input().split())

dg = 10**6


edge = [[] for _ in [0]*n]

for _ in [0]*m:
    l,r,c = map(int,input().split())
    edge[l-1].append(c*dg+r-1)

d = [10**20]*n
d[0] = 0

tank = []
for e in edge[0]:
    heapq.heappush(tank,e)
while len(tank) != 0:
    q = heapq.heappop(tank)
    go = q%dg
    if d[go] != 10**20:
        continue
    cost = q//dg

    for i in range(go,-1,-1):
        if d[i] != 10**20:
            break
        d[i] = cost
        for e in edge[i]:
            heapq.heappush(tank,e+cost*dg)
if d[-1] == 10**20:
    print(-1)
else:
    print(d[-1])
    







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

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
map<int, int> mp;
map<int, int>mm;
#define ll long long
#define ld long double
#define PI 3.14159265358979l

int gcd(int a, int b) {
	if (a < b) {
		int tmp = a;
		a = b;
		b = tmp;
	}
	int r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}


int main() {
	
	int ans = 0;
	int m=0;
	rep(i, 5) {
		int n;
		cin >> n;
		if (n % 10 == 0)ans += n;
		else {
			int a = (n / 10 + 1) * 10 - n;
			if (a > m)m = a;
			ans += (n / 10 + 1) * 10;
		}
	}
	
	cout << ans-m<< 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);
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i=0; i<n; i++) {
            a[i] = sc.nextInt();
        }

        int xor = 0;

        int[] res = new int[n];
        for(int i=0; i<n; i++) {
            xor ^= a[i];
        }
        for(int i=0; i<n; i++) {
            res[i] = xor ^ a[i];
        }
        for(int i=0; i<n; i++) {
            if(i>0) {
                System.out.print(" ");
            }
            System.out.print(res[i]);
        }
        System.out.println();


    }



}

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

// --------------------------------------------------------------------------------
#define fastio	ios_base::sync_with_stio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define deb(name,value) cout <<"->>  "<<name<< "= " <<value<<" "
#define frepi(a,b,k) for(int i=a;i<=b;i+=k)
#define frepj(a,b,k) for(int j=a;j<=b;j+=k)
// --------------------------------------------------------------------------------


void solve_main()
{
    ll a,b,k;cin>>a>>b>>k;
    ll x = min(a,k);
    a-=min(a,k);
    k-=x;
    b-=min(b,k);
    cout<<a<<" "<<b<<"\n";
}

int main()
{
	// #ifndef ONLINE_JUDGE
 //    	freopen("/home/suryakant/input.txt","r",stdin);
 //        freopen("/home/suryakant/output.txt","w",stdout);
 //    #endif
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve_main();
    }
    
}

Measured memory_bytes: 3600
def main():
    n, k = (int(i) for i in input().split())
    MOD = 10**9 + 7
    m = 2*n + 5
    fac = [0] * m
    finv = [0] * m
    inv = [0] * m

    def COMBinitialize(m):
        fac[0] = 1
        finv[0] = 1
        if m > 1:
            fac[1] = 1
            finv[1] = 1
            inv[1] = 1
            for i in range(2, m):
                fac[i] = fac[i-1] * i % MOD
                inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
                finv[i] = finv[i - 1] * inv[i] % MOD

    def COMB(n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

    COMBinitialize(m)
    if k >= n - 1:
        print(COMB(2*n-1, n))
    else:
        k = min(k, n-1)  # ここなに？？？？？
        ans = 0
        for m in range(k+1):
            ans += COMB(n, m) * COMB(n-1, n-m-1)
            ans %= MOD
        print(ans % MOD)


if __name__ == '__main__':
    main()


Measured memory_bytes: 48752
import java.util.Scanner;

/**
 *
 * AOJ Card Game</br>
 *
 * ?????????????????????????????????????????????????????????????????°?????????????????????</br>
 * ?????¨ 1 ??????????????¨??????????¨???? 20 ??\?????????????¢??????? 50% ??\????????¨??????YES???????????§???????????? NO ?????????
 *
 * @author ?????????????????§???
 *
 */
public class Main{

	// ???????????????????????°
	private static final int DECK = 10;
	// ???????????????????????????????¨??????????
	private static final int CARDNUM_SUM = 20;

	/*
	 * ????????°???????????¨?????????????????????
	 */
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		while (sc.hasNext()) {

			// ????????????????????????????????????????????????
			int my_c1 = sc.nextInt();
			int my_c2 = sc.nextInt();

			// ????????????????????????????????????????????????
			int your_c = sc.nextInt();

			// ????????????????????????????¨??????????????¶????????????´??????????´???´???
			int draw_c = 0;

			/*
			 * ????????¬?????????????????????????????????????????¨????????????
			 */
			for (int c_cnt = 0; c_cnt <= DECK; c_cnt++) {

				if (my_c1 == c_cnt || my_c2 == c_cnt || your_c == c_cnt) {
					continue;
				}
				if ((my_c1 + my_c2 + c_cnt) < CARDNUM_SUM) {
					draw_c++;
				}
			}
			// ???????????????
			System.out.println((((double) draw_c) / (DECK - 3)) > 0.5 ? "YES" : "NO");

		} // while?????????????????????
			// ????????????????????????
		sc.close();
	}// ?????????????????????????????????

}// CardGame?????????????????????

Measured memory_bytes: 26136
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b) - 1; (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    ll n,x,ans = 0;
    cin >> n >> x;
    ll a[n];
    rep(i, n)cin >> a[i];
    qsort(a, n, sizeof(ll), asc);
    rep(i, n){
        x -= a[i];
        if (x >= 0) {
            ++ans;
        }
    }
    if (x > 0) {
        --ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
s = list(str(input()))
if s[k-1] == "A":
  s[k-1] = "a"
elif s[k-1] == "B":
  s[k-1] = "b"
else:
  s[k-1] = "c"
ans = ""
for x in s:
  ans += x
print(ans)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define fore(i,a,b) for(int i=a,almo5t=b;i<almo5t;++i)
#define SZ(x) ((int)x.size())
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define FIN std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
 
const int N = 0;
 
typedef long long int ll;
 
using namespace std;
 
int main(){

    int n,m;cin>>n>>m;
    double nums[n];
    double votes = 0;
    fore(i,0,n){
       cin>>nums[i];
       votes+=nums[i];
    }
    
    sort(nums,nums+n,greater<double>());

    double frac = votes/(4*m);
    bool posible = true;
    fore(i,0,m){
        if(nums[i]<frac){
            posible= false;
            break;
        }
    }
    if(posible){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define uniq(x) (x).erase(unique(all(x)),(x).end())

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<31-1;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

void solve(void){
    int N, S, T;
    cin >> N >> S >> T;
    bool f = N + S >= T && N <= T;
    cout << (f?"YES":"NO") << '\n';
}

int main(void){
  solve();
  return 0;
}


Measured memory_bytes: 256
main = interact $ unlines . map (show . roman_figure . map read_roman) . lines
read_roman r = case r of {'I'->1; 'V'->5; 'X'->10; 'L'->50; 'C'->100; 'D'->500; 'M'->1000}
roman_figure = sum . count
 where
  count (x:y:xys) = if x<y then y-x : count xys else x : count (y:xys)
  count xs = xs

Measured memory_bytes: 3592