akhauriyash/Code-Regression huggingface dataset:
# bit 全探索
INF = 10 ** 7
n, m, x = gets.split.map(&:to_i)
books = []
n.times { books << gets.split.map(&:to_i) }
ans = INF
(2 ** n).times do |i|
  skill = Array.new(m, 0)
  price = 0
  i.to_s(2).rjust(n, "0").each_char.with_index do |bit, digit|
    next if bit == "0"
    book = books[digit]
    price += book.first
    book[1..-1].each_with_index do |up, alg|
      skill[alg] += up
    end
  end
  ans = price if ans > price && skill.min >= x
end
puts ans == INF ? -1 : ans


Measured memory_bytes: 14352
main :: IO ()
main = readLn >>= print . solve

solve :: Int -> Int
solve n = go 0 False False False
  where
    go c s f t
      | c > n     = 0
      | otherwise = (if and [s,f,t] then 1 else 0)
      + go (10*c+7) True f t
      + go (10*c+5) s True t
      + go (10*c+3) s f True


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

int main() {
  int n;
  string s;
  cin >> n >> s;
  char now = '#';
  int ans = 0;
  rep(i, s.size()) {
    if (now != s[i]) ans++;
    now = s[i];
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int a, b, c;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> a >> b >> c;
    if (a == b && b == c) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
package main

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

func harshad_number(number int) {

	var sums int = 0
	number_str := strconv.Itoa(number)
	array := strings.Split(number_str, "")

	for i := 0; i < len(array); i++ {

		transfer, _ := strconv.Atoi(array[i])
		sums += transfer

	}

	if number%sums == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}

func main() {

	var x int

	fmt.Scan(&x)

	if x < 1 && 100000000 < x {

		fmt.Println("Overflow")
		os.Exit(0)
	}

	harshad_number(x)

}


Measured memory_bytes: 640
#include <iostream>
#include<vector>
#define rep(i,n) for (int i=0;i<n;++i)
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector<bool> broken(n + 1);
	rep(i, m) {
		int a;
		cin >> a;
		broken[a] = true;
	}

	vector<int>dp(n + 2);
	const int mod = 1000000007;
	dp[n] = 1;
	for (int i = n - 1; i >= 0; i--) {
		if (broken[i]) {
			dp[i] = 0;
			continue;
		}
		dp[i] = (dp[i + 1] + dp[i + 2]) % mod;
	}
	cout << dp[0] << endl;
	return 0;
	
}

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

int main(){
    int n,m,l;
    cin >> n >> m >> l;
    long A[n][m];
    long B[m][l];
    long C[n][l];
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            cin >> A[i][j];
        }
    }
    for (int i = 0; i < m; i++){
        for (int j = 0; j < l; j++){
            cin >> B[i][j];
        }
    }

    for (int i = 0; i < n; i++){
        for (int j = 0; j < l; j++){
            long product = 0;
            for (int k = 0; k < m; k++){
                product += A[i][k] * B[k][j];
            }
            C[i][j] = product;
        }
    }

    for (int i = 0; i < n; i++){
        for (int j = 0; j < l; j++){
            cout << C[i][j];
            if (j != l-1){
                cout << ' ';
            }
        }
        cout << '\n';
    }
}



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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 1100000;

