akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"fmt"
	"math"
)

func main() {
	var A, B, C, min, tmp float64
	fmt.Scan(&A, &B, &C)

	min = math.Abs(A-B) + math.Abs(B-C)
	tmp = math.Abs(A-C) + math.Abs(C-B)
	if min > tmp {
		min = tmp
	}
	tmp = math.Abs(B-A) + math.Abs(A-C)
	if min > tmp {
		min = tmp
	}
	tmp = math.Abs(B-C) + math.Abs(C-A)
	if min > tmp {
		min = tmp
	}
	tmp = math.Abs(C-A) + math.Abs(A-B)
	if min > tmp {
		min = tmp
	}
	tmp = math.Abs(C-B) + math.Abs(B-A)
	if min > tmp {
		min = tmp
	}

	fmt.Print(min)
}

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

#define times(n, i)      uptil(0, n, i)
#define upto(f, t, i)    for(decltype(t) _##i = (t), i = (f); i <= _##i; i++)
#define uptil(f, t, i)   for(decltype(t) _##i = (t), i = (f); i < _##i; i++)
#define downto(f, t, i)  for(decltype(t) _##i = (t), i = (f); i >= _##i; i--)
#define downtil(f, t, i) for(decltype(t) _##i = (t), i = (f); i > _##i; i--)
#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define all(v) v.begin(), v.end()
#define ln << "\n"

struct line{};

template<class T> istream& operator>>(istream& in, vector<T>& v) {
    times(v.capacity(), i) in >> v[i];
    return in;
}

template<class T> const ostream& operator<<(ostream& out, const vector<T>& v) {
    times(v.size(), i) out << (i ? " " : "") << v[i];
    return out;
}

template<class T, class...U> typename enable_if<is_same<T, line>::value, string>::type next(istream& in, const U&... args) {
    string s;
    getline(in, s, args...);
    return move(s);
}

template<class T, class...U> typename enable_if<!is_same<T, line>::value, T>::type next(istream& in, const U&... args) {
    T t(args...);
    in >> t;
    return move(t);
}
template<class T, class...U> auto next(const U&... args) -> decltype(next<T>(cin)) {
    return next<T>(cin, args...);
}

template<class T> T sum(const vector<T>& v) {
    T ans = T();
    for(const T& t : v) ans += t;
    return ans;
}

template<class T> T min_elem(const vector<T>& v) {
    return *min_element(v.begin(), v.end());
}

template<class T> T max_elem(const vector<T>& v) {
    return *max_element(v.begin(), v.end());
}

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

    cout << min_elem(next<vector<int>>(3)) + min_elem(next<vector<int>>(2)) - 50 ln;

    return 0;
}

Measured memory_bytes: 1200
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n; cin>>n;
    string s; cin>>s;
    rep(i,s.size()){
        cout<<(char)((s[i]-'A'+n)%26+'A');
    }
    cout<<endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<vector>
#include<math.h>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
const long long mod = 1e9 + 7;
typedef long long ll;

