akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') c=getchar(),f=-1;
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') c=getchar(),f=-1;
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
int main(){
	int A=read(),B=read(),C=read(),x=read(),y=read();
	C=min(C*2,A+B);
	A=min(A,C),B=min(B,C);
	printf("%d\n",min(x,y)*C+(x-min(x,y))*A+(y-min(x,y))*B);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> PDL;
typedef pair<LD, LD> PDD;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

template<class T>
void in(T& x) {
	cin >> x;
}

template<class T1,class T2>
void in(pair<T1, T2>& p) {
	in(p.first);
	in(p.second);
}

template<class T>
void in(vector<T>& v,LL st=-1,LL en=-1) {
	if (st == -1) {
		st = 0;
		en = v.size() - 1;
	}
	for (LL n = st; n <= en; n++) {
		in(v[n]);
	}
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	LL N;
	cin >> N;
	LL SUM = 0;
	LL MAX = 0;
	for (LL n = 0; n < N; n++) {
		LL p;
		cin >> p;
		MAX = max(MAX, p);
		SUM += p;
	}
	SUM -= MAX / 2;
	cout << SUM << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>

using namespace std;

int main(){
    int W[15]={0},S[15]={0},answ=0,anss=0;
    for(int i=0;i<10;++i){
        cin >>W[i];
    }
    for(int i=0;i<10;++i){
        cin>>S[i];
    }
    sort(W, W+10);
    sort(S, S+10);
    answ=W[7]+W[8]+W[9];
    anss=S[7]+S[8]+S[9];
    cout <<answ<<" "<<anss<<endl;
    return 0;
}

Measured memory_bytes: 1180
#include<stdio.h>

int main(void){
  int n;
  int a[101];
  int i;
  scanf("%d\n",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
  }
  
  int p=1;
  for(i=1;i<=n;i++){
    if(a[i]%2==0){
      if(a[i]%3!=0&&a[i]%5!=0){
        p=0;
      }
    }
  }
  
  if(p==1){
    printf("APPROVED");
  }else{
    printf("DENIED");
  }
  
  return 0;
}

Measured memory_bytes: 128
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        S: String,
    }
    println!("{}",S.replace(","," "));
}

Measured memory_bytes: 4352
#include <stdio.h>

long long gcd(long long  a, long long b)
{
    if (a < b) {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    
    return b ? gcd(b, a % b) : a;
}

long long lcm(long long a, long long b)
{
    return a * b / gcd(a, b);
}

int main(void)
{
  long long a, b;
  scanf("%lld", &a);
  scanf("%lld", &b);
  //printf("gcd(%d, %d) = %d\n", a, b, gcd(a, b));
  printf("%lld\n",lcm(a, b));
  return 0;
}



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

public class Main {
	public static long l=0,l2=0;
	public static void main(String[] args) throws IOException {
		l = System.currentTimeMillis();
		new Main().exec();
		l2 = System.currentTimeMillis();
		
	}

	public void exec() throws IOException {
		InputUtil in = new InputUtil();
		PrintWriter out = new PrintWriter(System.out);
		int Q = (int)in.nextInt();
		int H = (int)in.nextInt();
		int S = (int)in.nextInt();
		int D = (int)in.nextInt();
		int N = (int)in.nextInt();
		
		long p1 = Math.min(Math.min(Q*4, H*2),S);
		long p2 = Math.min(p1*2, D);
		
		long p = (N/2)*p2 + (N%2)*p1;
		
		out.println(p);
		out.flush();
	}
}




class InputUtil {
	//Static Fields
	private static final int BUFSIZ = 100000;
	
	//Fields
	protected InputStream in;
	private char[] buf = null;
	private int ptr = 0;
	private int max = -1;
	private BufferedReader br = null;
	
	//Constructors
	public InputUtil() {this(System.in,BUFSIZ);}
	public InputUtil(InputStream in, int bufsiz) {
		initBuf(bufsiz);
		initIn(in);
	}
	
	//Methods
	//Initializer
	protected void initIn(InputStream in) {br = new BufferedReader(new InputStreamReader(this.in = in));}
	protected void initBuf(int bufsiz) {buf = new char[bufsiz];}
	
	//buffer operation
	private void next() throws IOException {ptr++; readBuf();}
	private void readBuf() throws IOException {
		if(ptr >= max && br.ready()) {
			if(max>0) Arrays.fill(buf,0,max,(char)0);
			max = br.read(buf);
			ptr = 0;
		}
	}
	
	//Number Input Reader/Parser
	private boolean isNum(char b) {return '0' <= b && b <= '9'; }
	private boolean isMinus(char b) {return b=='-'; }

	private int _nextInt() throws IOException {
		int sign = 1;
		int res = 0;
		char c;
		while (!isNum(c=buf[ptr]) && !isMinus(c)) 
			next();
		if (isMinus(buf[ptr])) {
			sign = -1;
			next();
		}
		while (isNum(c=buf[ptr])) {
			res *= 10;
			res += c - '0' ;
			next();
		}
		next();
		return sign * res;
	}
	
	public int nextInt() throws IOException {
		readBuf();
		return _nextInt();
	}

	public int[] nextInt(int[] result) throws IOException {
		readBuf();
		for(int i=0; i<result.length; i++) {
			result[i] = _nextInt();
		}
		return result;
	}
	
	//Close 
	public void close() throws IOException {
		if(!this.in.equals(System.in)) 
			this.in.close();
	}

}

Measured memory_bytes: 22996
import math
PI=3.14159265358979323846
a,b,x=map(int,input().split())
s=x/a
ans=0
a2=0

if s==a*b:
  ans=0
else:
  if s>b*a/2:
    bu=2*s/a-b
    s-=a*bu
    b-=bu
    a2=2*s/b
  else:
    a2=2*s/b
  r=math.atan(b/a2)
  ans=r*(180/PI)
print(ans)
  

Measured memory_bytes: 3064
def main():
    import sys
    input = sys.stdin.readline
    n,m = map(int,input().split())
    A = list(map(int,input().split()))
    BC = [list(map(int,input().split())) for _ in range(m)]

    BC = sorted(BC,key=lambda x:(x[1]),reverse=True)
    append_list = []
    for b,c in BC:
        if len(append_list)>=n:
            break
        append_list+=[c]*b
    A+=append_list
    A.sort(reverse=True)
    print(sum(A[:n]))

if __name__=='__main__':
    main()

Measured memory_bytes: 35260
import sys
input = sys.stdin.readline
 
def main():
    W, H, x, y = map(int, input().split())
 
    area = W * H / 2
 
    cenx = W / 2
    ceny = H / 2
 
    if x == cenx and y == ceny:
        print(area, '1')
    else:
        print(area, '0')
 
main()

Measured memory_bytes: 2940
#include <cstdlib>
#include <array>
#include <iostream>
#include <string>


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

  std::array<std::string, 3> ss;
  for (auto&& s : ss) {
    std::cin >> s;
  }
  std::array<std::string::size_type, 3> posArray{0, 0, 0};
  int turn = 0;
  for (;;) {
    if (posArray[turn] == ss[turn].length()) {
      break;
    }
    turn = ss[turn][posArray[turn]++] - 'a';
  }
  std::cout << static_cast<char>(turn + 'A') << std::endl;

  return EXIT_SUCCESS;
}


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

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
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 [int(x) for x in sys.stdin.readline().split()]
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 main():
    n,m = LI()
    e = collections.defaultdict(set)
    f = collections.defaultdict(set)
    for _ in range(n+m-1):
        a,b = LI_()
        e[a].add(b)
        f[b].add(a)

    s = -1
    for k in e.keys():
        if len(f[k]) == 0:
            s = k
            break

    r = [None] * n
    r[s] = 0
    al = set([s])
    q = set([s])
    while q:
        u = set()
        for c in q:
            for d in e[c]:
                if len(f[d] - al) == 0:
                    u.add(d)
                    r[d] = c + 1
        al |= u
        q = u

    return '\n'.join(map(str, r))