void run_case()
{
    int k;
    cin >> k;
    string s;
    cin >> s;
    if (s.size() > k)
    {
        for (int i = 0; i < k; i++)
        {
            cout << s[i];
        }
        cout << "...\n";
    }
    else
    {
        cout << s << "\n";
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 3660
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        a: usize,
        b: usize,
    }

    let mut ans = -1;

    for i in 0..10000 {
        if (i as f64 * 0.08) as usize == a && (i as f64 * 0.1) as usize == b {
            ans = i;
            break;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 2200
#include<iostream>
using namespace std;
int main(){
    
    int x,y,z;
    cin >>x >>y >>z;
    
    int a,b,c;
    
    if (x<y){
        a = x;
        b = y;
    } else {
        a = y;
        b = x;
    }
    if (a<z){
        if (b<z){
            c = z;
        } else {
            c = b;
            b = z;
        }
    } else {
        if (a<b){
            c = b;
            b = a;
            a = z;
        } else {
            c = a;
            a = z;
        }
    }
    
    cout << a << " " << b << " " << c << endl;
    
    return 0;
}



Measured memory_bytes: 3104
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
  int N; cin >> N;
  vector<int>nums(N);
  for (int i = 0; i < N; ++i) {
    cin >> nums[i];
  }
  set<int>aset;
  set<int>ans;
  for (int i = 0;i< N; ++i) {
    set<int>newset;
    for (auto s : aset) {
      if (s < 1000) {
        newset.emplace(s * 10 + nums[i]);
        ans.emplace(s * 10 + nums[i]);
      }
    }
    newset.emplace(nums[i]);
    ans.emplace(nums[i]);
    aset = newset;
  }
  int n = 0;
  int finans = ans.size();
  for (auto s : ans) {
    if (s != n) {
      finans = n;
      break;
    }
    else {
      n++;
    }
  }
  cout << finans << endl;
  return 0;
}

Measured memory_bytes: 3184
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define mod 1000000007 
#define check exit(0)
#define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
#define ll long long int
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace __gnu_pbds;
using namespace std;

int main()
{
    jaldi
    int n,k;
    cin>>n>>k;
    vector<int> v(n);
    for(int &x:v) cin>>x;
    vector<ll> dp(n,INT_MAX);
    dp[0]=0;
    for(int i=1;i<n;i++)
    {
        for(int j=k;j>=1;j--)
        {
            if(i-j>=0)
            {
                dp[i]=min(dp[i],dp[i-j]+abs(v[i]-v[i-j]));
            }
        }
    }
    cout<<dp[n-1];
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <vector>

using IV = std::vector<int>;
IV ToFixedIntArray(std::istream& is, int n) {
	IV ret(n);
	auto* dst = ret.data();
	while(n > 0) {
		--n;
		is >> *dst++;
	}
	return ret;
}

void DisableIOSync() {
	std::cin.tie(0);
	std::cout.tie(0);
	std::ios::sync_with_stdio(false);
}
int main() {
	DisableIOSync();

	const int N = ToFixedIntArray(std::cin, 1)[0];
	const auto input = ToFixedIntArray(std::cin, N);
	int count_4 = 0,
		count_2 = 0;
	for(auto& i : input) {
		int flag = i & 0x03;
		if(flag == 0)
			++count_4;
		else if(flag == 2)
			++count_2;
	}
	int remain = N - count_4;
	remain -= count_2/2;
	if((N+1)/2 >= remain)
		std::cout << "Yes";
	else
		std::cout << "No";
	std::cout << std::endl;

	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<queue>
using namespace std;
bool ice[123][123]; int ret = 0;
void dfs(int x, int y, int count) {
	ice[x][y] = false; count++; ret = max(ret, count);
	if (ice[x - 1][y]) dfs(x - 1, y, count);
	if (ice[x + 1][y]) dfs(x + 1, y, count);
	if (ice[x][y - 1]) dfs(x, y - 1, count);
	if (ice[x][y + 1]) dfs(x, y + 1, count);
	ice[x][y] = true;
}
int main() {
	for (int g = 0; g < 5; g++) {
		int n, m, a; cin >> m >> n;
		if (m == 0 && n == 0) { return 0; }
		for (int h = 1; h <= n; h++) {
			for (int i = 1; i <= m; i++) {
				cin >> a;
				ice[h][i] = a == 1;
			}
		}
		for (int h = 1; h <= n; h++) {
			for (int i = 1; i <= m; i++) {
				if (ice[h][i]) dfs(h, i, 0);
			}
		}
		cout << ret << endl; ret = 0;
	}
}



Measured memory_bytes: 3044
N = int(input())
A = list(map(int, input().split()))
money = [[1000, 0]]
ans = 1000
B = [1 for _ in range(N)] #-1 -> buy 1 ->sell 0 -> nothing
for k in range(N-1):
  if A[k] < A[k+1]:
    B[k] = -1
  elif A[k] == A[k+1]:
    B[k] = 0

for k in range(N):
  if B[k] == -1:
    new = []
    for j in range(len(money)):
      if A[k] <= money[j][0]:
        new.append([money[j][0]%A[k], money[j][1] + money[j][0]//A[k]])
    money += new
  
  if B[k] == 1:
    ans = 0
    for j in range(len(money)):
      ans = max(money[j][0] + money[j][1]*A[k], ans)
    money[0] = [ans, 0]

print(ans)

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

int main(){
	string s,ans;
   	cin>>s;
   	int a=(int)(s.length());
  	if(s[a-1]=='s') ans=s+"es";
  	else ans=s+'s';
  	cout<<ans;
  	return 0;
}

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

int main(void)
{
  int K, N;
  cin >> K >> N;
  vector<int> A(N);
  for (int i = 0;i<N;i++){
    cin >> A.at(i);
  }
  int max = (K - A.at(N-1)) + A.at(0);
  
  for (int i=0;i<N-1;i++){
    if (A.at(i+1)-A.at(i) > max){
      max = A.at(i+1)-A.at(i);
    }
  }
  
  cout << K-max << endl;
  
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;

template <class T> using V = vector<T>;

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

const long long INF = 1LL << 60;

using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;



#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define pb(a) push_back(a);




ll Sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}



const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}


#define comuse Comuse()

ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll perm(int n,int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] % MOD) % MOD;
}


ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}


vll div(ll n){
  vll ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n){
        ret.push_back(n/i);
      }
    }
  }
  SORT(ret);
  return (ret);
}


ll modpow(ll a,ll n,ll mod){
  ll ans=1;
  while(n>0){
    if(n&1){
      ans=ans*a%mod;
    }

    a=a*a%mod;
    
    n>>=1;
  }

  return ans;
}

void Solve();


const int MAX_N = 131072;
//segment tree 
int NN;
int seg[MAX_N*2-1];
void seguse(){
  for(int i=0;i<2*NN-1;i++){
    seg[i]=INT_MAX;
  }
}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(20)<<fixed;
  Solve();
}



/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
//segtreeの葉の先頭の添え字はn-1
void Solve(){
  //ll N=262144;
  //vll segtree(2*N-1);
  ll q,h,s,d;
    cin>>q>>h>>s>>d;
  ll n;
    cin>>n;
  q*=4;
  h*=2;
  ll ans=0;
  if(n%2==1){
    ans+=min({q,h,s});
    n--;
  }
  n/=2;
  ans+=n*min({2*q,2*h,2*s,d});
  cout<<ans<<"\n";
}

Measured memory_bytes: 256
import math
from itertools import combinations
 
N = int( input() )
 
