akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>                 // [PRIMES]               1777 ~2^10.80
using namespace std;                     //                       10333 ~2^13.33
using ll = long long;                    // seq 1 128 | factor   100333 ~2^16.61
using ld = long double;                  //   | grep -v ' .* '  1300111 ~2^20.31
using vl = vector<ll>;                   //                    10300777 ~2^23.30
using vvl = vector<vl>;                  //                   100400999 ~2^26.58
using pll = pair<ll,ll>;                 //                  1300400999 ~2^30.28
using vpll = vector<pll>;                //                 10200500333 ~2^33.25
using vb = vector<bool>;                 //                100200400777 ~2^36.54
using vs = vector<string>;               //               1200300700111 ~2^40.13
const ll oo = 0x3f3f3f3f3f3f3f3fLL;      //              10200300500777 ~2^43.21
const ld eps = 1e-9;                     //             100200300400777 ~2^46.51
#define sz(c) ll((c).size())             //            1200300400600999 ~2^50.09
#define all(c) begin(c),end(c)           //           10200300400600111 ~2^53.18
#define mp make_pair                     //          100200300400600333 ~2^56.48
#define mt make_tuple                    //         1200300400500800999 ~2^60.06
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(0) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main(){
	cin.sync_with_stdio(0);
	cin.tie(0);

	string s, t; cin >> s >> t;

	ll n = sz(s), m = sz(t);
	vvl dp(n+1, vl(m+1, 0));
	
	FOR(i,0,n) {
		FOR(j,0,m) {
			if (s[i] == t[j]) {
				dp[i+1][j+1] = dp[i][j] + 1;
			} else {
				dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
			}
		}
	}

	ll i = n, j = m;
	vector<char> res;
	while (dp[i][j] > 0) {
		if (dp[i][j] != max(dp[i-1][j], dp[i][j-1])) {
			TR(i);
			TR(j);
			i--; j--;
			TR(s[i]);
			res.pb(s[i]);
		} else {
			if (dp[i][j] == dp[i-1][j]) {
				i--;
			} else {
				j--;
			}
		}
	}

	if (sz(res) == 0) {
		cout << " ";
	} else {
		FORD(c,0,sz(res)) {
			cout << res[c];
		}
	}
	cout << "\n";

	return 0;
}


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

fn gcd(a: usize, b: usize) -> usize {
    use std::cmp::{max, min};
    let mi = min(a, b);
    let ma = max(a, b);

    let r = ma % mi;
    if r == 0 {
        return mi;
    }

    gcd(mi, r)
}

fn reduce(a: isize, b: isize) -> (isize, isize) {
    if a == 0 {
        return (0, 1);
    }

    if b == 0 {
        return (1, 0);
    }

    let mut a = a;
    let mut b = b;
    if b < 0 {
        b = -b;
        a = -a;
    }

    let g = gcd(a.abs() as usize, b.abs() as usize) as isize;
    (a / g, b / g)
}

fn inv(ab: (isize, isize)) -> (isize, isize) {
    if ab == (1, 0) {
        return (0, 1);
    }

    if ab == (0, 1) {
        return (1, 0);
    }

    if ab.0 < 0 {
        (ab.1, -ab.0)
    } else {
        (-ab.1, ab.0)
    }
}

static MOD: isize = 1000000007;

#[fastout]
fn main() {
    input! {
        n: usize,
        abs: [(isize, isize); n]
    };

    let mut f = vec![0; n + 1];
    f[0] = 1;
    for i in 1..=n {
        f[i] = (f[i - 1] * 2) % MOD;
    }

    let mut abzero = 0;
    let mut abs2 = vec![];
    let mut hash = std::collections::HashMap::<(isize, isize), usize>::new();
    for (a, b) in abs {
        if a == 0 && b == 0 {
            abzero += 1;
            continue;
        }

        let rab = reduce(a, b);
        if let Some(v) = hash.get_mut(&rab) {
            *v = *v + 1;
        } else {
            hash.insert(rab, 1);
        }

        abs2.push((a, b));
    }

    let mut set = std::collections::HashSet::<(isize, isize)>::new();
    let mut m = 1;
    let abs2len = abs2.len();
    for (a, b) in abs2 {
        let rab = reduce(a, b);
        if set.contains(&rab) {
            continue;
        }

        set.insert(rab);

        let rab_n = *hash.get(&rab).unwrap() as usize;
        let mut s = 1;
        for _ in 0..rab_n {
            s *= 2;
            s %= MOD;
        }

        let rab_inv = inv(rab);
        if !hash.contains_key(&rab_inv) {
            m *= s;
            m %= MOD;
            continue;
        }

        set.insert(rab_inv);

        s += (MOD - 1);
        s %= MOD;

        let inv_n = *hash.get(&rab_inv).unwrap() as usize;
        let mut t = 1;
        for _ in 0..inv_n {
            t *= 2;
            t %= MOD;
        }

        t += (MOD - 1);
        t %= MOD;

        m *= (s + t + 1) % MOD;
        m %= MOD;
    }

    if abzero == n {
        println!("{}", n);
    } else {
        println!("{}", (abzero as isize + m + (MOD - 1)) % MOD);
    }
}


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

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int n = Integer.parseInt(str[0]);
    int m = Integer.parseInt(str[1]);
    String[] hw_days = in.readLine().split(" ");
    int sum = 0;
    for(int i=0; i<m; i++){
      sum += Integer.parseInt(hw_days[i]);
    }
    System.out.println(n-sum >= 0?n-sum:-1);
  }
}

