akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
const double PI  =3.141592653589793238463;
using namespace std;
using ll = long long;
const ll INF = +10010010000;
typedef pair<int,int> P;
const int mod = 1e9+7;

struct mint{
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a){
        (x+=a.x)%=mod;
        return *this;
    }
    mint& operator-=(const mint a){
        (x-=mod-a.x)%=mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x *= a.x)%= mod;
        return *this;
    }
    mint operator+(const mint a)const{
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a)const{
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a)const{
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
      if(!t)return 1;
      mint a = pow(t>>1);
      a*=a;
      if(t%1)a*=*this;
      return a;
    }

    // for prime mod
    mint inv() const {
      return pow(mod-2);
    }
    mint& operator/=(const mint a){
      return (*this) *= a.inv();
    }
    mint operator/(const mint a)const{
      mint res(*this);
      return res/=a;
    }
};

struct combination{
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1){
    fact[0] = 1;
    for(int i = 1; i<n;++i)fact[i] = fact[i-1] * i;
    ifact[n] = fact[n].inv();
    for(int i = n; i>=1;--i) ifact[i-1] = ifact[i] * i;
  }
  mint operator()(int n, int k){
    if(k<0 || k>n)return 0;
    return fact[n] * ifact[k] + ifact[n-k]; 
  }
};

ll k,pre;
ll mod_k(int i){
    if(i==1)return pre=7%k;
    return pre = ((pre*10) + 7)%k;
}


