akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using static System.Console;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long gcd(long x, long y)
        {
            if (y < x) gcd(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }
        public static long keta(long x)
        {
            var z = 1;
            while (x > 0)
            {
                x /= 10;
                z++;
            }
            return z;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var abc = Reads();
            var a = abc[0];
            var b = abc[1];
            var c = abc[2];
            var k = Read();
            while (a>=b)
            {
                b *= 2;
                k--;
            }
            while (c <= b)
            {
                c *= 2;
                k--;
            }
            if (k >= 0) WriteLine("Yes");
            else WriteLine("No");


            Console.Out.Flush();
        }
    }
}



Measured memory_bytes: 19128
#include <iostream>
using namespace std;
int cnt[2005];
int Abs(int n) {
    return n >= 0 ? n : -n;
}
int main() {
    int N, X, Y;
    cin >> N >> X >> Y;
    for (int i = 1; i <= N - 1; ++i) {
        for (int j = i + 1; j <= N; ++j) {
            int dis = min(j - i, Abs(X - i) + 1 + Abs(Y - j));
            ++cnt[dis];
        }
    }
    for (int i = 1; i <= N - 1; ++i)
        cout << cnt[i] << endl;
    return 0;
}


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





int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int h, n;
	cin >> h >> n;
	long long suma = 0;
	int a;
	for (int i = 1; i <= n; ++i){
		cin >> a;
		suma += a;
	}
	cout << (suma >= h ? "Yes\n" : "No\n");
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
using namespace std;
int main (void) {
    int A, B;
    int K;

    cin >> A >> B >> K;

    set<int> st;

    for (int i = A; i < A + K; i++) {
        if (i <= B) {
            st.insert(i);
        }
    }
    for (int i = B - K + 1; i <= B; i++) {
        if (i >= A) {
            st.insert(i);
        }
    }

    for (auto x : st) {
        cout << x << endl;
    }

    return 0;
}


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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 30;
int n, m;
char a[N][N];

bool ok(int x, int y)
{
	return x >= 1 && x <= n && y >= 1 && y <= m && a[x][y] == '.';
}

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

int d[N][N][N][N];