print(main())




Measured memory_bytes: 88088
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define pb push_back
#define xx first
#define yy second
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define repp(i,k,n) for(int i=k;i<n;i++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> iv;
typedef pair<int,int> iip;
typedef map<int,int> mii;
template <typename T>
void dbg(T t){cerr<<t<<endl ;}
template<typename T, typename... Args>
void dbg(T t, Args... args) {cerr << t <<" ";dbg(args...) ;}

int main(){
	int n,a;
	int t[3]={0,0,0};
	cin>>n;
	rep(i,n){
		cin>>a;
		if(a%4==0)t[2]++;
		else if(a%2==0)t[1]++;
		else t[0]++;
	}
	if(t[1]!=0)t[0]++;
		if(t[0]>t[2]+1)cout<<"No"<<endl;
		else cout<<"Yes"<<endl;

	return 0;
 }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

int main() {
    int k;
    cin >> k;
    int x = 7;
    vector<int>cnt(1000001);
    int i = 1;
    while(true) {
        if(x % k == 0) {
            cout << i << endl;
            return 0;
        }
        x %= k;
        cnt[x]++;
        if(cnt[x]==2) {
            cout << -1 << endl;
            return 0;
        }
        x = x*10+7;
        i++;
    }
}


Measured memory_bytes: 7164
import java.util.*;
import java.io.*;

public class Main {
	public static void main (String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] opens = new int[n];
		for (int i = 0; i < n; i++) {
			String[] lines = br.readLine().split(" ", 10);
			int base = 0;
			for (int j = 0; j < 10; j++) {
				base *= 2;
				base += Integer.parseInt(lines[j]);
			}
			opens[i] = base;
		}
		int[][] benefits = new int[n][11];
		for (int i = 0; i < n; i++) {
			String[] lines = br.readLine().split(" ", 11);
			for (int j = 0; j < 11; j++) {
				benefits[i][j] = Integer.parseInt(lines[j]);
			}
		}
		int max = Integer.MIN_VALUE;
		for (int i = 1; i < 1024; i++) {
			int revenue = 0;
			for (int j = 0; j < n; j++) {
				revenue += benefits[j][getCount(i, opens[j])];
			}
			max = Math.max(max, revenue);
		}
		System.out.println(max);
	}
	
	
	static int getCount(int x, int y) {
		int target = x & y;
		int count = 0;
		while (target > 0) {
			count += target % 2;
			target /= 2;
		}
		return count;
	}
}


Measured memory_bytes: 22996
using System;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        long n = long.Parse(input[0]);
        long k = long.Parse(input[1]);
        long ans = n % k;
        if (ans <= Math.Abs(ans - k))
        {
            Console.WriteLine(ans);
        } else
        {
            Console.WriteLine(Math.Abs(ans - k));
        }
    }
}

Measured memory_bytes: 13140
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<map>
#include<set>

#define fi first
#define se second
#define long long long

using namespace std;

