akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 10
#define PI 3.141592653589793
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define mem(x, a) memset(x, a, sizeof x)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>


ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V, V1;
unordered_map<ll, ll> mp;
set<ll> s;
string S = "";
ll cases;
char mat[MAX_INT][MAX_INT];

int main() {
	go;
    cin >> N >> M >> A;
    fi(i, 0, N, 1) {
    	fi(j, 0, M, 1) {
    		cin >> mat[i][j];
    	}
    }
    ll ans = 0;
    fi(i, 0, (1 << N), 1) {
    	V.clear();
    	fi(j, 0, N, 1) {
    		if(i & (1 << j)) {
    			V.push_back(j);
    		}
    	}
		// fi(x, 0, V.size(), 1) {
		// 	trace2(i, V[x]);
		// }
		fi(k, 0, (1 << M), 1) {
			V1.clear();
			fi(l, 0, M, 1) {
				if(k & (1 << l)) {
					V1.push_back(l);
				}
			}
			// fi(y, 0, V1.size(), 1) {
			// 	trace2(k, V1[y]);
			// }
			ll cnt = 0;
			fl(x, 0, N, 1) {
				fl(y, 0, M, 1) {
					if(find(V.begin(), V.end(), x) != V.end() || find(V1.begin(), V1.end(), y) != V1.end()) {
						continue;
					}
					// trace3(x, y, mat[x][y]);
					if(mat[x][y] == '#') {
						cnt++;
					}
				}
			}
			// trace2(i, k);
			// trace1(cnt);
			if(cnt == A) {
				ans++;
			}
		}
    }
    cout << ans << " \n";
    
	return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
char s[12345];
int main() {
	scanf("%s", s);
	int len = strlen(s);
	long long ans = 0;
	for (int t = 0; t < (1 << (len - 1)); t++) {
		long long num = s[0] - '0';
		for (int i = 0; i < len - 1; i++) {
			if (t & (1 << i)) {
				ans += num;
				num = 0;
			}
			num = num * 10 + s[i + 1] - '0';
		}
		ans += num;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int func(vector<int> v)
{
  int n=v.size();
  int i;
  int dp[n];
  dp[0]=0;dp[1]=abs(v[1]-v[0]);
  for(i=2;i<n;i++)
  {
    dp[i]=min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));
  }
  return dp[n-1];
}
 
int main()
{
  int n;
  cin>>n;
  vector<int> v;
  int i,a;
  for(i=0;i<n;i++)
  {
    
    cin>>a;
  	v.push_back(a);
  }
  cout<<func(v)<<"\n";
}


Measured memory_bytes: 1528
n = int(raw_input())
print "",
for i in range(1, n+1):
  if i % 3 == 0:
    print "%d" % i,
  else:
    z = i
    while 1:
      if z % 10 == 3:
        print "%d" % i,
        break
      z /= 10
      if z == 0:
        break

Measured memory_bytes: 4496
s = input()
l = len(s)

a = []

for i in range(2 ** (l-1)):
    f = []
    b = '{:b}'.format(i).zfill(l-1)
    for j, c in enumerate(s):
        f.append(c)
        if j < l-1 and b[j] == '1':
        	f.append('+')
    a.append(eval(''.join(f)))

print(sum(a))

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  public void run() {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out)) {

      String[] lines = in.readLine().split(" ");
      int x = Integer.parseInt(lines[0]);
      int y = Integer.parseInt(lines[1]);

      int ans = x + (y>>1);
      System.out.println(ans);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
}

Measured memory_bytes: 22100
#include <iostream>
using namespace std;
int min(int x,int y){
	if(x<y) return x;
	return y;
}
int main() {
	int p[3],j[2];
	int minp,minj;
	int daikin;
	for(int i=0;i<3;i++){
		cin >> p[i];
	}
	for(int i=0;i<2;i++){
		cin >> j[i];
	}
	minp=min(p[0],p[1]);
	minp=min(minp,p[2]);
	minj=min(j[0],j[1]);
	daikin=minp+minj-50;
	cout << daikin << endl;
	
	// your code goes here
	return 0;
}

Measured memory_bytes: 3088
n = gets.to_i

a = gets.split.map(&:to_i) # ryori
b = gets.split.map(&:to_i) # manzoku
c = gets.split.map(&:to_i) # manzoku+++
manzoku = 0
prea = nil
n.times do |i|
  manzoku += b[a[i]-1]
  manzoku += c[a[i]-2] if prea == a[i] - 1
  prea = a[i]
end
p manzoku
# 14 74 150


Measured memory_bytes: 3836
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			int x = sc.nextInt();
			
			int fhCount = x / 500;
			
			int rest = x - fhCount * 500;
			int fCount = rest / 5;
			
			System.out.println(fhCount * 1000 + fCount * 5);
			
		}
	}

}

Measured memory_bytes: 21844
// Making chalk mark on generator: $1
// Knowing where to make mark: $9,999
#include <bits/stdc++.h>
#define when(...) fprintf(stderr,__VA_ARGS__)
typedef long long ll;
ll read() {
	static char c;
	static ll x;
	int flag = 1;
	while (c = getchar(), !isdigit(c))
		if (c == '-') flag = 0;
	x = c - '0';
	while (c = getchar(), isdigit(c))
		x = x * 10 + c - '0';
	return flag ? x : -x;
}