int main(){
   int n;
   cin >> n;
   int a[n], b[n], c[n-1];
   int ans = 0;
   rep(i,n){
      cin >> a[i];
      a[i] = a[i] - 1;
   }
   rep(i,n){
      cin >> b[i];
   }
   rep(i,n-1){
      cin >> c[i];
   }
   rep(i,n){
      ans += b[a[i]];
      if(i != 0){
         if(a[i] == a[i-1] + 1) ans += c[a[i-1]];
      }
   }
   cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#define llint long long

using namespace std;

llint h, w, a, b;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> h >> w >> a >> b;
	if(a > w-a || b > h-b){
		cout << "No" << endl;
		return 0;
	}
	
	for(int i = 1; i <= h; i++){
		for(int j = 1; j <= w; j++){
			if((i<=b&&j<=a) || (i>b&&j>a)) cout << 1;
			else cout << 0;
		}
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>

using namespace std;
int main() {
    int h, w; cin >> h >> w;
    char a[h+1][w+1];
    for (int i = 1; i <= h; i++) {
        for (int k = 1; k <= w; k++) {
            cin >> a[i][k];
        }
    }
    for (int i = 1; i <= h; i++) {
        bool judge = true;
        for (int k = 1; k <= w; k++) {
            if (a[i][k] == '#') {
                judge = false;
                break;
            }
        }
        if (judge) {
            for (int j = 1; j <= w; j++) {
                a[i][j] = ' ';
            }
        }
    }
    
    for (int i = 1; i <= w; i++) {
        bool judge = true;
        for (int k = 1; k <= h; k++) {
            if (a[k][i] == '#') {
                judge = false;
                break;
            }
        }
        if (judge) {
            for (int j = 1; j <= h; j++) {
                a[j][i] = ' ';
            }
        }
    }
    for (int i = 1; i <= h; i++) {
        bool draw = false;
        for (int k = 1; k <= w; k++) {
            if (a[i][k] != ' ') {
                cout << a[i][k];
                draw = true;
            }
        }
        if (draw) cout << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 10

int main(){
    ll m;
    cin>>m;
    ll a = 0;
    ll ans = 0;
    rep(i,0,m){
      ll d,c;
      cin>>d>>c;
      a += d*c;
      ans += c;
    }
    ans--;
    while(a>9){
      ll b = a/10;
      ans += b;
      a %= 10;
      a += b;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
area = [list(map(int, input().split())) for i in range(h)]

ans = []
temp = []
p = 0
for i in range(h):
    if i%2 == 0:
        rw = list(range(w))
    else:
        rw = list(range(w))[::-1]
    for j in rw:
        if p == 1:
            temp.append('{} {} {} {}'.format(
                prev[0], prev[1], i+1, j+1
            ))
            prev = (i+1, j+1)
        if area[i][j]%2 == 1:
            if p == 0:
                prev = (i+1, j+1)
                p+=1
            elif p == 1:
                p = 0
                ans += temp
                temp = []

print(len(ans))
for a in ans:
    print(a)


Measured memory_bytes: 20548
#include<bits/stdc++.h>
using namespace std;
int check(string s)
{
    for(int i=0;i<s.length()/2;i++)
    {
        if(s[i]!=s[s.length()-1-i])
            return 0;

    }
    return 1;
}
int main()
{
    string s,p="",m="";
    cin>>s;
    int n=s.length();
    if(check(s))
    {
        for(int i=0;i<(n-1)/2;i++)
        {
            p+=s[i];
        }
        if(check(p))
        {
            for(int i=(n+3)/2-1;i<n;i++)
            {
                m=m+s[i];

            }
            if(check(m))
                cout<<"Yes";
            else
                cout<<"No";
        }
        else
            cout<<"No";
    }
    else
        cout<<"No";
}

Measured memory_bytes: 3600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp6
{
    class Program
    {
        static void Main(string[] args)
        {
            int ss = 0;
            string a = Console.ReadLine();
            for(int i =0; a.Length/2 > i; i++)
            {
                if(a[i] != a[a.Length - 1 - i])
                {
                    ss++;
                }
            }
            Console.WriteLine(ss);

        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
 
int main() {
  int n;cin>>n;
  vector<int> v(n);
  rep(i,n) cin>>v[i];
  bool ans=true;
  rep(i,n) {
    if (v[i]%2==0) {
      if (v[i]%3!=0&&v[i]%5!=0) ans=false;
    }
  }
  cout<<(ans ? "APPROVED":"DENIED")<<endl;
  return 0;
}

Measured memory_bytes: 256
mod=10**9+7
n,a,b,c=map(int,input().split())
m=2*10**5
def modinv(n):
    return pow(n,mod-2,mod)
Fact=[1] #階乗
for i in range(1,m+1):
    Fact.append(Fact[i-1]*i%mod)
Finv=[0]*(m+1) #階乗の逆元
Finv[-1]=modinv(Fact[-1])
for i in range(m-1,-1,-1):
    Finv[i]=Finv[i+1]*(i+1)%mod
def comb(n,r):
    if n<r:
        return 0
    return Fact[n]*Finv[r]*Finv[n-r]%mod
p=a*modinv(100-c); q=b*modinv(100-c)
ans=0
for k in range(n,2*n):
    ans+=k*comb(k-1,n-1)*(pow(p,n,mod)*pow(q,k-n,mod)+pow(p,k-n,mod)*pow(q,n,mod))
    ans%=mod
ans*=100*modinv(100-c)
print(ans%mod)

Measured memory_bytes: 55408
from collections import defaultdict


class Graph(object):
    """
    隣接リストによる無向グラフ
    重み無しで距離は１
    """

    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst):
        self.graph[src].append(dst)
        self.graph[dst].append(src)

    def get_nodes(self):
        return self.graph.keys()


def main():
    N, M = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in range(M)]
    g = Graph()
    for e in ab:
        g.add_edge(e[0], e[1])

    for i in range(N):
        print(len(g.graph[i+1]))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int M1 = sc.nextInt();
		int D1 = sc.nextInt();
		int M2 = sc.nextInt();
		int D2 = sc.nextInt();
		if (M1 == M2) {
			System.out.print(0);
		} else {
			System.out.print(1);
		}
	}
}


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

int N, K;
vector<ll> H;
ll cn = 0;

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

  int h;
  for(int i = 0; i < N; i++){
    cin >> h; H.push_back(h);
  }

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

  for(int i = 0; i < N-K; i++) cn += H[i];

  cout << cn << endl;
  return 0;
}


Measured memory_bytes: 2420
use List::Util qw/ sum /;
my ($n, $k) = glob <>;
sub wa {
    my ($a, $l) = @_;
    return ($l-$a+1) * ($a + $l) / 2;
}

print sum( map { 
    wa($n-$_+1, $n) - wa(0, $_-1) + 1
} ($k..$n+1)) % (10**9 + 7);

Measured memory_bytes: 19604
s=input()
q=int(input())

rev=0

sento=[]
matsubi=[]

for _ in range(q):
    temp=input().split(" ")
    
    if temp[0]=="1":
        if rev==0:
            rev=1
        else:
            rev=0
    else:
        if rev==0:
            if temp[1]=="1":
                sento.append(temp[2])
            else:
                matsubi.append(temp[2])
        else:
            if temp[1]=="2":
                sento.append(temp[2])
            else:
                matsubi.append(temp[2])

sento_s="".join(sento)
sento_s=sento_s[::-1]
matsubi_s="".join(matsubi)

s=sento_s+s+matsubi_s

if rev==0:
    print(s)
else:
    print(s[::-1])

Measured memory_bytes: 5924
from fractions import gcd

a, b, c, d = [int(e) for e in input().split()]

def f(a, b, n):
  return b // n - (a - 1) // n

acc = 0
acc += f(a, b, c)
acc += f(a, b, d)
acc -= f(a, b, c * d // gcd(c, d))
print(b - a + 1 - acc)


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

s = input()
a = [int(x) for x in list(s.split())]

s = input()
b = [int(x) for x in list(s.split())]

x = [0] * M
y = [0] * M
c = [0] * M
for i in range(M):
    x[i],y[i],c[i] = map(int, input().split())

amin = 10 ** 6
for aa in a:
    amin = min(amin,aa)
bmin = 10 ** 6
for bb in b:
    bmin = min(bmin,bb)

sum_min = amin + bmin

for i in range(M):
    sum_min = min(sum_min,a[x[i]-1]+b[y[i]-1]-c[i])

print(sum_min)


Measured memory_bytes: 24528
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int q1, b, c1, c2, q2;
        cin >> q1 >> b >> c1 >> c2 >> q2;
        if(q1 == 0)
            return 0;

        int x = 0;
        int y = q2;
        while(x != y){
            int z = (x + y + 1) / 2;
            if(b - z*c1 >= 0 && (b - z*c1) / c2 >= q1 - z)
                x = z;
            else
                y = z-1;
        }

        if(x == 0)
            cout << "NA" << endl;
        else
            cout << x << ' ' << ((b - x*c1) / c2) << endl;
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}

bool cmp(P a, P b) {
    if(a.se!=b.se) return a.se < b.se;
    else return a.fi < b.fi;
}


signed main() {
    int n;
    cin >> n;
    V(P) rb(n);
    rep(i, n) {
        int x, l;
        cin >> x >> l;
        rb[i] = P(x-l, x+l);
    }
    sort(ALL(rb), cmp);

    int res = 0;
    int prev = -1e10;
    rep(i, n) {
        if(rb[i].fi >= prev) {
            res++;
            prev = rb[i].se;
        }
    }

    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 1792
using System;
public class Hello{
    public static void Main(){
        // Your code here!
         long a,b,k;
            string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
            a = long.Parse(str[0]); //標準入力
         
            b = long.Parse(str[1]);  //数値で受け取りたい場合は変換する
            k = long.Parse(str[2]);
            long temp=a;
            if(a>0){
                if(k>a){
                    k-=a;
                    a=0;
                }else{
                    a-=k;
                    k=0;
                }
            }
            if(b>0){
                
                b=k>b?0:b-k;    
                
            }
            
        Console.Write(a+" "+b);
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <cstdlib>

using namespace std;

long long extgcd(long long a, long long b, long long &xd, long long &yd){
    if(b == 0){
        xd = 1;
        yd = 0;
        return a;
    }
    else {
        long long gcd = extgcd(b, a % b, yd, xd);
        yd -= (a / b) * xd;
        return gcd;
    }
}
int main()
{
    long long a, b, x, y;
    x = 0;
    y = 0;
    cin >> a >> b;
    extgcd(a, b, x, y);
    cout << x << " " << y << endl;
}


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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    X=I()
    
    flag=0
    
    for a in range(1000):
        if flag==1:
            break
        for b in range(1000):
            aa=pow(a,5)
            bb=pow(b,5)
            if aa-bb==X:
                print(a,b)
                flag=1
                break
            
            if aa+bb==X:
                print(a,-1*b)
                flag=1
                break
                

main()


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




int main(){

    string s;
    cin>>s;
    int num=s.length();
    int str;
    for(int i=1; i<num; i++){
        if((num-i)%2!=0){
            continue;
        }
        else{
            str=(num-i)/2;
            int e=1;
            for(int i=0; i<str; i++){
                if(s[i]!=s[i+str])e=0;
            }
            if(e==1){
                cout<<str*2<<endl;
                break;
            }
            
        }
    }
    return 0;
        }


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

public class Main {
	final int _intMax = Integer.MAX_VALUE; // =2147483647>10^9
	final int _intMin = Integer.MIN_VALUE;
	final long _longMax = Long.MAX_VALUE; // =9223372036854775807L>10^18
	final long _longMin = Long.MIN_VALUE;
	static boolean bElapsed = false;

	void solve() {
		int n = readNum();
		int[] ia = readNums();
		Arrays.sort(ia);
		int a = 0;
		int b = 0;
		boolean bAlice = true;
		for (int i = n - 1; i >= 0; i--) {
			if (bAlice) {
				a += ia[i];
			} else {
				b += ia[i];
			}
			bAlice = !bAlice;
		}
		pln(a - b);
	}

	int pint(String s) {
		return Integer.parseInt(s);
	}

	long plong(String s) {
		return Long.parseLong(s);
	}

	String readLine() {
		try {
			return _in.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	int readNum() {
		String line = readLine();
		return pint(line);
	}

	String[] readFlds() {
		String line = readLine();
		return line.split(" ");
	}

	int[] readNums() {
		String[] flds = readFlds();
		int[] nums = new int[flds.length];
		for (int i = 0; i < flds.length; i++) {
			nums[i] = pint(flds[i]);
		}
		return nums;
	}

	void p(char c) {
		_out.print(c);
	}

	void pln(char c) {
		_out.println(c);
	}

	void p(double d) {
		_out.print(d);
	}

	void pln(double d) {
		_out.println(d);
	}

	void p(long l) {
		_out.print(l);
	}

	void pln(long l) {
		_out.println(l);
	}

	void p(String s) {
		_out.print(s);
	}

	void pln(String s) {
		_out.println(s);
	}

	static BufferedReader _in;
	static PrintWriter _out;

	public static void main(String[] args) {
		long start = System.currentTimeMillis();
		_in = new BufferedReader(new InputStreamReader(System.in));
		_out = new PrintWriter(System.out);
		new Main().solve();
		_out.flush();
		long end = System.currentTimeMillis();
		if (bElapsed) {
			System.err.println((end - start) + "ms");
		}
	}
}


Measured memory_bytes: 22740
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define REP_IN(i, n, x) for (ll i = 0; i < n; i++)in>>x;
#define REP_OUT(i, n, x) for (ll i = 0; i < n; i++)out<<x<<endl;
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
#define endl '\n'
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
// template end
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    //vector<ll> X(N);
    string s,t;
    in >> s >> t;
    //vector<string> s,t;
    //s.resize(N);
    //ll N;
    //in >> N;
    
    ll f = 0;
    ll n = SIZE(s);

    for(ll i=0;i<n;i++){
        //out << s[i] << " " << t[i] << endl;
        if(s[i]!=t[i]){
            //out << s[i] << " " << t[i] << endl;
            f=1;
            break;
        }
    }
    if(f==0 && n+1 == SIZE(t)){
        out << "Yes" << endl;
    }else if(f==1){
        out << "No" << endl;
    }

    
    
}

Measured memory_bytes: 3536
#include "bits/stdc++.h"
#define LF '\n'
#define ALL(x) x.begin(), x.end()
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
template<class Itr> void dump(Itr begin, Itr end) { for (;begin != end; ++begin) clog << *begin << LF; }

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

  set<char> U({'a', 'i', 'u', 'e', 'o'});
  char c;
  cin >> c;
  if (U.count(c)) {
    cout << "vowel" << LF;
  } else {
    cout << "consonant" << LF;
  }

  return 0;
}



Measured memory_bytes: 256
x, y, z, k = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)
AB_pair = []
for a in A:
    for b in B:
        AB_pair.append(a + b)
AB_pair.sort(reverse=True)

ans = []
for total in AB_pair[:3001]:
    for c in C:
        ans.append(total + c)
ans.sort(reverse=True)
print(*ans[:k], sep="\n")


Measured memory_bytes: 223240
#include<stdio.h>

int main(void){
        char s[11];
        scanf("%s", s);

        int ans = 0;
        char t[1000];
        while(scanf("%s", t)){
                if(getchar()==EOF) break;
                int same = 1;
                for(int i=0; i<11; i++){
                        if(s[i]!=t[i] && s[i]-'A'+'a'!=t[i] && s[i]!=t[i]-'A'+'a'){
                                same = 0;
                                break;
                        }
                        if(s[i]=='\0'){
                                if('a'<=t[i]&&t[i]<='z' || 'A'<=t[i]&&t[i]<='Z') same = 0;
                                break;
                        }
                }
                if(same) ans++;
        }
        printf("%d\n", ans);
        return 0;
}


Measured memory_bytes: 2060
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long lint;
typedef unsigned long long ulint;


//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
//template <typename T> void print(T* v, int N) { if (N == 0) cout << "{ }"; cout << "{" << v[0]; for (int p = 1; p < N; p++) cout << ", " << v[p]; cout << "}"; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
	


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

	return 0;
}


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

main()
{

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

    long long i,j,k,l,m,n,p;
 while(cin>>m>>n>>p){
    if(m>n)swap(m,n);
    cout<<n/p-(m-1)/p<<endl;
 }


    return 0;

}


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

using namespace std;

int a[200000];

int main() {
  int n; scanf("%d", &n);
  for(int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  sort(a, a + n);
  reverse(a, a + n);
  long long ans = a[0];
  for(int i = 0; i < n - 2; ++i) {
    ans += a[i / 2 + 1];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4548
# import numpy as np
N = input()
# a =  np.araray((map(int, raw_input().split())))
# sum_a = np.sum(a)
a =  list(map(int, raw_input().split()))
sum_a = sum(a)

sum_top = a[0] + 0
sum_bottom = a[-1] + 0
cur_sum = sum_top

for i in range(1, N - 1):
    sum_top += a[i]
    if abs(sum_a / 2. - sum_top) <= abs(sum_a / 2. - cur_sum):
        cur_sum = sum_top

print abs(2 * cur_sum - sum_a)


Measured memory_bytes: 18440
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt64(scanner)
	k := getNextInt64(scanner)
	m := n % k
	if m < k {
		if m < k-m {
			fmt.Fprintln(writer, m)
			return
		}
		fmt.Fprintln(writer, k-m)
		return
	}
	if m < m-k {
		fmt.Fprintln(writer, m)
		return
	}
	fmt.Fprintln(writer, m-k)
}


Measured memory_bytes: 1816
#include<bits/stdc++.h>
using namespace std;
vector<int> vec;
vector<int> sel;
int _min=INT_MAX;
int main()
{
	int n,k;
	cin>>n>>k;
	sel.resize(k);
	vec.resize(n);
	for(int i=0;i<n;i++)
	{
		cin>>vec[i];
	}
	sort(vec.begin(),vec.end());
	for(int i=0;i<=n-k;i++)
	{
		_min=min(vec[i+k-1]-vec[i],_min);
	}
	cout<<_min<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fto(i,a,b) for(int i=a; i<=b; ++i)
#define fdto(i,a,b) for(int i=a; i>=b; --i)
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define st first
#define nd second
#define maxn
#define Ntu ""

using namespace std;
int n;
int main()
{
    ios_base::sync_with_stdio(0);
    //freopen(Ntu".inp","r",stdin);
    //freopen(Ntu".out","w",stdout);
    cin.tie(NULL);cout.tie(NULL);
    cin >> n;
    fto(i,1,n)
    fto(j,i+1,n)
    {
        for(int o=0; (1<<o)<=n; ++o) if((i&(1<<o)) != (j&(1<<o)))
        {
            cout << o+1;
            break;
        }
        if(j == n) cout << '\n';
        else cout << ' ';
    }
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll mod = 1e9 + 7;

int main(){
	ll n, a, b;
	cin >> n >> a >> b;
	ll c = a + b, ans = n / c * a;
	if (n % c >= a) {
		ans += a;
	} else {
		ans += n % c;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

vector<vector<int>> adjlist;
vector<bool> visited;

int visit(int v) {
  visited[v] = true;
  vector<int> unvisited;
  for (int w : adjlist[v]) {
    if (!visited[w]) {
      unvisited.push_back(w);
    }
  }

  if (unvisited.size() == 0) return 0;
  else if (unvisited.size() == 1) {
    return 1 + visit(unvisited[0]);
  } else {
    int res = 0;
    for (int w : unvisited) {
      int test = 1 + visit(w);
      res ^= test;
    }
    return res;
  }
}

int main() {
  int n;
  scanf("%d", &n);
  adjlist.resize(n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    a--;
    b--;
    adjlist[a].push_back(b);
    adjlist[b].push_back(a);
  }

  visited.assign(n, false);
  int test = visit(0);
  if (test == 0) printf("Bob\n");
  else printf("Alice\n");
  return 0;
}


Measured memory_bytes: 18176
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};

//探索、更新にO(log n)
struct segment_tree{
    int init ; //　空いてる値はこれになる
    int n; //　n個のデータ
    vector<int> data; // データ置き場・n-1~2n-1に元データ

    //(個数、初期値)
    //初期化　nを2の累乗に直す  初期値は最も選ばれない値にする
    segment_tree(int a, int b) : init(b) {
        n = 1;
        while( n < a ) n *= 2;
        data.assign(n * 2 - 1,init);
    }

    //+とかにしてもいい、結合法則はいる
    //選ぶ方の決め方（ここでは小さい方）
    int which(int a, int b){
        if(a > b) return b;
        else return a;
    }

    // k番目をaに更新
    void update(int k, int a){
        k += n-1;
        data[k] = a;

        //下から上に更新
        while( k > 0 ){
            k = (k - 1) / 2;
            data[k] = which( data[k*2+1] , data[k*2+2] );
        }
    }

    // [a, b)の最小値を求める
    // 後ろのほうの引数は、計算の簡単のための引数。
    // kは節点の番号、l, rはその節点が[l, r)に対応づいていることを表す。
    // したがって、外からはquery(a, b, 0, 0, n)として呼ぶ。
    int query( int a, int b, int k, int l, int r){

        // [a, b)と[l, r)が交差しなければ、MAX_INT
        if(r <= a || b <= l) return init;

        // [a, b)が[l, r)を完全に含んでいれば、この節点の値
        if(a <= l && r <= b) return data[k];

        // そうでなければ、2つの子の最小値
        int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
        int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
        return which( vl, vr );
    }

    // 外から呼ぶとき用
    // [a, b)の最小値を求める
    int query( int a, int b){
        return query( a, b, 0, 0, n);
    }

    int look(int a){
        return data[a+n-1];
    }
};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int n,m;
    cin>>n>>m;
    string s;
    cin>>s;

    segment_tree sg(n+1, inf);
    sg.update(0,0);

    REP(i,1,n+1){
        if(s[i]=='1') continue;
        int x = sg.query(max(0,i-m), i);
        if(x==inf) continue;
        else sg.update(i,x+1);
    }

    int x = sg.look(n);

    if(x==inf){
        cout<<-1<<endl;
        return 0;
    }

    vector<int> move(x+1,-1);
    move[x]=n;
    x --;

    for(int i = n-1; i>=0; i--){
        if(sg.look(i)==x){
            move[x] = i;
            x --;
        }
        if(sg.look(i)==x+1 && i+m>=move[x+2] && x+2!=move.size()){
            move[x+1] =i;
        }
    }

    rep(i,move.size()-1){
        cout<<move[i+1]-move[i];
        if(i!=move.size()-2) cout<<" ";
        else cout<<endl; 
    }

    // cout<<"data: ";
    // rep(i,n+1) cout<<sg.look(i)<<" ";
    // cout<<endl;

    // cout<<"move: ";
    // for(auto y:move) cout<<y<<" ";
    // cout<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 4644
#!/usr/bin/env python3
import sys
import math

sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(float, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()

A, B, H, M = nm()


def solve():
    tb = M / 60.0 * (2 * math.pi)
    ta = (H + (M / 60.0)) / (12.0) * (2.0 * math.pi)
    C2 = A ** 2.0 + B ** 2.0 - 2.0 * A * B * math.cos(abs(tb - ta))
    return math.sqrt(C2)


if __name__ == "__main__":
    print(solve())


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

int main() {
  ll N;
  ll sum = 0;
  cin >> N;
  vector<ll> A(N);
  rep(i,N){
    cin >> A.at(i);
  }
  sort(A.begin(),A.end());
  ll cnt = 0;
  if(N%2 == 0){
    rep(i,N/2){
      sum += A.at(N-1-i);
    }
    sum *= 2;
    sum -= A.at(N-1);
  }
  else{
    rep(i,(N/2)+1){
      sum += A.at(N-1-i);
    }
    sum *= 2;
    sum -= A.at(N-1) + A.at(N-1-N/2);
  }
  cout << sum << endl;
}

Measured memory_bytes: 4824
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dbl;
#define sqr(int) (int * int)
#define sqr3(int) (int * int * int)
#define pi M_PI
#define nl "\n"


  int main(){
	ios::sync_with_stdio(true);
	cin.tie(0);
	int a,b;
	cin >> a >> b;
	cout << a*b;
	
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <string>
using namespace std;
vector<string> v;

bool solve(int a){
	int i = a;
	int res = 0;
	while(i < v.size()){
		res += v[i].size();
		i++;
		if(res == 5){
			while(i < v.size()){
				res += v[i].size();
				i++;
				if(res == 12){
					while(i < v.size()){
						res += v[i].size();
						i++;
						if(res == 17){
							while(i < v.size()){
								res += v[i].size();
								i++;
								if(res == 24){
									while(i < v.size()){
										res += v[i].size();
										i++;
										if(res == 31)return true;
										else if(res > 31)return false;
									}
								}
								else if(res > 24)return false;
							}
						}
						else if(res > 17)return false;
					}
				}
				else if(res > 12)return false;
			}
		}
		else if(res > 5)return false;
	}
	return false;
}

int main(){
	int n;
	string s;
	while(cin >> n,n){
		v.clear();
		for(int i = 0;i < n;i++){
			cin >> s;
			v.push_back(s);
		}
		for(int i = 0;i < n;i++){
			if(solve(i)){
				cout << i+1 <<endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3136
#include <iostream>
#include <deque>

int main()
{
	int q;
	std::deque<int> di;
	std::cin >> q;
	while (q--) {
		int a;
		std::cin >> a;
		if (a == 0) {
			int d, x;
			std::cin >> d >> x;
			if (d == 0) {
				di.push_front(x);
			} else {
				di.push_back(x);
			}
		} else if (a == 1) {
			int p;
			std::cin >> p;
			std::cout << di[p] << std::endl;
		} else {
			int d;
			std::cin >> d;
			if (d == 0) {
				di.pop_front();
			} else {
				di.pop_back();
			}
		}
	}

	return 0;
}


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

int n;
vector <int> a;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    a.resize(n);
    for(auto &i : a) cin >> i;
    if(*max_element(a.begin(), a.end()) < 0){
        int mx = 0;
        for(int i = 0 ; i < n ; i++){
            if(a[i] > a[mx]) mx = i;
        }
        cout << a[mx] << "\n" << n - 1 << "\n";
        for(int i = n - 1 ; i > mx ; i--){
            cout << i + 1 << "\n";
        }
        for(int i = 0 ; i < mx ; i++){
            cout << "1\n";
        }
        return 0;
    }
    pair <ll, pair <int, int> > ans = {-1, {-1, -1}};
    for(int i = 0 ; i < n ; i++){
        ll cur = 0;
        for(int j = i ; j < n ; j += 2){
            cur += max(0, a[j]);
            ans = max(ans, {cur, {i, j}});
        }
    }
    int l = ans.second.first, r = ans.second.second;
    while(r > l && a[r] < 0){
        r -= 2;
    }
    vector <int> res;
    for(int i = n - 1 ; i > r ; i--){
        res.push_back(i);
        a.erase(a.begin() + i);
    }
    for(int i = 0 ; i < l ; i++){
        res.push_back(0);
        a.erase(a.begin());
    }
    while(true){
        n = a.size();
        int idx = -1;
        for(int i = 0 ; i < n ; i += 2){
            if(a[i] < 0){
                idx = i;
                break;
            }
        }
        if(idx == -1) break;
        res.push_back(idx);
        a[idx] = a[idx - 1] + a[idx + 1];
        a.erase(a.begin() + idx + 1);
        a.erase(a.begin() + idx - 1);
    }
    for(int i = n - 2 ; i >= 1 ; i -= 2){
        res.push_back(i);
    }
    cout << ans.first << "\n" << res.size() << "\n";
    for(auto &i : res) cout << i + 1 << "\n";
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define F first
#define S second

using namespace std;

typedef pair<int, int> P;
typedef long long LL;
static const int INF = INT_MAX;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int cnt = 0;
    while(n > 0) {
        if(n % 10 == 2) ++cnt;
        n /= 10;
    }
    cout << cnt << endl;

    return 0;
}



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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    vector<tll> cities;
    for(int i = 0; i < M; i++)
    {
        ll P, Y;
        cin >> P >> Y;
        cities.emplace_back(P, Y, i);
    }
    sort(cities.begin(), cities.end());
    vector<pll> answers(M);
    ll prevPref = -1;
    ll index = 0;
    for(tll city: cities)
    {
        ll pref, year, id;
        tie(pref, year, id) = city;
        if(pref != prevPref)
        {
            index = 1;
        }else{
            index++;
        }
        answers.at(id) = make_pair(pref, index);
        prevPref = pref;
    }
    for(auto answer: answers)
    {
        ll pref, index;
        tie(pref, index) = answer;
        cout << setfill('0') << setw(6) << pref;
        cout << setfill('0') << setw(6) << index;
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 6256
#include <bits/stdc++.h>
using namespace std;
int n;
int h[100];
int ans = 0;
int main()
{
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    while (true)
    {
        ans++;
        bool l = false;
        for (int i = 0; i < n; i++)
        {
            if (h[i])
                l = true;
            if (l && h[i] == 0)
                break;
            if (l)
                h[i]--;
        }
        if (!l)
        {
            break;
        }
    }

    cout << ans - 1 << endl;
}

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

int main() {
    long long L, R;
    cin >> L >> R;
    long long c = L * R;
    if (R - L >= 4038){
        cout << 0 << endl;
    }else{
        for(long long a = L;a < R; ++a){
            for(long long b = a + 1;b <= R;++b){
                c = min(c, (a * b) % 2019);


            }

        }
        cout << c << endl;

    }

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  string s;
  cin >> s;
  int n = 0;
  n = s.size();
  vector<int> up(n);
  vector<int> notup(n);
  up[n - 1] = 10 - (s[n - 1] - '0');
  notup[n - 1] = s[n - 1] - '0';
  for(int i = n - 2;i >= 0;i--){
    int now = 0;
    now = s[i] - '0';
    up[i] = min(10 - (now + 1) + up[i + 1],10 - now + notup[i + 1]);
    notup[i] = min(now + 1 + up[i + 1],now + notup[i + 1]);
  }
  int res = 0;
  res = min(up[0] + 1,notup[0]);
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 9220
#include <bits/stdc++.h>
using namespace std;
int l,r,ans=INT_MAX;
int main(){
	cin>>l>>r;
	int r1=l%2019,r2=r%2019;
	if(r-l>2019||r2<=r1)	return puts("0"),0;
	bool b1=0,b2=0;
	for(int x=r1;x<=r2;x++){
		if(x%3==0)		b1=1;
		if(x%673==0)	b2=1;
	}
	if(b1&&b2)	return puts("0"),0;
	for(int i=r1;i<=r2;i++){
		for(int j=r1;j<i;j++){
			ans=min(ans,i*j%2019);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    int N, K;
    string S;
    cin >> N >> K >> S;

    S[K - 1] = (char)(S[K - 1] - 'A' + 'a');
    cout << S << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const ll MOD = 1000000007;

int main() {FIN

	ll h, w, i, j;
	cin >> h >> w;

	vvll dp(h, vll(w));
	vs rw(h);
	dp[0][0] = 1;
	for (i = 0; i < h; i++) {
		cin >> rw[i];
		for (j = 0; j < w; j++) {
			if (rw[i][j] == '.') {
				if (i > 0 and rw[i - 1][j] == '.')
					dp[i][j] = (dp[i][j] + dp[i - 1][j]) % MOD;
				if (j > 0 and rw[i][j - 1] == '.')
					dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
			}
		}
	}

	cout << dp[h - 1][w - 1] << "\n";

	return 0;
}

Measured memory_bytes: 12424
#include <stdio.h>
#include <stdlib.h>
#include "time.h"
#include "unistd.h"
#include "string.h"
#include <math.h>
int ans=0;
int main(int argc, char* argv[]){
	long long int a, b = 0, c = 0,d=0,e=0;
	double f=0,g=0;
	scanf("%lld %lld",&a,&b);
	for(int i=1;i<=a;i++){
		c=i;
		g=1.0/a;
		for (;c<b;c=c*2,g=g/2) {
		}
		f+=g;
	}
	printf("%.12lf\n",f);
}


Measured memory_bytes: 128
#include<iostream>//入出力
#include<vector>//可変長配列
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<deque>//両端アクセスのキュー
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REPS(i,a,b) for(ll i=(a);i<(b);i++)
#define RREPS(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000

int main(){
    int n, m;
    cin >> n >> m;
    cout << (n+m)*(n+m-1)/2 -  n*m << endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
// #define int               long long
#define nl                "\n"
#define pb                push_back
#define mp                make_pair
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define f                 first
#define s                 second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
#define fast_io           ios_base::sync_with_stdio(false);cin.tie(NULL);
 
const long long INF=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;

 int a[100005];
 int dp[100005];



void solve(){
	int n,k;
	cin>>n>>k;
    //cout<<n<<k;
    rep(i,0,n)cin>>a[i];

   dp[0]=0;
      
     rep(i,1,k+1){
     	 dp[i]=0;
          rep(j,0,n){
          	if(i>=a[j] and dp[i-a[j]]==0){dp[i]=1;break;}
          }
     } 

 
   if( dp[k]==1)cout<<"First";
     else  cout<<"Second";
	 

}	


signed main(){
	fast_io
   
	#ifdef SIEVE
		sieve();
	#endif
	#ifdef NCR
		init();
	#endif
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}


Measured memory_bytes: 4016
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>

#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>

#include <algorithm>

using namespace std;



int main(int argc, char *argv[]) {
	
	int n, k;
	cin >> n >> k;
	double res = 0.0;
	for (int i = 1; i <= n; i++) {
		if (i >= k) {
			res += 1.0 * (n - i + 1) / n;
			break;
		}
		else {
			double rres = 1.0 / n;
			int ii = i;
			while (ii < k) {
				ii *= 2;
				rres = rres / 2.0;
			}
			res += rres;
			// res += 1.0 / n * pow(0.5, ceil(log2(k / i)));
		}
	}
	printf("%.12lf\n", res);
}



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

int main(void){
    int M,T,P,R,m,t,p,j;

    while(cin>>M>>T>>P>>R, M|T|P|R){
        int cnt[51]={};
        int time[51]={};
        int penalty[51][11]={};
        int s[51]={};

        /*????????¨??????????????£????¨????*/
        while(R--){
            cin>>m>>t>>p>>j;
            if(j==0){
                ++cnt[t];
                time[t] += m+penalty[t][p];
            }
            else penalty[t][p]+=20;
        }

        /*???????????¨??????*/
        for(t=1;t<=T;t++)s[t]=t;

        /*??????????????????*/
        for(int a=1;a<T;a++){
            for(int b=T;b>a;b--){
                if(cnt[s[b]]<cnt[s[b-1]]
                   ||(cnt[s[b]]==cnt[s[b-1]] && time[s[b]]>time[s[b-1]])
                   ||(cnt[s[b]]==cnt[s[b-1]] && time[s[b]]==time[s[b-1]] && s[b]<s[b-1]))
                    swap(s[b],s[b-1]);
            }
        }

        /*??????????????????????????????*/
        for(t=T;t>=1;t--){
            cout<<s[t];
            if(t==1)break;
            if(cnt[s[t]]==cnt[s[t-1]] && time[s[t]]==time[s[t-1]])cout<<"=";
            else cout<<",";
        }
        cout<<endl;

    }
    return 0;
}

Measured memory_bytes: 1160
#include<cstdio>
#include<string>
#include<cstring>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<algorithm>
#include<vector>
#include<iostream>
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define inf 0x7fffffff
using namespace std;
int a[100010];
int main()
{
	int i,j,k,n,m,x=0,y=inf;
	ll sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		x=x^(a[i]<0);
		y=min(y,abs(a[i]));
		sum+=abs(a[i]);
	}
	if(x)
	{
		sum-=2*y;
	}
	printf("%lld",sum);
	return 0;
}

Measured memory_bytes: 640
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)


class UF_tree:
    def __init__(self, n):
        self.root = [-1] * (n + 1)  # -1ならそのノードが根,で絶対値が木の要素数
        self.rank = [0] * (n + 1)

    def find(self, x):  # xの根となる要素番号を返す
        if self.root[x] < 0:
            return x
        else:
            self.root[x] = self.find(self.root[x])
            return self.root[x]

    def isSame(self, x, y):
        return self.find(x) == self.find(y)

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        elif self.rank[x] < self.rank[y]:
            self.root[y] += self.root[x]
            self.root[x] = y
        else:
            self.root[x] += self.root[y]
            self.root[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def getNodeLen(self, x):
        return -self.root[self.find(x)]


if __name__ == "__main__":
    N, M = map(int, input().split())
    AB = tuple(tuple(map(int, input().split())) for _ in range(M))

    ans = 0
    for i in range(M):
        uf = UF_tree(N)
        for j, (a, b) in enumerate(AB):
            if i == j:
                continue
            uf.unite(a, b)
        a, b = AB[i]
        if not uf.isSame(a, b):
            ans += 1
    print(ans)

Measured memory_bytes: 3064