int main(){
    cin >> k;
    rep(i,k){
        if(mod_k(i+1)==0){
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << -1<<endl;
    return 0;
}

Measured memory_bytes: 3580
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl
#define CE cout<<endl
#define pb push_back

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010],ac[1010];
bool r,ra,rb,rc[200010];
string s,sa,sb,sc;
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc,vd,ve,vaa,vbb;
set<int> st;

template<typename MAIN>
void intovec(MAIN * star,vector<MAIN> & vtar,int size){
    vtar.clear();
    for(int i=0;i<size;i++){
        vtar.pb(star[i]);
    }
}

template<typename MAIN>
ostream & operator<<(ostream & osys,vector<MAIN> vtar){
    osys<<"[";
    for(int i=0;i<vtar.size();i++)osys<<vtar[i]<<(i==vtar.size()-1 ? "":",");
    osys<<"]";
    return osys;
}

template<typename MAIN>
MAIN binary_search(vector<ll> & vtar,MAIN key){
    int left=-1,right=vtar.size(); 
    while(right-left>1) {
        int mid=left+(right-left)/2;
        if(vtar[mid]>=key)right=mid;
        else left=mid;
    }
    return right;
}

int main(){
    cin>>n;
    C n*n*n E;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int MAXN=100050;
int a[MAXN];

int main() {
	int N; scanf("%d",&N);
	for(int i=0;i<N;i++) scanf("%d",a+i);
	ll ans=0;
	for(int i=0;i<N;i++) {
		ans+=a[i]/2;
		a[i]%=2;
		if(i+1<N && a[i]>0 && a[i+1]>0) ans++, a[i]--, a[i+1]--;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}

#[allow(unused_macros)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn a() {
    let (a, b) = read!(i32, i32);
    println!("{}", max(0, a - 2 * b));
}

fn b() {
    unimplemented!();
}

fn c() {
    unimplemented!();
}

fn d() {
    unimplemented!();
}

fn e() {
    unimplemented!();
}

fn f() {
    unimplemented!();
}

fn main() {
    a();
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>

int main() {
    int N, M;
    std::cin >> N >> M;
    std::vector<std::vector<int>> A(N);
    std::vector<int> K(N);
    for (int i = 0; i < N; ++i) {
        std::cin >> K[i];
        for (int j = 0; j < K[i]; ++j) {
            int a;
            std::cin >> a;
            A[i].push_back(a);
        }
    }
    
    int ans = 0;
    for (int i = 0; i < K[0]; ++i) {
        bool judge = true;
        for (int j = 1; j < N; ++j) {
            bool aru = false;
            for (int k = 0; k < K[j]; ++k) if (A[0][i] == A[j][k]) aru = true;
            if (!aru) judge = false;
        }
        if (judge) ++ans;
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>

#define MOD 1000000007

using namespace std;

int main()
{
	long long t1, t2;
	long long a1, a2;
	long long b1, b2;

	//("input.txt", "r", stdin);

	scanf("%lld %lld %lld %lld %lld %lld", &t1, &t2, &a1, &a2, &b1, &b2);

	if (a1 == b1)
	{
		printf("infinity");

		return 0;
	}

	long long da1, da2, db1, db2, diff1, diff2;

	da1 = t1*a1;
	da2 = t2*a2;
	db1 = t1*b1;
	db2 = t2*b2;

	diff1 = da1 - db1;
	diff2 = diff1 + da2 - db2;

	if (diff2 == 0)
	{
		printf("infinity");

		return 0;
	}

	if (diff1 < 0 && diff2 < 0 || diff1>0 && diff2>0)
	{
		printf("0\n");

		return 0;
	}

	long long sol;

	sol = abs(diff1) / abs(diff2) * 2 + !!(abs(diff1) % abs(diff2));

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

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <tr1/unordered_map>
 
using std::pair;
using std::vector;
using std::string;

typedef long long ll;
typedef pair<int, int> pii;
 
#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) std::make_pair(a, b)
#define debug(...) fprintf(stderr, __VA_ARGS__)
 
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
 
const int oo = 0x3f3f3f3f;
 
template<typename T> T read(T& x) {
    int f = 1; x = 0;
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48; 
    return x *= f;
}

const int N = 100;
const int mo = 998244353;

string get_substr(string x, int l, int sl) {
    string tmp, res;

    for(int i = 0; i < sl; ++i) res += '1';
    for(int i = 0; i < l; i += sl) {
        tmp = x.substr(i, sl);
        
        for(int j = 0; j < sl; ++j) {
            res[j] = ((res[j] - '0') && (tmp[j] - '0')) + '0';
        }
    }
    return res;
}

std::tr1::unordered_map<string, int> mp;

int dp(string x) {

    if(mp.count(x)) return mp[x];

    int len = x.length();
    int res = 1ll * dp(x.substr(0, len-1)) * dp(x.substr(len-1, 1)) % mo;

    for(int i = 1; i <= len; ++i) {
        for(int j = i+i; j <= len; j += i) {

            string lft = x.substr(0, len - j);
            string rht = get_substr(x.substr(len - j, j), j, i);

            res = (res + 1ll * dp(lft) * dp(rht)) % mo;
            /*
            if(len != i*i) {
                tmp = get_substr(x, len, len / i);
                res = (res + chk(tmp, 0)) % mo;
            }
            */
        }
    }
    return mp[x] = res;
}

int main() {
#ifdef Wearry
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif 

    string st;
    std::cin >> st;

    mp[""] = 1;
    mp["0"] = 1; 
    mp["1"] = 2;

    printf("%d\n", dp(st));

    return 0;
}


Measured memory_bytes: 4620
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<double,P> PP;
struct edge { int to; int cost; };

signed main() {
	int r, d, x; cin >> r >> d >> x;
	rep(i, 10) {
		cout << x*r - d << endl;
		x = x*r - d;
	}
}

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val Array(datN) = readLine.split(" ").map(_.toInt)
    val datA = readLine.split(" ").map(_.toLong)

    def recFunc(sum: Long, height: Long, idx: Int): Long = {
      if (idx == datA.length) sum
      else {
        if (datA(idx) > height) recFunc(sum, datA(idx), idx + 1)
        else recFunc(sum + (height - datA(idx)), height, idx + 1)
      }
    }
    val ans = recFunc(0, 0, 0)
    println(ans)
  }
}


Measured memory_bytes: 84216
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

vector<int> prime;

bool Is_Prime(int n){
  if(n==1) return false;
  else if(n==2)return true;
  else if(n%2==0)return false;
  for(int i=3;i*i<=n;i+=2){
    if(n%i==0)return false;
  }
  return true;
}

signed main(){
  LOOP(i,1,250000)if(Is_Prime(i))prime.PB(i);
  int n;
  while(cin>>n,n){
    int m=n*2;
    cout<<lower_bound(ALL(prime),m+1)-upper_bound(ALL(prime),n)<<endl;
  }


  return 0;
}



Measured memory_bytes: 3244
str = gets.split
A,B,K = str[0].to_i, str[1].to_i, str[2].to_i

c = A-K
c = c<0 ? 0 : c
d = K-(A-c)
e = B-d
e = e<0 ? 0 : e

print c
print " "
puts e

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

namespace Atc_0028
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Math.Pow(int.Parse(Console.ReadLine()), 2));
        }
    }
}


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