vector<int> vec[100003], chi[100003];
bool visited[100003];
long A[100003];
int root = 0;

void dfs(int u)
{
    visited[u] = 1;
    long sum = 0;
    long mx = 0;
    for(int v : vec[u])
    {
        if(visited[v]) continue;
        chi[u].push_back(v);
        dfs(v);
        sum += A[v];
        mx = max(mx, A[v]);
    }
//    printf("%d %d %d\n", u, A[u], sum);
    
    if(chi[u].size() == 0)
    {
        return;
    }
    
    if(sum < A[u])
    {
        printf("NO\n");
        exit(0);
    }
    if(sum > 2*A[u])
    {
        printf("NO\n");
        exit(0);
    }
    
    long dif = sum-A[u];
     A[u] -= dif;
    if(sum-mx < dif)
    {
        printf("NO\n");
        exit(0);
    }
    
}

int main()
{
//        freopen("input.in", "r", stdin);
    int n;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++)
        scanf("%lld", &A[i]);
    
    for(int i = 1; i < n; i++)
    {
        int u, v;
        scanf("%d %d", &u, &v);
        vec[u].push_back(v);
        vec[v].push_back(u);
    }
    
    if(n == 2)
    {
        if(A[1] == A[2]) printf("YES\n");
        else printf("NO\n");
        return 0;
    }
    
    for(int i = 1; i <= n; i++)
    {
        if(root == 0 && vec[i].size() != 1)
            root = i;
    }
    
    dfs(root);
    
//    printf("ROOT : %d %lld\n", root, A[root]);
    
    if(A[root]) printf("NO\n");
    else printf("YES\n");
}


Measured memory_bytes: 18688
# instead of AVLTree
class BITbisect():
    def __init__(self, max):
        self.max = max
        self.data = [0]*(self.max+1)
    
    # 0からiまでの区間和
    # 立っているビットを下から処理
    def query_sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s

    # i番目の要素にxを足す
    # 覆ってる区間すべてに足す
    def add(self, i, x):
        while i <= self.max:
            self.data[i] += x
            i += i & -i

    def insert(self, x):
        self.add(x, 1)

    def delete(self, x):
        self.add(x, -1)

    def count(self, x):
        return self.query_sum(x) - self.query_sum(x-1)
    
    def length(self):
        return self.query_sum(self.max)
    
    # 下からc番目(0-indexed)の数
    # O(log(N))
    def search(self, c):
        c += 1
        s = 0
        ind = 0
        l = self.max.bit_length()
        for i in reversed(range(l)):
            if ind + (1<<i) <= self.max:
                if s + self.data[ind+(1<<i)] < c:
                    s += self.data[ind+(1<<i)]
                    ind += (1<<i)
        if ind == self.max:
            return False
        return ind + 1
    
    def bisect_right(self, x):
        return self.query_sum(x)

    def bisect_left(self, x):
        if x == 1:
            return 0
        return self.query_sum(x-1)

    # listみたいに表示
    def display(self):
        print('inside BIT:', end=' ')
        for x in range(1, self.max+1):
            if self.count(x):
                c = self.count(x)
                for _ in range(c):
                    print(x, end=' ')
        print()

from bisect import bisect_left, bisect_right
from operator import itemgetter
import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
STX = [list(map(int, input().split())) for _ in range(N)]
D = [int(input()) for _ in range(Q)]

bit = BITbisect(Q+1)

for i, d in enumerate(D):
    bit.insert(i+1)

STX.sort(key=itemgetter(2))

ans = [-1]*Q
for s, t, x in STX:
    #print(s, t, x)
    #bit.display()
    il = bisect_left(D, s-x)
    ir = bisect_right(D, t-x-1)
    #print(il, ir)
    ind_l = bit.bisect_right(il)
    ind_r = bit.bisect_right(ir)
    #print(ind_l, ind_r)
    for ind in range(ind_l, ind_r):
        il = bit.search(ind_l)
        bit.delete(il)
        ans[il-1] = x


for a in ans:
    print(a)

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

using namespace std;