struct limit{
	int l,r,x;
	bool operator<(const limit &rhs)const {return r<rhs.r;}	
} ps[333];
bool check(int r,int g,int b,int beg,int end){
	for(int i=beg;i<=end;++i){
		int inrange=0;
		if (r>=ps[i].l&&r<=ps[i].r)++inrange;
		if (g>=ps[i].l&&g<=ps[i].r)++inrange;
		if (b>=ps[i].l&&b<=ps[i].r)++inrange;
		if (inrange!=ps[i].x) return 0;
	}
	return 1;
}

int n,m;
const ll mod=1e9+7;
ll ans[303][303][303];
ll f(int r,int g,int b,int cur=1){
	ll &tmp=ans[r][g][b];
	if (tmp>=0) return tmp;
//	when("BEGIN solve %d %d %d %d\n",r,g,b,cur);
	
	int x=std::max({r,g,b})+1;
	if (x>n) return tmp=1;
	
	int beg=cur;
	while (cur<=m&&ps[cur].r<=x) ++cur;
	
	tmp=0;
	if (check(x,g,b,beg,cur-1)) tmp+=f(x,g,b,cur);
	if (check(r,x,b,beg,cur-1)) tmp+=f(r,x,b,cur);
	if (check(r,g,x,beg,cur-1)) tmp+=f(r,g,x,cur);
	tmp%=mod;
	return tmp;
}

signed main() {
	memset(ans,-1,sizeof ans);
	n=read(),m=read();
	for(int i=1;i<=m;++i){
		ps[i].l=read(),ps[i].r=read();
		ps[i].x=read();	
	}
	std::sort(ps+1,ps+1+m);
	printf("%lld\n",f(0,0,0));
}



Measured memory_bytes: 217600
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N; cin >> N;
    vector<int> a(N);
    for(int i=0;i<N;i++){
        cin >> a[i]; a[i]--;
    }
    int x=0;
    int out=-1;
    for(int i=1;i<N;i++){
        x = a[x];
        if(x==1){
            out = i;
            break;
        }

    }
    cout << out << endl;
    return 0;
}


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

using namespace std;

int main()
{
    long long n;
    cin >> n;
    
    for (int i=1; i<10; i++) {
        if(n%i==0 && n/i<10){cout<<"Yes"; return 0;}
    }
    cout << "No";
    return 0;
}


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

int main(){
        ll n;
        scanf("%lld", &n);
        vector<P> a(n);

        ll prev = -1;
        for(ll i=0; i<n; i++){
                ll tmp;
                scanf("%lld", &tmp);
                if(prev==tmp) n--, i--;
                else a[i] = {tmp, 0};
                prev = tmp;
        }

        if(n==1){
                if(a[0].first==0)printf("%d\n", 0);
                else printf("%d\n", 1);
                return 0;
        }

        if(a[0]>a[1]) a[0].second = 1;
        for(ll i=1; i<n-1; i++){
                if(a[i-1]>a[i] && a[i]<a[i+1]) a[i].second = -1;
                else if(a[i-1]<a[i] && a[i]>a[i+1]) a[i].second = 1;
        }
        if(a[n-2]<a[n-1]) a[n-1].second = 1;
        sort(a.begin(), a.end(), greater<P>());

        ll ans = 1, land = 0;
        for(ll i=0; i<n; i++){
                land += a[i].second;
                if(i==n-1 || a[i].first!=a[i+1].first) ans = max(ans, land);
        }
        printf("%lld\n", ans);
        return 0;
}



Measured memory_bytes: 4384
mod = 10 ** 9 + 7
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
X , Y = map(int,input().split())
N = max(X,Y)
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
mod = 10 ** 9 + 7
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
if X % 2 == 0 :
    p = X // 2
    q = 0
    while True :
        if Y == p + 2 * q :
            ans = cmb(p+q,min(p,q),mod)
            break
        elif p < 0 :
            ans = 0
            break
        else:
            p -= 1
            q += 2
    print(ans)
else:
    p = X // 2
    q = 1
    while True:
        if Y == p + 2 * q:
            ans = cmb(p + q, min(p, q),mod)
            break
        elif p < 0 :
            ans = 0
            break
        else:
            p -= 1
            q += 2
    print(ans)