int main() {
    ll n, k;
    cin >> n >> k;

    int ans = k; 

    for (int i = 1; i < n; i++)
    {
        ans *= (k-1);
    }

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

Measured memory_bytes: 3636
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ch = sc.next().toCharArray();
		Set<Character>set = new HashSet<>();
		for(char c : ch) {
			set.add(c);
		}
		System.out.println((ch.length == set.size()) ? "yes" : "no");		
	}

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;



int main(){
	ll N;
	cin >> N;
	vector<ll> H(N,0);
	for(ll i=0;i<N;i++){
		cin>>H[i]
	;}
	ll counter=0;
	ll ans=0;
	for(ll i=0;i<N-1;i++){
		if(H[i]>=H[i+1])counter++;
		else counter=0;
		ans=max(ans,counter);
	;}
	cout<<ans<<endl;
return 0;
}  



Measured memory_bytes: 1152
from collections import defaultdict
d = defaultdict(int)
n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]
xy.sort()

for i in range(n - 1):
    xa, ya = xy[i]
    for j in range(i + 1, n):
        xb, yb = xy[j]
        p = xb - xa
        q = yb - ya
        d[(p, q)] += 1

ans = n
for k, v in d.items():
    ans = min(ans, n - v)
if n == 1:
    ans = 1

print(ans)


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  multiset<int> s;
  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    int t,x;
    cin>>t>>x;
    if(t==0) s.emplace(x);
    if(t==0) cout<<s.size()<<endl;
    if(t==1) cout<<s.count(x)<<endl;
    if(t==2) s.erase(x);
    if(t==3){
      int y;
      cin>>y;
      auto latte=s.lower_bound(x);
      while(latte!=s.end()&&*latte<=y) cout<<*latte++<<endl;
    }
  }
  return 0;
}



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

int main(){
    int n,m; cin >> n >> m;
    if(n==m) cout << "Yes" << endl;
    else cout << "No" << endl;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	while(1){
		int a=0,b=0;
		bool server=true;
		cin>>s;
		if(s=="0")break;
		for(int i=1;i<s.size();i++){
			if(s[i]=='A')a++;
			else b++;
		}
		if(a>b)a++;
		else b++;
		cout<<a<<" "<<b<<endl;
	}
}

Measured memory_bytes: 1184
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <list>
using namespace std;

typedef long long ll;

#define MOD 1000000007
#define p(x) cout << x << endl;
#define el cout << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

    int a, b ,c;
    cin >> a >> b >>c;

    if(a <= c && c <= b){
        p("Yes");
    }else{
        p("No");
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>

using namespace std;

int main(){
	int A,B,sum,dif,mul;

	scanf("%d %d",&A,&B);
	sum=A+B;
	dif=A-B;
	mul=A*B;
	if(sum>=dif && sum>=mul){
		printf("%d",sum);
	}
	else if(dif>=sum && dif>=mul){
		printf("%d",dif);
	}
	else if(mul>=dif && mul>=sum){
		printf("%d",mul);
	}
}

Measured memory_bytes: 256
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	k := scanInt()
	s := scanString()
	if k >= len(s) {
		fmt.Fprintln(wr, s)
	} else {
		fmt.Fprint(wr, s[:k], "...")
		fmt.Fprintln(wr)
	}
}


Measured memory_bytes: 1760
#include<iostream>

using namespace::std;
#define int long long int

int ar[100005],neg,sum,minn=1e9+7;