int main(){
    int N,M;
    cin >> N >> M;
    vector<vector<int>> graph(N);
    vector<int> color(N,-1);
    for(int i=0;i<M;i++){
        int A,B;
        cin >> A >> B;
        A--;
        B--;
        graph[A].push_back(B);
        graph[B].push_back(A);
    }

    queue<int> Q;

    Q.push(0);
    color[0] = 0;

    while(!Q.empty()){
        int now = Q.front();
        Q.pop();

        for(int i=0;i<graph[now].size();i++){
            if(color[graph[now][i]]==-1){
                color[graph[now][i]] = now;
                Q.push(graph[now][i]);
            }
        }
    }

    for(int i=1;i<N;i++){
        if(color[i]==-1){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    for(int i=1;i<N;i++){
        cout << color[i]+1 << endl;
    }
}

Measured memory_bytes: 10112
dic={"AC":0,"WA":0,"TLE":0,"RE":0}
n=int(input())
for i in range(n):
    s=input()
    dic[s]+=1

print("AC x "+str(dic["AC"]))
print("WA x "+str(dic["WA"]))
print("TLE x "+str(dic["TLE"]))
print("RE x "+str(dic["RE"]))

Measured memory_bytes: 9192
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int main() {
  string s, t = "YAKI";
  cin >> s;
  for (int i = 0; i < 4; i++) {
      if(s[i]!=t[i]){
        cout << "No" << endl;
        return 0;
      }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
import sys


def input():
    return sys.stdin.readline()[:-1]


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

if A == B:
	if A != C:
		print("Yes")
	else:
		print("No")

elif A == C:
	if A != B:
		print("Yes")
	else:
		print("No")

elif B == C:
	if B != A:
		print("Yes")
	else:
		print("No")
		
else:
	print("No")	


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define mp make_pair
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

int main(){
  ll n,h,a,b;
  P c[200010];
  cin>>n>>h;
  fr(i,n){
    cin>>a>>b;
    c[2*i]=mp(a,0);
    c[2*i+1]=mp(b,1);
  }
  sort(c,c+2*n);
  reverse(c,c+2*n);
  ll d=0,ans=0;
  fr(i,2*n){
    if(c[i].second){d+=c[i].first;ans++;}
    else{ans+=1+(h-d-1)/c[i].first;break;}
    if(d>=h) break;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3456
#ifdef _WIN32
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

// 継承可能な型
template <class Type>
struct IN : Type
{
	IN()
	{
		std::cin >> *this;
	}
};

// 継承不可能な型
template <class Type>
struct IN_
{
	Type val;

	IN_()
	{
		std::cin >> val;
	}

	operator Type&()
	{
		return val;
	}

	IN_<Type>& operator=(const Type& _value)
	{
		val = _value;
		return *this;
	}
};

template <class Char, class Type>
std::basic_ostream<Char>& operator <<(std::basic_ostream<Char>& os, const IN_<Type>& value)
{
	return os << value.val;
}

template <class Char, class Type>
std::basic_istream<Char>& operator >>(std::basic_istream<Char>& is, IN_<Type>& value)
{
	return is >> value.val;
}

template <class Type>
void OUT(const Type& value)
{
	std::cout << value << std::endl;
}

template <class Type, class ... Args>
void OUT(const Type& value, const Args& ... args)
{
	std::cout << value << ' ';
	OUT(args...);
}

void Yes()
{
	OUT("Yes");
}
void No()
{
	OUT("No");
}

using ll = long long;
using inll = IN_<ll>;
using vll = std::vector<ll>;
using setll = std::set<ll>;
using msetll = std::multiset<ll>;
using instr = IN<std::string>;

#define FOR(i, m, n) for (ll (i) = (m); (i) < (n); ++(i))
#define REP(i, n) for (ll (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for (ll (i) = (n); (i) >= 0; --(i))
#define ITRREP(it, v) for (auto (it) = (v).begin(); (it) != (v).end(); ++(it))
#define ITRREPR(it, v) for (auto (it) = (v).rbegin(); (it) != (v).rend(); ++(it))
#define DIVUP(a, b) (((a) + (b) - 1) / (b))

void Main();

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

	Main();

#ifdef _DEBUG
	system("pause");
#endif

	return 0;
}

using namespace std;

//////////////////////////////

void Main()
{
	instr s1, s2, s3;

	cout << s1[0] << s2[1] << s3[2] << endl;
}


Measured memory_bytes: 256
var d = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
var info = line = '';
var map = [];

while (line = d.shift()) {
  info = line.split(' ');
  map.push([info[0], +info[1]]);
}
map.sort(function(a, b) {
  if (a[0] < b[0]) return -1;
  if (a[0] > b[0]) return 1;
  if (a[1] < b[1]) return -1;
  if (a[1] > b[1]) return 1;
  return 0;
});

var word = '';
var pages = [];
map.forEach(function(info, i) {
  if (word !== info[0]) {
    if (i !== 0) {
      console.log(pages.join(' '));
      pages = [];
    }
    console.log(info[0]);
  }
  pages.push(info[1]);
  word = info[0];
});
console.log(pages.join(' '));

Measured memory_bytes: 8700
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

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

    void run() {

        int h = sc.nextInt();
        int w = sc.nextInt();
        int m = sc.nextInt();
        int[][] arr = new int[m][2];
        int[] cntH = new int[h];
        int[] cntW = new int[w];
        for (int i=0; i<m; i++) {
            arr[i][0] = sc.nextInt() - 1;
            arr[i][1] = sc.nextInt() - 1;
            cntH[arr[i][0]]++;
            cntW[arr[i][1]]++;
        }

        Pair[] pairH = new Pair[h];
        Pair[] pairW = new Pair[w];

        int maxhCnt = 0;
        for (int i=0; i<h; i++) {
            maxhCnt = Math.max(maxhCnt, cntH[i]);
        }
        int maxWCnt = 0;
        for (int i=0; i<w; i++) {
            maxWCnt = Math.max(maxWCnt, cntW[i]);
        }


        for (int i=0; i<h; i++) {
            pairH[i] = new Pair(cntH[i], i);
        }
        for (int i=0; i<w; i++) {
            pairW[i] = new Pair(cntW[i], i);
        }


        Set<Integer> setH = new TreeSet<>();
        for (int i=0; i<h; i++) {
            if (pairH[i].cnt == maxhCnt) setH.add(pairH[i].idx);
        }
        Set<Integer> setW = new TreeSet<>();
        for (int i=0; i<w; i++) {
            if (pairW[i].cnt == maxWCnt) setW.add(pairW[i].idx);
        }

//        System.out.print(setH);
//        System.out.print(setW);

        for (int i=0; i<m; i++) {
            if (!setH.contains(arr[i][0])) {

            }
        }


        long cnt = 0;
        for (int i=0; i<m; i++) {
            if (setH.contains(arr[i][0]) && setW.contains(arr[i][1])) cnt++;
        }

        if ((long)setH.size() * (long)setW.size() == cnt) {
            System.out.print(maxhCnt + maxWCnt - 1);
        } else {
            System.out.print(maxhCnt + maxWCnt);
        }



    }

    class Pair {
        int cnt;
        int idx;
        public Pair(int c, int i) {
            this.cnt = c;
            this.idx = i;
        }
    }



}



Measured memory_bytes: 113808
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string.h>
#include<math.h>
#include<cstring>
using namespace std;
int maxim(int a,int b){
	if(a>b){
		return a;
	}else{
		return b;
	}
}
int tanri(double a,int y,double ri,double te){
	double i,b=0;
	for(i=0;i<y;i++){
		b+=a*ri;
		a-=te;
		a=(int)a;
		b=(int)b;
	}
	return a+b;
}

int fukuri(double a,int y,double ri,double te){
	int i,j;
	for(i=0;i<y;i++){
		a+=a*ri;
		a-=te;
		a=(int)a;
	}
	return a;
}

int main(){
	int m;
	cin>>m;
	for(;m>0;m--){
		int i,j,k,year,n,th;
		double a,b,c,max,ri,te;
		cin>>a>>year>>n;
		max=a;
		for(i=0;i<n;i++){
			cin>>th>>ri>>te;
			if(th==0){
				max=maxim((int)max,tanri(a,year,ri,te));
			}else{
				max=maxim((int)max,fukuri(a,year,ri,te));
			}
		}
		cout<<(int)max<<endl;
	}
    return 0;
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define VIEW(x) do {cerr << #x << ": "; for(auto i : x) cerr << i << " "; cerr << endl;} while(0)
#define ALL(x) (x).begin(),(x).end()
template<class T>bool umax(T &a, const T &b) {if(a<b){a=b;return 1;}return 0;}
template<class T>bool umin(T &a, const T &b) {if(b<a){a=b;return 1;}return 0;}

template<typename A,size_t N,typename T> void FILL(A (&array)[N],const T &val){fill((T*)array,(T*)(array+N),val);}
template<typename T> void FILL(vector<T> &v, const T &x) {fill(v.begin(), v.end(), x);}
template<typename T> void FILL(vector<vector<T>> &v, const T &x) {for(auto &i:v)fill(i.begin(), i.end(), x);}

int main() {
  int x;
  cin >> x;
  cout << (x==0) << endl;
}


Measured memory_bytes: 3604
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
 
void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main(){
  int N,K;
  cin>>N>>K;
  string S;
  cin>>S;
  
  if(S[K-1]=='A') S[K-1]='a';
  if(S[K-1]=='B') S[K-1]='b';
  if(S[K-1]=='C') S[K-1]='c';
  
  cout<<S<<endl;
}
  
  

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

int main() {
  int x;
  cin >> x;
  priority_queue<int> p;
  p.push(1);
  rep(i, pow(x, 0.5)){
    if(i > 1){
      int a = i*i;
      while(a <= x){
        p.push(a);
        a *= i;
      }
    }
  }
  cout << p.top() << endl;
  return 0;
}

Measured memory_bytes: 512
/*
Knapsack 1  ナップザック問題１
メモ再帰による解法
 */

#include <string.h>
#include<iostream>
#include<vector>
using namespace std;

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;

long long N,W;

long long weight[100100],value[100100];

long long dp[110][100100];

//i番目以下のindexの品から重量がsum_wになるように選んだときの
//取りうる価値の総和の最大値を返す関数
long long rec(int i,int sum_w)
{
    //すでに探索していたら結果を再利用
    if(dp[i][sum_w]!=-1)
    {
        return dp[i][sum_w];
    }
    //現在価値を表す変数
    long long res;
    //品番N+1以降は存在しないのでres=0
    if(i==N)
    {
        res=0;
    }
    //
    else if(W-sum_w-weight[i]<0)
    {
        res=rec(i+1,sum_w);
    }
    else
    {
        res=max(
            rec(i+1,sum_w),
            rec(i+1,sum_w+weight[i])+value[i]
        );   
    }
    return dp[i][sum_w]=res;
}

int main()
{   
    // メモ化テーブルを-1で初期化　以下のforループと等価
    //<string.h>をincludeすると利用可能
    memset(dp, -1, sizeof(dp)); 

    cin>>N>>W;
    for(int i=0;i<N;++i)
    {
        cin>>weight[i]>>value[i];
    }
    cout << rec(0, 0) << endl;
}



Measured memory_bytes: 86272
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  bool ok=true;
  string s[n];
  cin >> s[0];  
  rep(i,n-1){
    cin >> s[i+1];
    if(s[i][s[i].size()-1]!=s[i+1][0]) ok=false;
  }
  sort(s,s+n);
  rep(i,n-1){
   	if(s[i]==s[i+1]) ok=false;
  }
  
  
  if(ok) cout <<"Yes" << endl;
  else cout <<"No" << endl;
  return 0;
}

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

typedef long long ll;
const ll mod = 1e9+7;

ll modpow(ll a, ll b, ll p = 1e9+7){
    if(b == 0)  return 1;

    if(b % 2 == 0){
        ll d = modpow(a, b/2, p);
        return (d*d) % p;
    }else{
        return (a%p * modpow(a, b-1, p)) % p;
    }
}

struct ModComb{
    vector<ll> po, inv;
    ll N;

    ModComb(ll n) : N(n), po(n), inv(n) {
        po[0] = 1;
        for(int i = 1; i < N; i++)  po[i] = (po[i-1] * i) % mod;
        inv[N-1] = modpow(po[N-1], mod-2, mod);
        for(int i = N-2; i >= 0; i--)   inv[i] = (inv[i+1] * (i+1)) % mod;
    }
    
    ll nCk(ll n, ll k){
        if(k == 0)  return 1;
        if(n < k)   return 0;
        return (((po[n]*inv[n-k])%mod)*inv[k])%mod;
    }

    ll nPk(ll n, ll k){
        if(k == 0)  return 1;
        if(n < k)   return 0;
        return (po[n]*inv[n-k])%mod;
    }

    ll nHk(ll n, ll k){
        if(n == 0 && k == 0)    return 1;
        return nCk(n+k-1, k-1);
    }
};

int main(){
    ll n, m;
    cin >> n >> m;
    ModComb mc(m+1);
    ll ans = mc.nPk(m, n);
    for(int i = 1; i <= n; i++){
        ans += mc.nCk(n, i) * mc.nPk(m-i, n-i) % mod * (i%2==1 ? -1 : 1) + mod;
        ans %= mod;
    }
    ans *= mc.nPk(m, n);
    ans %= mod;
    cout << ans << endl;
    return 0;
}

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

int main(){
  int64_t N;
  cin >> N;
  vector<int> n(0);
  for(;N>0;N/=10)
    n.push_back(N%10);
  reverse(n.begin(),n.end());
  int64_t m=0;
  for(int64_t tmp=0;tmp<(1<<n.size()-1);tmp++){
    bitset<9> s(tmp);
    int64_t j=0,k=n.at(0);
    for(int i=0;i<n.size()-1;i++){
      if(s.test(i)){
        j+=k;
        k=0;
      }else
        k*=10;
      k+=n.at(i+1);
    }
    m+=j+k;
  }
  cout << m << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    var (n, x) = readInputLine().split(" ").map { it.toInt() }
    
    val aList = readInputLine().split(" ").map { it.toInt() }.toList().toIntArray()

    aList.sort()
    
    var ans = 0

    for ((i, a) in aList.withIndex()) {
        if (x < a) {
            break
        }
        ans++
        x -= a
        if (x == 0) {
            break
        }
        
        if (i == aList.size - 1) {
            ans--
        }
    }

    println(ans)
}
 
fun readInputLine(): String {
    return readLine()!!
}


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

#define rep(a, b, i) for(int i = a; i < b; i++)

char ch(int a, int b, int c) {
	return (a * (c - 'a') + b) % 26 + 'a';
}

int main() {
	int n, a, b, c;
	cin >> n;
	cin.ignore();

	string str, res = "";
	for (; n > 0; n--) {
		getline(cin, str);

		rep(1, 30, a) {
			if (a == 2 || a == 13) continue;
			rep(1, 30, b) {
				res = str;
				c = 0;
				rep(0, str.size(), c) {
					if (res[c] == ' ') continue;

					res[c] = ch(a, b, res[c]);
				}
				if (res.find("this") != -1 || res.find("that") != -1) {
					cout << res << endl;
					a = 114514;
					b = 114514;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3032
/*
                   _ooOoo_
                  o8888888o
                  88" . "88　AC!AC!
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rep3(var, min, max) for (ll (var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll (var) = (max) - 1; (var) + 1 > (min); --(var))
#define Mp(a,b) make_pair((a),(b))
#define F first
#define S second
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll MOD = 1e9 + 7;
int main(){
    ll n;cin>>n;
    V vec(n);
    rep(i,n)cin>>vec[i];
    sort(all(vec));
    ll sum=0;
    for(int i=n-1;i>=2;i--){
        rep(j,i){
            ll k=vec[i]-vec[j];
            if(upper_bound(all(vec),k)-vec.begin()-1<j){
              //  if(vec[j]==*upper_bound(all(vec),k))continue;
                //cout<<vec[i]<<" "<<vec[j]<<" "<<*upper_bound(all(vec),k)<<endl;
                ll l=upper_bound(all(vec),k)-vec.begin();
                //cout<<j<<endl;
                //cout<<k<<endl;
                sum+=(j-l);
                //cout<<k<<endl;
             //   cout<<j-l<<endl;
                
                //cout<<sum<<endl;
            }
        }
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>

using namespace std;
typedef long long ll;
ll N;

int main(){

    string b;
    cin >> b;
    vector<string > ss;
    
    for(int i = 0; i < b.length();i++){
        string sss;
        for(int j = 0; j < b.length() - i;j++){      
            sss = b.substr(i,j + 1);
            //cout << sss << endl;   
            ss.push_back(sss); 
        }   
    }

    int ans = 0;
    int f = 0;
    for(int i = 0; i <ss.size();i++){
        for(int j = 0; j < ss[i].length();j++){  
            string h = ss[i].substr(j,1);    
            if(!( h == "A" ||  h == "C" ||  h == "G" ||  h == "T")){
                f = 1;
            }
        }   
        if(f != 1){
            int size = ss[i].length();
            ans = max(ans, size);
        }
        f = 0;
    }
    cout << ans << endl;
} 

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

int main () {
  string n;
  cin >> n;

  for (int i=0;i<3;++i)
    if (n[i]=='1') n[i]='9';
    else n[i]='1';

  cout << n << endl;
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using int64 = int64_t;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, n;
  cin >> h >> n;
  int mx = h + 10010;
  const int INF = (int)1e9;
  vector<int> dp(mx, INF);
  dp[0] = 0;
  while (n--) {
    int a, b;
    cin >> a >> b;
    rep(i, mx) {
      if (i - a >= 0) {
        dp[i] = min(dp[i], dp[i - a] + b);
      }
    }
  }
  int ans = INF;
  for (int i = h; i < mx; i++) {
    ans = min(ans, dp[i]);
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 3736
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 998244353;
int mod(int n) {
    return (n % MOD + MOD) % MOD;
}   
int fp(int a, int p) {
    int ans = 1, cur = a;
    for (int i = 0; (1ll << i) <= p; ++i) {
        if ((p >> i) & 1) ans = mod(ans * cur);
        cur = mod(cur * cur);
    }   
    return ans;
}   
void add(int &a, int b) {
    a = mod(a + b);
}   
int mdiv(int a, int b) {
    return mod(a * fp(b, MOD - 2));
}   
const int N = 1e6 + 7;
int f[N];
int C(int n, int k) {
    return mdiv(f[n], mod(f[k] * f[n - k]));
}   
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    f[0] = 1;
    for (int i = 1; i < N; ++i) f[i] = mod(f[i - 1] * i);
    int n, a, b, k;
    cin >> n >> a >> b >> k;
    int ans = 0;
    for (int i = 0; i <= n && i * a <= k; ++i) {
        int t = k - i * a;
        if (t % b == 0 && t/b <= n) {
            add(ans, C(n, i) * C(n, t / b));
        }   
    }   
    cout << ans << '\n';
}   

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


using namespace std;


#define ll long long
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()


ll sum(int n);


void go(){
	int n,k,x,y;cin>>n>>k>>x>>y;
	int ans=0;
	for(int i=1;i<=n;i++){
		if(i<=k){
			ans+=x;
		}else{
			ans+=y;
		}
	}
	cout << ans;
}
int main(){
   
   ios_base::sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);

   go();

   return 0;
}

ll sum(int n){                
   if(n == 0){
      return n;
   }else{
      return sum(n/10) + n%10;
   }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int INF = 1 << 20;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;


int main()
{
    int n; cin >> n;
    int num[100010] = {0};
    for(int i = 0; i < n; i++){
        int a,b; cin >> a >> b;
        for(int j = a; j <= b; j++){
            num[j]++;
        }
    }
    int ans = 0;
    for(int i = 0; i < 100010; i++){
        if(i-1 <= num[i]){
            ans = i-1;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3492
#include<stdio.h>
#include<string.h>
int main()
{
	char str[3];
	int i;
	
	scanf("%s",&str);

	if(strlen(str)==2)
		printf("%s",str);
	else
	{
		for(i=strlen(str)-1;i>=0;i--)
		printf("%c",str[i]);
	}

	return 0;	
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Project
{
	class Node
	{
		public int num;
		public int dim;
		public int[] c;
		public int parent = -1;
		public string type;
		public int depth;
		public Node(int num, int dim, int[] c)
		{
			this.num = num;
			this.dim = dim;
			this.c = new int[dim];
			for (int i = 0; i < dim; i++)
			{
				this.c[i] = c[i];
			}
		}
	}

	class MainClass
	{
		public static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			Node[] nodes = new Node[n];
			for (int i = 0; i < n; i++)
			{
				string[] s = Console.ReadLine().Split(' ');
				int num = int.Parse(s[0]);
				int dim = int.Parse(s[1]);
				int[] c = new int[s.Length - 2];
				for (int j = 2; j < s.Length; j++)
				{
					c[j - 2] = int.Parse(s[j]);
				}
				nodes[i] = new Node(num, dim, c);
			}
			Array.Sort(nodes, (a, b) => a.num - b.num);
			for (int i = 0; i < n; i++)
			{
				foreach (int x in nodes[i].c)
				{
					nodes[x].parent = nodes[i].num;
				}
			}
			int root = 0;
			for (int i = 0; i < n; i++)
			{
				if (nodes[i].parent == -1)
				{
					nodes[i].type = "root";
					root = i;
					break;
				}
			}
			ope(nodes, nodes[root], 0);
			var sb = new StringBuilder();
			for (int i = 0; i < n; i++)
			{
				sb = new StringBuilder();
				Console.Write("node {0}: parent = {1}, depth = {2}, {3}, [",nodes[i].num,nodes[i].parent,nodes[i].depth,nodes[i].type);
				if (nodes[i].c.Count() != 0)
				{
					for (int k = 0; k < nodes[i].c.Count(); k++)
					{
						sb.Append(nodes[i].c[k]);
						if (k != nodes[i].c.Count() - 1)
							sb.Append(", ");
					}
				}
				Console.WriteLine(sb + "]");
			}
		}

		public static void ope(Node[] nodes, Node node, int depthcnt)
		{
			node.depth = depthcnt;
			if (node.c.Count() != 0 && node.parent != -1)
				node.type = "internal node";
			else if (node.c.Count() == 0 && node.parent != -1)
				node.type = "leaf";
			for (int i = 0; i < node.c.Length; i++)
			{
				ope(nodes, nodes[node.c[i]], depthcnt + 1);
			}
		}
	}
}

Measured memory_bytes: 28776
#include <bits/stdc++.h>
#define ll long long
#define _n 2020
#define C continue
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define gc getchar
#define pc putchar
#define kg putchar(' ')
#define hh putchar('\n')
#define mem(a,b) memset(a,b,sizeof(a))
#define _for(i,a,b) for( int i=(a); i<=(b); i++)
#define _rep(i,a,b) for( int i=(a); i>=(b); i--)
using namespace std;
inline int rd()
{
    int x=0,f=1;char ch=gc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=gc();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=gc();}
    return x*f;
}
char ch[200];
inline void rt(int x )
{
    int cnt=0,tmp=x>0?x:-x;
    if (!x) {pc('0');return;}
    if(x<0) pc('-');
    while(tmp>0) {ch[cnt++]=tmp%10+'0';tmp/=10;}
    while(cnt>0) pc(ch[--cnt]);
}
int main()
{
	int k=rd();
	_for(i,1,k)
	{
		printf("ACL");
	}

    return 0;
}





Measured memory_bytes: 3608
#include "bits/stdc++.h"
using namespace std;
int main(){
	int a,b,k;
	cin>>a>>b>>k;
	for(int i=a;i<=min(b, a+k-1);i++) cout<< i <<endl;
	for(int i=max(b-k+1, a+k);i<=b;i++) cout<< i <<endl;

	return 0;
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  string ans = "Yes";

  while (true) {
    c -= b;
    if (c <= 0) {
      ans = "Yes";
      break;
    }
    a -= d;
    if (a <= 0) {
      ans = "No";
      break;
    }
  }

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


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

#define ll long long int
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(A) A.begin(), A.end()
#define SZ(A) (ll)A.size()
typedef vector <int> vi;
typedef vector <ll> vl;
typedef pair <int, int> pii;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
const int inf = 1e9;
//const ll inf = 1e18;
const int N = 1e6;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll h, res = 0;
	cin >> h;
	ll x = 1, y = 2;
	while (h != 0) {
		res += x;
		x *= 2;
		h = h / 2;
	}
	cout << res << "\n";
 	return 0;
}

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

int main() {
  string s;
  int v[100];

  cin >> s;

  int top = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '0') {
      v[top] = 0;
      top++;
    }
    else if (s[i] == '1') {
      v[top] = 1;
      top++;
    }
    else {
      if(top > 0) {
        top--;
      }
    }
  }

  for (int i = 0; i < top; i++) {
    cout << v[i];
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 256
def main():
  _max = max
  h, w = map(int, input().split())
  s = [input() + '#' for _ in range(h)]
  s.append('#' * (w + 1))

  rt = [[-1] * w for _ in range(h)]

  tstart = [-1] * (w + 1)
  for i in range(h + 1):
    si = s[i]
    ystart = -1
    for j in range(w + 1):
      if si[j] == '#':
        if ystart != -1:
          for k in range(ystart, j):
            rt[i][k] += j - ystart
          ystart = -1
        if tstart[j] != -1:
          for k in range(tstart[j], i):
            rt[k][j] += i - tstart[j]
          tstart[j] = -1
      else:
        if ystart == -1:
          ystart = j
        if tstart[j] == -1:
          tstart[j] = i

  print(_max(_max(l) for l in rt))

main()

Measured memory_bytes: 96984
N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

kai1 = [1, 1]
kai2 = [1, 1]
inverse = [0, 1]
for i in range(2, N + 1):
  kai1.append((kai1[-1] * i) % MOD)
  inverse.append((-inverse[MOD % i] * (MOD // i)) % MOD)
  kai2.append((kai2[-1] * inverse[-1]) % MOD)


def comb(n, r):
  if r < 0 or r > n:
    return 0
  r = min(r, n - r)
  return (kai1[n] * kai2[r] * kai2[n - r]) % MOD

if K >= 2:
  A.sort(reverse = True)
  maxS = 0
  minS = 0
  for i in range(N - K + 1):
    maxS += A[i] * comb(N - i - 1, K - 1)
    maxS %= MOD
  A.sort()
  for i in range(N - K + 1):
    minS += A[i] * comb(N - i - 1, K - 1)
    minS %= MOD
  print((maxS - minS) % MOD)
else:
  print(0)

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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

const ll INF = TEN(18);
const ll L = TEN(15);
const int maxn = 100010;

V<pii> g[2][maxn];
ll d[2][maxn];

int main() {
    int n, m, s, t;
    cin >> n >> m >> s >> t;
    --s, --t;
    rep(i, m) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        --u, --v;
        g[0][v].eb(u, a);
        g[0][u].eb(v, a);
        g[1][v].eb(u, b);
        g[1][u].eb(v, b);
    }
    rep(c, 2) {
        int st = (c == 0 ? s : t);
        using pll = pair<ll, int>;
        priority_queue<pll, V<pll>, greater<pll>> que;
        fill(d[c], d[c] + n, INF);
        d[c][st] = 0;

        que.push(mp(0, st));
        while (!que.empty()) {
            auto t = que.top();
            que.pop();
            int v = t.se;
            if (d[c][v] < t.fi) continue;
            for (auto e : g[c][v]) {
                ll nt = t.fi + e.se;
                if (nt < d[c][e.fi]) {
                    d[c][e.fi] = nt;
                    que.push(mp(nt, e.fi));
                }
            }
        }
    }

    V<ll> ans(n, -1);
    rep(i, n) if (d[0][i] + d[1][i] <= L) {
        chmax(ans[i], L - d[0][i] - d[1][i]);
    }
    for (int i = n - 2; i >= 0; --i) {
        chmax(ans[i], ans[i + 1]);
    }
    for (auto v : ans) {
        cout << v << '\n';
    }
    return 0;
}

Measured memory_bytes: 16196