Measured memory_bytes: 121792
local n,m=io.read("n","n")
if m%n==0 then
    print(m//n)
else
    local d={}
    for i=1,math.sqrt(m) do
        if m%i==0 then
            table.insert(d,i)
            table.insert(d,m//i)
        end
    end
    table.sort(d)

    local max=0
    for _,v in pairs(d) do
        if v*n<=m then
            max=math.max(max,v)
        end
    end
    print(max)
end

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

typedef struct {
  char mark;
  int value;
} Card;

void BubbleSort(Card *, int);
void SelectionSort(Card *, int);
void print(Card *, int);
int Judge(Card *, Card *, int);

int main()
{
  Card c1[37], c2[37]; 
  int i, N;
  
  scanf("%d", &N);

  for( i = 0 ; i < N ; i++ ){
    scanf(" %c%d", &c1[i].mark, &c1[i].value);
  }
    
  for( i = 0 ; i < N ; i++ ) c2[i] = c1[i];

  BubbleSort(c1, N);  
  print(c1, N);
  printf("Stable\n");

  SelectionSort(c2, N);
  print(c2, N);

  if( Judge(c1, c2, N) == 0 ) printf("Stable\n");
  else printf("Not stable\n");
  
  return 0;
}

void BubbleSort(Card c1[], int N)
{
  int i, j;
  Card t;
  
  for( i = 0 ; i < N ; i++ ){
    for( j = N-1 ; j > i ; j-- ){
      if( c1[j].value < c1[j-1].value ){
	t = c1[j];
	c1[j] = c1[j-1];
	c1[j-1] = t;
      }
    }
  }
} 

void SelectionSort(Card c2[], int N)
{
  int i, j, minj;
  Card t;

  for( i = 0 ; i < N ; i++ ){
    minj = i;
    for( j = i ; j < N ; j++ ){
      if( c2[j].value < c2[minj].value ) minj = j;
    }
    t = c2[i];
    c2[i] = c2[minj];
    c2[minj] = t;
  }
}
    
void print(Card c[], int N)
{
  int i;
  
  for( i = 0 ; i < N ; i++ ){
    if( i > 0 ) printf(" ");
    printf("%c%d", c[i].mark, c[i].value);
  }
  printf("\n");
}

int Judge(Card c1[], Card c2[], int N)
{
  int i;

  for( i = 0 ; i < N ; i++ )
    if( c1[i].mark != c2[i].mark ) return 1;
  
  return 0;
}

Measured memory_bytes: 612
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> num = new ArrayList<Integer>();
		ArrayList<String> param = new ArrayList<String>();
		int system = 0; // 文字の空白区切り 0:ON 1:OFF

		while (sc.hasNext()) {
			if (sc.hasNextInt()) {
				num.add(sc.nextInt());
			} else {
				if (system == 0)
					param.add(sc.next());
				if (system == 1)
					param.add(sc.nextLine());
			}
		}
		Method(num, param);
	}

	static void Method(ArrayList<Integer> num, ArrayList<String> param) {
		HashSet<String> color = new HashSet<>();
		int unknown = 0;
		int max = 0;
		int min = 0;
		num.remove(0);

		for(int i = 0; i < num.size(); i++){
			if(num.get(i) < 400){
				color.add("gray");
			}else if(num.get(i) < 800){
				color.add("brown");
			}else if(num.get(i) < 1200){
				color.add("green");
			}else if(num.get(i) < 1600){
				color.add("aqua");
			}else if(num.get(i) < 2000){
				color.add("blue");
			}else if(num.get(i) < 2400){
				color.add("yellow");
			}else if(num.get(i) < 2800){
				color.add("daidai");
			}else if(num.get(i) < 3200){
				color.add("red");
			}else if(num.get(i) >= 3200){
				unknown++;
			}
		}
		max = color.size() + unknown;

		min = color.size();
		if(min == 0 && unknown > 0) min = 1;

		System.out.print(min + " " + max);
	}
}

Measured memory_bytes: 21972
// 1_abc136_a
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    if(a - b >= c){
        cout << 0 << endl;
    }else{
        cout << c - (a - b) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
if __name__ == '__main__':
    n = int(input())
    abc = [list(map(int, input().split())) for _ in range(n)]

    dp_a, dp_b, dp_c = 0, 0, 0

    for a, b, c in abc:
        ai = max(dp_b, dp_c) + a
        bi = max(dp_a, dp_c) + b
        ci = max(dp_a, dp_b) + c
        dp_a, dp_b,dp_c = ai, bi, ci

    print(max(dp_a, dp_b, dp_c))


Measured memory_bytes: 62936
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL; 

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

//ここから書き始める
int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    string str;
    cin >> str;

    int size = SZ(str);
    bool ok = 0;

    if(str == "keyence")
    {
        cout << "YES" << endl;
        return 0;
    }

    REP(i,size)
    {
        FOR(j,i,size)
        {
            // delete between i,j
            string newstr = str; 
            newstr.erase(newstr.begin()+i, newstr.begin()+j+1);
            if(newstr == "keyence") ok = 1;
            //int newsize = SZ(newstr);
        }
    }
    if(ok) cout << "YES" << endl;
    else cout << "NO" << endl;

}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int a,b,c,num=0,i;
  scanf("%d %d %d",&a,&b,&c);
  for(i=a; i<=b; i++){
    if(c%i==0)num+=1;
  }
  printf("%d\n",num);
  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m;i >= n;--i)
#define SORT(v, n) sort(v, v+n)
#define VSORT(v) sort(begin(v), end(v))
#define REV(v) reverse(begin(v), end(v))
#define VI vector<int>
#define PB(x) push_back(x)
#define SZ(x) end(x) - begin(x)
#define DEBUG(x) cerr << __LINE__ << ":" << #x << ": " << x << "\n";
//#define int long long
using namespace std;
using lint = long long;
struct Fast{Fast(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};} fast;
const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
inline void CO(auto &a) {REP(i, SZ(a)) cout << i << ": " << a[i] << "\n";}
//if (IO > 1e5){lint a;	scanf(%lld, &a);	printf("%lld\n", a);}

