akhauriyash/Code-Regression huggingface dataset:
def iteraccumulate(l):
    from itertools import accumulate
    return list(accumulate(l))


def resolve():
    from bisect import bisect_right
    inf = 10 ** 10
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    aa = [0] + iteraccumulate(a) + [inf]
    bb = iteraccumulate(b) + [inf]
    lbb = len(bb)
    ans = 0
    for index, i in enumerate(aa):
        j = bisect_right(bb, k - i)
        if j == 0 and i <= k:
            ans = max(ans, index)
        elif j > 0 and i + bb[j - 1] <= k:
            ans = max(ans, index + j)
    print(ans)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 49748
#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
        if(b&1)
            r=(r*a)%m;
        b>>1;
        a=(a*a)%m;
    }
    return r%m;
}

int main(){
    ll n; cin>>n;
    vi arr(n-1);
    rep(i,0,n-1)cin>>arr[i];
    vi ans(n);
    ans[0] = arr[0];
    ans[1] = arr[0];
    for(ll i=1;i<n-1;i++)
    {
        ans[i+1] = arr[i];
        if(max(ans[i],ans[i+1])>arr[i])
            ans[i] = arr[i];
    }
    ll sum=0;
    for(auto x:ans)sum+=x;

    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit
#include <cstdio>	// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define DEBUG 0

using namespace std;

const int dir[][2] = { {-1, 0 }, { 0, 1 }, {1, 0 }, {0, -1 } };

char f[1000][1000];
//bool used[1000][1000];
int par[1000*1000];
int w, h;


// ØÌªðßé
int root (int x )
{
	return (par[x] == x ? x : par[x] = root (par[x] ) );
}

// xÆyÌ®·éWð}[W
void unite (int x, int y )
{
	x = root (x);
	y = root (y);
	if (x != y ){ 
		(y < x ? par[x] = y : par[y] = x ) ;
	} // end if
}

// xÆyª¯¶WÉ®·é©Û©
bool same (int x, int y )
{
	return (root (x) == root (y) );
}


void dfs (int row, int col )
{
//	used[row][col] = true;
	rep (k, 4 ){
		int nr = row + dir[k][0];
		int nc = col + dir[k][1];
		if (nr < 0 || nc < 0 || nr >= h || nc >= w || f[nr][nc] == '#' ) continue;
		unite (row*w + col, nr*w + nc  );
//		if (!used[nr][nc] )
//			dfs (nr, nc );
	} // end rep
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.luckydip2", "r", stdin );

//	memset (used, false, sizeof (used ) );

	scanf (" %d %d", &w, &h );
	int g = 0;		// Üª éÊu
	rep (i, h*w ){
		scanf (" %c", f[i/w]+(i%w) );
		if (f[i/w][i%w] == 't' ){
			g = i;
		} // end if
		par[i] = i;
	} // end rep
	rep (i, h ) rep (j, w ) if (f[i][j] != '#' ) dfs (i, j );

	if (same (0, g ) ){
		printf ("0\n" );
		return 0;
	} // end if	

	int n;	// ðú³êéÇÌ
	scanf (" %d", &n );
	for (int i = 1; i <= n; i++ ){
		int x, y;
		scanf (" %d %d", &x, &y );
		f[y][x] = '.';
		dfs (y, x );
		if (same (0, g ) ){
			printf ("%d\n", i );
			return 0;
		} // end if
	} // end rep

	printf ("-1\n" );
	
	return 0;
}

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

int main(){
	int n;
	cin >> n;
	
	int a[n];
	for(int i=0; i<n; i++) cin >> a[i];
	
	int ecnt=0, cnt=0;
	for(int i=0; i<n; i++){
		if(a[i]%2==0){
			ecnt++;
			if(a[i]%3==0 || a[i]%5==0) cnt++;
		}
	}	
	if(ecnt==cnt) cout << "APPROVED" << endl;
	else cout << "DENIED" << endl;
}

Measured memory_bytes: 256
//
//  main.cpp
//
 
#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
 
template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,a,b) for(ll i=(a)-1;i>=(b);i--)

int main() {
	ll N;
	cin >> N;
	rep(i,0,N) {
		ll A;
		cin >> A;
		if (A % 2 == 1) {
			cout << "first" << endl;
			return 0;
		}
	}
	cout << "second" << endl;
	return 0;
}


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