def distance( a, b ):
  x1, y1 = a
  x2, y2 = b
  return math.sqrt( ( x1 - x2 ) ** 2 + ( y1 - y2 ) ** 2 )
 
d = []
for i in range(N):
  x, y = map( int, input().split() )
  d.append( [x, y] )
 
base = list(combinations(range(N),2))
sums = 0
for x in base:
  a, b = x
  sums += distance( d[a], d[b] )
print( sums / (len(base)) * ( N - 1 ))

Measured memory_bytes: 3064
import java.util.Scanner;
class Main{
 public static void main(String args[]){
  int h,w,i,j,p;
  Scanner sc = new Scanner(System.in);
  while(true){
   h=sc.nextInt();
   w=sc.nextInt();
   if(h==0 && w==0)
    break;
   for(i=0;i<h;i++){
    if(i==0 || i==h-1){
     for(j=0;j<w;j++)
      System.out.print("#");
     System.out.println("");}
    else{
     System.out.print("#");
     for(p=0;p<w-2;p++)
      System.out.print(".");
     System.out.println("#");}}
   System.out.println();}
 }
}


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

int pal(int x){
  int sum=0;
  while(x>0){
    sum *= 10;
    sum += x%10;
    x /= 10;
  }
  return sum;
}

int main(){
  int A,B;
  cin >> A >> B;
  int ans=0;
  for(int i=A;i<=B;i++){
    if(i==pal(i)){
      ans ++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n,q = map(int,input().split())
s = list(input())
ac = ["A","C"]
li = []

cnt = 0
for i in range(n):
    if s[i-1:i+1] == ac:
        cnt += 1
    li.append(cnt)

for i in range(q):
    l,r = map(int,input().split())
    l-=1
    r-=1
    print(li[r]-li[l])

Measured memory_bytes: 6828
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <iomanip> // setprecision
#include <bitset> // bitset
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    int N, M;
    cin >> N >> M;
    vector<vi> data(N + 1);
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        data[a].push_back(b);
        data[b].push_back(a);
    }
    vb check(N + 1, false);
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (check[i + 1]) {
            continue;
        }
        int count = 1;
        queue<int> que;
        que.push(i + 1);
        check[i + 1] = true;
        while(!que.empty()) {
            int a = que.front();
            que.pop();
            for (int x : data[a]) {
                if (check[x]) {
                    continue;
                }
                count++;
                que.push(x);
                check[x] = true;
            }
        }
        if (count > ans) {
            ans = count;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 14960
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

struct point{
    double x=0,y=0;
    constexpr point(double x=0,double y=0):x(x),y(y){}
    constexpr bool operator==(const point& r)const{return (x==r.x&&y==r.y);};
    constexpr point operator+(const point& r)const{return point(*this)+=r;}
    constexpr point operator+=(const point& r){
        x+=r.x;y+=r.y;
        return *this;
    }
    constexpr point operator-(const point& r)const{return point(*this)-=r;}
    constexpr point operator-=(const point& r){
        x-=r.x;y-=r.y;
        return *this;
    }
    constexpr point operator*(const double& r)const{return point(*this)*=r;}
    constexpr point operator*=(const double& r){
        x*=r;y*=r;
        return *this;
    }
    constexpr point operator/(const double& r)const{return point(*this)/=r;}
    constexpr point operator/=(const double& r){
        x/=r;y/=r;
        return *this;
    }
};

double norm(const point& a){return a.x*a.x+a.y*a.y;}
double abs(const point& a){return sqrt(a.x*a.x+a.y*a.y);}
double dot_product(const point& a,const point& b){return a.x*b.x+a.y*b.y;}
double cross_product(const point& a,const point& b){return a.x*b.y-a.y*b.x;}
point projection(const point& p,const point& b){return b*dot_product(p,b)/norm(b);}

point pp[3];

int main(){
    while(scanf("%lf,%lf,%lf,%lf,%lf,%lf",&pp[0].x,&pp[0].y,&pp[1].x,&pp[1].y,&pp[2].x,&pp[2].y)!=EOF){
        point t = projection(pp[2]-pp[0],pp[1]-pp[0]) + pp[0];
        point ans = (t - pp[2])*2 + pp[2];
        cout << setprecision(10) << ans.x << " " << ans.y << endl;
    }
    return 0;
}


Measured memory_bytes: 3316
n, m = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(m)]

red, cnt = set([1]), {i: 1 for i in range(1, n + 1)}
for xi, yi in xy:
    if xi in red:
        red.add(yi)
        if cnt[xi] == 1:
            red.remove(xi)
    cnt[xi] -= 1
    cnt[yi] += 1
print(len(red))


Measured memory_bytes: 102080
#include <stdio.h>
#include <stdlib.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
typedef long long ll;

int main(void)
{
    ll ans = 0;

    ll n, a, b;
    scanf("%lld%lld%lld", &n, &a, &b);

    if ((b - a) % 2)
        ans = min(a - 1, n - b) + 1 + (b - a - 1) / 2;
    else
        ans = (b - a) / 2;

    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <ostream>
#include <utility>
#include <vector>
#include "math.h"

// 0 <= n <= 6
// 0 <= x <= 100
// 0 <= y <= 100
//
struct Point {
    double x;
    double y;
};

void koch(int n, Point a, Point b, std::vector<Point>* point);

int main(int argc, char const* argv[])
{
    int n;
    std::cin >> n;

    Point a,b;

    a.x = 0;
    a.y = 0;
    b.x = 100;
    b.y = 0;

    std::vector<Point> point;
    point.push_back(a);

    koch( n, a, b, &(point));

    // std::cout << "Debug" << std::endl;
    point.push_back(b);
    for (auto i = point.begin(); i < point.end(); i++) {
        std::cout << i->x << " " << i->y << std::endl;
    }
    return 0;
}

void koch(int n, Point a, Point b, std::vector<Point> *point){
    if ( n == 0){ return; }

    Point s, t, u;
    double th = M_PI * 60 / 180;

    s.x = ( 2.0 * a.x + 1.0 * b.x) /3.0;
    s.y = ( 2.0 * a.y + 1.0 * b.y) /3.0;
    t.x = ( 1.0 * a.x + 2.0 * b.x) /3.0;
    t.y = ( 1.0 * a.y + 2.0 * b.y) /3.0;
    u.x = ( t.x - s.x) * cos(th) - (t.y - s.y)* sin(th) + s.x;
    u.y = ( t.x - s.x) * sin(th) + (t.y - s.y)* cos(th) + s.y;

    koch(n -1 , a , s ,point);
    // std::cout << s.x << " " << s.y << std::endl;
    point->push_back(s);
    koch(n -1 , s , u ,point);
    // std::cout << u.x << " " << u.y << std::endl;
    point->push_back(u);
    koch(n -1 , u , t ,point);
    // std::cout << t.x << " " << t.y << std::endl;
    point->push_back(t);
    koch(n -1 , t , b ,point);

}



Measured memory_bytes: 3340
#include <cstdio>
#include <vector>
#include <numeric>

int testcase_ends() {
  int N, M, P;
  scanf("%d %d %d", &N, &M, &P);
  if (N == 0 && M == 0 && P == 0) return 1;

  --M;
  std::vector<int> a(N);
  for (auto& ai: a) scanf("%d", &ai);
  if (a[M] == 0) return puts("0"), 0;
  int sum = std::accumulate(a.begin(), a.end(), 0) * (100-P);
  printf("%d\n", sum / a[M]);
  return 0;
}

int main() {
  while (!testcase_ends()) {}
}



Measured memory_bytes: 2688
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

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

  int x;
  cin >> x;

  if(x == 7 || x == 5 || x == 3) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}



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

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

    vector<double> x(N);
    vector<string> u(N);

    for (int i=0; i<N; i++){
        cin >> x.at(i) >> u.at(i);
    }

    double otoshidama = 0;

    for (int i=0; i<N; i++){
        if (u.at(i) == "JPY"){
            otoshidama += double(x.at(i));
        } else {
            otoshidama += double(x.at(i) * 380000);
        }
    }

    cout << otoshidama << endl;
}

Measured memory_bytes: 256
var
	n,a,b,i,j,nn,na:Longint;
	x,sum:int64;
	v:array[1..50]of int64;
	c:array[0..50,0..50]of int64;
begin
	read(n,a,b);
	for i:=1 to n do read(v[i]);
	c[0,0]:=1;
	for i:=1 to n do begin
		c[i,0]:=1;
		for j:=1 to i do c[i,j]:=c[i-1,j]+c[i-1,j-1];
	end;
	for i:=1 to n do begin
		for j:=i+1 to j do begin
			if v[i]<v[j] then begin
				x:=v[i];
				v[i]:=v[j];
				v[j]:=x;
			end;
		end;
	end;
	for i:=1 to a do inc(sum,v[i]);
	writeln((sum/a):0:9);
	for i:=1 to a do if v[i]=v[a]then inc(na);
	nn:=na;
	for i:=a+1 to n do if v[i]=v[a]then inc(nn);
	if v[1]<>v[a]then begin
		writeln(c[nn,na]);
	end else begin
		x:=0;
		for i:=a to b do begin
			if i>n then break;
			inc(x,c[nn,i]);
		end;
		writeln(x);
	end;
end.


Measured memory_bytes: 128
n,m,c = map(int, input().split())
b = list(map(int, input().split()))
count = 0
for i in range(n):
    a = list(map(int, input().split()))
    li = []
    for j in range(m):
        li.append(a[j]*b[j])
    if sum(li) + c > 0:
            count += 1
print(count)

Measured memory_bytes: 3064
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
      	String S = sc.next();	
      	String T = sc.next();
		int cnt = 0;

		String[] S2 = S.split("", 0);
		String[] T2 = T.split("", 0);
      	
	   	for(int i  = 0;i<3;i++){
          	if(S2[i].equals(T2[i]) ){
              	cnt++;
            }
        }
      	
      	System.out.println(cnt);
	}
}