signed main(){
	VI a(6);
	REP(i,6) cin >> a[i];
	if (a[4] - a[0] <= a[5]) cout << "Yay!" << endl;
	else cout << ":(" << endl;
	
return 0;
}


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

#define FILE
#define fr first
#define se second

using namespace std;

const long long N = 2e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

int X;
int Y;
int A;
int B;
int C;
int x;
long long res;
vector<int> a;
vector<int> b;
vector<int> c;
vector<int> ans;
int main()
{
    #ifdef FILEs
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);

    cin >> X >> Y >> A >> B >> C;
    for(int i = 1; i <= A; i ++){
        cin >> x;
        a.push_back(x);
    }
    for(int i = 1; i <= B; i ++){
        cin >> x;
        b.push_back(x);
    }
    for(int i = 1; i <= C; i ++){
        cin >> x;
        c.push_back(x);
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.rbegin(), c.rend());
    while((int)ans.size() < X){
        ans.push_back(a.back());
        a.pop_back();
    }
    while((int)ans.size() - X < Y){
        ans.push_back(b.back());
        b.pop_back();
    }
    int idx = 0;
    sort(ans.begin(), ans.end());
    for(int i = 0; i < min(C, X + Y); i ++){
        if(idx == (int)ans.size()){
            break;
        }
        if(ans[idx] < c[i]){
            ans[idx ++] = c[i];
        }
    }
    long long res = 0;
    for(auto x: ans){
        res += x;
    }
    cout << res << "\n";
}


Measured memory_bytes: 2552
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	long long N, K;
	cin >> N >> K;
	vector<long long> H(N);
	for (long long i = 0; i < N; i++)
		cin >> H[i];

	sort(H.begin(), H.end(), greater<>());

	long long ans = 0;
	for (long long i = 0; i < N; i++, K--) {
		if (K <= 0) {
			ans += H[i];
		}
	}
	cout << ans << endl;

	return 0;
}

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

int main(){
  int a,b,t;
  cin >> a >> b >> t;
  
  cout << (t/a)*b;
  
  return 0;
}

Measured memory_bytes: 256
X, N = gets.split.map(&:to_i)
arr = gets.split.map(&:to_i)
exist = []
ans = 0
sa = Float::INFINITY
102.times do |i|
	exist << i
end

N.times do |i|
	exist.delete(arr[i])
end

(exist.length).times do |i|
	tmp = (exist[i]-X).abs
	if sa > tmp
		sa = tmp
		ans = exist[i]
	end
end

p ans

Measured memory_bytes: 14364
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int a,b;
	while(cin>>a>>b,a||b){
		int d=a*a+b*b;
		bool h=false;
		for(;;d++){
			for(int i=a+1;d-i*i>=0;i++){
				for(int q=i+1;q<151;q++)if(i*i+q*q==d&&i<q){
					h=true;
					cout<<i<<" "<<q<<endl;
					break;
				}
				if(h)break;
			}
			if(h)break;
			a=0;
		}
	}
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define ifor(i,n) for(i=0;i<n;i++)
#define ll long long
int main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     ll int i,n,t,p=INT_MAX,j=0,x,a=0,b,l=0,r=0;
     string s,m;
     cin>>s;
     for(i=0;i<s.size();i+=2){
        m=s.substr(i,2);
        if(m=="hi"){

        }
        else{
            cout<<"No"<<endl; return 0;
        }
     }
     cout<<"Yes"<<endl ;

     return EXIT_SUCCESS;
}




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

N = int(input())
# X, Y = map(int,input().split())
# Z, W = map(int,input().split())
# vA = list(map(int, input().split()))

for x in range(1, N+1):
    if 100.0 <= N/x <= 105.0:
        print(1)
        exit(0)
print(0)


Measured memory_bytes: 2940
def calc(ds) -> int:
  ds = sorted(ds)
  half = len(ds) // 2
  lower_d = ds[half - 1]
  higher_d = ds[half]
  
  return higher_d - lower_d

_ = input()
numbers_str = input()
result = calc([int(n) for n in numbers_str.split(' ')])
print(result)


Measured memory_bytes: 14456
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