int main(){
  vector<int> vec1(3),vec2(3),vec3(3),vec4(3),vec5(3),vec6(3),vec7(3),vec8(3),vec(3),x(3);
  for(int i=0;i<3;i++)
    cin>>vec1.at(i)>>vec2.at(i)>>vec3.at(i);
  int N;
  cin>>N;
  vector<int> num(N);
  for(int i=0;i<N;i++){
    cin>>num.at(i);
    for(int j=0;j<3;j++){
      if(num.at(i)==vec1.at(j)) vec1.at(j)=0;
      if(num.at(i)==vec2.at(j)) vec2.at(j)=0;
      if(num.at(i)==vec3.at(j)) vec3.at(j)=0;
    }
  }
  for(int i=0;i<3;i++){
    if(i==0) x=vec1;
    else if(i==1) x=vec2;
    else x=vec3;
    vec4.at(i)=x.at(0);
    vec5.at(i)=x.at(1);
    vec6.at(i)=x.at(2);
  }
  vec7={vec1.at(0),vec2.at(1),vec3.at(2)};
  vec8={vec1.at(2),vec2.at(1),vec3.at(0)};
  if(vec1==vec||vec2==vec||vec3==vec||vec4==vec||vec5==vec||vec6==vec||vec7==vec||vec8==vec) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#include <queue>

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

  string S, T;

  cin >> S >> T;

  string min_string = "";
  bool flag_rep = false;
  for (size_t i = 0; i + T.size() - 1 < S.size(); i++) {
    string tmp_string = S;
    bool flag = false;
    for (size_t j = 0; j < T.size(); j++) {
      if (S.at(i + j) == '?' or S.at(i + j) == T.at(j)) {
        tmp_string.at(i + j) = T.at(j);
      } else {
        flag = true;
        break;
      }
    }
    if (flag) {
      continue;
    }
    for (size_t j = 0; j < S.size(); j++) {
      if (tmp_string.at(j) == '?') {
        tmp_string.at(j) = 'a';
      }
    }
    if (tmp_string < min_string or min_string == "") {
      min_string = tmp_string;
      flag_rep = true;
    }
  }

  if (flag_rep) {
    cout << min_string;
  } else {
    cout << "UNRESTORABLE";
  }

  return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuffer ans = new StringBuffer();
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == '0') {
				ans = ans.append('0');
			}else if(s.charAt(i) == '1') {
				ans = ans.append('1');
			}else if(s.charAt(i) == 'B') {
				if(ans.length() > 0) {
					ans = ans.deleteCharAt(ans.length()-1);
				}
		}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 35492
# -*- coding: utf-8 -*-
s = input()
x = list("abcdefghijklmnopqrstuvwxyz")

if len(s)<26:
    for c in x:
        if c not in s:
            print(s+c)
            exit()
else:
    s = list(s)
    d = set()
    c = s[-1]
    d.add(c)
    i = len(s)-2
    while True:
        if i<0:
            break
        elif s[i]>c:
            c = s[i]
            i -= 1
            d.add(c)
        else:
            break
    if i>=0:
        minc = None
        for c in d:
            if c<s[i]:
                continue
            elif minc is None:
                minc = c
            elif c<minc:
                minc = c
        if minc is not None:
            s[i] = minc
            s = s[:i+1]
            print("".join(s))
            exit()
print(-1)


Measured memory_bytes: 3064
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            new ABC122().SolveA(new ConsoleInput(Console.In, ' '));
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
  class ABC122
    {
        public void SolveA(ConsoleInput cin)
        {
            var b = cin.Read;
            switch (b)
            {
                case "A":
                    WriteLine("T");
                    break;
                case "T":
                    WriteLine("A");
                    break;
                case "C":
                    WriteLine("G");
                    break;
                case "G":
                    WriteLine("C");
                    break;
            }
            ReadLine();
        }
    }
}

Measured memory_bytes: 11348
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <deque>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)


int main(){
    deque<char> deq;
    string s;
    cin >> s;
    rep(i,s.size()) deq.push_back(s[i]);
    int q;
    cin >> q;
    bool f = true;
    while(q--){
        int a,b;
        char c;
        cin >> a;
        if (a == 1) f = !f;
        else{
            cin >> b >> c;
            if (f && b == 2) deq.push_back(c);
            else if (f && b == 1) deq.push_front(c);
            else if (!f && b == 1)deq.push_back(c);
            else deq.push_front(c);
        }
    }
    if (f){
        for (auto itr = deq.begin(); itr != deq.end(); itr++){
            cout << *itr;
        }
        cout << endl;
    }
    else {
        for (auto itr = deq.end()-1; itr != deq.begin(); itr--){
            cout << *itr;
        }
        cout << *(deq.begin()) << endl;
    }
    
   return 0;

}

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

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int k, a, b; cin >> k >> a >> b;
	for (int i = 1; k * i <= b; ++i)
	{
		if (k * i >= a && k * i <= b)
		{
			cout << "OK" << endl;
			return 0;
		}
		else
			continue;
	}
	cout << "NG" << endl;

	return 0;
}

Measured memory_bytes: 3560
n = int(input())
w = list(map(int, input().split()))
s1 = w[0]
s2 = sum(w[1:])
ans = abs(s1-s2)
for i in range(1,n-1):
    s1 += w[i]
    s2 -= w[i]
    if abs(s1-s2)<ans:
        ans=abs(s1-s2)
print(ans)

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

int main()
{
    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        a[i]++;
    }

    vector<ll> s(n + 1, 0);
    for (int i = 0; i < n; i++) s[i + 1] = s[i] + a[i];

    ll res = 0;
    for (int i = 0; i <= n - k; i++) res = max(res, s[i + k] - s[i]);

    cout << fixed << setprecision(12) << (double)res / 2 << endl;
    return 0;
}


Measured memory_bytes: 6428
#include <iostream>
#include <vector>

using namespace std;