void bfs(int x, int y)
{
	int X = x, Y = y;
	FILL(d[x][y], -1);
	queue<PII> q;
	d[x][y][x][y] = 0;
	q.push({x, y});
	while(!q.empty())
	{
		x = q.front().X;
		y = q.front().Y;
		q.pop();
		
		FOR(k, 0, 4)
		{
			int i = x + dx[k];
			int j = y + dy[k];
			if (!ok(i, j) || d[X][Y][i][j] != -1) continue;
			q.push({i, j});
			d[X][Y][i][j] = d[X][Y][x][y] + 1;
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	cin >> n >> m;
	FOR(i, 0, N) FOR(j, 0, N) a[i][j] = '#';
	FOR(i, 1, n + 1) FOR(j, 1, m + 1) cin >> a[i][j];
	
	FOR(i, 1, n + 1) FOR(j, 1, m + 1) bfs(i, j);
	
	int ans = 0;
	
	FOR(i, 1, n + 1) FOR(j, 1, m + 1) FOR(k, 1, n+ 1) FOR(l, 1, m + 1)
		if (ok(i, j) && ok(k, l))
			setmax(ans, d[i][j][k][l]);
	
	cout << ans << endl;
	
	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



Measured memory_bytes: 1792
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
    int n,k;
    int ans=1;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
        ans=fmin(ans*2,ans+k);
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a=0,b=0,c=0;
		for(int i = 0;i < n;i++){
		 	a = scan.nextInt();
		 	a = a * a;
		 	b = scan.nextInt();
		 	b = b * b;
		 	c = scan.nextInt();
		 	c = c * c;
		 	if((a + b == c) || (a + c == b) || (b + c == a)){
		 		System.out.println("YES");
		 	}else{
		 		System.out.println("NO");
		 	}
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int A[9];
    int pair[8][3] = {{0, 3, 6}, {1, 4, 7}, {2, 5, 8}, {0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 4, 8}, {2, 4, 6}};
    cins(A, A + 9);
    int N;
    cin >> N;
    map<int, int> b;
    for(int i = 0; i < N; i++){
        int num;
        cin >> num;
        b[num]++;
    }
    for(auto i: pair){
        if(b[A[i[0]]] && b[A[i[1]]] && b[A[i[2]]]){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 384
# include <iostream>
# include <algorithm>
# include <string>
#include <sstream>
#include <iomanip>
# define MAX 100003

using namespace std;

struct city{
    int citynum;
    long long pref;
    long long year;
    long long citycode; 
};

bool order (city C1, city C2) {
    if ( C1.pref > C2.pref ){
        return true;
    } else if (C1.pref < C2.pref ){
        return false;
    } else if ( C1.year > C2.year ){
        return true;
    } else {
        return false;
    }
};

bool reorder (city C1, city C2){
    if (C1.citynum < C2.citynum){
        return true;
    } else {
        return false;
    }
};

int N, M;
city C[MAX];

int main(){
    cin >> N >> M;
    for ( int i = 1; i <= M; i ++ ){
        int P, Y;
        cin >> P >> Y;
        city x = { i, P, Y, 0 };
        C[i] = x;
    }
    
    sort( C + 1 , C + 1 + M, order );
 
    int cnt = 1;
    int prevpref = 0;
    for ( int i = M; i >= 1; i -- ){
        
        if ( C[i].pref != prevpref ) { cnt = 1; }
        C[i].citycode = 1000000 * C[i].pref + cnt;
    
        cnt ++;
        prevpref = C[i].pref;
    }
    
    sort( C + 1, C + 1 + M, reorder);

    for ( int i = 1; i <= M; i ++ ){
        ostringstream sout;
        sout << std::setfill('0') << std::setw(12) << C[i].citycode;
        string ret = sout.str();
        cout << ret << endl;
    }
    return 0;
}

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

int main()
{
    ll n, a = 0, b;
    cin >> n;
    vector<ll> x(n), y(n, 0);
    for (ll i = 0; i < n; i++)
    {
        cin >> x[i];
        a += x[i];
    }
    a /= n;
    b = a + 1;
    for (ll i = 0; i < n; i++)
    {
        y[i] = x[i] - a;
        y[i] *= y[i];
        x[i] -= b;
        x[i] *= x[i];
    }
    a = 0;
    b = 0;
    for (ll i = 0; i < n; i++)
    {
        a += y[i];
        b += x[i];
    }
    cout << min(a, b) << endl;
    return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>

using namespace std;

typedef complex<int> Point;

Point rotate_90(Point p) {
    p *= Point(0, 1);
    return p;
}

int main() {

    while (true) {

        int N;
        cin >> N;

        if(N==0) break;

        vector<int> ans;

        vector <vector<Point>> lines(N + 1, vector<Point>());
        for (int i = 0; i <= N; i++) {
            int m;
            cin >> m;
            for (int j = 0; j < m; j++) {
                int x, y;
                cin >> x >> y;
                lines[i].push_back(Point(x, y));
            }
        }

        vector <Point> origin = lines[0];

        for (int i = 0; i <= N; i++) {
            Point p = lines[i][0];
            for (int j = 0; j < lines[i].size(); j++)lines[i][j] -= p;
        }

        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < lines[0].size(); j++) lines[0][j] = rotate_90(lines[0][j]);
            for (int j = 1; j < lines.size(); j++) {
                if (lines[0].size() != lines[j].size()) continue;
                bool good = true;
                for (int k = 0; k < lines[j].size(); k++) if (lines[0][k] != lines[j][k]) good = false;
                if (good) ans.push_back(j);
            }
        }

        lines[0] = origin;
        reverse(lines[0].begin(), lines[0].end());
        for (int i = 0; i <= 0; i++) {
            Point p = lines[i][0];
            for (int j = 0; j < lines[i].size(); j++)lines[i][j] -= p;
        }

        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < lines[0].size(); j++) lines[0][j] = rotate_90(lines[0][j]);
            for (int j = 1; j < lines.size(); j++) {
                if (lines[0].size() != lines[j].size()) continue;
                bool good = true;
                for (int k = 0; k < lines[j].size(); k++) if (lines[0][k] != lines[j][k]) good = false;
                if (good) ans.push_back(j);
            }
        }

        sort(ans.begin(), ans.end());
        for (int i = 0; i < ans.size(); i++) cout << ans[i] << endl;
        cout << "+++++" << endl;
    }


    return 0;
}

































Measured memory_bytes: 3152
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 1e7;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,k; cin >> n >> k;
    vector<ll> v(10);
    for(int i = 0; i < k; i++){
        ll d;
        cin >> d;
        v[d] = 1;
    }
    auto check = [&](ll x){
        bool ok = true;
        while(x){
            ll t = x % 10;
            if(v[t])return false;
            x /= 10;
        }
        return true;
    };
    rep(i,n, n_max){
        if(check(i)){
            cout << i << "\n";
            return 0;
        }
    }
}

Measured memory_bytes: 3656
import math

while True:
    m,f,r=map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    if m==-1 or f==-1:
        print('F')
    elif m+f>=80:
        print('A')
    elif m+f>=65 and m+f<80:
        print('B')
    elif m+f>=50 and m+f<65:
        print('C')
    elif m+f>=30 and m+f<50:
        if r>=50:
            print('C')
        else:
            print('D')
    else:
        print('F')


Measured memory_bytes: 5656
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
mod=10**9+7

n=int(input())
p=list(map(int,input().split()))
now=0
ans=0
for i in range(n):
    if now==1:
        now=0
        if (i+1)==p[i]:
            ans+=1
        else:
            ans+=1
    elif (i+1)==p[i]:
        now=1
print(ans+now)


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

int main()
{
    ll n,x,j=0,u=1e9;cin>>n;ll a[n];
    for(int i=0;i<n;i++)
       cin>>a[i];
    for(int i=100;i!=0;i--)
    {  j=0;
       for(int o=0;o<n;o++)
    {
       j+=pow((a[o]-i),2);
    }
      u=min(j,u);
    }

    cout<<u;




    return 0;
}


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

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

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] str = br.readLine().split(" ");
		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int c = Integer.parseInt(str[2]);
		int count = 0;
		for (int i = a; i <= b; i++) {
			if (c % i == 0) {
				count++;
			}
		}
		System.out.println(count);
	}

}

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