int main(){
    int N;
    string s;
    cin >> N;
    cin >> s;
    int r=0;
    for(int i=0; i<s.size(); i++){
        if(s[i]=='R'){
            r++;
        }
    }
    if(r>(N-r)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

int main(){
  int w;
  vector<int> v;

  while( !cin.eof() && cin>>w ){

    if( w>0 ){
      v.clear();
      for( int i=512;i>=1;i= i/2 ){
	//	cout << "i="<<i<<endl;
	if( w>=i ){
	  w-=i;
	v.push_back( i );
	}
      }

      for( int i=v.size()-1;i>0;--i )
	cout << v[i]<< " ";
      cout << v[0] << endl;
    }else
      cout << "0" << endl;
  }

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <random>
#include <ctime>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx2")
#define ll long long
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define pll pair<ll,ll>
#define ld double
#define pld pair<ld,ld>
#define pii pair<int,int>
#define sqr(a) ((a)*(a))
#define all(v) v.begin(),v.end()

using namespace std;
//using namespace __gnu_pbds;

const ll MOD = 998244353;
const ll INF = 1e18;
const ld E = 1e-12;
const ld PI=acos(-1);
mt19937_64 rnd(time(0));
ll p1 = 31, p2 = 37, p3 = 7, p4 = rnd() % 100 + 1, md1 = MOD, md2 = 998244353, md3 = 998244357, md4 = rnd() % 1000000000;

//using ord_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

ll n, m;
ll dp[3001][3001];

ll binpow(ll h, ll r, ll md = MOD)
{
    ll l = 1;
    while (r)
    {
        if (r & 1) l *= h, l %= md;
        h *= h;
        h %= md;
        r /= 2;
    }
    return l;
}

ll gcd(ll x, ll y)
{
    if (x < y) swap(x, y);
    while (x && y)
    {
        x %= y;
        swap(x, y);
    }
    return x + y;
}

void solve()
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    dp[a][b]=1;
    for (int i = a; i <= c; i++)
        for (int j = b; j <= d; j++)
        {
            dp[i][j]-=(dp[i-1][j-1]*(i-1)%MOD*(j-1)%MOD);
            if (dp[i][j]<0) dp[i][j]+=MOD;
            if (i<c) dp[i+1][j]=(dp[i+1][j]+dp[i][j]*j)%MOD;
            if (j<d) dp[i][j+1]=(dp[i][j+1]+dp[i][j]*i)%MOD;
        }
    cout << dp[c][d] << "\n";
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //freopen("capitals.in","r",stdin);
    //freopen("capitals.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t=1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

/*
8 2
2 2 2 2 2 2 2 2
1 2

*/


Measured memory_bytes: 73880
package main

import (
	"fmt"
	"strings"
	"strconv"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	d := make([]int, k)

	for i:=0; i<k; i++ {
		fmt.Scan(&d[i])
	}

	for i:=n; i<100000; i++ {
		count := true
		for _, v := range d {
			if strings.Contains(strconv.Itoa(i), strconv.Itoa(v)) {
				count = false
				break
			}
		}
		if count {
			fmt.Println(i)
			break
		}
	}
}

Measured memory_bytes: 2048
X=int(input())
if 400<=X<=599:
    print(8)
elif 600<=X<=799:
    print(7)
elif 800<=X<=999:
    print(6)
elif 1000<=X<=1199:
    print(5)
elif 1200<=X<=1399:
    print(4)
elif 1400<=X<=1599:
    print(3)
elif 1600<=X<=1799:
    print(2)
else:
    print(1)

Measured memory_bytes: 9208
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
#include<math.h>
//#include "Ants.h"
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
typedef pair < int, int> P;
/****Union-Ford-Tree***/
int par[int(0x7ffffff)];//Parent
int Rank[int(0x7ffffff)];//Deep_of_the_Tree

//int a[100] = { 4,2,3,1,5 }, m[100] ={3,2,2};
//int n = 0;
//const ll mod = 1000000007;


//n要素で初期化
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		Rank[i] = 0;
	}
}
//木の根探し
int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}
//xとyの属する集合を併合
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;

	if (Rank[x] < Rank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (Rank[x] == Rank[y])Rank[x]++;
	}
}