int main() {
    string S, T;
    cin >> S >> T;

    vector<char> S_(S.begin(), S.end());
    vector<char> T_(T.begin(), S.end());

    int result { 0 };
    for (int i { 0 }; i < 3; ++i) {
        if (S_[i] == T_[i]) result++;
    }
    
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;

int main(){
    int H, N;
    cin >> H >> N;
    vector<int> A(N);
    vector<int> B(N);
    for(int i=0;i<N;i++) cin >> A[i] >> B[i];
    vector<vector<int>> dp(N+1, vector<int>(3*10000, INF));
    dp[0][0] = 0;
    for(int i=0;i<N;i++){
        for(int j=0;j<3*10000;j++){
            if(j-A[i] >=0) dp[i+1][j] = min(dp[i][j], dp[i+1][j-A[i]]+B[i]);
            else dp[i+1][j] = dp[i][j];
        }
    }
    int ans = INF;
    for(int j=H;j<3*10000;j++) ans = min(ans, dp[N][j]);
    cout << ans << endl;

}

Measured memory_bytes: 117760
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

struct UnionFind{
    v: Vec<usize>
}

fn gcd(a: u64, b: u64) -> u64{
    if b == 0{
        return a;
    }

    return gcd(b, a%b);
}

fn lcm(a: u64, b: u64) -> u64{
    return (a*b)/ gcd(a, b);
}

fn main(){
    let line: Vec<usize> = read_as_vec();
    let (n, m) = (line[0], line[1] as u64);

    let a: Vec<u64> = read_as_vec();
    let mut lcm_of_vec = a[0];

    for &elem in &a{
        if lcm_of_vec%elem == 0 && (lcm_of_vec/elem%2) == 0{
            println!("0");
            return;
        }else if elem%lcm_of_vec == 0 && (elem/lcm_of_vec%2) == 0{
            println!("0");
            return;
        }
        lcm_of_vec = lcm(elem, lcm_of_vec);
        if lcm_of_vec > 2*m{
            println!("0");
            return;
        }
    }
    let half_lcm: u64 = lcm_of_vec/2;

    if half_lcm > m as u64{
        println!("0");
    }else{
        println!("{}", (m + half_lcm)/lcm_of_vec);
    }
}


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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359;
#define inf (1 << 21);
#define mod 1000000007;

int main() {
    ll N; cin >> N;
    ll Nsave = N;
    ll n = (ll)sqrt(N);
    vector<int> cnt(n);
    for (int i = 2; i < n; i++) {
        while (N % i == 0) {
            cnt.at(i)++;
            N /= i;
        }
    }
    ll ans;
    if (N == Nsave) {
        if (N == 1) {
            ans = 0;
        }
        else {
            ans = 1;
        }
    }
    else {
        if (N != 1) {
            ans = 1;
        }
        else {
            ans = 0;
        }
        for (int i = 2; i < n; i++) {
            int k = 1;
            while (cnt.at(i) - k >= 0) {
                ans++;
                cnt.at(i) -= k;
                k++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7288
n = int(input())
h = list(map(int, input().split()))
dp = [0]*n
dp[1] = abs(h[0]-h[1])
for i in list(range(n))[2:]:
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print(dp[-1])

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

using namespace std;

const long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    long long h, w;
    cin >> h >> w;

    long long best = h * w;

    for(long long cut = 1; cut < w; ++cut){
        long long a1 = h * cut;

        long long mid = h >> 1;
        long long a2 = (w - cut) * mid;
        long long a3 = h * w - a1 - a2;

        best = min(best, max(a1, max(a2, a3)) - min(a1, min(a2, a3)));

        mid = (w - cut) >> 1;
        a2 = h * mid;
        a3 = h * w - a1 - a2;

        best = min(best, max(a1, max(a2, a3)) - min(a1, min(a2, a3)));

    }

    for(long long cut = 1; cut < h; ++cut){
        long long a1 = w * cut;

        long long mid = w >> 1;
        long long a2 = (h - cut) * mid;
        long long a3 = h * w - a1 - a2;

        best = min(best, max(a1, max(a2, a3)) - min(a1, min(a2, a3)));

        mid = (h - cut) >> 1;
        a2 = w * mid;
        a3 = h * w - a1 - a2;

        best = min(best, max(a1, max(a2, a3)) - min(a1, min(a2, a3)));

    }

    cout << best;

    return 0;
}


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

using namespace std;

#define long long long
#define INF 1e18
#define MOD (long) (998244353)

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

    long ans = 1000 - (n % 1000);
    if (ans == 1000) ans = 0;
    printf("%lld\n", ans);
}


Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P ,P> PP;
const ll MOD = ll(1e9)+7;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()


int main() {
    int Q;
    cin >> Q;
    ll bsum = 0, fmin = 0;
    // 中央値の左右をもつ
    multiset<ll> stl, str;
    stl.insert(-IINF);
    str.insert(IINF);
    REP(i,Q){
        ll c, a = 0, b = 0;
        cin >> c;
        if(c==1){
            cin >> a >> b;
            bsum += b;
            if(a >= *(--stl.end()) && a <= *str.begin()){
                stl.insert(a);
                str.insert(a);
            }
            else if(a > *str.begin()){
                fmin += a - *str.begin();
                REP(j,2)str.insert(a);
                stl.insert(*str.begin());
                str.erase(str.begin());
            }
            else{
                fmin += *--stl.end() - a;
                REP(j,2)stl.insert(a);
                str.insert(*--stl.end());
                stl.erase(--stl.end());
            }
        }
        else {
            cout << *--stl.end() << " " << fmin + bsum << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 18944
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define mod 1000000007
using namespace std;
ll binpow(ll x,ll y)/* (x^y)%p in O(log y) */{ll res=1;while (y > 0){if(y&1)res=(res*x);y = y>>1;x=(x*x);}return res;}
ll binpowmod(ll x,ll y,ll p)/* (x^y)%p in O(log y) */{ull res=1;x=x%p;while (y > 0){if(y&1)res=(res*x)%p;y = y>>1;x=(x*x)%p;}return res;}
ll mod_inverse(ll n,ll p)/* Returns n^(-1) mod p */{return binpowmod(n,p-2,p);}
int gcd(int x,int y)
{
    if(y==0)
        return x;
    return gcd(y,x%y);
}
bool comp(pair<int,int> x,pair<int,int> y)
{
    return x.first<y.first;
}
bool comp_pairs_by_s(pair<ll,ll> &x ,pair<ll,ll> &y)
{
    return x.second<y.second;
}
bool isPowerOfTwo (ll x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}

class cmp      //comparator for priority_queue 
{               //declaration: priority_queue<int,vector<int>,cmp>
public:         
    bool operator()(pair<int,int> A,pair<int,int> B)
    {
        if(abs(A.first-A.second)==abs(B.first-B.second))
            return A.first>B.first;
        return abs(A.first-A.second)<abs(B.first-B.second);
    }
};
int prime[1768457]={0};
void sieve(void)
{
 int i,j;
 for(i=0;i<1768457;i++)
        prime[i]=1;
 prime[0]=0,prime[1]=0;
 for(i=2;i<=sqrt(1768457);i++){
     if(prime[i]){
         for(j=i*i;j<1768457;j+=i){
             prime[j]=0;
         }
     }
 }
    
}
void swap(ll &x,ll &y){
    int temp=x;
    x=y;
    y=temp;
}
  
unsigned int onesComplement(unsigned int n) 
{ 
   // Find number of bits in the given integer 
   int number_of_bits = floor(log2(n))+1; 
  
   // XOR the given integer with poe(2,  
   // number_of_bits-1 and print the result  
   return ((1 << number_of_bits) - 1) ^ n; 
}


void solve()
{   
    ll n;
    cin>>n;
    vector<ll> x(n);
    for(auto &it : x)
        cin>>it;
    ll total=x[0];
    for(int i=1;i<n;++i)
        total^=x[i];
    for(int i=0;i<n;++i)
        cout<<(total^x[i])<<' ';
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}   


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

const int INF = 1000000;

int dp[42][402][402];

int main()
{
    int n, ma, mb;
    cin >> n >> ma >> mb;
    int a[42], b[42], c[42];
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i];
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= 400; j++){
            for(int k = 0; k <= 400; k++) dp[i][j][k] = INF;
        }
    }
    dp[0][0][0] = 0;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= 400; j++){
            for(int k = 0; k <= 400; k++){
                dp[i][j][k] = dp[i - 1][j][k];
            }
        }
        for(int j = a[i - 1]; j <= 400; j++){
            for(int k = b[i - 1]; k <= 400; k++){
                dp[i][j][k] = min(dp[i][j][k], dp[i - 1][j - a[i - 1]][k - b[i - 1]] + c[i - 1]);
            }
        }
    }
    int ans = INF;
    for(int i = 1; i * ma <= 400 && i * mb <= 400; i++){
        ans = min(ans, dp[n][i * ma][i * mb]);
    }
    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 29444
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

template<typename Monoid>
struct Starry_Sky_Tree{
    Monoid f(Monoid a, Monoid b){
        return min(a, b);
    }
    const Monoid unit;
    int n;
    vector<Monoid> seg, lazy;
    
    Starry_Sky_Tree(int N, const Monoid &x) : unit(x){
        n = 1;
        while(n < N) n <<= 1;
        seg.assign(2*n, 0);
        lazy.assign(2*n, 0);
    }
    
    void add(int a, int b, const Monoid &x, int i = 1, int l = 0, int r = -1){
        if(r < 0) r = n;
        if(a >= r || b <= l) return;
        if(a <= l && r <= b){
            lazy[i] += x;
            return;
        }
        add(a, b, x, 2*i, l, (l+r)/2);
        add(a, b, x, 2*i+1, (l+r)/2, r);
        seg[i] = f(seg[2*i]+lazy[2*i], seg[2*i+1]+lazy[2*i+1]);
    }
    
    Monoid query(int a, int b, int i = 1, int l = 0, int r = -1){
        if(r < 0) r = n;
        if(a >= r || b <= l) return unit;
        if(a <= l && r <= b) return seg[i]+lazy[i];
        Monoid vl = query(a, b, 2*i, l, (l+r)/2);
        Monoid vr = query(a, b, 2*i+1, (l+r)/2, r);
        return f(vl, vr)+lazy[i];
    }
    
    void update(int i = 1, int l = 0, int r = -1){
        if(r < 0) r = n;
        seg[i] = seg[i]+lazy[i];
        if(r-l > 1){
            lazy[2*i] += lazy[i];
            lazy[2*i+1] += lazy[i];
            update(2*i, l, (l+r)/2);
            update(2*i+1, (l+r)/2, r);
        }
        lazy[i] = 0;
    }
    
    Monoid operator [] (int i) const {return seg[n+i];}
    
    void clear(){
        fill(seg.begin(), seg.end(), 0);
        fill(lazy.begin(), lazy.end(), 0);
    }
};

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> rs[M+1];
    rep(i, N){
        int l, r; cin >> l >> r;
        rs[l].pb(r);
    }
    Starry_Sky_Tree<int> seg(M+2, inf);
    rep(i, M+2) seg.add(i, i+1, M+1-i);
    int ans = min(M-N, 0);
    rep(i, M+1){
        for(auto &e: rs[i]){
            seg.add(0, e+1, -1);
            chmin(ans, i+seg.query(0, M+2));
        }
    }
    cout << -ans << endl;
}

Measured memory_bytes: 15676
#include <iostream>
using namespace std;
using Int = long long;
int main()
{
    string S;
    cin >> S;
    int price = 700;
    for (int i = 0; i < 3; i++) {
        if (S[i] == 'o') price += 100;
    }
    cout << price << endl;
    return 0;
}

Measured memory_bytes: 256
"""
文字列lの？個目が文字列Sに含まれたらansの？個目は0，含まれなかったら1
ansの要素を全部足して0だったら文字列Sにはアルファベットが全て含まれる
range(25)にしていた
これだとiが0~24まで25回しか繰り返していない
"""
s=input()
l="abcdefghijklmnopqrstuvwxyz"
ans=[0]*26
for i in range(26):
    if l[i] not in s:
        ans[i]=1
    else:
        ans[i]=0
if sum(ans[x] for x in range(26))>0:
    print(l[ans.index(1)])
else:
    print("None")

Measured memory_bytes: 3188
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
#define LL  long long
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return

int main(){
  CIN(N);
  I vec;
  REP(a,N){
      CIN(b);vec.pb(b);
      }
  int b;
  LL ins = 0;
  REP(a,N){
   if(a==0){
       b = vec.at(a);
       ins += abs(vec.at(a));
   }else if(a==N-1)
   {
       ins += abs(b-vec.at(a));
       ins += abs(vec.at(a));
   }else
   {
       ins += abs(b-vec.at(a));
       b = vec.at(a);
   }
  }
  //COUT(ins);
  vec.insert(vec.begin(),0);
  vec.pb(0);
  REP(a,vec.size()){
      if(a==0||a==vec.size()-1)continue;
      COUT(ins-abs(vec.at(a)-vec.at(a+1))-abs(vec.at(a)-vec.at(a-1))+abs(vec.at(a-1)-vec.at(a+1)));
    }
  return 0;
}


Measured memory_bytes: 1784
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))