#define pb(a) push_back(a)
#define vi vector<int>
#define loop(i, n) for(int i=1;i<=n;i++)
#define loop0(i, n) for(int i=0;i<n;i++)
#define in(i) scanf("%d", &i);
#define out(i) printf("%d", i)

int n, k, a[100001], b[100001], c[100001];
int dp[100001][4];
int solve(int day, int prev)
{
  if(day==n+1)
    return 0;
  if(dp[day][prev]!=-1)
    return dp[day][prev];
  if(prev==1)
    return dp[day][prev]=max(
        solve(day+1, 2)+b[day],
        solve(day+1, 3)+c[day]);
  else if(prev==2)
    return dp[day][prev]=max(
        solve(day+1, 1)+a[day],
        solve(day+1, 3)+c[day]);
  else if(prev==3)
    return dp[day][prev]=max(
        solve(day+1, 2)+b[day],
        solve(day+1, 1)+a[day]);

  return max(
      solve(day+1, 1)+a[day],
      max(
        solve(day+1, 2)+b[day],
        solve(day+1, 3)+c[day]
         )
      );
}
int main()
{
  memset(dp, -1, sizeof(dp));
  in(n);
  loop(i, n)
  {
    in(a[i]);
    in(b[i]);
    in(c[i]);
  }
  cout<<solve(1, -1);
}



Measured memory_bytes: 12632
#include <cstdio>

int main()
{
        unsigned long a, b;

        while (scanf("%lu %lu", &a, &b) != EOF) {
                unsigned long max = (a > b) ? a : b,
                                          min = (a < b) ? a : b;
                while (min) {
                        int r = max % min;
                        max = min;
                        min = r;
                }
                unsigned long lcm = a * b / max;
                printf("%lu %lu\n", max, lcm);
        }

        return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,D;
  cin >> A>>B>>C>>D;
  int T = A/D;
  if(A%D!=0){
    T++;
  }
  int O = C/B;
  if(C%B!=0){
    O++;
  }
  
  if(T<O){
    cout <<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
}

Measured memory_bytes: 3624
#include <iostream>

int main() {
    using namespace std;
    int W = 0;
    int H = 0;
    int x = 0;
    int y = 0;
    int r = 0;
    

    cin >> W >> H >> x >> y >> r;
    
    
    // Noのパターンを抽出して、そうでなければYesとするプログラム
    if (x + r > W) {
        cout << "No" << endl;
    }else if (x - r < 0) {
        cout << "No" << endl;
    }else if (y + r > H) {
        cout << "No" << endl;
    }else if (y - r < 0) {
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
const ll INF=1e18+7;
const ll MOD=1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s1,s2,s3;
	cin >> s1 >> s2 >> s3;
	cout << s1[0] << s2[0] << s3[0] << endl;
}

Measured memory_bytes: 256
import java.util.*;
 
class Main{
    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();

        int[][] matrix = new int[n][m];
        int[] vectorB = new int[m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j += 1) {
                matrix[i][j] = scan.nextInt();
            }
        }
        for (int s = 0; s < m; s++) {
            vectorB[s] = scan.nextInt();
        }
        for (int t = 0; t < n; t++) {
            int ans = 0;
            for (int u = 0; u < m; u++) {
                ans += matrix[t][u] * vectorB[u];
            }
            System.out.println(ans);
        }
    }
}