bool same(int x, int y) {
	return find(x) == find(y);
}
/************************************************************************************/
//int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
/**************/
ll dp[102][int(1e3)*100+1];
ll n, W;
ll w[101], v[101];
int main()
{
	cin >> n >> W;
	for (int i = 0; i < n; i++)cin >> w[i] >> v[i];
	fill(dp[0], dp[0] + int(1e3) * 100 + 1,INF+10);
	dp[0][0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= int(1e3) * 100; j++) {
			if (j < v[i]) {
				dp[i + 1][j] = dp[i][j];
			}
			else {
				//cout << "work" << endl;
				dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
			}
		}
	}
	ll res = 0;
	for (int i = 0; i <= int(1e3) * 100; i++) {
		
		if (dp[n][i] <= W) {
			
			res = i;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 80128
N = int(input())
num_list = [int(input()) for i in range(N)]
max_num = max(num_list)
max_num_num = num_list.count(max_num)

for cnt in range(N):
  if num_list[cnt] == max_num and max_num_num == 1:
    print(max(num_list[0:cnt] + num_list[cnt+1:]))
  else:
    print(max_num)

Measured memory_bytes: 15584
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k,n;
	scanf("%d%d",&k,&n);
	for(int i=n-k+1;i<n;i++)
	{
		printf("%d ",i);
	}
	printf("%d",n);
	for(int i=n+1;i<n+k;i++)
	{
		printf(" %d",i);
	}
}

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

struct UnionFind{
    vector<int> par;
    vector<int> dep;

    UnionFind(int siz){
        par.assign(siz,0);
        dep.assign(siz,1);
        for(int i = 0; i < siz; i++){
            par[i] = i;
        }
    };

    int find(int x){
        if(par[x] == x) return x;
        else return par[x] = find(par[x]);
    }
    ll unite(int x, int y){
        x = find(x);
        y = find(y);
        ll dx = dep[x], dy = dep[y];
        if(x == y) return 0;
        if(dep[x] < dep[y]){
            par[x] = y;
            dep[y] += dep[x];
        }
        else{
            par[y] = x;
            dep[x] += dep[y];
        }
        return dx * dy;
    }

    bool same(int x, int y){
        return find(x) == find(y);
    }
};

int main(){
    ll n, m;
    cin >> n >> m;
    
    UnionFind uf(n);
    vector<vector<int>> edge(m, vector<int>(2));
    for(int i = 0; i < m; i++){
        cin >> edge[i][0] >> edge[i][1];
        edge[i][0]--, edge[i][1]--;
    }
    vector<ll> ans(m);
    ll sum = n*(n-1)/2;
    for(int i = 0; i < m; i++){
        ans[m - i - 1] = sum;
        sum -= uf.unite(edge[m - i - 1][0], edge[m - i - 1][1]);
    }
    for(int i = 0; i < m; i++) cout << ans[i] << endl;
}

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

using namespace std;

bool Solve() {
    string s;
    cin >> s;

    if (s[0] != 'A') return false;
    int cnt = 0;
    for (size_t i = 2; i + 1 < s.size(); ++i) {
        if (s[i] == 'C') ++cnt;
        else if ('A' <= s[i] && s[i] <= 'Z') return false;
    }
    if (cnt != 1) return false;
    for (size_t i = 2; i + 1 < s.size(); ++i)
        if (s[i] == 'C') s[i] = 'c';

    for (size_t i = 1; i < s.size(); ++i)
        if ('A' <= s[i] && s[i] <= 'Z') return false;

    return true;
}

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

    if (Solve()) cout << "AC\n";
    else cout << "WA\n";

    return 0;
}


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

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

    if ((a * b) % 2 == 1)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader in =new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(in.readLine());

		HashSet<String> dicA = new HashSet<String>();
		HashSet<String> dicC = new HashSet<String>();
		HashSet<String> dicG = new HashSet<String>();
		HashSet<String> dicT = new HashSet<String>();

		for (int i = 0; i < n; i++) {
			String com = in.readLine();

			if (com.substring(0, 1).equals("i")) {
				if (com.substring(7, 8).equals("A")) {
					dicA.add(com.substring(7));
				} else if (com.substring(7, 8).equals("C")) {
					dicC.add(com.substring(7));
				} else if (com.substring(7, 8).equals("G")) {
					dicG.add(com.substring(7));
				} else if (com.substring(7, 8).equals("T")) {
					dicT.add(com.substring(7));
				}
			} else {
				if (com.substring(5, 6).equals("A")) {
					if (dicA.contains(com.substring(5))) {
						System.out.println("yes");
					} else {
						System.out.println("no");
					}
				} else if (com.substring(5, 6).equals("C")) {
					if (dicC.contains(com.substring(5))) {
						System.out.println("yes");
					} else {
						System.out.println("no");
					}
				} else if (com.substring(5, 6).equals("G")) {
					if (dicG.contains(com.substring(5))) {
						System.out.println("yes");
					} else {
						System.out.println("no");
					}
				} else if (com.substring(5, 6).equals("T")) {
					if (dicT.contains(com.substring(5))) {
						System.out.println("yes");
					} else {
						System.out.println("no");
					}
				}
			}

		}
	}
}

Measured memory_bytes: 159760
N = int(input())
S = input()

S = [ord(s) - 65 for s in S]
for i in range(len(S)):
    position = S[i] + N
    if position > 25:
        S[i] = position - 26
    else:
        S[i] = position

print(''.join(chr(s + 65) for s in S))


Measured memory_bytes: 3188
/**
 * File              : H - Grid 1 .cpp
 * Author            : horcrux2301 <khajuriaharsh729@gmail.com>
 * Date              : 06.01.2019
 * Last Modified Date: 06.01.2019
 */
#include <bits/stdc++.h>
#define ll long long
#define mp(a,b)     make_pair(a,b)
#define newline     cout << endl;
#define ff          first
#define ss          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
using namespace std;

template<typename S, typename T>
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.ff<<", "<<p.ss<<')';return out;}

template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
int l=v.size();for(int i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}

template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}

int main(){
    //clock_t tStart = clock();
    int test;
    test=1;
    //cin >> test;
    while(test--){
        int a,b;
        cin >> a >> b;
        char arr[a][b];
        for(ll i=0;i<a;i++){
            string x; cin >> x;
            for(ll j=0;j<b;j++){
                arr[i][j]=x[j];
            }
        }
        ll M = 1e9+7;
        ll dp[a+1][b+1];
        bool f = 0;
        for(ll i=0;i<a+1;i++){
            for(ll j=0;j<b+1;j++){
                if(i==0 || j==0) {
                    dp[i][j]=0;
                    continue;
                } 
                if(arr[i-1][j-1]=='.'){
                    if(f==1)
                        dp[i][j]=(dp[i-1][j]+dp[i][j-1])%M;
                    else{
                        f=1;
                        dp[i][j]=1;
                     }
                }
                else{
                    dp[i][j]=0;
                }
            }
        }
        ll ans = dp[a][b];
        cout << ans << endl;
    }
    //printf("Time taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
    return 0;
}



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

using namespace std;
using ll = long long;

void A() {
  char f, s, t;
  scanf("%c%c%c", &f, &s, &t);
  if (f == 'R' && s == 'R' && t == 'R') {
    printf("3");
  } else if (f == 'R' && s == 'R' || s == 'R' && t == 'R') {
    printf("2");
  } else if (f == 'R' || s == 'R' || t == 'R') {
    printf("1");
  } else {
    printf("0");
  }
  printf("\n");
}