bool st(int h[5]){
	bool f=true;
	rep(i,4)if(h[i+1]-h[i]!=1)f=false;
	return f;
}

int main(){
	int h[5],c[5],a,*e;
	char *s[]={
		"null","one pair","two pair","three card","straight","full house","four card",
	};
	while(~scanf("%d,%d,%d,%d,%d",h,h+1,h+2,h+3,h+4)){
		sort(h,h+5);
		if(h[0]==0)break;
		a=0;
		rep(i,5)c[i]=count(h,h+5,h[i]);
		int d=count(c,c+5,2);
		if(d==4)a=2;
		e=unique(c,c+5);
		sort(c,e);
		if(*(e-1)==4)a=6;
		else if(*c==2 && c[1]==3)a=5;
		else if(*(e-1)==3)a=3;
		else if(*(e-1)==2 && d==2)a=1;
		bool f=st(h);
		if(!f){
			rotate(h,h+1,h+5);
			replace(h,h+5,1,14);
			f=st(h);
		}
		if(f)a=4;
		puts(s[a]);
	}
	
	return 0;
}

Measured memory_bytes: 1192
#from math import gcd
from fractions import gcd
T = int(input())
ABCD = [list(map(int,input().split())) for _ in range(T)]

for a,b,c,d in ABCD:
    if a < b:
        print('No')
        continue
    if d < b:
        print('No')
        continue
    tmp = a % b
    if tmp > c:
        print('No')
        continue
    if d % b == 0:
        print('Yes')
        continue
    if c >= b-1:
        print('Yes')
        continue
    if a%2 == 0 and b%2 == 0 and d %2 == 0 and b-c == 2:
        print('Yes')
        continue
    GCD = gcd(b,d)
    if b-GCD +(a%GCD) > c:
        print('No')
    else:
        print('Yes')



    