Measured memory_bytes: 40724
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<int,int>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
int main(){
  string s;
  cin>>s;
  cout<<s.substr(0,3)<<"\n";
}


Measured memory_bytes: 3656
import collections
N=int(input())
A=list(map(int,input().split()))
i=0
A.insert(0,float("inf"))
#print(A)
buy=[0]*N
sell=[0]*N
for i in range(N-1):
    if (A[i]>=A[i+1])and(A[i+2]>=A[i+1]):
        buy[i]=1
    if (A[i]<=A[i+1])and(A[i+2]<=A[i+1]):
        sell[i]=1
kabu=0
money=1000
#print(buy,sell)
#print(money,kabu)
A=A[1:]
#print(A)
for i in range(N):

    if buy[i]==1:
        kabu=kabu+money//A[i]
        money=money-(money//A[i])*A[i]

    if sell[i]==1:
        money=money+kabu*A[i]
        kabu=0

    #print(money,kabu,A[i])
    #input()
#print(money,kabu)
money=money+kabu*A[N-1]
print(money)



Measured memory_bytes: 64984
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

pub trait LexicalPermutation {
    fn next_permutation(&mut self) -> bool;
    fn prev_permutation(&mut self) -> bool;
}
impl<T> LexicalPermutation for [T]
where
    T: Ord,
{
    fn next_permutation(&mut self) -> bool {
        if self.len() < 2 {
            return false;
        }
        let mut i = self.len() - 1;
        while i > 0 && self[i - 1] >= self[i] {
            i -= 1;
        }
        if i == 0 {
            return false;
        }
        let mut j = self.len() - 1;
        while j >= i && self[j] <= self[i - 1] {
            j -= 1;
        }
        self.swap(j, i - 1);
        self[i..].reverse();
        true
    }
    fn prev_permutation(&mut self) -> bool {
        if self.len() < 2 {
            return false;
        }
        let mut i = self.len() - 1;
        while i > 0 && self[i - 1] <= self[i] {
            i -= 1;
        }
        if i == 0 {
            return false;
        }
        self[i..].reverse();
        let mut j = self.len() - 1;
        while j >= i && self[j - 1] < self[i - 1] {
            j -= 1;
        }
        self.swap(i - 1, j);
        true
    }
}

pub fn l2norm(a: &[f64], b: &[f64]) -> f64 {
    a.iter()
        .zip(b.iter())
        .map(|(i, j)| (i - j).powf(2.0))
        .sum::<f64>()
        .sqrt()
}

fn main() {
    input! {
        n: usize,
        xys: [[f64;2];n]
    }
    let mut idx: Vec<usize> = (0..n).collect();
    let mut sum: f64 = 0.0;
    let mut c: usize = 0;
    loop {
        for i in 0..n-1 {
            sum += l2norm(&xys[idx[i]], &xys[idx[i+1]]);
        }
        c += 1;
        if !idx.next_permutation() { break; }
    }
    println!("{}", sum / (c as f64));
}
/* vim:set foldmethod=marker: */


Measured memory_bytes: 4352
#include<stdio.h>
int main(void)
{
    char s[100000];
    int i,count1=0,count2=0;
    scanf("%s",s);
    for(i=0;i<100000;i++){
        //010101...の場合
        if(s[2*i]=='1') count1++;
        if(s[2*i+1]=='0') count1++;
        //101010...の場合
        if(s[2*i]=='0') count2++;
        if(s[2*i+1]=='1') count2++;
        
        if(s[2*i+1] == NULL) break;
    }
    if(count1<=count2) printf("%d",count1);
    else printf("%d",count2);
    
    return 0;
}



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

using namespace std;

using ll = long long;

template <typename T>
using matrix = std::vector<std::vector<T>>;

long long mod = 1e9 + 7;

template <typename T>
matrix<T> make_matrix(int n, int m, T id = 0)
{
    return matrix<T>(n, std::vector<T>(m, id));
}

template <typename T>
matrix<T> modmul(const matrix<T> &l, const matrix<T> &r)
{
    matrix<T> ret(l.size(), std::vector<T>(r[0].size()));
    for (int i = 0; i < (int)l.size(); i++)
    {
        for (int k = 0; k < (int)r.size(); k++)
        {
            for (int j = 0; j < (int)r[0].size(); j++)
            {
                ret[i][j] %= mod;
                ret[i][j] += (l[i][k] % mod) * (r[k][j] % mod) % mod;
                ret[i][j] %= mod;
            }
        }
    }
    return ret;
}

template <typename T>
std::vector<T> modmul(const matrix<T> &a, const std::vector<T> &x)
{
    const int n = a.size();
    const int m = x.size();
    std::vector<T> ret(n);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            ret[i] += (a[i][j] % mod) * (x[j] % mod) % mod;
            ret[i] %= mod;
        }
    }
    return ret;
}