void B() {
  int n;
  int sticks[100 + 2];
  scanf("%d", &n);
  for (auto i = 0; i < n; ++i) scanf("%d", &sticks[i]);
  ll triples = 0;
  for (auto i = 0; i < n; ++i) {
    for (auto j = i + 1; j < n; ++j) {
      if (sticks[i] == sticks[j]) continue;
      for (auto k = j + 1; k < n; ++k) {
        if (sticks[i] != sticks[k] && sticks[j] != sticks[k] &&
            sticks[i] + sticks[j] > sticks[k] &&
            sticks[i] + sticks[k] > sticks[j] &&
            sticks[j] + sticks[k] > sticks[i]) {
          ++triples;
        }
      }
    }
  }
  printf("%lld\n", triples);
}

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


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

void solve(){
    int a; cin >> a;
    cout << (1000 - a%1000)%1000 << '\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>

#define MOD 1000000007
#define INF INT_MAX
#define NINF INT_MIN
#define LLINF LLONG_MAX
using ll = long long;
using namespace std;

int main() {
    ll X, Y;
    cin >> X >> Y;
    if (abs(X - Y) <= 1) {
        cout << "Brown" << endl;
    }
    else {
        cout << "Alice" << endl;
    }
    getchar(); getchar();
    return 0;
}

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

int main() {
  cout << fixed << setprecision(10);
  double L;
  cin >> L;
  double l = L / 3;
  double ans = l * l * l;
  cout << ans << endl;
}


Measured memory_bytes: 3780
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

int main(void)
{
    cin.sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> As(N);
    REP(n, N) cin >> As[n];

    vector<int> colors{As[0]};
    
    FOR(i, 1, N) {
        auto a = As[i];
        if (a <= colors[0]) {
            colors.insert(colors.begin(), a);
        }
        else {
            auto it = lower_bound(ALL(colors), a);
            --it;
            *it = a;
        }
    }
    cout << SIZE(colors) << endl;
    return 0;
}


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

int main(){
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    
    for(int i = 0; i < 3; i++){
        for(int j = 1; j < 3-i; j++){
            if(a[j-1] > a[j]){
                int tmp = a[j-1];
                a[j-1] = a[j];
                a[j] = tmp;
            }
        }
    }
    
    cout << a[0] << " " << a[1] << " " << a[2] << endl;
    
    return 0;
}


Measured memory_bytes: 3080
N = int(input())

A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

sum1 = sum(B)
sum2 = 0 
for i in range(N-1):
    if A[i] + 1 == A[i+1]:
        sum2 += C[(A[i]-1)]
print(sum1 + sum2)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N,A,B;
    cin >> N >> A >> B;
    vector<int> V(10000);
    for(int i = 1; i <= N; i++){
        V[i-1] = i / 10000 % 10 + i / 1000 % 10 + i / 100 % 10+ i / 10 % 10+ i % 10;
    }
    int ans = 0;
    for(int i = 0; i < N; i++){
        if(V[i] >= A && V[i] <= B) ans += i+1;
    }
    cout << ans << endl;
}


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

int main(){
  char s[3]; cin>>s;
  
  if(s[0] == s[1] || s[1] == s[2] || s[2] == s[0]){
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }
}

Measured memory_bytes: 256
N,X,M = map(int,input().split())
A = [0]*M
S = 0
r = X % M
A[r] = 1
d = 0
I = 0
for i in range(1,M+1):
    r = (r*r) % M
    if A[r] == 0:
        A[r] = i+1
    else:
        I = A[r]
        j = i+1
        d = j-I
        break
r = X
for i in range(I):
    S += r
    r = (r*r) % M
if d != 0:
    t,u = (N-I)//d,(N-I)%d
    s = 0
    for i in range(d):
        s += r
        r = (r*r) % M
    S += s*t
    for i in range(u):
        S += r
        r = (r*r) % M
print(S)

Measured memory_bytes: 65924
#include<stdio.h>
#include<string.h>
int main()
{
	int k,i,len;
	char s[101];
	scanf("%d %s",&k,s);
	len=strlen(s);
	if(len>k){
		for(i=0;i<k;i++){
			printf("%c",s[i]);
		}
		printf("...\n");
	}
	else printf("%s",s); 
	return 0;
}

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

int main(){
	int ar[10];
	int br[10];
	
	for(int i=0;i<10;i++){
		cin>>ar[i];
		}
		
	for(int i=0;i<10;i++){
		cin>>br[i];
		}	
		sort(ar,ar+10);
		sort(br,br+10);
		int c=ar[7]+ar[8]+ar[9];
		int d=br[7]+br[8]+br[9];
		
		cout<<c<<" "<<d<<endl;
		return 0;
		
	}

Measured memory_bytes: 3112
n, x = map(int, input().split())

def num_patty(n, x):
  if 2**(n+2)-3 <= x:
    return 2**(n+1)-1
  elif 2**(n+1) <= x and x <= 2**(n+2)-4:
    return num_patty(n-1, x-2**(n+1)+1)+(2**n-1)+1
  elif x == 2**(n+1)-1:
    return (2**n-1)+1
  elif 2 <= x and x <= 2**(n+1):
    return num_patty(n-1, x-1)
  else:
    return 0
    
print(num_patty(n, x))

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