Measured memory_bytes: 5116
n = int(input())
s = input()
#print(s)

tot = s.count('R') * s.count('G') * s.count('B')
#print(tot)

for i in range(n):
    for d in range(1,n):
        j = i+d
        k = j+d
        if k > n-1:
            break
        if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
            tot -= 1

print(tot)

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

struct matrix_size{
	int row;
	int col;
};

int matrixchaincost(vector <matrix_size> &M){
	int n=M.size();
	vector < vector <int> > cost(n, vector <int> (n));
	vector < vector <matrix_size> > X(n, vector <matrix_size> (n));
	for (int i=0; i<n; i++){
		cost[i][i] = 0;
		X[i][i] = M[i];
	}

	for (int length=2; length<=n; length++){
		for (int i=0; i+length<=n; i++){
			int j = i+length-1;
			X[i][j].row = X[i][i].row;
			X[i][j].col = X[j][j].col;
			if (X[i][j-1].col != X[j][j].row){
				cout<<"error"<<endl;
				return NULL;
			}
			int k = i+1;
			int mincost = X[i][k-1].row * X[i][k-1].col * X[k][j].col + cost[i][k-1] + cost[k][j];
			k++;
			while (k<=j){
				int tmp = X[i][k-1].row * X[i][k-1].col * X[k][j].col + cost[i][k-1] + cost[k][j];
				if (tmp<mincost)
					mincost = tmp;
				k++;
			};
			cost[i][j] = mincost;
		}
	}
	return cost[0][n-1];
}

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

	vector <matrix_size> M(n);

	for (int i=0; i<n; i++){
		cin>>M[i].row;
		cin>>M[i].col;
	}
	cout<<matrixchaincost(M)<<endl;
	return 0;
} 