Measured memory_bytes: 21844
def solve(a,b,c):
	ans = 0
	if (a&1) != (b&1) and (a&1) != (c&1):
		ans += 1
		b += 1
		c += 1
	elif (b&1) != (a&1) and (b&1) != (c&1):
		ans += 1
		a += 1
		c += 1
	elif (c&1) != (a&1) and (c&1) != (b&1):
		ans += 1
		a += 1
		b += 1

	return ans + (c-b)//2 + (c-a)//2

print(solve(*sorted(map(int,input().split()))))

Measured memory_bytes: 9200
fn main() {
    proconio::input! {
        n: usize,
        k: usize,
        a: [proconio::marker::Usize1;n],
    }
    let mut m=vec![0;n];
    let mut i=k;
    let mut p=0;
    while i>0 {
        if m[p]>0 {
            i%=m[p]-i;
            break;
        }
        m[p]=i;
        i-=1;
        p=a[p];
    }
    while i>0 {
        i-=1;
        p=a[p];
    }
    println!("{}",p+1);
}

Measured memory_bytes: 6448
#pragma GCC optimize("Ofast")
#include<stdio.h>
#include<set>
#include<string>
#include<algorithm>
using namespace std;
char str[15];
set<string> se;
int main(){
	int i,n;
	string s;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf(" %s",str);
		s=str;
		se.insert(s);
	}
	printf("%d\n",se.size());
}