template <typename T>
matrix<T> eye(const int n)
{
    matrix<T> ret(n, std::vector<T>(n));
    for (int i = 0; i < n; i++)
        ret[i][i] = 1;
    return ret;
}

template <typename T>
matrix<T> modpow(matrix<T> x, long long n)
{
    auto ret = eye<T>(x.size());
    while (n)
    {
        if (n & 1)
            ret = modmul(ret, x);
        x = modmul(x, x);
        n /= 2;
    }
    return ret;
}

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

template <typename T>
void printmat(const matrix<T> &a)
{
    for (const auto &v : a)
    {
        printv(v);
    }
}

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

    ll l, a, b;
    cin >> l >> a >> b >> mod;
    ll sum = 0, ma = 10;
    vector<ll> ret = {0, a, 1};
    for (int d = 1; d <= 18; d++)
    {
        // d 桁の数の個数
        // ~ ma-1
        ll c = -sum;
        if (ma - 1 - a >= 0)
        {
            c += (ma - 1 - a) / b + 1;
        }
        bool f = false;
        if (sum + c >= l)
        {
            c = l - sum;
            f = true;
        }
        auto mat = make_matrix<ll>(3, 3);
        mat[0][0] = ma;
        mat[0][1] = mat[1][1] = mat[2][2] = 1;
        mat[1][2] = b;
        mat = modpow(mat, c);
        ret = modmul(mat, ret);
        sum += c;
        ma *= 10;
        if (f)
            break;
    }
    cout << ret[0] << endl;
}


Measured memory_bytes: 256
n = int(input())

xs = list(map(int, input().split()))

l = min(xs)
r = max(xs)

costs = []
for i in range(1, 100):
    cost = 0
    for j in xs:
        cost += (j - i) * (j - i)
    costs.append(cost)

print(min(costs))



Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> P;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[100000],dp[100][100];

int main(){
  cin >> n >> s;
  clr(d,0);
  rep(i,0,n){
    if(s[i] == 'D')d[i]--;
    else d[i]++;
  }
  l = 0;
  rep(i,0,n){
    l = max(l,d[i]);
    d[i+1] += d[i];
  }
  print(l);
  return 0;
}