using namespace std;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
long long baseW;
long long N, W;
vector<long long> val[4];
 
int main(){
	cin >> N >> W;
	for(long long i = 0; i < N; i++){
		long long tmpw, tmpv;
		cin >> tmpw >> tmpv;
		if(i == 0){
			baseW = tmpw;
		}
		val[tmpw - baseW].push_back(tmpv);
	}
	for(int i = 0; i < 4; i++){
		sort(val[i].begin(), val[i].end(), greater<long long>());
		val[i].insert(val[i].begin(), 0);
		for(int j = 0; j < val[i].size() - 1; j++){
			val[i][j+1] += val[i][j];
		}
	}
 
	long long ans = 0;
	for(long long i = 0; i < val[0].size(); i++){
		for(long long j = 0; j < val[1].size(); j++){
			for(long long k = 0; k < val[2].size(); k++){
				long long curw;
				curw = i * baseW + j * (baseW + 1) + k * (baseW + 2);
				if(curw > W){
					continue;
				}else{
					long long l = (W - curw)/(baseW + 3);
					ans = max(ans, val[0][i] + val[1][j] + val[2][k] + val[3][min(l, (long long)val[3].size() - 1)]);
				}
			}
		}
	}

	/*
	for(long long i = 0; i < val[0].size(); i++){
		for(long long j = 0; j < val[1].size(); j++){
			for(long long k = 0; k < val[2].size(); k++){
				for(long long l = 0; l < val[3].size(); l++){
					long long curw;
					if(i * baseW + j * (baseW + 1) + k * (baseW + 2) + l * (baseW + 3) > W){
						continue;
					}else{
						ans = max(ans, val[0][i] + val[1][j] + val[2][k] + val[3][l]);
					}
				}
			}
		}
	}
	*/


	cout << ans << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
const ll MD = 1000000007;

/* sample input

*/
int h, w;
char s[50][50];
int  d[50][50];
int whitenum = 0;
int minpath = INT_MAX;

int bfs() {
	queue<P> que;
	int dx[4] = { 1,0,-1,0 };
	int dy[4] = { 0,1,0,-1 };
	
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			d[i][j] = INT_MAX;
		}
	}

	que.push(P(0, 0));

	d[0][0] = 0;
	while (que.size()) {
		P p = que.front();
		que.pop();
		if (p.first == h - 1 && p.second == w - 1) break;

		for (int i = 0; i < 4; i++) {
			int ny = p.first + dy[i];
			int nx = p.second + dx[i];
			if (0 <= nx && nx < w && 0 <= ny&&ny < h&&s[ny][nx] != '#'&&d[ny][nx] == INT_MAX) {
				que.push(P(ny, nx));
				d[ny][nx] = d[p.first][p.second] + 1;
			}
		}
	}
	return d[h - 1][w - 1];
}

int main()
{

	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> s[i][j];
			if (s[i][j] == '.') {
				whitenum++;
			}
		}
	}

	if (bfs() == INT_MAX) {
		cout << -1 << endl;
	}
	else {
		int answer = whitenum - (bfs() + 1);
		cout << answer << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MOD = 1e9+7;

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

    int n;
    cin >> n;

    vector<int> a(n+1);
    REP(i,n) cin >> a[i];

    ll ans = 0;
  	map<int,int> memo;
    REP(i,n) memo[ -a[i]+i ]++;
    REP(i,n){
      memo[ -a[i]+i ]--;
      ans += memo[ a[i]+i ];
    }
  
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 21056
package main
import "fmt"
func main() {
  var q,h,s,d,n int64
  fmt.Scan(&q,&h,&s,&d)
  fmt.Scan(&n)
  q *= 8
  h *= 4
  s *= 2
  fmt.Println((n/2)*min(q,h,s,d)+(n%2)*min(q,h,s)/2)
}
func min(n ...int64) int64 {
  var m int64 = n[0]
  for i:=1;i<len(n);i++ {
    if m > n[i] { m = n[i] }
  }
  return m
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int H,W;
vector<vector<int>> field;

void dfs(int h, int w){
   field[h][w] = 0;
   
   for(int dh = -1; dh <= 1; dh++){
      for(int dw = -1; dw <= 1; dw++){
         int nh = h + dh;
         int nw = w + dw;
      
         if(nh < 0 || nh >= H || nw < 0 || nw >= W)continue;
         if(field[nh][nw] == 0)continue;

         dfs(nh, nw);
      }
   }
}

int main(){
   while(true){
   cin >> W >> H;
   if(H == 0 || W == 0)return 0;
   field.assign(H, vector<int>(W, 0));

   for (int i = 0; i < H; i++){
      for(int j = 0; j < W; j++){
         cin >> field[i][j];
      }
   }

   int count = 0;
   for(int i = 0; i < H; i++){
      for(int j = 0; j < W; j++){
         if(field[i][j] == 0) continue;
         dfs(i, j);
         count++;
      }
   }
   cout << count << endl;
   }
}


Measured memory_bytes: 3200
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <tuple>
#include <iomanip>
using namespace std;
typedef long long ll;

int main() {
    ll a, b, k;
    cin >> a >> b >> k;
    cout << max(0ll, a - k) << " " << max(0ll, b + min(0ll, a - k)) << endl;
}

Measured memory_bytes: 256