Measured memory_bytes: 18932
#include<stdio.h>

int main()
{
    int H,N,A,temp=0,i;
    scanf("%d%d",&H,&N);
    for (i=0;i<N;i++)
    {
        scanf("%d",&A);
        H=H-A;
        if (H<=0)
        {
            temp=1;
        }
    }
    if (temp==1)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    string s[n];
    ll dis[n][n];
    for(int i=0;i<n;i++){
        cin>>s[i];
        for(int j=0;j<n;j++){
            if(i==j){
                dis[i][j]=0;
            }else{
                dis[i][j]=1e9;
            }
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(s[i][j]=='1'){
                dis[i][j]=1;
            }
        }
    }
    for(int k=0;k<n;k++){
    	for(int i=0;i<n;i++){
    		for(int j=0;j<n;j++){
    			dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
    		}
    	}
    }
    set<ll> iroha;
    for(int i=0;i<n;i++){
    	if(dis[0][i]&1)iroha.insert(i);
    }
    ll ans=0;
    for(int i=0;i<n;i++){
    	for(int j=0;j<n;j++){
    		if(s[i][j]=='1'){
    			if(!((iroha.count(i))^(iroha.count(j)))){
    				cout << -1<<endl;
    				return 0;
    			}
    		}
    		ans=max(ans,dis[i][j]);
    	}
    }
    cout << ans+1<<endl;


    return 0;
}


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

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(S: str):
    n = 0
    d = False
    for i in range(1,len(S)+1):
        if i % 2 == 1:
            if not ( S[i-1] == "R" or 
               S[i-1] == "U" or 
               S[i-1] == "D"):
                d = True
                break
        else:
            if not ( S[i-1] == "L" or 
               S[i-1] == "U" or 
               S[i-1] == "D"):
                d = True
                break

    if d:
        print(NO)
    else:
        print(YES)

    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import java.util.*;
public class Main{
    public static int find(int cur_v, int cur_t, int[] time, int[] parent){
        if(time[cur_v] < cur_t) return cur_v;
        if(parent[cur_v] == cur_v) return cur_v;
        return parent[cur_v] = find(parent[cur_v], cur_t, time, parent);
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()) {
            int n = sc.nextInt();
            int q = sc.nextInt();
            if (n == 0 && q == 0) return;
            int[] parent = new int[n+1];
            int[] time = new int[n+1];
            Arrays.fill(time, Integer.MAX_VALUE);
            List<Integer> qt = new ArrayList<Integer>();
            List<Integer> vt = new ArrayList<Integer>();
            for (int i = 2; i <= n; i++) {
                int v = sc.nextInt();
                parent[i] = v;
            }
            parent[1] = 1;
            long sum = 0;
            for (int i = 1; i <= q; i++) {
                String s = sc.next();
                int v = sc.nextInt();
                if (s.equals("M"))
                    time[v] = Math.min(time[v], i);
                else
                {
                    qt.add(i);
                    vt.add(v);
                }
            }
            int q_ct = qt.size();
            for(int i=q_ct-1; i>=0; i--){
                int cur_v = vt.get(i);
                int cur_t = qt.get(i);
                sum += find(cur_v, cur_t, time, parent);
            }
            System.out.println(sum);
        }
    }
}


Measured memory_bytes: 294424
import sys
def input(): return sys.stdin.readline().strip()
N,M,K = map(int,input().split())
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

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

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
uni = UnionFind(N)
fn = [0 for i in range(N)]
bl = [[] for i in range(N)]
bn = [0 for i in range(N)]
for i in range(M):
    a,b= map(int,input().split())
    a -= 1
    b -= 1
    uni.union(a,b)
    fn[a] +=1
    fn[b] += 1
for i in range(K):
    a,b= map(int,input().split())
    a -= 1
    b -= 1
    if uni.find(a) == uni.find(b):
        bn[a] += 1
        bn[b] += 1
ans = [0 for i in range(N)]
for i in range(N):
    ans[i] = uni.size(i) - bn[i] - fn[i] -1
print(' '.join([str(i) for i in ans]))

Measured memory_bytes: 26728
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
    int n;
    string s;
    cin >> n >> s;
    int cnt = 0;
    for (int i = 0; i < 1000; i++) {
        string num = to_string(i);
        if (0 <= i && i <= 9) num = "00" + to_string(i);
        if (10 <= i && i <= 99) num = "0" + to_string(i);
        int tmp;
        bool find0 = false, find1 = false;
        for (int j = 0; j < n; j++) {
            if (s[j] == num[0]) {
                tmp = j;
                find0 = true;
                break;
            }
        }
        for (int j = tmp+1; j < n; j++) {
            if (s[j] == num[1]) {
                tmp = j;
                find1 = true;
                break;
            }
        }
        for (int j = tmp+1; j < n; j++) {
            if (find0 && find1 && s[j] == num[2]) {
                cnt++;
                break;
            }
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")

#define rep(i,n) for(int i=0;i<n;i++)
const long long MOD = 1000000007;

int main(){
  int n; cin >> n;
  int a = n/25;
  int b = (n-a*25)/10;
  int c = (n-a*25-b*10)/5;
  int d = n%5;
  cout << a+b+c+d <<"\n";
}


Measured memory_bytes: 3112
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    String ans = "Odd";
    if(((a*b)&1)==0) ans = "Even";
    System.out.println(ans);
  }
}