Measured memory_bytes: 1024
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var N = nextInt();
  var output = 0;
  var count = 1;
  while(output < N){
    output += count;
    count++;
  }
  count--;
  myout(count);
}


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

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

	int W, H, N;
	int x, y, a;
	scanf("%d %d %d", &W, &H, &N);

	int edge[5] = {-1, 0, W, 0, H};
	for (int i = 0; i < N; i++) {
		scanf("%d %d %d", &x, &y, &a);
		switch (a) {
			case 1:
				edge[1] = max(x, edge[1]);
				break;
			case 2:
				edge[2] = min(x, edge[2]);
				break;
			case 3:
				edge[3] = max(y, edge[3]);
				break;
			case 4:
				edge[4] = min(y, edge[4]);
				break;
			default:
				break;
		}
	}
	// printf("%d %d %d %d \n", edge[1], edge[2], edge[3], edge[4]);
	printf("%d", max(0, (edge[2] - edge[1])) * max(0, (edge[4] - edge[3])));
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int n,ans=0;
	cin>>n;
	int a[n+1],b[n+1];
	for(int i=1; i<=n; i++)  cin>>a[i];
	for(int i=1; i<=n; i++)  cin>>b[i];
	for(int i=1; i<=n; i++){
		if(a[i]-b[i]>=0)ans+=a[i]-b[i];
	} 
	cout<<ans;
}
//しかし、Cを支払う必要があります。Ciは私の宝石を獲得します。xは獲得した宝石の値の和であり、Yは支払う費用の和である。検索の最大可能値xマイナスy。

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<int> liczby;
int main(){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	liczby.push_back(a);
	liczby.push_back(b);
	liczby.push_back(c);
	sort(liczby.begin(),liczby.end());
	int naj = liczby[2];
	int drug = liczby[1];
	int trz = liczby[0];
	int wynik = 0;
	if ((naj-drug) % 2 == 0){
		wynik = wynik + (naj-drug)/2;
	}
	else{
		wynik = wynik + (naj-drug)/2 + 1;
		trz +=1;
	}
	//printf("%d %d %d %d\n",wynik,naj,drug,trz);
	if ((naj-trz)%2 == 0){
		wynik = wynik + (naj-trz)/2;
	}
	else {
		wynik = wynik + (naj-trz)/2 + 2;
	}
	printf("%d",wynik);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int i,j,n,x;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		printf("Case %d:\n",i);
		scanf("%d",&x);
		for(j=1;j<=10;j++){
			x = x * x;
			x = ((x % 1000000) - (x % 100)) / 100;
			printf("%d\n",x);
		}
	}
	return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  string s;
  cin>>s;
  n=sz(s);
  vll a(2019);
  ll ans=0;
  rep(i,n){
    vll b(2019);
    rep(j,2019){
      b[(j*10+(s[i]-'0'))%2019]+=a[j];
    }
    rep(j,2019){
      a[j]=b[j];
    }
    a[(s[i]-'0')]++;
    ans+=a[0];
  }
  COUT(ans);
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef vector<int>vi;
typedef pair<int,int>pi;
typedef vector<pi>vpi;
typedef vector<vi>vvi;
#define double long double
#define pow powl
#define sqrt sqrtl
#define cbrt cbrtl
#define floor floorl
#define ceil ceill
#define pb push_back
#define ep emplace_back
#define PB pop_back
#define pf push_front
#define ef emplace_front
#define PF pop_front
#define mp make_pair
#define ub(a,b) upper_bound(all(a),b)-a.begin()
#define lb(a,b) lower_bound(all(a),b)-a.begin()
#define bs(a,b) binary_search(all(a),b)
#define mem(a,b) memset(a,b,sizeof(a))
#define in(a,n) FOR(i,0,n-1) cin>>a[i]
#define in1(a,n) FOR(i,1,n) cin>>a[i]
#define ff first
#define ss second
#define out(a,n) FOR(i,0,n-1) cout<<a[i]<<" ";cout<<endl;
#define out1(a,n) FOR(i,1,n) cout<<a[i]<<" ";cout<<endl;
#define clr(a) a.clear()
#define pow2(a) (1LL<<a)
#define all(a) a.begin(),a.end()
#define all1(a) a.begin()+1,a.end()
#define rall(a) a.rbegin(),a.rend()
#define rall1(a) a.rbegin(),a.rend()
#define sz(a) ((int)a.size())
#define FOR(i,a,b) for(auto i=a;i<=b;i++)
#define NFOR(i,a,b) for(auto i=a;i>=b;i--)
const int mod=1e9+7;

inline int add(int a,int b){return (a%mod + b%mod)%mod;}
inline int sub(int a ,int b){return (a%mod - b%mod + mod)%mod;}
inline int mul(int a,int b){return (a%mod * b%mod)%mod;}
inline int power(int a,int b,int MOD){int res=1;while(b){if(b&1){res*=a;res%=MOD;}a=a*a;a%=MOD;b>>=1;}return res;}