main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>ar[i],minn=min(abs(ar[i]),minn),neg+=(ar[i]<0),sum+=abs(ar[i]);
    if(neg&1)
        cout<<sum-2*minn<<'\n';
    else cout<<sum<<'\n';
    //cout<<neg<<' '<<minn<<' '<<sum<<'\n';
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static int maxV = 100;
	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int N = in.nextInt();
			long W = in.nextLong();
			int[] v = new int[N], w = new int[N];
			for (int i = 0; i < N; i++) {
				v[i] = in.nextInt(); w[i] = in.nextInt();
			}

			long[][] dp = new long[N+1][N*maxV+1];
			Arrays.fill(dp[0], INF);
			dp[0][0] = 0;

			for (int i = 0; i < N; i++) {
				for (int j = 0; j <= N*maxV; j++) {
					if (j-v[i]>=0) {
						dp[i+1][j] = Math.min(dp[i][j], dp[i][j-v[i]]+w[i]);
					} else {
						dp[i+1][j] = dp[i][j];
					}
				}
			}

			for (int i = N*maxV; i >= 0; i--) {
				if (dp[N][i] <= W) {
					out.println(i);
					return;
				}
			}

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}



Measured memory_bytes: 33328
use std::vec::Vec;
use std::cmp::max;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
    let N: usize = read();
    let alpha = vec!['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i' , 'j'];
    let mut tot = Vec::new();
    dfs(N, 1, vec![], &mut tot, 1);


    for v in tot {
      let ans: String = v.into_iter().collect();
      println!("{}", ans);
    }
}


fn dfs(N: usize, n: usize, v: Vec<char>, tot: &mut Vec<Vec<char>>, m: usize) {
    let alpha = vec!['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i' , 'j'];
    if n == N+1 {
      tot.push(v.clone());
      return
    }

    for i in 0..m {
      let mut x = v.clone();
      
      x.push(alpha[i]);
      if i == m-1 {
        dfs(N, n+1, x, tot, m+1);
      } else {
        dfs(N, n+1, x, tot, m);
      }
    }
}



Measured memory_bytes: 12924
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 min = 1;

		for (int i = 0; i < n; i++) {
			min = Math.min(min * 2, min + k);
		}

		System.out.println(min);

		sc.close();

	}

}


Measured memory_bytes: 35752
import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

      int a = sc.nextInt();
      int b = sc.nextInt();

      if (a>b) {
        for (int i = 0;i<a ;i++ ) {
          System.out.print(b);
        }
      }else{
        for (int i = 0;i<b ;i++ ) {
          System.out.print(a);
        }
      }
      System.out.println();


  }
}


Measured memory_bytes: 21716
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <map>

using namespace std;
int k;

int main() {
    scanf("%d", &k);

    int mod = 7 % k;
    int cnt = 1;
    set<int> s;

    while (s.count(mod) == 0) {
        // found vertex zero
        if (mod == 0) {
            printf("%d\n", cnt);
            return 0;
        }

        // visit vertex (mod)
        s.insert(mod);
        mod = (mod * 10 + 7) % k;
        cnt++;
    }

    printf("-1\n");
    return 0;
}

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

int main() {
    //
    int k, x;
    cin >> k >> x;
    int cnt = 0;

    for (int i = 0; i < k; i++) {
        if (i == -1000001) {
            for (int j = 0; j < k - i; j++) {
                //
                cout << x+j << " ";
            }
        }

        cout << x-k+i+1 << " ";
        cnt++;
    }

    for (int i = 1; i < k; i++) {
        if (i == 1000001) {
            for (int j = 1; j < k - i; j--) {
                //
                cout << x-j << " ";
            }
        }

        cout << x+i << " ";
    }
}

Measured memory_bytes: 3588
import java.io.{BufferedReader, InputStream, InputStreamReader}
import java.util.{Comparator, StringTokenizer}

import scala.collection.mutable
import scala.util.Sorting
import math.{abs, max, min}
import scala.collection.mutable.{ArrayBuffer, ListBuffer}

object Main {
  val MOD = 1000000007
  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val Q = sc.nextInt()

    val N = 100000
    val p = Array.ofDim[Int](N + 1)
    val d = Array.ofDim[Int](N + 1)

    (2 to math.sqrt(N).toInt) foreach { i =>
      if (p(i) == 0) {
        (2 to N / i) foreach { j =>
          p(j * i) = 1
        }
      }
    }

    (3 to N).reverse foreach { i =>
      if (p(i) == 0 && p((i + 1) / 2) == 0) d(i) = 1
    }

    (0 until N) foreach { i =>
      d(i + 1) += d(i)
    }