Measured memory_bytes: 23764
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a,b,c;
		a=sc.nextInt();
		b=sc.nextInt();
		c=sc.nextInt();
		
		if(a<=c&&c<=b)
			System.out.println("Yes");
		else
			System.out.println("No");
	}

}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

const ll oo = 1e18;
const ll mod = 998244353,maxn = 3030;
const double PI = acos(-1);


int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m, a, b;

    cin >> n >> m;

    vector<int> ans(n, 0);

    for (int i=0; i<m; i++){
        cin >> a >> b;
        ans[--a]++;
        ans[--b]++;
    }

    for (auto x : ans) cout << x << endl;
    return 0;
}

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

int N;

int main(){
	bool r[8];
	int s = 0;
	memset(r, false, sizeof(r));
	cin >> N;
	for(int i = 0; i < N; i++){
		int val;
		cin >> val;
		if(val > 3199) s++;
		else if(val > 2799) r[7] = true;
		else if(val > 2399) r[6] = true;
		else if(val > 1999) r[5] = true;
		else if(val > 1599) r[4] = true;
		else if(val > 1199) r[3] = true;
		else if(val > 799) r[2] = true;
		else if(val > 399) r[1] = true;
		else r[0] = true;
	}
	int sum = 0, full = 0;
	for(int i = 0; i < 8; i++)
		if(!r[i]) sum++;
		else full++;
	printf("%d %d\n", max(full, 1), full + s);
	return 0;
}


Measured memory_bytes: 256
n, k, c = map(int, input().split())
s = input()

left_to_right = [0 for _ in range(n)]
now = 1
i = 0
while i < n:
    if s[i] == "o":
        left_to_right[i] = now
        i += c
        now += 1
    i += 1

right_to_left = [0 for _ in range(n)]
now = k
i = n - 1
while 0 <= i:
    if s[i] == "o":
        right_to_left[i] = now
        i -= c
        now -= 1
    i -= 1

for i in range(n):
    if left_to_right[i] == right_to_left[i] and left_to_right[i] != 0:
        print(i + 1)

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

int main(){
    int A, B,flag_A=0,flag_B=0;
    cin >> A >> B;
    if(A>=1 && A<=9){
        flag_A=1;
    }
    if(B>=1 && B<=9){
        flag_B=1;
    }
    if(flag_A*flag_B==1){
        cout << A*B << endl;
    }else{
        cout << -1 << endl;
    }   
}


Measured memory_bytes: 256
#include<queue>
#include<string.h>
#include<iostream>
#include<algorithm>

#define F first
#define S second
#define FR q.front()

using namespace std;

typedef pair<int, int>Pt;

char map[1001][1001];
int zikan[1001][1001];
int mx[] = { 0,1,0,-1 };
int my[] = { 1,0,-1,0 };
pair<int, int> SG[10];
int n, h, w;
char tmp[] = { "S123456789" };

bool check(int, int);

int main() {

	cin >> h >> w >> n;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> map[i][j];
			for (int l = 0; l <= n; l++) {
				if (map[i][j] == tmp[l]) SG[l] = make_pair(i, j);
			}

		}
	}

	//for (int i = 0; i <= n; i++) printf("%d %d\n",SG[i].F,SG[i].S);

	int minute = 0;
	for (int i = 0; i < n; i++) {
		queue<Pt> q;
		memset(zikan, -1, sizeof(zikan));
		q.push(SG[i]);
		zikan[SG[i].F][SG[i].S] = 0;
		while (!q.empty()) {
			if (q.front()==SG[i+1]) break;
			for (int l = 0; l < 4; l++) {
				if (check(mx[l] + FR.F, my[l] + FR.S)) {
					zikan[mx[l] + FR.F][my[l] + FR.S] = zikan[FR.F][FR.S] + 1;
					q.push(make_pair(mx[l] + FR.F, my[l] + FR.S));
				}
			}
			q.pop();
		}
		
		minute += zikan[SG[i+1].F][SG[i+1].S];

	}
	cout << minute << endl;
}

bool check(int i, int j) {
	if (i >= 0 && i < h && j >= 0 && j < w && map[i][j]!='X' && zikan[i][j]==-1) return true;
	return false;
}



Measured memory_bytes: 7944
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;

const int mod = 998244353;

int pd[310][310][310];
string s;
int k;