Measured memory_bytes: 34248
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <unordered_set>
#include <set>
#include <cmath>
using namespace std;

typedef long long ll;

int main() {
	int T1,T2;
	ll A1,A2;
	ll B1,B2;

	cin>>T1>>T2>>A1>>A2>>B1>>B2;

	ll C1,C2;
	C1 = A1*T1-B1*T1;
	C2 = A2*T2-B2*T2;
	
	ll K = C1+C2;

	if (K == 0)
	{
		cout<<"infinity"<<endl;
		return 0;
	}

	if (K < 0)
	{
		K = -K;
		C1 = -C1;
		C2 = -C2;
		swap(A1, B1);
		swap(A2, B2);
	}

	ll S1,S2;
	S1 = 0;
	S2 = C1;

	ll D1, D2;
	D1 = 0;
	D2 = 0;

	if (C1 > 0)
	{		
		D1 = 0;
	}
	else
	{
		D1 += -C1 / K;
	}

	if (C2 > 0)
	{
		if(S2 > 0)D2 = 0;
		else
		{
			ll e = max<ll>(0, ceil(1. * (-S2-C2) / K));
			S2 += K * e;

			D2 += ceil(1. * -S2 / K);
		}
	}
	else
	{
		if (S2 < 0)
		{
			ll e = ceil(1. * -S2 / K);
			S2 += K * e;

			D2 += max<ll>(0ll, ceil(1. * (-C2 - S2) / K));
		}
		else
		{
			D2 += max<ll>(0ll, ceil(1. * (-C2-S2) / K));
		}
	}

	cout<<D1+D2<<endl;

	return 0;
}

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