    (0 until Q) foreach { _ =>
      val l, r = sc.nextInt()
      println(d(r) - d(l - 1))
    }
  }


  def main(args: Array[String]): Unit = {
    solve()
  }


  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = null

    def next: String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next.toInt
    def nextLong(): Long = next.toLong
    def nextChar(): Char = next.charAt(0)
  }

}


Measured memory_bytes: 43104
import copy
n = int(input())
a = [0]*n
for i in range(n):
  a[i] = int(input())
b = copy.copy(a)
b.sort(reverse=True)

for j in range(n):
  if a[j] == b[0]:
    print(b[1])
  else:
    print(b[0])

Measured memory_bytes: 81416
import Control.Monad.ST
import Data.Char


readInt :: IO Int
readInt = read <$> getLine :: IO Int

readIntSplit :: IO [Int]
readIntSplit = map read . words <$> getLine :: IO [Int]

readStr :: IO String
readStr = getLine

readStrSplit :: IO [String]
readStrSplit = map read . words <$> getLine

-- solve :: [Int] -> Int
-- solve [] = 1
-- solve (x:xs) = x * solve xs


solve :: Int -> Int -> Int
solve n r
  | n > 10 = r
  | otherwise = r + (100 * (10 - n))


main :: IO ()
main = do
  [n, r] <- readIntSplit
  print $ solve n r

Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
#define __ <<' '<<
#define ___ <<' '
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define int long long

struct IoSetup {IoSetup() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout <<fixed<<setprecision(12);
    cerr <<fixed<<setprecision(12);
}}IoSetup;

using ll = long long;
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int SMOD = 1000000007;
constexpr int NMOD = 998244353;
constexpr int dx[]={1,0,-1,0,1,1,-1,-1};
constexpr int dy[]={0,1,0,-1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a<b?a=b,true:false);}
template<class T>bool chmin(T &a, const T &b){return(a>b?a=b,true:false);}
inline int qp(int a,ll b,int mo){ll ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}



signed main() {

    int a, b, c, k;

    cin >> a >> b >> c >> k;

    cout << min(a, k) - max(0LL, k - a - b) << endl;


  
    return 0;
}



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

int n, pos;
vector<int> pre, in, post;

void reconstruction(int l, int r){
    if(l >= r){
        return;
    }
    int root = pre[pos++];
    int m = distance(in.begin(), find(in.begin(), in.end(), root));
    reconstruction(l, m);
    reconstruction(m + 1, r);
    post.push_back(root);
}
void solve(){
    pos = 0;
    reconstruction(0, pre.size());
    for(int i=0; i<n; i++){
        if(i) cout << " ";
        cout << post[i];
    }
    cout << endl;
}

int main(){
    int k;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> k;
        pre.push_back(k);
    }
    for(int i=0; i<n; i++){
        cin >> k;
        in.push_back(k);
    }

    solve();

    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v)                               \
  cerr << #v << ": ";                              \
  REP(__i, (v).size()) cerr << ((v)[__i]) << ", "; \
  cerr << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(), x.end()

#include <iostream>
using namespace std;

int main() {
    int s,w;
    cin >> s >> w;
    string ans;
    if(w>=s) ans = "unsafe";
    else ans = "safe";

    cout << ans << endl;
}


Measured memory_bytes: 3624
#include<stdio.h>