vector<int> cnts;

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

    cin >> s >> k;

    int lim = 2;
    
    int cnt = 0;
    for (int i = 0; i < (int)s.size(); i++) {
        if (s[i] == '0') {
            cnts.push_back(cnt);
            cnt = 0;
        }
        else {
            cnt++;
            lim++;
        }
    }

    cnts.push_back(cnt);
    int n = cnts.size();
    k = min(k, lim);

    pd[0][k][0] = 1;

    for (int pos = 0; pos < n; pos++) {
        for (int rem = 0; rem <= k; rem++) {
            for (int curd = 0; curd <= k; curd++) {
                for (int use = -min(cnts[pos], curd); use <= rem; use++) {
                    
                    int nrem = rem;
                    if (use > 0) nrem -= use;
                    int nuse = curd + use;

                    if (nrem < 0 || nuse < 0 || nuse >= lim) continue;

                    pd[pos+1][nrem][nuse] = (pd[pos+1][nrem][nuse] + pd[pos][rem][curd]) % mod; 
                }
            }
        }
    }

    int ans = 0;
    for (int rem = 0; rem <= k; rem++) {
        ans = (ans + pd[n][rem][0]) % mod;
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 31844
def s_comb(n,k):
    s=1
    r=min(k,n-k)
    p=10**9+7
    for c in range(r):
        s=(s*(n-c)*pow(c+1,p-2,p))%p
    return s

x,y=map(int,input().split())
if (x+y)%3!=0 or 2*y<x or 2*x<y:
    print(0)
else:
    r=int(min(2*y-x,2*x-y)/3)
    print(s_comb(int((x+y)/3),r))


Measured memory_bytes: 3064
A, B, C, D = map(int, input().split())

c1 = min(C, D)
d1 = max(C, D)

def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x

lcm = c1 * d1 // gcd(d1, c1)

def count(x):
    return B // x - ((A - 1) // x)

s = count(c1)
t = count(d1)
u = count(lcm)
v = count(1)

print(v - s - t + u)

Measured memory_bytes: 3064
c=[]
for i in range(3):
    c.append(list(map(int,input().split())))
cnt=[]
ans=0
for k in range(2):
    cnt=c[k]
    for i in range(k+1,3):
        for j in range(-100,101,1):
            if k==i:
                break
            else:
                d=c[i]
                d=[a+j for a in c[i]]
                if d==c[k]:
                    ans+=1
                    break
                #print(c[i])
if ans==3:
    for k in range(2):
        c1=c[0][k]
        c2=c[1][k]
        c3=c[2][k]
        for i in range(k+1,3):
            d1=c[0][i]
            d2=c[1][i]
            d3=c[2][i]
            for j in range(-100,101,1):
                if k==i:
                    break
                else:
                    d1+=j
                    d2+=j
                    d3+=j
                    if d1==c1 and d2==c2 and d3==c3:
                        ans+=1
                        break
                    else:
                        d1=c[0][i]
                        d2=c[1][i]
                        d3=c[2][i]
                    #print(d1,d2,d3)
    #print(ans)
    if ans==6:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Measured memory_bytes: 3064
N = int(input())
T,A = map(int, input().split())
H = list(map(int, input().split()))

ans = 0
diff = float("inf")
for i in range(N):
    if diff > abs(T - H[i]*0.006 - A):
        ans = i+1
        diff = abs(T - H[i]*0.006 - A)
print(ans)

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

#define GET_MACRO(a, b, c, d, NAME, ...) NAME
#define REP(...) GET_MACRO(__VA_ARGS__, REP4, REP3, REP2)(__VA_ARGS__)
#define REP2(i, a) REP3(i, 0, a)
#define REP3(i, a, b) REP4(i, a, b, 1)
#define REP4(i, a, b, s) for (int i = (a); i < (int)(b); i += (s))
#define REPR(...) GET_MACRO(__VA_ARGS__, REPR4, REPR3, REPR2)(__VA_ARGS__)
#define REPR2(i, a) REPR3(i, 0, a)
#define REPR3(i, a, b) REPR4(i, a, b, 1)
#define REPR4(i, a, b, s) for (int i = (b)-1; i >= (int)(a); i -= (s))
#define ALL(c) (c).begin(), (c).end()
#define DUMP(x) (std::cerr << #x << ':' << ' ' << x << '\n')
#define TMPL_T template <typename T>
#define TMPL_TU template <typename T, typename U>
#define mut auto
#define let const auto

using Int = long long;
// clang-format off
namespace extio {
std::string delimiter=" ",pdelimiter=" ";
std::string bracket_b="",bracket_e="";
void chdelim(const std::string&s){delimiter=s;}
void chpdelim(const std::string&s){pdelimiter=s;}
void chbracket(const std::string&b,const std::string&e){bracket_b=b,bracket_e=e;}
TMPL_T  void pcont(std::ostream&os,const T&x){int c=0;for(const auto&a:x){if(c++)os<<delimiter;os<<a;}}
TMPL_TU void ppair(std::ostream&os,const std::pair<T,U>&p){os<<bracket_b<<p.first<<pdelimiter<<p.second<<bracket_e;}
}
namespace std {
TMPL_T ostream& operator<<(ostream&os,const vector<T>&x){extio::pcont(os,x);return os;}
TMPL_T ostream& operator<<(ostream&os,const set<T>&x){extio::pcont(os,x);return os;}
TMPL_T ostream& operator<<(ostream&os,const multiset<T>&x){extio::pcont(os,x);return os;}
TMPL_T ostream& operator<<(ostream&os,const deque<T>&x){extio::pcont(os,x);return os;}
TMPL_TU ostream& operator<<(ostream&os,const map<T,U>&x){extio::pcont(os,x);return os;}
TMPL_TU ostream& operator<<(ostream&os,const pair<T,U>&x){extio::ppair(os,x);return os;}
}
TMPL_TU inline bool chmax(T&x,U a){return x<a&&(x=a,1);}
TMPL_TU inline bool chmin(T&x,U a){return a<x&&(x=a,1);}

inline int in(){int x;std::cin>>x;return x;}

struct Initializer_ {
  Initializer_(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(0);
    std::cout << std::setprecision(10);
    std::cerr << std::setprecision(10);
  }
} precalc;
// clang-format on
// }}}

using namespace std;

signed main() {
  vector<int> a;
  REP(i, 10) a.push_back(in());
  sort(ALL(a));
  reverse(ALL(a));
  REP(i, 3) cout << a[i] << endl;
  return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;

int main(){
    int N,R;
    cin >> N >> R;
    int a;
    if (N>= 10) a=R;
    else a=R+(100*(10-N));
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 256
import bisect
N, M = map(int, input().split())
py_list = [list(map(int, input().split())) for i in range(M)]

pref_city_map = {}

for i in range(N+1):
    pref_city_map[i] = []

for py in py_list:
    p = py[0]
    pref_city_map[p].append(py[1])

for k in pref_city_map.keys():
    pref_city_map[k].sort()

for py in py_list:
    p = py[0]
    y = py[1]
    p_str = str(p).zfill(6)
    idx = bisect.bisect(pref_city_map[p], y)
    idx_str  = str(idx).zfill(6)
    print(p_str + idx_str)




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

#define print2(a, b) cerr << "(" << a << "," << b << ")" << endl
#define print3(a, b, c) cerr << "(" << a << "," << b << "," << c << ")" << endl


void solve(long long N, long long D){
    cout << (N + 2 * D) / (2 * D + 1) << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long D;
    scanf("%lld",&D);
    solve(N, D);
    return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    a,b = LS()
    c = LI()
    d = S()
    if d == a:
        c[0] -= 1
    elif d == b:
        c[1] -= 1

    return JA(c, " ")


print(main())





Measured memory_bytes: 6480
import java.util.*;

public class Main {
   public static void main(String [] args) {
      Scanner sc = new Scanner(System.in);
      int n = Integer.parseInt(sc.nextLine());
      int[] arr = new int[n];
      int counter = 0;
      int minIndex;
      
      String[] input = sc.nextLine().split(" ");
      for(int i = 0; i < n; i ++) {
         arr[i] = Integer.parseInt(input[i]);
      }
      
      for(int i = 0; i < n; i ++) {
         minIndex = i;
         for(int j = i; j < n; j ++) {
            if(arr[j] < arr[minIndex]) {
               minIndex = j;
            }
         }
         int temp = arr[minIndex];
         arr[minIndex] = arr[i];
         arr[i] = temp;
         if(minIndex != i) {
            counter ++;
         }
      }
      
      for(int i = 0; i < n; i ++) {
         System.out.print(arr[i]);
         if(i != n-1) {
            System.out.print(" ");
         }
      }
      
      System.out.println("\n" + counter);
      
   }
}



Measured memory_bytes: 26168
from itertools import permutations


def solve(string):
    n, a, b, c, *l = map(int, string.split())
    ans = 3000

    for _l in permutations(l):
        for i in range(1, len(l) - 1):
            tmp_a = 10 * (i - 1) + abs(a - sum(_l[:i]))
            if tmp_a >= ans:
                continue
            for j in range(i + 1, len(l)):
                tmp_b = 10 * (j - i - 1) + abs(b - sum(_l[i:j]))
                if tmp_a + tmp_b >= ans:
                    continue
                for k in range(j + 1, len(l) + 1):
                    tmp = tmp_a + tmp_b + 10 * (k - j - 1) + abs(c - sum(_l[j:k]))
                    if tmp < ans:
                        ans = tmp
    return str(ans)


if __name__ == '__main__':
    n, a, b, c = map(int, input().split())
    print(solve('{} {} {} {}\n'.format(n, a, b, c) + '\n'.join([input() for _ in range(n)])))


Measured memory_bytes: 48860
import sys
input = sys.stdin.readline
N = int(input())
a = [int(x) for x in input().split()]
j = 1
if 1 not in a:
    print(-1)
    sys.exit()
for i in range(N):
    if a[i] == j:
        j += 1
print(N - j + 1)



Measured memory_bytes: 24632
#include <bits/stdc++.h>
using namespace std;
//#define endl "\n"
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define LL long long int
const LL MOD=998244353;
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
//            When something is important enough, you do it even if the odds are not in your favor.

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    // code goes here
    LL t=1;//cin>>t;
    while(t--){
      LL n,k,i,j;cin>>n>>k;
      pair<LL,LL> a[k];
      fo(i,0,k) cin>>a[i].ff>>a[i].ss;
      LL dp[n+1];
      dp[n-1]=1;dp[n]=0;
      rfo(i,n-2,-1){
        dp[i]=dp[i+1];
        fo(j,0,k){
          if(i+a[j].ff<n){
            LL x=dp[i+a[j].ff]-dp[min(n,i+a[j].ss+1)];
            while(x<0) x+=MOD;
            dp[i]+=x;
            dp[i]%=MOD;
          }
        }
      }
      LL x=dp[0]-dp[1];
      while(x<0) x+=MOD;
      cout<<x;
    }
    return 0;
}

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

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

ans = sum(B)
for i in range(N-1):
    if A[i+1] - A[i] == 1:
        ans += C[A[i]-1]

print(ans)

Measured memory_bytes: 3060