Measured memory_bytes: 1340
N,M = $stdin.gets.chomp.split(" ").map{ |a| a.to_i }
arr = []
N.times {
  arr << $stdin.gets.chomp.split(" ").map{ |a| a.to_i }
}

puts [
  [+1,+1,+1],
  [+1,+1,-1],
  [+1,-1,+1],
  [+1,-1,-1],
  [-1,+1,+1],
  [-1,+1,-1],
  [-1,-1,+1],
  [-1,-1,-1],
].map { |b|
  arr.map{ |a| a[0]*b[0]+a[1]*b[1]+a[2]*b[2] }.sort.last(M).inject(:+)
}.max || 0

Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int w,h,x,y,r;
    cin >> w >> h >> x >> y >>r;
    string out = "No";

    if((x - r ) >= 0
    && (x + r ) <= w
    && (y - r ) >= 0
    && (y + r ) <= h) out = "Yes";

    cout << out << endl;
}


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

int main() {
  int N,K;
  cin >> N >> K;
  int s;
  s=1;
  int i;
  for (i=0; i<N; i++){
    if (s*2>s+K)
      s+=K;
    else
      s*=2;
  }
  cout << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin>>s>>t;
    ll min=10000000000;
    for(ll i=0;i<=s.size()-t.size();i++)
    {
    	ll ch=0;
    	for(ll j=i;j<i+t.size();j++)
    	{
    		if(s[j]!=t[j-i])
    		++ch;
    	}
    	 
    	if(ch<min)
    	min=ch;
    }
    cout<<min<<endl;
	return 0;
}

Measured memory_bytes: 3640
import java.util.*;
import java.io.*;

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        char[] s=fsc.next().toCharArray();
        fsc.close();
        int n=s.length;
        int score=0;
        for(int i=0;i<n;i++){
            if(i<(n+1)/2){
                if(s[i]=='p'){
                    score--;
                }
            } else{
                if(s[i]=='g'){
                    score++;
                }
            }
        }
        System.out.println(score);
    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


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

#define N 8
#define FREE -1
#define N_FREE 1


int low[N],co[N],dps[2*N-1],dng[2*N-1];
bool Y[N][N];

void initialize(){
  int i;

  for(i=0;i<N;i++){
    low[i] = FREE;
    co[i] = FREE;
  }

  for(i=0;i<2*N-1;i++){
    dps[i] = FREE;
    dng[i] = FREE;
  }
}

void print(){
  int i,j;

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(Y[i][j]){
        if(low[i] != j) return;
      }
    }
  }

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
        cout << ((low[i] == j) ? "Q" : ".");

    }
cout << endl;
  }

}

void recursive(int l){
int j;

  if(l==N){
    print(); return;
  }
for(j=0;j<N;j++){
  if(N_FREE == co[j] || N_FREE == dps[l+j] || N_FREE == dng[l-j+N-1]) continue;
  low[l]=j;
  co[j]=dps[l+j]=dng[l-j+N-1] = N_FREE;
  recursive(l+1);
  low[l]=co[j]=dps[l+j]=dng[l-j+N-1] = FREE;
}

}



int main(){
  int i,j,n,q,p;

  initialize();

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      Y[i][j]= false;
    }
  }
  cin >> n;

  for(i=0;i<n;i++){
  cin >> p >> q;
    Y[p][q] = true;
  }

  recursive(0);


  return 0;
}



Measured memory_bytes: 3112
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<algorithm>

using namespace std;

#define LL long long
#define SP setprecision
#define PI 3.141592653589793
string s;
LL W, H, x, y, a, b, c, num[5];
double r;

int main() {
	while (true) {
		cin >> a >> s >> b;
		if (s == "?")break;
		if (s == "+")cout << a + b << endl;
		else if (s == "-")cout << a - b << endl;
		else if (s == "*")cout << a * b << endl;
		else cout << a / b << endl;

	}

	return 0;
}



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

using uli = unsigned long int;
using lli = long long int;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define repa(a,i,x) for(int i=a;i<=x;i++)