int main(){
	int x,y,a,z;
	while(scanf("%d%d",&x,&y)!=EOF){
		if(x==0 && y==0)break;
		if(x<y)a=x,x=y,y=a;
		a=0;
		while(y!=0){
			z=y;
			y=x%y;
			x=z;
			a++;
		}
		printf("%d %d\n",x,a);
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();

		int cnt = 0;

		for (int i = A; i <= B; i++) {

			if(Digits(i)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}

	public static boolean Digits(int n) {

		int digit[] = new int[5];

		for (int i = 0; i < 5; i++) {
			digit[i] = n % 10;
			n /= 10;
		}

		if(digit[0] == digit[4]
				&& digit[1] == digit[3]) {
			return true;
		} else {
			return false;
		}
	}
}


Measured memory_bytes: 27092
def main():
  n = int(raw_input().strip())
  a = [raw_input().strip() for i in xrange(3)]
  foo = 0
  for i in xrange(n):
    bucket = { }
    for s in a:
      bucket[s[i]] = True
    foo += len(bucket) - 1
  print(foo)

if __name__ == '__main__':
  main()

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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int rem = n % 10;
    if (rem == 3)
        print("bon");
    else if (rem == 0 or rem == 1 or rem == 6 or rem == 8)
        print("pon");
    else
        print("hon");

    return 0;
}


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

int main() {
  ll n, m;
  cin >> n >> m;
  ll mini = min(n, m);
  ll maxi = max(n, m);
  ll ans;
  
  if(mini==1) {
    if(maxi==1) ans = 1;
    else ans = maxi-2;
  }
  else ans = (mini-2)*(maxi-2);
    
  cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)

                    
using ll = long long;
using ull = unsigned long long;
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; }
const ll mod = 1e9+7;
void chmod(ll &M){
  if(M >= mod) M %= mod;
  else if(M < 0){
     M += (abs(M)/mod + 1)*mod;
    M %= mod;
}
}
ll modpow(ll x, ll n){
   if(n==0) return 1;
  ll res=modpow(x, n/2);
 if(n%2==0) return res*res%mod;
else return res*res%mod*x%mod;
}
int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

using namespace std;
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
int main()
{
    int N;
    cin >> N;
    if (N % 1000 == 0) cout << N % 1000 << endl;
    else  cout << 1000 - (N % 1000) << endl;
}


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

#define all(x) (x).begin(), (x).end()
#define make_unique(vec) sort(all(vec)); vec.resize(unique(all(vec)) - vec.begin());
#define dbg(x) cerr<<#x<<" = "<<x<<endl

using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

bool tests = false;

void solve(){
    string s, t;
    cin >> s >> t;
    bool ok = true;
    if (t.size() == s.size()+1){
        for (int i=0; i<s.size(); i++){
            if (s[i] != t[i]){
                ok = false;
                break;
            }
        }
    }else ok = false;
    cout << (ok ? "Yes" : "No");
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    if (tests){
        cin >> t;
    }
    while (t--){
        solve();
    }
    return 0;
}


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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#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()

int n;
int a[100010];

int main() {
	cin >> n;
	rep(i, n) cin >> a[i];

	int ret = 0;

	for (int i = 0; i < n; ) {
		++ret;
		if (i >= n-2) break;

		int j = i;
		int st = -1;

		while (j+1 < n) {
			if (a[j+1] != a[j]) {
				if (st == -1) {
					st = (a[j+1] > a[j]);
				} else if (st != (a[j+1] > a[j])) {
					break;
				}
			}
			++j;
		}
		i = j + 1;
	}

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  
  for(int i = 1; i < 10000000;i++){
    if((a*i)%b == c){
      cout << "YES";
      return 0;
    }
  }
  
  cout << "NO";
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int S = scan.nextInt();
		int h = 0, m = 0, s = 0;
		int k = 0;
		s = S % 60;
		k = S / 60;
		m = k % 60;
		h = k / 60;
		System.out.println(h + ":" + m + ":" + s);
	}
}


Measured memory_bytes: 26392
a,b,c = gets.strip.split(' ').map(&:to_i)
K = gets.strip.to_i
num=0
while(!(a<b&&b<c))
  unless a<b
    b+=b
    num+=1 
  end
  unless b<c
    c+=c
    num+=1 
  end
end

flag = num<=K ? 'Yes' : 'No'
puts flag

Measured memory_bytes: 14376
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

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

Measured memory_bytes: 256
import java.util.*;

class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        HashMap<Integer, Integer> map = new HashMap<>();

        for (int i = 0; i < N; i++) {
            int value = sc.nextInt();

            int valueCount = map.containsKey(value) ? map.get(value) + 1 : 1;
            int valueMinusOneCount = map.containsKey(value - 1) ? map.get(value - 1) + 1 : 1;
            int valuePlusOneCount = map.containsKey(value + 1) ? map.get(value + 1) + 1 : 1;

            map.put(value, valueCount);
            map.put(value - 1, valueMinusOneCount);
            map.put(value + 1, valuePlusOneCount);
        }

        Iterator ite = map.values().iterator();

        int max = 0;
        while (ite.hasNext()) {
            int val = (Integer) ite.next();
            max = Math.max(val, max);
        }
        System.out.println(max);
    }
}

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