int main() 
{
	int a;
	cin >> a;
	bool st = true;
	int ar[a];
	for(int i=0; i<a; i++){
		cin >> ar[i];
	}
	sort(ar,ar+a);
	for(int i=1; i<a; i++){
		if(ar[i]==ar[i-1])st = false;
	}
	if(st)cout<<"YES\n";
	else cout <<"NO\n";
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main()
{
	int i, n, a[100001];
	scanf("%d", &n);
	for (i = 1; i <= n; i++) scanf("%d", &(a[i]));
	
	int j, parity;
	long long ans[2], sum[2];
	if (a[1] > 0) {
		sum[0] = a[1];
		sum[1] = -1;
		ans[0] = 0;
		ans[1] = a[1] + 1;
	} else if (a[1] < 0) {
		sum[0] = 1;
		sum[1] = a[1];
		ans[0] = 1 - a[1];
		ans[1] = 0;
	} else {
		sum[0] = 1;
		sum[1] = -1;
		ans[0] = 1;
		ans[1] = 1;
	}
	for (i = 2; i <= n; i++) {
		for (j = 0; j < 2; j++) {
			parity = (i + j) % 2 * 2 - 1;
			if ((sum[j] + a[i]) * parity <= 0) {
				ans[j] += 1 - (sum[j] + a[i]) * parity;
				sum[j] = parity;
			} else sum[j] += a[i];
		}
	}
	
	printf("%lld\n", (ans[0] < ans[1])? ans[0]: ans[1]);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
//void chmin(int &a, int b) { if (a > b) a = b; }
//void chmax(int &a, int b) { if (a < b) a = b; }

const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

//重みある時
using Edge = pair<int,int>;
using Graph = vector<vector<Edge> >;

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        cout << 'x';
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i)
#endif

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define dis distance
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define pub push_back
#define sec second
#define fir first

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector <int> > vvi;
const int EPS = 1e-9;
const int MOD = 1e9+7;
const int INF = (1 << 30);
const double PI = acos(-1);

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;
	cin >> a >> b;
	string ans;
 	//和じゃなくて積だったw
	if(a<=0&&b>=0)ans="Zero";
	else if(a<0&&b<0){
      if((-a)%2+(-b)%2==1)ans = "Positive";
      else ans="Negative";
    }
	else ans = "Positive";
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
using ll = long long;

int main (){
    int k;
    string s;
    cin >> k >> s;
    if (s.size() <= k){
        cout << s << endl;
    }else{
        string ans;
        ans = s.substr(0,k);
        cout << ans.insert(k,"...") << endl;
    }
return 0;
}

Measured memory_bytes: 3132
import java.util.*;
public class Main {
	Scanner sc;
	int A,B;

	public Main() {
		sc = new Scanner(System.in);
	}
	
	private void calc() {
		A = sc.nextInt();
		B = sc.nextInt();
		int open = 1;
		int c = 0;
		while (open < B) {
			c++;
			open = open + A - 1;
		}
		System.out.println(c);
		System.out.flush();
	}

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

}

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

public class Main {
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		int[] A = new int[N], B = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			B[i] = sc.nextInt();
		}
		Arrays.sort(A);
		Arrays.sort(B);
		boolean impar = N % 2 == 1;
		int ans = 0;
		if (impar) {
			int min = A[N/2];
			int max = B[N/2];
			ans = max - min + 1;
		} else {
			int min = A[N/2-1] + A[N/2];
			int max = B[N/2-1] + B[N/2];
			ans = max - min + 1;
		}
		out.println(ans);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 58484
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

X,Y,A,B,C = map(int, readline().split())

P = sorted(map(int, readline().split()),reverse=True)
Q = sorted(map(int, readline().split()),reverse=True)
R = sorted(map(int, readline().split()),reverse=True)

lis = P[:X] + Q[:Y] + R

print(sum(sorted(lis,reverse=True)[:X+Y]))

Measured memory_bytes: 22720
import Control.Applicative
  
main = do
    [n,k] <- map read.words <$> getLine :: IO [Double]
    putStrLn.show.(/n).sum $ map (answer k) [1..n]

answer :: Double -> Double -> Double
answer goal pt = (1/2) ** v where
    table = map (\x -> pt*fromIntegral (2^x)) [0,1..]
    v = fromIntegral $ length $ takeWhile (<goal) table

Measured memory_bytes: 1020
#include <iostream>
#include <cstdio>
#include <cmath>
// #include <stack>
// #include <vector>
#include <cstring>
// #include <algorithm>
using namespace std;

const int MAX = 100000;

struct node{
    int id = -1;
    int parent = -1;
    int childCount = 0;
    int leftChild = -1;
    int rightSib = -1;
};

node nodes[MAX];

char *label(node no, char *l) {
    if (no.parent == -1) l = "root";
    else if (no.childCount < 1) l = "leaf";
    else l = "internal node";
    
    return l;
}

int getDepth(node no, int depth) {
    if (no.parent == -1) {
        return depth;
    }
    
    return getDepth(nodes[no.parent], depth + 1);
}

int main() {
    int N;
    // node nodes[MAX];

    scanf("%d", &N);
    
    for (int i = 0; i < N; i++) {
        int id;
        scanf("%d", &id);
        nodes[id].id = id;

        int childCount;
        scanf("%d", &childCount);
        nodes[id].childCount = childCount;

        int prevId = -1;
        for (int j = 0; j < childCount; j++) {
            int childId;
            scanf("%d", &childId);

            if (j == 0) {
                nodes[id].leftChild = childId;
                prevId = childId;
            } else {
                nodes[prevId].rightSib = childId;
                prevId = childId;
            }

            nodes[childId].parent = id;
        }
    }
    
    for (int i = 0; i < N; i++) {
        char *l;
        l = label(nodes[i], l);

        int dep = getDepth(nodes[i], 0);

        printf("node %d: parent = %d, depth = %d, %s, ", nodes[i].id, nodes[i].parent, dep, l);
        
        int prevId = -1;

        cout << "[";
        for (int j = 0; j < nodes[i].childCount; j++) {
            if (j != 0) {
                cout << ", ";
            }
            if (j == 0) {
                cout << nodes[i].leftChild;
                prevId = nodes[i].leftChild;
            } else {
                cout << nodes[prevId].rightSib;
                prevId = nodes[prevId].rightSib;
            }
        }
        cout << "]";
        
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 5240
# coding: utf-8
# Your code here!
# coding: utf-8
import sys
sys.setrecursionlimit(10000000)

#const
dxdy=((1,0),(0,1))
# my functions here!
def pin(type=int):
    return map(type,input().rstrip().split())
"""  
def resolve():
    N,M=pin()
    print(N*(N-1)//2+M*(M-1)//2)
""" 
def resolve():
    S=input()
    N=len(S)
    S2=(S[0:(N-1)//2])
    S3=(S[(N+3)//2-1:N])
    print(["No","Yes"][S==S[::-1] and S2==S2[::-1] and S3==S3[::-1]])
"""         
#printデバッグ消した？
#前の問題の結果見てないのに次の問題に行くの？
"""
"""
お前カッコ閉じるの忘れてるだろ
"""
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """akasaka"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """level"""
        output = """No"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """atcoder"""
        output = """No"""
        self.assertIO(input, output)

if __name__=="__main__":resolve()


Measured memory_bytes: 50156
require "set"
n,k = gets.chomp.split(" ").map(&:to_i)
d_arr = gets.chomp.split(" ").map(&:to_i)

# 使える数字
set = Set.new((0..9).to_a - d_arr)

# 9n回ループ
n.upto(10 * n) do |i|
  flag = true
  # 最大4ループ
  i.to_s.each_char do |c|
    if !set.include?(c.to_i)
      flag = false
      break
    end
  end
  if flag
    puts i
    exit
  end
end


Measured memory_bytes: 14476
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    int N; cin >> N; bool can = false;
    map<int,int> m;
    rep(i,N){
        int a; cin >> a;
        m[a]++;
    }
    if(m.size()==1 && m[0]==N) can = true;
    else if(m.size()==3 && N%3==0){
        bool can2 = true; vector<int> v;
        for(auto p:m){
            if(p.second!=N/3) can2 = false;
            v.push_back(p.first);
        }
        int a=v[0]^v[1]^v[2];
        if(can2 && a==0) can = true;
    }
    else if(m.size()==2 && N%3==0){
        bool can3 = true;
        for(auto p:m){
            if(p.second==N*2/3 || p.second==N/3 && p.first==0);
            else can3=false;
        }
        if(can3) can = true;
    }
    cout << (can ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 5120
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		int n;
		Scanner scan = new Scanner(System.in);
		while(true){
			n=scan.nextInt();
			if(n==0)
				break;
			double sum = 0;
			int[] s = new int[n];
			for(int i=0;i<n;i++){
				s[i]=scan.nextInt();
				sum+=s[i];
			}
			sum/=n;
			double variance = 0;
			for(int i=0;i<n;i++){
				variance+=(s[i]-sum)*(s[i]-sum);
			}
			variance/=n;
			System.out.println(Math.sqrt(variance));
		}
		scan.close();
	}
}


Measured memory_bytes: 31132
using System;
using System.Collections.Generic;
class Program{
	static long[] s;
	static int[,] h;
	static List<int[]> li=new List<int[]>();
	static void Main(){
		s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		h=new int[s[0],s[1]];
		int ans=0;
		for(int i=0;i<s[0];i++){
			string q=Console.ReadLine();
			for(int j=0;j<s[1];j++){
				if(q[j]=='.'){ans++;}
				else{h[i,j]=-1;}
			}
		}
		h[0,0]=1;
		li.Add(new int[]{0,0});
		while(li[0][0]!=s[0]-1||li[0][1]!=s[1]-1){
			if(li[0][0]!=0){fu(li[0][0]-1,li[0][1],h[li[0][0],li[0][1]]+1);}
			if(li[0][1]!=0){fu(li[0][0],li[0][1]-1,h[li[0][0],li[0][1]]+1);}
			if(li[0][0]!=s[0]-1){fu(li[0][0]+1,li[0][1],h[li[0][0],li[0][1]]+1);}
			if(li[0][1]!=s[1]-1){fu(li[0][0],li[0][1]+1,h[li[0][0],li[0][1]]+1);}
			li.RemoveAt(0);
			if(li.Count==0){break;}
		}
		Console.WriteLine("{0}",li.Count==0?-1:ans-h[s[0]-1,s[1]-1]);
	}
	static void fu(int x,int y,int p){
		if(h[x,y]==0){
			h[x,y]=p;
			li.Add(new int[]{x,y});
		}
	}
}

Measured memory_bytes: 13396
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.stream.IntStream;

public class Main {
    public static void main(final String[] args) {
        final FastScanner scanner = new FastScanner(System.in);
        final int n = scanner.nextInt();
        final int m = scanner.nextInt();

        final boolean[] isRoot = new boolean[n + 1];
        Arrays.fill(isRoot, 1, n + 1, true);
        final Node[] nodes = new Node[n + 1];
        for (int i = 1; i <= n; i++) {
            nodes[i] = new Node();
        }
        for (int i = 0; i < n - 1 + m; i++) {
            final int a = scanner.nextInt();
            final int b = scanner.nextInt();

            isRoot[b] = false;
            nodes[a].children.add(b);
            nodes[b].parentCandidates.add(a);
        }

        final int root = IntStream.rangeClosed(1, n).filter(i -> isRoot[i]).findFirst().orElseThrow(RuntimeException::new);
        dfs(root, nodes);
        Arrays.stream(nodes, 1, n + 1)
                .forEach(node -> System.out.println(node.parent));
    }

    private static void dfs(final int current, final Node[] nodes) {
        final Node node = nodes[current];
        final List<Integer> nextNodes = new ArrayList<>();
        for (final int child : node.children) {
            if (nodes[child].parentCandidates.size() != 1) {
                nodes[child].parentCandidates.remove(current);
                continue;
            }
            nodes[child].parent = current;
            nextNodes.add(child);
        }
        nextNodes.forEach(next -> dfs(next, nodes));
    }

    private static class Node {
        final Set<Integer> parentCandidates = new HashSet<>();
        int parent;
        final List<Integer> children = new ArrayList<>();
    }

    private static class FastScanner {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(final InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (final IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
    }
}


Measured memory_bytes: 151976
#include <stdio.h>

int main(void)
{
	int ans, w;
	
	while (scanf("%d", &w), w != -1){
		ans = 1150;
		if (30 <= w) ans += (w - 30) * 160, w -= w - 30;
		if (20 <= w) ans += (w - 20) * 140, w -= w - 20;
		if (10 < w) ans += (w - 10) * 125;
		printf("%d\n", 4280 - ans);
	}
	
	return (0);
}

Measured memory_bytes: 600
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdlib.h>
#include <time.h>
#include <vector>
#include <set>
#include <queue>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <map>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace gnu_pbds;

#define F first
#define S second
#define ll long long
#define pb push_back
#define mp make_pair
#define ppb pop_back
#define pii pair<int, int>
#define piii pair<int, pii>
#define __ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define watch(x) cout << (#x) << " is " << (x) << endl
#define int long long
// #define ld long double


const int N = 1e5 + 20, mod = 1e9 + 7, inf = 2e9 + 9;
const ll INF = 1e18 + 20;

string a, b;
int n, m, dp[3003][3003];
pii p[3003][3003];

signed main() { __
    // freopen("a.in", "r", stdin);
    // freopen("a.out", "w", stdout);
    cin>>a>>b;
    n = a.size();
    m = b.size();
    a = "-" + a;
    b = "#" + b;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            if(a[i] == b[j]) {
                dp[i][j] = dp[i - 1][j - 1] + 1;
                p[i][j] = {i - 1, j - 1};
            }
            else {
                if(dp[i - 1][j] < dp[i][j - 1]) {
                    dp[i][j] = dp[i][j - 1];
                    p[i][j] = {i, j - 1};
                }
                else {
                    dp[i][j] = dp[i - 1][j];
                    p[i][j] = {i - 1, j};
                }
            }
        }
    }
    int i = n, j = m;
    string ans = "";
    while(dp[i][j]) {
        if(p[i][j] == mp(i - 1, j - 1)) {
            ans += a[i];
            i--;
            j--;
        }
        else if(p[i][j] == mp(i - 1, j)) {
            i--;
        }
        else j--;
    }
    reverse(ans.begin(), ans.end());
    cout<<ans;
    return 0;
}


Measured memory_bytes: 211584
cnt = 10
top3 = [0,0,0]

for x in xrange(cnt):
    n = int( raw_input() )

    if top3[2] > n: continue
    top3[2] = n

    if top3[1] > top3[2]: continue
    top3[1], top3[2] = top3[2], top3[1]

    if top3[0] > top3[1]: continue
    top3[0], top3[1] = top3[1], top3[0]

print top3[0]
print top3[1]
print top3[2]



Measured memory_bytes: 4652
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <map>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

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; }

using namespace std;

const ll BIG = 1000000007LL;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

template<typename T>
void inputArray(T* p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

template<typename T>
void inputVector(vector<T> * p, int a){
    rep(i, a){
        T input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision = 0) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

const int Max = 2100;
int N;
ll K;
int A[Max];
pair<int, int> ab[Max];

int main(int argc, const char * argv[]) {
    cin >> N >> K;
    inputArray(A, N);
    rep(i, N) {
        int ai = A[i];
        ab[i] = make_pair(
            count_if(A, A+i,[ai](auto& aj) {return ai > aj;}),
            count_if(A+i, A+N,[ai](auto& aj) {return ai > aj;})
        );
    }

    ll ans = 0;
    rep(i, N) {
        ll bi = ab[i].first;
        ll ai = ab[i].second;
        ll facb = (K*(K-1)/2)%BIG;
        ll faca = (K*(K+1)/2)%BIG;
        ans += bi*facb;
        ans %= BIG;
        ans += ai*faca;
        ans %= BIG;
    }

    output(ans);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include<algorithm>
#include<sstream>
#include<iomanip>


using namespace std;

const int MAX_NUM = 1001;

int main() {
	int n;
	cin >> n;
	
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		ans += a - 1;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
//This code was made by Chinese_zjc_.
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<map>
#include<queue>
#define int long long
#define INF 0x3fffffffffffffff
using namespace std;
int n,cnt,p[20001],ans;
signed main()
{
	std::ios::sync_with_stdio(false);
	cin>>n;
	for(int i=2;i*i<=n;++i)
	{
		if(n%i==0)
		{
			++cnt;
			while(n%i==0)
			{
				n/=i;
				++p[cnt];
			}
		}
	}
	if(n>1)
	{
		++ans;
	}
	for(int i=1;i<=cnt;++i)
	{
		for(int j=1;j<=p[i];++j)
		{
			p[i]-=j;
			++ans;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
 
//#include <unistd.h>
//#include <iostream>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
//#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'
signed main() {
  char c;
  cin >> c;
  cout << (char)(c + 1) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int N,T;
    cin >> N >> T;
    vector<int> c(N),t(N);
    int ans = 5000000;

    for(int i=0; i<N; i++){
        cin >> c[i] >> t[i];
        if(t[i]<=T and c[i]<ans){
            ans = c[i];
        }
    }
    if(ans==5000000){
        cout <<  "TLE";
    }else{
        cout << ans;
    }


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALPHA 26
#define SIZE 10

int main()
{
    int N;
    cin >> N;
    unordered_map<string, int> tbl; 
    long long cnt = 0;
    for(int i = 0; i < N; ++i) {
        string tmp;
        cin >> tmp;
        sort(tmp.begin(), tmp.end());
        cnt += tbl[tmp];
        ++tbl[tmp];
    }
    cout << cnt << endl;
    return 0;
}

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

using namespace std;

int main() {
  int n,id,m1,s1,m2,s2,m3,s3,m4,s4,sum;
  pair<int,int> p;

  while(1){
    vector<pair<int,int>> v;
    cin>>n;

    if(n == 0){
      break;
    }

    for(int i = 0;i<n;++i){
      cin>>id>>m1>>s1>>m2>>s2>>m3>>s3>>m4>>s4;
      sum = (m1+m2+m3+m4)*60+(s1+s2+s3+s4);
      v.push_back(make_pair(sum,id));
    }

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

    p = v[0];

    cout<<p.second<<endl;

    p = v[1];

    cout<<p.second<<endl;

    p = v[n-2];

    cout<<p.second<<endl;
  }
  return 0;
}

Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <numeric>
using namespace std;
using ll = long long;

int main() {
	ll N;
	cin >> N;
    vector<int> A(N), B(N), C(N-1);
    for (int i=0;i<N;++i) {
        cin >> A[i];
        A[i]--;
    }
    for (int i=0;i<N;++i) {
        cin >> B[i];
    }
    for (int i=0;i<N-1;++i) {
        cin >> C[i];
    }
    int ans = accumulate(B.begin(), B.end(), 0);
    for (int i=0; i<N-1; ++i) {
        if (A[i+1] == A[i]+1) {
            ans += C[A[i]];
        }
    }
    cout << ans << endl;
	return 0;
}



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

typedef long long ll;
typedef unsigned long long ull;
typedef string st;
typedef double db;
typedef vector<long long> vecll;
typedef vector<char> vechar;

int main(){
    st s;
    cin >> s;
    ll ans =700;
    for(ll i; i < 3; i++) if(s.at(i) == 'o') ans += 100;
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;


namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string prev = Console.ReadLine();
            if(prev == "ABC")
            {
                Console.WriteLine("ARC");
            }
            else
            {
                Console.WriteLine("ABC");
            }
        }

        
        
    }
}


Measured memory_bytes: 25796
N = int(input())
XU = [list(input().split()) for _ in range(N)]
btc = 380000.0

summ = 0
for xu in XU:
    if xu[1] == 'BTC':
        summ += float(xu[0]) * btc
    else:
        summ += float(xu[0])

print(summ)

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

int main() {
	string s;
	cin >> s;
	int cnt = 0;
	if (s[0] == '1') cnt++;
	if (s[1] == '1') cnt++;
	if (s[2] == '1') cnt++;
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include <cstdlib>
#include<stack>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int,int>P;
int D,X,Y,at[2];
priority_queue<int> one,two;

int g1()
{
	if(one.empty())return -1;
	else return one.top();
}

int g2()
{
	if(two.empty())return -1;
	else return two.top();
}

int main()
{
	scanf("%d%d",&D,&X);
	for(int i=0;i<X;i++)
	{
		string s;
		int t;
		cin>>s>>t;
		if(s=="D")one.push(t);
	}
	scanf("%d",&Y);
	for(int i=0;i<Y;i++)
	{
		string s;
		int t;
		cin>>s>>t;
		if(s=="DD")two.push(t);
	}

	int res=0;
	while(D>0)
	{
		if(one.empty()&&two.empty())break;
		if(D==1)
		{
			if(!one.empty())
			{
				res+=one.top();
				one.pop();
			}
			D--;
		}
		else if(D>1)
		{
			if(two.empty())
			{
				res+=one.top();
				one.pop();
				D--;
			}
			else if(one.empty())
			{
				res+=two.top();
				two.pop();
				D-=2;
			}
			else
			{
				if(one.top()>two.top())
				{
					res+=one.top();
					one.pop();
					D--;
					goto x;
				}
				int p=one.top();one.pop();
				if(one.empty()||p+one.top()<two.top())
				{
					res+=two.top();
					two.pop();
					one.push(p);
					D-=2;
					goto x;
				}
				int q=one.top();one.pop();
				if(D==2&&p+q>=two.top())
				{
					res+=p+q;
					D-=2;
				}
				else if(one.empty()||p+q+one.top()<p+two.top())
				{
					res+=two.top();
					two.pop();
					one.push(p);
					one.push(q);
					D-=2;
				}
				else
				{
					res+=p+q;
					D-=2;
				}
			}
		x:;
		}
	}
	cout<<res<<endl;
}

Measured memory_bytes: 3264
n, k, q = map(int, input().split())
L = [k for i in range(n)]
a = [int(input()) for i in range(q)]

for i in a:
    L[i-1] = L[i-1] + 1

for i in range(len(L)):
    if q  < L[i]:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 10512
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
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")
    };
}

fn main() {
    input! {
        n: usize,
        k: usize,
        h: [usize; n],
    }
    let ans = h.into_iter().filter(|&hi| hi >= k).count();
    println!("{}", ans);
}


Measured memory_bytes: 4352
k, s = map(int, input().split())
ans = 0
tmp = 0

for i in range(k + 1):
    x = i
    tmp = s - x

    if tmp < 0:
        break

    if 2 * k >= tmp:
        if k >= tmp:
            ans = ans + tmp + 1
        else:
            ans = ans + ((k + 1) - (tmp - k))

print(ans)

Measured memory_bytes: 3060
import java.util.*;

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

        int k = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ad = 0;
        int ans = 0;
        sc.close();

        ad = a;
        for(int i=0 ; i<=(b-ad) ; i++){
            ans = (a%k==0)?1:0;
            if(ans == 1){break;}
            a++;
        }
        if(ans == 1){
            System.out.println("OK");
        }else{      
            System.out.println("NG");
        }
    }
}

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

int main() {
	int k;
	cin >> k;
	vector<int> a(32);
	a = { 1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51 };
	cout << a[k - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{   /// Standing in the hall of fame
    ios_base::sync_with_stdio() , cin.tie(NULL) , cout.tie(NULL);
    long long n;
    cin >> n;
    cout << n*(n-1)/2 << "\n";
    return 0;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i*500+j*100+k*50 == x:
                ans += 1

print(ans)

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

int main(){
	int n; cin>>n;
	int a=(n*100)/108;
	int b=(n*100+108-1)/108;
	if(n==a*108/100) cout<<a<<endl;
	else if(n==b*108/100) cout<<b<<endl;
	else cout<<":("<<endl;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define mod 1000000007

using namespace std;

long long mypow(long long x, long long y) {
    if (!y) {
        return 1;
    } else if (!(y % 2)) {
        long long k = x * x % mod;
        if (k < 0) {
            k += mod;
        }
        return mypow(k, y / 2);
    } else {
        long long k = (mypow(x, y - 1) * x) % mod;
        if (k < 0) {
            k += mod;
        }
        return k;
    }
}


long long fact[3000005];


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    long long x, y;
    cin >> x >> y;

    fact[0] = 1;
    for (long long i = 1; i < 3000005; ++i) {
        fact[i] = (fact[i - 1] * i) % mod;
    }


    long long a = (2 * y - x) / 3, b = (2 * x - y) / 3;

    if ((2 * y - x) % 3 || (2 * x - y) % 3 || a < 0 || b < 0) {
        cout << 0;
        return 0;
    }

    cout << (((fact[a + b] * mypow(fact[b], mod - 2)) % mod) * mypow(fact[a], mod - 2)) % mod;




}

Measured memory_bytes: 23680
#include "bits/stdc++.h"
using namespace std;

#define rep(i,a,b) for(int i=a;i<=b;i++)
typedef long long ll;
typedef unsigned long long ull;

const int maxn=1e5+5;
const int inf=0x3f3f3f3f;
const int bb=13331;
ll a,b,c,d,n,m;

int main()
{
    //ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    char q[2][5];
    cin>>q[0]>>q[1];
    a=0;
    for(int i=0;i<3;i++)if(q[0][i]==q[1][i])a++;
    cout<<a<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];
    sort(ALL(a));
    dump(a);

    vector<ll> plus, minus;
    REP(i, n) {
        if(a[i]<0) minus.push_back(a[i]);
        else plus.push_back(a[i]);
    }
    dump(minus);
    dump(plus);

    // K番目がmid以上である → X未満がK-1個以下である
    auto check = [&](ll x) {
        ll num = 0;
        ll idx1 = (ll)minus.size()-1, idx2 = 0;
        REP(i, minus.size()) {
            while(idx1 >= 0 && minus[i]*minus[idx1]<x) idx1--;
            while(idx2 < (ll)plus.size() && minus[i]*plus[idx2]>=x) idx2++;
            num += (ll)minus.size() - idx1 - 1;
            if(idx1 < i) num--;
            num += (ll)plus.size() - idx2;
            // dump(i, minus[i], num, idx1, idx2);
        }
        idx1 = 0, idx2 = (ll)plus.size()-1;
        REP(i, plus.size()) {
            while(idx1 < (ll)minus.size() && plus[i]*minus[idx1]<x) idx1++;
            while(idx2 >= 0 && plus[i]*plus[idx2]>=x) idx2--;
            num += idx1;
            num += idx2+1;
            if(i <= idx2) num--;
            // dump(i, plus[i], num, idx1, idx2);
        }
        // dump(x, num/2);
        return num/2 <= k-1;
    };

    ll lb = -INF, ub = INF;
    while(ub-lb>1) {
        ll mid = (lb+ub)/2;
        if(check(mid)) lb = mid;
        else ub = mid;
    }
    cout << lb << endl;

    return 0;
}

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

int main() {
    int n, y; cin >> n >> y;
    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= n - i; j++)
        {
           int k = n - i - j;
            if(10000 * i + 5000 * j + 1000 * k == y) {
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}


Measured memory_bytes: 256
n, y=map(int, input().split())
a=y//10000
b=y//5000
c=y//1000

for i in range(a+1):
    for j in range(b+1):
        k=n-i-j
        if 0<=k<=c and 10000*i + 5000*j + 1000*k == y:
            print(i ,j ,k)
            exit()

print(-1, -1, -1)

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

const int N = 1e5;

int n,k,q;
int li[N+5];

int main(){
	scanf("%d%d%d",&n,&k,&q);
	for(int i=1;i<=q;i++){
		int x;
		scanf("%d",&x);
		li[x]++;
	}
	for(int i=1;i<=n;i++){
		li[i]+=k;
		li[i]-=q;
		if(li[i] <= 0) printf("No\n");
		else printf("Yes\n");
	}
	return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))


int n;

int ps[100005];
vector<int> vs[100005];
int dep[100005];

int dub[100005][30];

void init(){
	rep(i,n)dub[i][0]=ps[i];
	
	rep(j,29){
		rep(i,n){
			dub[i][j+1]=dub[dub[i][j]][j];
		}
	}
}

void dfs(int no,int d){
	//printf("dfs %d %d\n",no,d);
	dep[no]=d;
	rep(i,vs[no].size()){
		dfs(vs[no][i],d+1);
	}
}

int lca(int p,int q){
	if(dep[p]<dep[q])swap(p,q);
	int d=dep[p]-dep[q];
	rep(i,30){
		if(d&(1<<i)){
			p = dub[p][i];
			d -= (1<<i);
		}
	}
	
	//printf("lca %d %d %d %d\n",p,q,dep[p],dep[q]);
	if(p==q)return p;
	
	irep(i,30){
		if(dub[p][i]!=dub[q][i]){
			p = dub[p][i]; 
			q = dub[q][i];
		}
	}
	
	return dub[p][0];	
}


int main(void){
	scanf("%d",&n);
	rep(i,n){
		int k;
		scanf("%d",&k);
		rep(j,k){
			int a;
			scanf("%d",&a);
			ps[a]=i;
			vs[i].push_back(a);
		}
	}
	ps[0]=0;
	init();
	dfs(0,0);
	
	
	
	int q;
	scanf("%d",&q);
	rep(i,q){
		int a,b;
		scanf("%d%d",&a,&b);
		
		printf("%d\n",lca(a,b));
	}
	return 0;
}

Measured memory_bytes: 23840
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int K = sc.nextInt();


		int sum = 0;
		int min = 1000000001;

		int tree[] = new int[N];

		for(int i = 0; i < N; i++) {
			tree[i] = sc.nextInt();
		}


		Arrays.sort(tree);

		for(int i = 0; i < N - (K -1); i++) {
			if(min > tree[i + (K -1)] - tree[i]) {
				min = tree[i + (K -1)] - tree[i];
			}


		}



		System.out.println(min);



	}

}

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

int check(int k){
    if (k%2 == 0){
        if (k%3 == 0 || k%5 == 0){
            return 0;
        }
        return 1;
    }
    return 0;
    
}

int main(){
    int n;

    cin >> n;
    int a[n], k;
    k = 0;

    for (int i = 0; i < n ; i++) {
        cin >> a[i];
        if (check(a[i]) == 1){
            k = 1;
            cout << "DENIED" << endl;
            return 0;
        }
    }


    cout << "APPROVED" << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>

int main()
{char s[4];
    int a,b,n,k,i,j,m;
    scanf("%s",s);
    if(strlen(s)==2)printf("%s",s);
    else{
        for(i=2;i>=0;i--){
            printf("%c",s[i]);
        }
    }
    

    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int mod = 1e9+7;
const int MAX = 510000;
const int V = 100005;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
#define INT_MAX 1e9+7



int main(){
    ll n,a,b; cin >> n >> a >> b;
    if(a+b>n+1 || a+b<a+(n+a-1)/a) puts("-1");
    else{
        vl ans;
        if(a+b==n+1){
            rep(i,b-1) ans.push_back(n-i);
            rep(i,a) ans.push_back(i+1);
        }else{
            ll now = n;
            rep(i,b-1){
                vl v;
                do{
                    v.push_back(now);
                    now--;
                    if(now<a+1) break;
                }while((b-i-2)*a<=now-a-1);
                reverse(all(v));
                for(auto j : v) ans.push_back(j);
                v.clear();
            }
            rep(i,a) ans.push_back(i+1);
        }
        for(auto i : ans) cout << i << " ";
    } 
}


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

#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define pf push_front
#define pof pop_front
#define pob pop_back
#define ull unsigned long long
#define ll long long
#define sz(a) a.size()
#define all(s) s.begin(), s.end()
#define rall(s, n) s, s + n
#define x first
#define y second
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define pii pair <int, int>
#define pll pair <ll, ll>
#define INF 1000000000
#define mod 1000000007
#define reset(a, nilai) memset(a, nilai, sizeof(a))
using namespace std;

int a, b, c;
int main () {
	IOS;

	cin >> a >> b >> c;
	int d = a + b + c;
	cout << (d >= 22 ? "bust" : "win") << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;



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

    string s;
    cin >> s;

    if(s[0] == s[1] && s[1] == s[2]){
        cout << "No" << endl;
        return 0;
    }
    else{
        cout << "Yes" << endl;
        return 0;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i < n; i ++)
#define rep1(i, n) for (int i=1; i <= n; i ++)
#define _min(x, y) x = min(x, y)
#define _max(x, y) x = max(x, y)
using namespace std;


int main() {
  int n; cin >> n;
  double ans = 0;
  rep(i, n) {
    double a; cin >> a;
    ans += 1 / a;
  }
  cout << setprecision(10) << 1 / ans << endl;
  return 0;
}


Measured memory_bytes: 256