#define trace(x) cout<<#x<<" :: "<<x<<endl;
#define trace2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define trace3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define trace4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
clock_t time_p = clock();
void time()
{
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (double)(time_p)/CLOCKS_PER_SEC <<endl;
}
signed main()
{
     SPEED;
     int n,d;
     cin>>n>>d;
     vi v[n];
     FOR(i,0,n-1)
     {
     	  FOR(j,0,d-1)
     	  {
     	   int x;
     	   cin>>x;
     	   v[i].pb(x);
     	  } 
     }
     int res=0;
     FOR(i,0,n-1)
     {
     	 FOR(j,i+1,n-1)
     	 {
     	 	  int ans=0;
     	 	  FOR(k,0,d-1)
     	 	  {
     	 	  	    ans+=(v[i][k]-v[j][k])*(v[i][k]-v[j][k]);
     	 	  }
     	 	  int p=sqrt(ans);
     	 	  if(p*p==ans)
     	 	  	++res;

     	 }
     }
     cout<<res<<endl;
     time();
     return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

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

		int N = sc.nextInt();

		int AliceP = sc.nextInt();
		int BoliceP = sc.nextInt();
		int dis = BoliceP - AliceP;

		if (dis % 2 == 0) {
			System.out.println("Alice");
		} else {
			System.out.println("Borys");
		}
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define int long long
using namespace std;



signed main()
{
 
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   
 
#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif      

    int n;
    cin>>n;
    string a;
    cin>>a;
    int x=0,y=n-1;
    int ans=0;
    while (x<y)
    {
        if(a[x]=='R')
        {
            x++;
            continue;
        }
        if(a[y]=='W')
        {
            y--;
            continue;
        }
        ans++;
        x++;
        y--;
    }
    cout<<ans;

}


Measured memory_bytes: 3772
import qualified Data.ByteString.Char8 as B
import Data.Maybe
import Data.List
main=putStrLn.unwords.map show.solve.sort.map(fst.fromJust.B.readInt).B.words=<<B.getContents
solve(_:xs)=((\x y->[max(signum y)x,x+y])<$>f.takeWhile(<8)<*>length.dropWhile(<8)).map(`div`400)$xs
f[]=0
f(x:xs)=1+f(dropWhile(==x)xs)

Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;

int n, r, i;
char t[20];
string s;

int main() {
scanf("%s", t);
s = t;
n = s.size();
r = 15 - n;
for (i=0;i<n;i++) if (s[i] == 'o') r++;
if (r >= 8) printf("YES\n"); else printf("NO\n");
}




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

typedef long long 		ll;
typedef vector<ll> 		vll;
typedef pair<ll,ll> 	pll;
typedef vector<pll> 	vpll;
typedef vector<int> 	vi;
typedef pair<int,int> 	pii;
typedef vector<pii> 	vpii;

#define fi				first
#define se 				second
#define pb 				push_back
#define mp 				make_pair
#define all(v)			v.begin(),v.end()
#define sz(v)			s.size()
#define rep(i,a,b) 		for(int i=a;i<=b;i++)
#define per(i,a,b) 		for(int i=a;i>=b;i--)
#define fill(a,v)		memset(a,v,sizeof(a))
#define tc				int T;cin>>T;while(T--)
#define nl				printf("\n")
#define aya				cerr<<"yaha aya"<<"\n"
#define debug(x,y)		printf("%d %d\n",x,y)
#define fast_io			ios_base::sync_with_stdio(false);cin.tie(NULL);
#define grt				greater<int>()

const int mod = 1e9+7;
const int mod2= 1e9+9;

inline int pow_(ll a, int n, int p=mod){
	int r=1;while(n){if(n&1)r=r*a%p;n>>=1;a=a*a%p;}return r;
}

int main(void)
{
	double R;
	cin >> R;
	double ans = 2 * M_PI * R;
	cout << fixed << setprecision(12) << ans << "\n";
}


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

int H, W;
string s[55];

int main()
{
    cin >> H >> W;
    for (int i = 0; i < H; i++) cin >> s[i];

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

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (s[i][j] == '.') continue;
            bool f = false;
            for (int k = 0; k < 4; k++) {
                if (s[i + (i > 0 && i < H ? dy[k] : 0)][j + (i > 0 && i < W ? dx[k] : 0)] == '#') {
                    f = true;
                }
            }
            if (!f) return cout << "No" << endl, 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
typedef long long ll;

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

    vector<ll> L(N, 0);
    for (int i = 0; i < N; i++)
    {
        cin >> L[i];
    }

    ll ans = 0;

    for (int i = 0; i < N - 2; i++)
    {
        for (int j = i + 1; j < N - 1; j++)
        {
            for (int k = j + 1; k < N; k++)
            {
                if (L[i] != L[k] && L[i] != L[j] && L[j] != L[k] && L[i] + L[j] > L[k] && L[i] + L[k] > L[j] && L[k] + L[j] > L[i])
                {
                    ans++;
                }
            }
        }
    }

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

Measured memory_bytes: 3628
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Vector3 {
	int x, y, z;

	Vector3(int x, int y, int z) {
		this.x = x;
		this.y = y;
		this.z = z;
	}

	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		Vector3 vector3 = (Vector3) o;

		if (x != vector3.x) return false;
		if (y != vector3.y) return false;
		return z == vector3.z;
	}

	public int hashCode() {
		int result = x;
		result = 31 * result + y;
		result = 31 * result + z;
		return result;
	}
}

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		int X = Integer.parseInt(sc.get());
		int Y = Integer.parseInt(sc.get());
		int Z = Integer.parseInt(sc.get());
		int K = Integer.parseInt(sc.get());
		long[] A = new long[X];
		Arrays.setAll(A, $ -> Long.parseLong(sc.get()));
		long[] B = new long[Y];
		Arrays.setAll(B, $ -> Long.parseLong(sc.get()));
		long[] C = new long[Z];
		Arrays.setAll(C, $ -> Long.parseLong(sc.get()));
		Arrays.sort(A);
		Arrays.sort(B);
		Arrays.sort(C);

		Set<Vector3> used = new HashSet<>();
		PriorityQueue<Vector3> queue = new PriorityQueue<>(Comparator.comparingLong((Vector3 v) -> A[v.x] + B[v.y] + C[v.z]).reversed());
		{
			Vector3 e = new Vector3(X - 1, Y - 1, Z - 1);
			queue.add(e);
			used.add(e);
		}
		for (int i = 0; i < K; i++) {
			Vector3 v = queue.remove();
			System.out.println(A[v.x] + B[v.y] + C[v.z]);
			if (v.x > 0) {
				Vector3 x = new Vector3(v.x - 1, v.y, v.z);
				if (!used.contains(x)) {
					queue.add(x);
					used.add(x);
				}
			}
			if (v.y > 0) {
				Vector3 y = new Vector3(v.x, v.y - 1, v.z);
				if (!used.contains(y)) {
					queue.add(y);
					used.add(y);
				}
			}
			if (v.z > 0) {
				Vector3 z = new Vector3(v.x, v.y, v.z - 1);
				if (!used.contains(z)) {
					queue.add(z);
					used.add(z);
				}
			}
		}
	}
}