class Main {

	void solve() {
		
		String a = instr(), b = instr();
		StringBuilder A = new StringBuilder(a), B = new StringBuilder(b);
		boolean ok = true;
		
		if (A.reverse().toString().equals(b) == false) ok = false;
		if (B.reverse().toString().equals(a) == false) ok = false;
		
		out.println(ok?"YES":"NO");
		
	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

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

	public int inint() {
		return in.nextInt();
	}

	public long inlong() {
		return in.nextLong();
	}
	
	public String instr() {
		return in.next();
	}

	public char inchar() {
		return in.next().charAt(0);
	}
	
	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lowb lower_bound
#define upb upper_bound
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
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;};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};

bool IsPrime(int num){
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0) {
            return false;
        }
    }
    return true;
}

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

    int n;
    while(cin >> n) {
        int t = n;

        while(--t) {
            if(IsPrime(t)) {
                cout << t << " ";
                break;
            }
        }

        t = n;
        while(++t) {
            if(IsPrime(t)) {
                cout << t << endl;
                break;
            }
        }
    }
    return 0;
}


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

    using namespace std;

    int main() {
        string a;
        cin >> a;
        int count = 0;
        for(int i=0;i<a.size()/2;i++)
        {
            if(a[i] != a[a.size()-i-1])
                count++;
        }
        cout << count << endl;
        return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <limits>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
#include <utility>
using namespace std;
#define rep(i, n) for (int i =0; i < (int)(n); i++)
typedef pair<int, string> P;




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

    vector<int> l(q), r(q);
    vector<int> pre(101010, 1);
    rep(i, q)cin >> l[i] >> r[i];

    //hurui
    pre[0] = 0;
    pre[1] = 1;
    for (int i = 2; i < 100010; i++) {
        for (int j = 2; i * j < 100010; j++) {
            if (pre[i*j] != 1)continue;
            pre[i * j] = 0;
        }
    }

    //2017
    vector<int> like(101010, 0);
    for (int i = 2; i < 100010; i++) {
        if (i % 2 == 0)continue;
        if (pre[i] == 1 && pre[(i + 1) / 2] == 1)like[i] = 1;
    }

    //ruisekiwa
    vector<int> s(101010, 0);
    for (int i = 2; i < 100010; i++) {
        s[i+1] =s[i]+ like[i];
    }
    
    rep(i, q)cout << s[r[i] + 1] - s[l[i]] << endl;
}

Measured memory_bytes: 5276
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
int main()
{
	string s = "";
	cin >> s;
	for (int i = s.size() - 1; i >= 0; i--)
	{
		cout << s[i];
	}cout << endl;
	return 0;

}

Measured memory_bytes: 3040
#include<stdio.h>
#define MAX 100005
#define NIL -1

struct Node{ int p, l, r;};
struct Node T[MAX];

int n, m, depth[MAX];
int Get(int u){
  int d = 0;
  for(; T[u].p != NIL ; d++ ) u = T[u].p;
  return d;
}
void print(int u){
  int i, c;

  printf("node %d: ", u);
  printf("parent = %d, ", T[u].p);
  printf("depth = %d, ", depth[u]);

  if ( T[u].p == NIL ) printf("root, ");
  else if ( T[u].l == NIL ) printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  
  for(i = 0, c = T[u].l; c != NIL; i++, c = T[c].r){
    if (i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
}

int main(){
  int i, j, d, v, c, l;

  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) T[i].p = T[i].l = T[i].r = NIL;

  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &v, &d);
    for ( j = 0; j < d; j++ ){
      scanf("%d", &c);
      if ( j == 0 ) T[v].l = c;
      else T[l].r = c;
      l = c;
      T[c].p = v;
    }
  }
  
  m = 0;
  for ( i = 0; i < n; i++ ){
    depth[i] = Get(i);
    if ( depth[i] > m ) m = depth[i];
  }

  for ( i = 0; i < n; i++ ) print(i);
  
  return 0;
}



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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
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; }