int main(){
	int N;
	cin >> N;
  	int D1[N],D2[N];
  	rep(i,N){
    	cin >> D1[i] >> D2[i];
    }
  	int D[N]={0};
  	rep(i,N) if(D1[i]==D2[i])D[i]=1;
  
  	rep(i,N-2){
      if(D[i]==1 && D[i+1]==1 && D[i+2]==1){
        cout << "Yes" << endl;
        return 0;
      }
    }
  
    cout << "No" << endl;
  	
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=2000005,INF=1<<30;

vector<int> prime;//i番目の素数
bool is_prime[MAX+1];

void sieve(int n){
    for(int i=0;i<=n;i++){
        is_prime[i]=true;
    }
    
    is_prime[0]=is_prime[1]=false;
    
    for(int i=2;i<=n;i++){
        if(is_prime[i]){
            prime.push_back(i);
            for(int j=2*i;j<=n;j+=i){
                is_prime[j] = false;
            }
        }
    }
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    vector<ll> A(N),B(N);
    for(int i=0;i<N;i++){
        cin>>A[i]>>B[i];
    }
    sort(all(A));
    sort(all(B));
    
    if(N&1){
        cout<<B[N/2]-A[N/2]+1<<endl;
    }else{
        cout<<B[N/2-1]+B[N/2]-A[N/2-1]-A[N/2]+1<<endl;
    }
}




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

typedef vector<int, int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long int ll;

int n, m, t, ans;
vii v;
int main() {
	cin >> t;
	while(t--) {
		cin >> n >> m;
		v.push_back(make_pair(n, m));
		// cout << m << " " << n << endl;
	}
	sort(v.begin(), v.end());
	n = v[v.size()-1].second;
	if(n < 0) n = 0;
	m = v[0].second;
	// cout << m << " " << n << endl;
	while (n >= 1)
		n--;
	if(v[0].first > 1) m += (v[0].first) - 1;
	// cout << m  << endl;
	// cout << n << endl;
	ans = 0;
	ans += (m - v[0].second);
	ans += (v[v.size()-1].second - n);
	ans += v[v.size()-1].first - v[0].first + 1;
	cout << ans << endl;
	return 0;
}

// v[v.size()-1].first

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

int main(){
  vector<int>x(5);
  for(int i=0;i<5;i++){
    cin>>x[i];
    if(i+1!=x[i]){
      cout<<i+1<<endl;
      break;
    }
  }
  
  return 0;
}








Measured memory_bytes: 3620
n = int(input())
alist = list(map(int, input().split()))
blist = list(map(int, input().split()))
ans = 0

for i in range(n):
    #  左を全力で倒す
    left = min(alist[i],blist[i])
    ans += left
    alist[i] -= left
    blist[i] -= left

    # 残った戦力で右を倒す
    right = min(alist[i+1],blist[i])
    ans += right
    alist[i+1] -= right
    blist[i] -= right
print(ans)

Measured memory_bytes: 18624
import sys
def input(): return sys.stdin.readline().strip()

i  = lambda: int(input())
li = lambda: list(map(int, input().split()))

N = i()
H = li()

ans = "Yes"
for i in range(N-1):
  if H[i] > H[i+1]:
    ans = "No"
    break
  if H[i] != H[i+1]:
    H[i+1] -= 1

print(ans)

Measured memory_bytes: 14480
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
class Program
{
    static void Main()
    {
        //入力
        //int n = 100;
        /*
        long n = long.Parse(Console.ReadLine());
        long[] input = new long[5];
        for(int a = 0; a < 5; a++)
        {
            input[a]=long.Parse(Console.ReadLine());
        }
        */
        int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
        Console.WriteLine(input[1]>=input[0]?input[0]:input[0]-1);

        /*
        //処理速度計測
        var sw = new System.Diagnostics.Stopwatch();
        sw.Start();
        //解法

        //処理速度表示
        sw.Stop();
        TimeSpan ts = sw.Elapsed;
        Console.WriteLine((int)(Math.Floor((ts).TotalMilliseconds))+"ms");
        */
        Console.ReadLine();
        
    }
}

Measured memory_bytes: 11348
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
const ll mod=1e9+7;
ll n, k;
ll a[maxn], fac[maxn], invfac[maxn], c[maxn];

ll pow(ll x,ll n)
{
    ll res=1;
    x%=mod;
    while(n)
    {
        if(n&1) res=res*x%mod;
        x=x*x%mod;
        n>>=1;
    }
    return res;
}
void init()
{
    fac[0]=1;
    for(int i=1; i<=n; i++) fac[i]=(fac[i-1]*(ll)(i))%mod;
    for(int i=0; i<=n; i++) invfac[i]=pow(fac[i], mod-2);
    for(int i=k-1; i<=n; i++) c[i]=((fac[i]*invfac[k-1])%mod*invfac[i-(k-1)])%mod;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>k;
    init();
    for(int i=1; i<=n; i++) cin>>a[i];
    sort(a+1, a+1+n);
    ll ans=0;
    for(int i=1; i<=n; i++) ans+=((c[i-1]-c[n-i])*a[i])%mod, ans%=mod;
    ans=(ans+mod)%mod;
    cout<<ans<<endl;
    return 0;
}


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

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

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976

struct UnionFind{
    vector<int> rank,p,size;
    UnionFind(int n){
        rank.resize(n,0);
        p.resize(n,0);
        size.resize(n,0);
        for(int i = 0; i < n; i++){
            p[i] = i;
            rank[i] = 0;
            size[i] = 1;
        }
    }
    bool same(int x,int y){
        return root(x) == root(y);
    }
    int root(int x){
        if(x != p[x]){
            p[x] = root(p[x]);
        }
        return p[x];
    }
    bool unite(int x,int y){
        int rx = root(x);
        int ry = root(y);
        if(rx == ry) return false;
        if(rank[rx] > rank[ry]){
            p[ry] = rx;
            size[rx] += size[ry];
        }else{
            p[rx] = ry;
            size[ry] += size[rx];
            if(rank[rx] == rank[ry]){
                rank[ry]++;
            }
        }
        return true;
    }
    int tree_size(int x){
        return (size[root(x)]);
    }
};



int main()
{
    int n,m,k; cin >> n >> m >> k;
    vector<int> fre[100005];
    vector<int> blo[100005];
    UnionFind uf(n);
    rep(i,m){
        int a,b; cin >> a >> b;
        a--; b--;
        uf.unite(a,b);
        fre[a].push_back(b);
        fre[b].push_back(a);
    }
    rep(i,k){
        int c,d; cin >> c >> d;
        c--; d--;
        if(uf.same(c,d)){
            blo[c].push_back(d);
            blo[d].push_back(c);
        }
    }
    rep(i,n){
        cout << uf.tree_size(i) - 1 - fre[i].size() - blo[i].size() << ' ';
    }
}


Measured memory_bytes: 13048
c = []
for i in range(3):
    x = list(map(int, input().split()))
    c.append(x)

a = [0] * 3
b = [0] * 3
x = 0
for i in range(3):
    a[i] = c[i][0] - x
for i in range(3):
    b[i] = c[0][i] - a[0]

flag = True
for i in range(3):
    for j in range(3):
        x = a[i] + b[j]
        if x != c[i][j]:
            flag = False
if flag:
    print("Yes")
else:
    print("No")


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

using namespace std;
int main(void){
    // Your code here!
    int s,t;
    cin>>s;
    t=(s/15)*200;
    if(s<15){
        cout<<s*800<<endl;
    }
    else{
        cout<<s*800-t<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

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

int main() {
    array<array<int64_t, 3>, 3> a;

    for (auto&& aa : a) {
        for (auto&& aaa : aa) {
            cin >> aaa;
        }
    }

    int64_t n;
    cin >> n;

    unordered_set<int64_t> s;
    for (auto i : irange(0L, n)) {
        int64_t b;
        cin >> b;
        s.insert(b);
    }

    for (auto&& aa : a) {
        for (auto&& aaa : aa) {
            if (s.count(aaa)) {
                aaa = -1;
            }
        }
    }

    bool bingo = false;
    for (auto i : irange(0L, 3L)) {
        if (a[i][0] == -1 && a[i][1] == -1 && a[i][2] == -1) {
            bingo = true;
        }
        if (a[0][i] == -1 && a[1][i] == -1 && a[2][i] == -1) {
            bingo = true;
        }
    }
    if (a[0][0] == -1 && a[1][1] == -1 && a[2][2] == -1) {
        bingo = true;
    }
    if (a[0][2] == -1 && a[1][1] == -1 && a[2][0] == -1) {
        bingo = true;
    }

    if (bingo) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
using namespace std;
int a[200001];
int n,k;
long long m;
int main()
{
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
    }
    for(int i=0; i<n; i++)
    {
        if(k>a[i])
        {
            m+=k-a[i];
        }
        else{
            k=a[i];
        }
    }
    printf("%lld",m);
    return 0;
}


Measured memory_bytes: 4612
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define ll int
#define bits_count __builtin_popcountll
#define endl '\n'
#define double long double
#define ld double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
#define sz(x) (ll)x.size()
#define pr pair<int,int>
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

void solve(){

    int n; cin>>n;

    int sum = 0;
    FOR(i,1,n){
        if(i%3 == 0 || i%5 == 0) continue;
        else sum += i;
    }

    cout<<sum<<endl;
}

signed main(){

   FastRead; 


    int t = 1; 
    // cin>>t;
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}





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

const int mod = 1e9 + 7, mxN = 110, mxK = 1e5 + 5;
int N, K, a[mxN];
ll dp[mxN][mxK];

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

	cin >> N >> K;
	for (int i = 1; i <= N; i++)
		cin >> a[i];
	dp[0][0] = 1;
	for (int i = 1; i <= N; i++) {
		ll pref[K + 1];
		pref[0] = dp[i - 1][0];
		for (int j = 1; j <= K; j++) {
			pref[j] = (pref[j - 1] + dp[i - 1][j]);
			if (pref[j] >= mod)
				pref[j] -= mod;
		}
		for (int j = 0; j <= K; j++) {
			dp[i][j] = pref[j];
			int t = j - a[i] - 1;
			if (t >= 0) {
				dp[i][j] -= pref[t];
			}
			if (dp[i][j] < 0)
				dp[i][j] += mod;
		}
	}
	cout << dp[N][K];

	return 0;
}

Measured memory_bytes: 82532