class Main {
	public static void main(String... args) {
		System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<String>() {
			StringTokenizer line;

			public String get() {
				try {
					return (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken();
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
		});
		System.out.flush();
	}
}

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;

int main(){
    int N,D,X; cin>>N>>D>>X;
    vector<int> A(N);
    rep(i,N)cin>>A[i];
    rep(i,N){
        X += (D-1)/A[i]+1;
    }
    cout<<X<<endl;
}


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

int main() {
  int N;
  cin >> N;
  
  int res = 0;
  for (int i=1; i<N+1; i++) {
    int count = 0;
    int d = i;
    while (d) {
      d /= 10;
      count++;
    }
    if (count % 2) res++;
  }
  
  cout << res << endl;
}

Measured memory_bytes: 256
import           Control.Monad
import qualified Data.Array.IO               as IO
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

main = do
  [w, h, n] <- getIntList
  xya <- replicateM n getIntList

  g <- IO.newArray ((1,1),(w,h)) 0 :: (IO (IO.IOUArray (Int, Int) Int))

  forM_ xya $ \[x, y, a] -> do
    when (a == 1) $ forM_ [1..x] $ \i -> forM_ [1..h] $ \j ->
      IO.writeArray g (i, j) 1
    when (a == 2) $ forM_ [(x+1)..w] $ \i -> forM_ [1..h] $ \j ->
      IO.writeArray g (i, j) 1
    when (a == 3) $ forM_ [1..w] $ \i -> forM_ [1..y] $ \j ->
      IO.writeArray g (i, j) 1
    when (a == 4) $ forM_ [1..w] $ \i -> forM_ [(y+1)..h] $ \j ->
      IO.writeArray g (i, j) 1

  res <- VM.new 1
  VM.write res 0 (0::Int)

  forM_ [1..w] $ \i -> forM_ [1..h] $ \j -> do
    c <- IO.readArray g (i, j)
    when (c == 0) $ do
      t <- VM.read res 0
      VM.write res 0 (t + 1)

  ans <- VM.read res 0
  print ans

Measured memory_bytes: 1020
#include <iostream>
#include <vector>
using namespace std;
const int INF = 1000000007;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> factor(n+1,1);
    for(int i = 1; i < n+1; ++i){
        int j = i;
        for(int k = 2; k < n+1; k++){
            while(j%k == 0){
                factor[k]++;
                j /= k;
            }
        }
    }
    long long ans = 1;
    for(int i = 1; i < n+1; ++i){
        ans *= factor[i];
        ans %= INF;
    }
    cout << ans << endl;
    return 0;
}
//Saw the editorial

Measured memory_bytes: 3624
# ABC112

N, T = map(int, input().split())
C_T = [map(int, input().split()) for _ in range(N)]
temp_c = 10**10
for c, t in C_T:
    if t <= T and c <= temp_c:
        temp_c = c


if temp_c == 10**10:
    ans = "TLE"
else:
    ans = temp_c
print(ans)


Measured memory_bytes: 9180
using System;

namespace AtCoder
{
 class Program
    {
        static void Main(string[] args)
        {
        	var input = double.Parse(Console.ReadLine());
            Console.WriteLine(CalculateCircumference(input));
        }
   
   		static double CalculateCircumference(double radius)
        {
        	return 2*Math.PI*radius;
        }
 }
}

Measured memory_bytes: 27624