int main() {
    int N, K;
    int R, S, P;
    int dp[100005][3];
    string T;
    
    cin >> N >> K >> R >> S >> P;
    cin >> T;
    
    fill_n(*dp, 100005 * 3, -INF);
    for (int i = 0; i < K; i++) {
        dp[i][0] = (int)(T[i] == 's') * R;
        dp[i][1] = (int)(T[i] == 'p') * S;
        dp[i][2] = (int)(T[i] == 'r') * P;
    }
    for (int i = K; i < N; i++) {
        dp[i][0] = max(dp[i - K][1], dp[i - K][2]) + (int)(T[i] == 's') * R;
        dp[i][1] = max(dp[i - K][2], dp[i - K][0]) + (int)(T[i] == 'p') * S;
        dp[i][2] = max(dp[i - K][0], dp[i - K][1]) + (int)(T[i] == 'r') * P;
    }
    int sum = 0;
    for (int i = N - 1; i >= N - K; i--) {
        sum += max({dp[i][0], dp[i][1], dp[i][2]});
    }
    cout << sum << endl;
    return (0);
}



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

int main(){
    int n,k;
    cin>>n>>k;
    ll ans = 0;
    for (int b = k+1; b <= n; b++)
    {
        
        ans += (n/b)*(b-k);
        //cout<<"a"<<ans<<endl;
        if(n+1-(b*(n/b)+k)>0&&n%b!=0&&k!=0)ans += n+1-(b*(n/b)+k);
        else if(n+1-(b*(n/b)+k)>0&&n%b!=0&&k==0)ans += n-(b*(n/b)+k);
       // printf("b %d n/b %d \n",b,n/b);
        //cout<<ans<<endl;
    }
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(v) v.begin(), v.end()
#define ll long long
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<long long>;
using vvll = vector<vll>;

int main(){
    ll n;
    cin>>n;
    ll k=n/15;
    ll i=0;
    ll ans=0;
    while(true){
        if(i==k) break;
        ans+=(1+2+4+7+8+11+13+14+(i*15*8));
        i++;
    }
    int j=0;
    while(j<=n%15){
        if(j%3!=0&&j%5!=0){
            ans+=j+k*15;
        }
        j++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    int n; std::cin >> n;
    std::vector<int> w(n), s(n), v(n);
    for (int i = 0; i < n; i++) std::cin >> w[i] >> s[i] >> v[i];
    std::vector<int> id(n);
    std::iota(id.begin(), id.end(), 0);
    std::sort(id.begin(), id.end(), [&](int i, int j) {
        return w[i] + s[i] < w[j] + s[j];
    });
    std::vector<long long> dp(1e5, -1e18);
    dp[0] = 0;
    for (int i : id) {
        for (int j = s[i]; j >= 0; j--) {
            dp[j + w[i]] = std::max(dp[j + w[i]], dp[j] + v[i]);
        }
    }
    std::cout << *std::max_element(dp.begin(), dp.end()) << std::endl;
    return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline int read()
{
	int f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int MAXN=100005;
int a[MAXN],b[MAXN],c[MAXN],n,L,T;
int final(int x,int d){return ((x+d*T)%L+L)%L;}
int f1[MAXN],l1,f2[MAXN],l2;
int main()
{
	n=read();L=read();T=read();
	int now=1;
	for(int i=1;i<=n;i++)
	{
		a[i]=read(),b[i]=read(),c[i]=final(a[i],b[i]==1?1:-1);
		if(b[i]==1)
		{
			int cnt=0,temp=T;
			if(temp<L-a[i])continue;temp-=L-a[i];++cnt;
			cnt+=temp/L;
			now=(now+cnt)%n;
		}
		else
		{
			int cnt=0,temp=T;
			if(temp<a[i]+1)continue;temp-=a[i]+1;++cnt;
			cnt+=temp/L;
			now=((now-cnt)%n+n)%n;
		}
	}sort(c+1,c+1+n);
	for(int i=1;i<=n;i++,now=now%n+1)pr2(c[now]);
	return 0;
}


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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    //good luck kittu!
    int n; cin>>n;
    n = n%10;
    if(n==2 || n==4 || n==5 || n==7 || n==9) cout<<"hon\n";
    else if(n==0 || n==1 || n==6 || n==8) cout<<"pon\n";
    else if(n==3) cout<<"bon\n";    
    return 0;
}

Measured memory_bytes: 3604