akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(void){
    int h, w, n;
    cin >> h >> w >> n;
    int M = max(h,w);
    int count=0;
    rep(i,M+1){
        if(i*M >= n){
            count = i;
            break;
        }
    }
    
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    x = I()
    if x in [3,5,7]:
        print("YES")
    else:
        print("NO")
    return

#B
def B():
    return

#C
def C():
    n = list(map(int,S()))
    l = len(n)
    dp = [[[0 for k in range(16)] for j in range(2)] for i in range(l+1)]
    dp[0][0][0] = 1
    for i in range(l):
        for j in range(2):
            for k in range(9):
                x = 9 if j else n[i]
                for d in range(x+1):
                    if d == 3:
                        f = 1
                    elif d == 5:
                        f = 2
                    elif d == 7:
                        f = 4
                    else:
                        if k == 0 and d == 0:
                            f = 0
                        else:
                            f = 8
                    dp[i+1][j or d < n[i]][k|f] += dp[i][j][k]
    ans = 0
    for i in range(2):
        ans += dp[l][i][7]
    print(ans)
#D
def D():
    def factorial(n):
        if n <= 3:
            return [n]
        l = []
        i = 2
        m = n
        while i**2 <= n:
            while m%i == 0:
                l.append(i)
                m //= i
            i += 1
        if m != 1:
            l.append(m)
        return l

    n = I()
    d = defaultdict(int)
    for i in range(2,n+1):
        l = factorial(i)
        for j in l:
            d[j] += 1
    a3 = 0
    a5 = 0
    a15 = 0
    a25 = 0
    a75 = 0
    for i in d.keys():
        if d[i] >= 74:
            a75 += 1
        if d[i] >= 24:
            a25 += 1
        if d[i] >= 14:
            a15 += 1
        if d[i] >= 4:
            a5 += 1
        if d[i] >= 2:
            a3 += 1
    ans = a75+(a3-1)*a25+(a5-1)*a15+(a3-2)*a5*(a5-1)//2
    print(ans)
#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    A()


Measured memory_bytes: 39920
/*  
    Come feed the rain
	Cos I'm thirsty for your love
	Dancing underneath the skies of lust
	Yeah feed the rain...
	Cos without your love my life
	Ain't nothing but this carnival of rust
    _________________________
    _________________________
    816 Hours of Solitude
    Quarantine_Day : 34
*/

#include<bits/stdc++.h>

using namespace std;

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

#define pb(n)           push_back(n)
#define GSORT(v)        sort(v.begin(), v.end(), greater<int>())
#define SORT(v)         sort(v.begin(), v.end());
#define REV(v)          reverse(v.begin(), v.end());
#define db(a)           cout<<#a<<" = "<<a<<endl;
#define FIN             freopen("in.txt","r",stdin);
#define FOUT            freopen("out.txt","w",stdout);
#define REP(i,n)        for(int i = (int)(0); i < (int)(n); i++)
#define FOR(i, a, b)    for(int i = (int)a; i <= (int)b; i++)    

#define MAX 50005
#define MOD 1000000007

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

	ll n, ans = 1;
	cin>>n;

	FOR(i, 1, n){
		ans = (ans * i) % MOD;
	}
	cout<<ans<<"\n";
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class WithIndex<T>
{
    public T Value;
    public int Index;
    public WithIndex(T value, int index)
    {
        this.Value = value;
        this.Index = index;
    }
}

static class Template
{
    public static int LineToInt()
    {
        return int.Parse(Console.ReadLine());
    }

    public static string[] LineToStrings()
    {
        return Console.ReadLine().Split();
    }

    public static int[] LineToInts()
    {
        return LineToStrings()
            .Select(s => int.Parse(s))
            .ToArray();
    }


    public static int[,] LinesToIntTable(int lineCount, int columnCount)
    {
        var value = new int[lineCount, columnCount];
        foreach (var y in Enumerable.Range(0, lineCount))
        {
            var ints = LineToInts();
            foreach (var x in Enumerable.Range(0, columnCount))
            {
                value[y, x] = ints[x];
            }
        }
        return value;
    }

    public static IEnumerable<WithIndex<T>> WithIndex<T>(this IEnumerable<T> sequence)
    {
        int index = 0;
        foreach (var item in sequence)
        {
            yield return new WithIndex<T>(item, index);
            index++;
        }
    }

    static void Main(string[] args)
    {
        var r = LineToInt();
        Console.WriteLine(r * r * 3);
    }
}



Measured memory_bytes: 11092
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
//////////////

void solve() {
	int N;
	cin >> N;
	vector<pair<int, int>> A(N);
	for (int i = 0; i < N; ++i) {
		cin >> A[i].second >> A[i].first;
	}
	sort(A.begin(), A.end());
	LL time = 0;
	for (int i = 0; i < N; ++i) {
		time += A[i].second;
		if (A[i].first < time) {
			cout << "No" << endl;
			return;
		}
	}
	cout << "Yes" << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 1792
#include<stdio.h>

int main(){
	int baris, kolom;
	scanf("%d %d", &baris, &kolom);
	while(baris!=0 && kolom!=0){
		for(int i=0; i<baris; i++){
			for(int i=0; i<kolom; i++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
		scanf("%d %d", &baris, &kolom);
	}
}


Measured memory_bytes: 2628
#include<bits/stdc++.h>
using namespace std;
long long cnt = 0;
void div2_up(int x){
    if ((x > 0) && ((x & 1) == 0)){
        cnt++;
        div2_up(x / 2);
    }
}
void div2_down(int x){
    if (x > 0 && ((x & 1) == 0)){
        cnt--;
        div2_down(x / 2);
    }
}
int main(){
    int N; cin >> N;
    string s; cin >> s;
    vector<int> A;
    vector<bool> v;
    bool flag = false;

    for (int i = 0; i < N; i++){
        A.push_back(s[i] - '0' - 1);
        if (A[i] == 1)flag = true;
    }
    
    for (int i = 1; i <= N; i++){
        v.push_back(cnt == 0);
        div2_up(N - i);
        div2_down(i);
    }

    int sum = 0;
    for (int i = 0; i < N; i++)
    {
        sum += (v[i] && A[i] % 2 == 1);
    }
    if ((sum % 2) == 1) {
        cout << 1 << endl;
    }
    else if (flag){
        cout << 0 << endl;
    }
    else{
        for (int i = 0; i < N; i++)
        {
            A[i] /= 2;
        }
        int sum2 = 0;
        for (int i = 0; i < N; i++)
        {
            sum2 += (v[i] && A[i] % 2 == 1);
        }
        if (sum2 % 2 == 1){
            cout << 2 << endl;
        }
        else
        {
            cout << 0 << endl;
        }
        
    }
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

template<int64 mod>
struct ModInt{
  int64 x;
  constexpr ModInt(int64 y = 0):x((y%mod+mod)%mod){}
  constexpr ModInt& operator+=(const ModInt& a){
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt& operator-=(const ModInt& a){
    if((x -= a.x) < 0)x += mod;
    return *this;
  }
  constexpr ModInt& operator*=(const ModInt& a){
    x = x * a.x % mod;
    return *this;
  }
  constexpr ModInt& operator/=(const ModInt& a){
    *this *= a.inv();
    return *this;
  }
  constexpr ModInt operator-() const {
    return ModInt(-x);
  }
  constexpr ModInt operator+(const ModInt& a) const {
    return ModInt(*this) += a;
  }
  constexpr ModInt operator-(const ModInt& a) const {
    return ModInt(*this) -= a;
  }
  constexpr ModInt operator*(const ModInt& a) const {
    return ModInt(*this) *= a;
  }
  constexpr ModInt operator/(const ModInt& a) const {
    return ModInt(*this) /= a;
  }
  constexpr ModInt operator++(){
    *this += ModInt(1);
    return *this;
  }
  constexpr ModInt operator++(int){
    ModInt old = *this;
    ++*this;
    return old;
  }
  constexpr ModInt operator--(){
    *this -= ModInt(1);
    return *this;
  }
  constexpr ModInt operator--(int){
    ModInt old = *this;
    --*this;
    return old;
  }
  constexpr bool operator==(const ModInt& a) const {
    return x == a.x;
  }
  constexpr bool operator!=(const ModInt& a) const {
    return x != a.x;
  }
  constexpr ModInt pow(int64 r) const {
    if(!r)return 1;
    ModInt res = pow(r>>1);
    res *= res;
    if(r & 1) res *= *this;
    return res;
  }
  constexpr ModInt inv() const {
    return pow(mod-2);
  }
  friend istream& operator>>(istream& is, ModInt& a){
    int64 t;
    is >> t;
    a = ModInt(t);
    return is;
  }
  friend ostream& operator<<(ostream& os, const ModInt& a){
    return os << a.x;
  }
};
using mint = ModInt<MOD>;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n,k;
  cin >> n >> k;

  vector<mint> fact(2*n+2,1);
  REP(i,2*n+1)fact[i+1] = fact[i] * (i+1);
  vector<mint> ifact(2*n+2);
  ifact[2*n+1] = fact[2*n+1].inv();
  FORR(i,2*n+1,1)ifact[i-1] = ifact[i] * i;
  auto comb = [&](int32 n, int32 r){
    return fact[n] * ifact[r] * ifact[n-r];
  };

  auto f = [&](int32 p, int32 r){ //person,room
    // cout << p << " " << r << " " << comb(p-1,r-1) << endl;
    return comb(p-1,p-r);
  };
  mint ans = 0;
  FOR(i,max<int32>(1,n-k),n+1)ans += comb(n,i) * f(n,i);
  ANS(ans);
  return 0;
}

Measured memory_bytes: 6528
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A=sorted(A)

BC=[]
for i in range(M):
    BC.append(list(map(int,input().split())))

BC=sorted(BC, key=lambda x:x[1], reverse=True)

i=0
for j,a in enumerate(A):
    if BC[i][0] == 0:
        i+=1
    if i == len(BC):break
    if a < BC[i][1]:
        A[j]=BC[i][1]
        BC[i][0]-=1

print(sum(A))

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

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define ull unsigned long long 
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll; 
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef vector<pll> vpll ;
// int ab  (int  x ) { return (x>0?x:-x); }

int main(){
	int n , ans = 0; 
	cin >> n ;
	for(int i = 1 ; i <= n ; i++ ){
		int x = i , cnt = 0 ; 
		while ( x ){
			x /= 10 ; cnt ++ ; 
		}
		if(cnt&1)ans ++ ; 
	}
	cout << ans << endl; 
}

Measured memory_bytes: 256
fn solve() {
    let stdin = std::io::stdin();
    let mut scn = Scanner { stdin: stdin.lock() };
    let n: usize = scn.read();
    println!("0");
    let root: String = scn.read();
    if root == "Vacant" {
        return ;
    }
    let mut left = 0;
    let mut right = n + 1;
    let mut query_cnt = 1;
    while query_cnt < 20 {
        let med = (right + left) / 2;
        if med >= n {
            right = med;
            continue;
        }
        println!("{}", med);
        query_cnt += 1;
        let pos: String = scn.read();
        if pos == "Vacant" {
            return ;
        }
        if med % 2 == 0 {
            if pos != root {
                right = med;
            } else {
                left = med;
            }
        } else {
            if pos == root {
                right = med;
            } else {
                left = med;
            }
        }
        
    }    
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}
pub mod utils {
    const DYX: [(isize, isize); 8] = [
        (0, 1),   //right
        (1, 0),   //down
        (0, -1),  //left
        (-1, 0),  //top
        (1, 1),   //down right
        (-1, 1),  //top right
        (1, -1),  //down left
        (-1, -1), //top left
    ];

    pub fn try_adj(y: usize, x: usize, dir: usize, h: usize, w: usize) -> Option<(usize, usize)> {
        let ny = y as isize + DYX[dir].0;
        let nx = x as isize + DYX[dir].1;
        if ny >= 0 && nx >= 0 {
            let ny = ny as usize;
            let nx = nx as usize;
            if ny < h && nx < w {
                Some((ny, nx))
            } else {
                None
            }
        } else {
            None
        }
    }
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 9040
import java.util.*;
 
public class Main {
  public static void main(String[] args)  {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int a = Integer.parseInt(s.substring(0, 1));
    int b = Integer.parseInt(s.substring(1, 2));
    int c = Integer.parseInt(s.substring(2, 3));
    int d = Integer.parseInt(s.substring(3, 4));
    
    if (a + b + c + d == 7) {
      System.out.println(a + "+" + b + "+" + c + "+" + d + "=7");
      return;
    }
    if (a + b + c - d == 7) {
      System.out.println(a + "+" + b + "+" + c + "-" + d + "=7");
      return;
    }
    if (a + b - c + d == 7) {
      System.out.println(a + "+" + b + "-" + c + "+" + d + "=7");
      return;
    }
    if (a + b - c - d == 7) {
      System.out.println(a + "+" + b + "-" + c + "-" + d + "=7");
      return;
    }
    if (a - b + c + d == 7) {
      System.out.println(a + "-" + b + "+" + c + "+" + d + "=7");
      return;
    }
    if (a - b + c - d == 7) {
      System.out.println(a + "-" + b + "+" + c + "-" + d + "=7");
      return;
    }
    if (a - b - c + d == 7) {
      System.out.println(a + "-" + b + "-" + c + "+" + d + "=7");
      return;
    }
    if (a - b - c - d == 7) {
      System.out.println(a + "-" + b + "-" + c + "-" + d + "=7");
      return;
    }
  }
}

Measured memory_bytes: 39292
#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<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
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 pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;

ll dp[301][5];
void solve() {
	int n; cin >> n;
	ll y; cin >> y;
	ll s = 0;
	vector<ll> a(n);
	rep(i, n) {
		cin >> a[i]; s += a[i];
	}
	vector<ll> ra(n + 1);
	rep(i, n) {
		ra[i + 1] = ra[i] + a[i];
	}
	ll ans = 0;
	rep(i, n) {
		if (i == 0)continue;
		rep(j, n + 1)rep(k, 5)dp[j][k] = 0;
		dp[i][0] = 1;
		for (int j = i + 1; j <= n; j++) {
			for (int l = i; l < j; l++) {
				ll sum = ra[j] - ra[l];
				if (sum + y < s / 5)continue;
				for (int k = 1; k <= 4; k++) {
					dp[j][k] += dp[l][k - 1];
				}
			}
		}
		for (int j = i + 4; j <= n; j++) {
			ll sum = ra[i] + (s - ra[j]);
			if (sum + y < s / 5)continue;
			ans += dp[j][4];
			
		}
	}
	cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(8);
	//init();
	solve();
	stop
		return 0;
}



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

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define pb push_back
#define odd(x) ((x)&1)
#define even(x) (!odd(x))
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(auto i=0;i<n;++i)
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define TEST_CASE int tc;cin>>tc;while(tc--)


#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define JD



int main(int argv, char* argc[])
{
    FASTIO

    #ifndef JD
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif


    char ch,s;
    cin>>ch;
    if(ch>='a'&&ch<='z')
        s = 'a';
    else
        s = 'A';
    cout<<s;



    return 0;
}


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

int n, c[10];

int main(){
	int t;
	while (cin >> n &&n != 0) {
		fill(c, c + 10, 0);
		for (int i = 0; i < n; i++) {
			cin >> t;
			c[t]++;
		}
		for (int i = 0; i <= 9; i++) {
			if (c[i] == 0) {
				cout << "-" << endl;
			}
			else {
				for (int j = 0; j < c[i]; j++) {
					cout << "*";
				}
				cout << endl;
			}
		}
	}

	return 0;
}

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

using namespace std;

#define ll long long
#define ull unsigned long long
#define endl '\n'
const int N = 5e5 + 5;
ll fact[N];
ll mod = 1e9 + 7;
ll binpow(ll u, ll p){
        if (p == 0) return 1;
        if (p == 1) return u % mod;
        ll t = binpow(u, p / 2);
        if (p & 1) return t * t % mod * u % mod;
        else return t * t % mod;
}
ll nCk(ll k, ll n){
        return fact[n] * binpow(fact[k], mod - 2) % mod * binpow(fact[n - k], mod - 2) % mod;
}
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        if (fopen("BONUS.INP", "r")){
                freopen("BONUS.INP", "r", stdin);
                freopen("BONUS.OUT", "w", stdout);
        }
        ll n, m;
        cin >> n >> m;
        fact[0] = 1;
        for (int i = 1; i <= m; i++) fact[i] = fact[i - 1] * i % mod;
        ll ans = nCk(n, m) * fact[n] % mod;
        ll cur = 0;
        for (int i = 1; i <= n; i++){
                ll now = nCk(i, n) * nCk(n - i, m - i) % mod * fact[n - i] % mod;
                if (i & 1) cur = (cur + now) % mod;
                else cur = (cur - now + mod * mod) % mod;
        }
        cout << (ans - cur + mod * mod) % mod * ans % mod;
}
/*
*/


Measured memory_bytes: 7420
#include <iostream>
#include <algorithm>
#include <vector>
#include <bitset>

using namespace std;

typedef long long int lli;

int main(int argc, char const *argv[]) {
  lli d, g;
  cin >> d >> g;
  vector<pair<lli, lli>> pc;
  for (size_t i = 0; i < d; i++) {
    lli p, c;
    cin >> p >> c;
    pc.push_back(make_pair(p,c));
  }
  lli ans = 1000;
  for (lli i = 0; i < 1<<d; i++){
    bitset<10> bs(i);
    lli cnt=0, sum = 0;
    for (lli j = d-1; j >= 0; j--) {
      if (bs[j]!=0) {
        cnt += pc[j].first;
        sum += pc[j].first*(j+1)*100+pc[j].second;
      }
    }
    for (lli j = d-1; j >=0 and sum < g; j--) {
      if (bs[j]==0) {
        lli temp = ((g - sum)+(j+1)*100-1)/((j+1)*100);
        if (temp >= pc[j].first) temp = pc[j].first-1;
        sum += temp*(j+1)*100;
        cnt += temp;
      }
    }
    if (cnt < ans and cnt != 0 and sum >= g) ans = cnt;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	int n;
	cin >> n;
	vector<string>s(n);
	vector<int>p(n);
	int r[105] = { 0 };
	int i, j;
	for (i = 0; i < n; i++)
	{
		cin >> s.at(i) >> p.at(i);
		r[i]++;
	}
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
		{
			if (s.at(i) > s.at(j))
			{
				//cout << ":" << i << " " << j << endl;
				r[i]++;
			}
			else if (s.at(i) == s.at(j))
			{
				if (p.at(i) < p.at(j))
					r[i]++;
			}
		}
	}
	for (i = 1; i <= n; i++)
	{
		for (j = 0; j < n; j++)
		{
			if (i == r[j])
				cout << j+1 << endl;
		}
	}
}

Measured memory_bytes: 3636
package main

import (
	"fmt"
	"io"
	"os"
)

func answer(reader io.Reader, writer io.Writer) {
	var n, k int
	var s string
	_, _ = fmt.Fscan(reader, &n, &s, &k)
	var r string
	for i := 0; i < len(s); i++ {
		if s[i] == s[k-1] {
			r = r + string(s[k-1])
		} else {
			r = r + "*"
		}
	}
	_, _ = fmt.Fprintf(writer, "%s", r)
}

func main() {
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>

using namespace std;

int main()
{
    vector<int> a(3);
    for (int i = 0; i < 3; i++)
    {
        cin >> a[i];
    }

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

    cout << a[0] << " " << a[1] << " " << a[2] << endl;

    return 0;
}


Measured memory_bytes: 3096
// Problem : A - Five Variables
// Contest : AtCoder - AtCoder Beginner Contest 170
// URL : https://atcoder.jp/contests/abc170/tasks/abc170_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// writer: w33z8kqrqk8zzzx33
#include <bits/stdc++.h>
using namespace std;

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define fi first
#define se second
#define pb push_back
 
#define ll long long
#define pii pair<int, int>
//#define int ll
const int MOD = 1000000007;

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int v;
    cin >> v; if(!v) cout << 1 << endl;
    cin >> v; if(!v) cout << 2 << endl;
    cin >> v; if(!v) cout << 3 << endl;
    cin >> v; if(!v) cout << 4 << endl;
    cin >> v; if(!v) cout << 5 << endl;
}



Measured memory_bytes: 3608
# 2019/08/16

h,w=map(int,input().split())
w+=2
a=[['.']*w]
for i in range(h):
    a+=[['.']+list(input())+['.']]

a+=[['.']*w]

g=(h,w-2)
cnt=0

i,j=1,1
while i<h or j<w:
    a[i][j]='@'
    if a[i-1][j]=='#' or a[i][j-1]=='#':
        ans='Impossible'
        break

    if (i,j)==g:
        ans='Possible'
        break
        
    if (a[i+1][j]=='#')^(a[i][j+1]=='#'):
        if a[i+1][j]=='#':
            i+=1
        else:
            j+=1
    else:
        ans='Impossible'
        break

print(ans)

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

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int

int main(){
    int n;
    lld max;
    scanf("%d %lld", &n, &max);
    lld dp[n+1][n+1][301];
    lld w[n], v[n];
    rep(i, 0, n){
        scanf("%lld %lld", &w[i], &v[i]);
    }
    rep(i, 0, n+1){
        rep(j, 0, n+1){
            rep(k, 0, 301){
                dp[i][j][k] = 0;
            }
        }
    }
    lld base = w[0];
    rep(i, 1, n+1){
        lld buf = w[i-1] - base;
        rep(j, 1, n+1){
            rep(k, 0, 301){
                dp[i][j][k] = dp[i-1][j][k];
                if(buf <= k && dp[i][j][k] < dp[i-1][j-1][k-buf] + v[i-1]){
                    dp[i][j][k] = dp[i-1][j-1][k-buf] + v[i-1];
                }
            }
        }
    }
    lld ans = 0;
    rep(i, 1, n+1){
        rep(j, 0, 301){
            if(base*i + j <= max && ans < dp[n][i][j]){
                ans = dp[n][i][j];
            }
        }
    }
    printf("%lld", ans);

    return 0;
}

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

#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define int long long
using namespace std;
const int INF = 2e18;
const int MOD = 1e9 + 7;
const int MB = 60;

struct FenvikTree {
	vector<int> t;
	FenvikTree(int n) {
		t.resize(n + 1);
	}
	void update(int i, int v) {
		i++;
		for (; i < t.size(); i+=(i&(-i))) {
			t[i] = max(t[i], v);
		}
	}

	int get(int i) {
		i++;
		int res = 0;
		for (; i > 0; i -= (i&(-i))) {
			res = max(res, t[i]);
		}
		return res;
	}
};

void solve() {
	int n;
	cin >> n;
	vector<int> h(n), a(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
		h[i]--;
	}
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}


	FenvikTree tree(n);
	for (int i = 0; i < n; i++) {
		int x = tree.get(h[i]);
		tree.update(h[i], x + a[i]);
	}

	cout << tree.get(n - 1);
}

signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	solve();
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
#define umi2357 	ios::sync_with_stdio(0);cin.tie(0);
const ll maxn=2e5+7;
ll n,p,ans=0,cnt[maxn],res,dp[maxn],a[maxn];
string s;
int main(void){
    cin>>n>>p;
    cin>>s;
    res=1;
    dp[n]=0;
    if(p==2||p==5){
        rep(0,i,n){
            if((s[i]-'0')%p==0)ans+=i+1;
        }
    }else{
        rep(0,i,n){
            ll x=n-1-i;
            a[x]=s[x]-'0';
            dp[x]=(dp[x+1]+a[x]*res)%p;
            res=(res*10)%p;
            ++cnt[dp[x]];
        }
        rep(0,i,p){
            ll x=cnt[i];
            ans+=x*(x-1)/2;
        }
        ans+=cnt[0];
    }
    cout<<ans;
}

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

int main() {
    int N;
    cin >> N;
    if (N == 1) cout << 1 << endl;
    else if (N % 2 == 0) cout << ( N / 2.0 ) / N << endl;
    else cout << ((N + 1) / 2.0 ) / N << endl;
    
}

Measured memory_bytes: 256
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
int a,b; 
int main(){
	cin>>a>>b;
	cout<<max(max(a+b,a-b),a*b);
	return 0;
}


Measured memory_bytes: 256
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]

    A,B,C,D,E,F = LI()

    w = set()
    for i in range(int(F/A/100)+1):
        for j in range(int(F/B/100)+1):
            if 0 < A*i+B*j <= int(F/100):
                w.add((A*i+B*j)*100)
    s = set()
    for i in range(int(F*E/(100+E)/C)+1):
        for j in range(int(F*E/(100+E)/D)+1):
            if 0 <= C*i+D*j <= int(F*E/(100+E)):
                s.add(C*i+D*j)

    max_E = -1.0
    ans_w = 0
    ans_s = 0
    for x in w:
        for y in s:
            if x + y <= F and y <= x/100 * E and max_E < y/(x+y) * 100:
                max_E = y/(x+y) * 100
                ans_w = x + y
                ans_s = y
    print(ans_w,ans_s)

if __name__ == '__main__':
    main()

Measured memory_bytes: 40812
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<queue>
#include<stack>
#include<map>

using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int>P;

int main(){
    int a=0;
    string s;
    cin>>s;
    for(int i=0; i<s.size(); i++){
        if(s[i]== '1')a++;
    }
    cout<<a<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;

int main (){
	int ans=2020;
	int l,r;
	scanf("%d %d",&l,&r);
	int l_=l%2019;
	int r_=r%2019;
	if (r-l>=2019){
		printf("0");
		return 0;
		}
	if (r_-l_<0){
		r_+=2019;
		}
	for (int i = l_+1;i<=r_;i++){
		for (int j = l_;j<i;j++){
			ans = min(ans,(i*j)%2019);
		}
	}
	printf("%d",ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>
#include <array>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)


typedef long long int ll;
typedef double D;      // ??§?¨?????????????double???long double?????????
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;


const int INF = (1<<30) - 1;
const D EPS = 1e-9;

#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

int N, M, K;

int dfs(int cur, int s){
    if(cur == 0){
        return s-K > 0 ? s-K: 1;
    }
    
    int ans = 0;
    for(int i=1; i<=M; i++){
        ans += dfs(cur-1, s+i);
    }
    return ans;
}

void solve(){
    double d = dfs(N, 0);
    for(int i=0; i<N; i++)
        d /= M;
    printf("%.7lf\n", d);
}

//g++ -std=c++0x -msse4.2 -O3
//#include <bits/stdc++.h>
int main(){
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    //cout.precision(16);
    
    while(cin>>N>>M>>K, N|M|K)
        solve();
    
    return 0;
}

Measured memory_bytes: 1172
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>
#include<functional>

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair<long long int, long long int> P;

int main(void) {
	struct Dice {
		int suf[7];
	};

	Dice d1;
	int q;
	int a, b;
	int e, f;
	int res[25];

	FOR(i, 1, 6) {
		cin >> d1.suf[i];
	}
	cin >> q;
	FOR(i, 1, q) {
		cin >> a >> b;
		FOR(t, 1, 6) {
			if (d1.suf[t] == a) {
				e = t;
			}
		}
		FOR(t, 1, 6) {
			if (d1.suf[t] == b) {
				f = t;
			}
		}
		switch (e) {
		case 1:
			switch (f) {
			case 1:
				break;
			case 2:
				res[i] = 3;
				break;
			case 3:
				res[i] = 5;
				break;
			case 4:
				res[i] = 2;
				break;
			case 5:
				res[i] = 4;
				break;
			case 6:
				break;
			}
			break;
		case 2:
			switch (f) {
			case 1:
				res[i] = 4;
				break;
			case 2:
				break;
			case 3:
				res[i] = 1;
				break;
			case 4:
				res[i] = 6;
				break;
			case 5:
				break;
			case 6:
				res[i] = 3;
				break;
			}
			break;
		case 3:
			switch (f) {
			case 1:
				res[i] = 2;
				break;
			case 2:
				res[i] = 6;
				break;
			case 3:
				break;
			case 4:
				break;
			case 5:
				res[i] = 1;
				break;
			case 6:
				res[i] = 5;
				break;
			}
			break;
		case 4:
			switch (f) {
			case 1:
				res[i] = 5;
				break;
			case 2:
				res[i] = 1;
				break;
			case 3:
				break;
			case 4:
				break;
			case 5:
				res[i] = 6;
				break;
			case 6:
				res[i] = 2;
				break;
			}
			break;
		case 5:
			switch (f) {
			case 1:
				res[i] = 3;
				break;
			case 2:
				break;
			case 3:
				res[i] = 6;
				break;
			case 4:
				res[i] = 1;
				break;
			case 5:
				break;
			case 6:
				res[i] = 4;
				break;
			}
			break;
		case 6:
			switch (f) {
			case 1:
				break;
			case 2:
				res[i] = 4;
				break;
			case 3:
				res[i] = 2;
				break;
			case 4:
				res[i] = 5;
				break;
			case 5:
				res[i] = 3;
				break;
			case 6:
				break;
			}
			break;
		}
	}
	FOR(i, 1, q) {
		cout << d1.suf[res[i]] << endl;
	}

	
	return 0;
}


Measured memory_bytes: 3088
import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

const real eps = 1e-10;

void main(){
	auto n = readInt();
	long a = 1;
	int ans;
	while(a < n) {
		a *= 3;
		++ans;
	}
	writeln(ans);
}

Measured memory_bytes: 2524
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=2e5+5,mod=1e9+7;
int Mn(int a,int b){return a<b?a:b;}
int upt(int x){while(x>=mod)x-=mod;while(x<0)x+=mod;return x;}
int n,m,lm,dp[N],sm[N],ans,g[N];
char s[N];
void solve()
{
  g[0]=sm[0]=1;
  for(int i=1;i<=n;i++)
  {
    if(i>=2)g[i]=sm[i-2];
    sm[i]=upt(sm[i-1]+g[i]);
  }
  int ans=1;//ans=1 for all one color
  for(int i=2;i<=n;i++)
    ans=(ans+(ll)i*g[n-i])%mod;
  printf("%d\n",ans);
}
int main()
{
  scanf("%d%d",&n,&m);
  scanf("%s",s+1); bool fg=0;
  for(int i=1;i<=m;i++)if(s[i]!=s[1]){fg=1;break;}
  if(!fg){solve();return 0;}
  if(n&1){puts("0");return 0;}
  lm=n+1;
  for(int i=1;i<=m;i++)if(s[i]==s[1])//== not !=
  {
    int j=i;
    while(j+1<=m&&s[j+1]==s[j])j++;
    swap(i,j); j=i-j+1;
    if(i-j==0) lm=Mn(lm,j+((j&1)==0));
    else if((j&1)&&i!=m)lm=Mn(lm,j);//i!=m not lst
    //else if((j&1)&&i!=lst)lm=Mn(lm,j);
  }
  n>>=1; lm=(lm+1)>>1; dp[0]=sm[0]=1;
  for(int i=1;i<=n;i++)
  {
    dp[i]=sm[i-1]; if(i>lm)dp[i]=upt(dp[i]-sm[i-lm-1]);
    sm[i]=upt(sm[i-1]+dp[i]);
  }
  int ans=0;
  for(int i=1;i<=lm;i++)//lm not n
    ans=(ans+(ll)i*2*dp[n-i])%mod;
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 2048
#!/usr/bin/env python
import sys 
input = sys.stdin.readline

n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
mod = 1000000007

dp = [-1 for _ in range(n)]
for i in range(m):
    dp[a[i]-1] = 0 

if n == 1:
    print(1)
    exit()
if n == 2:
    if m == 0:
        print(2)
        exit()
    elif m == 1:
        print(1)
        exit()

if dp[0] != 0:
    dp[0] = 1 
if dp[1] != 0:
    dp[1] = dp[0]+1

for i in range(2, n): 
    if dp[i] == 0:
        continue
    dp[i] = (dp[i-1] + dp[i-2])%mod

print(dp[n-1])


Measured memory_bytes: 13560
#include<iostream>

using namespace std;

int main()
{
    
    
    string a;
    
    cin>>a;
    if(a[0]=='A'&&a[1]=='A'&&a[2]=='A')
    {
        cout<<"No\n";
    }
    else if(a[0]=='B'&&a[1]=='B'&&a[2]=='B')
    {
        cout<<"No\n";
    }
    else{
        cout<<"Yes\n";
    }
}

Measured memory_bytes: 256
grade=[]
while True:
    score=[m,f,r]=[int(x) for x in input().split()]
    if [m,f,r]==[-1,-1,-1]:
        break
    elif -1 in [m,f]:
        print("F")
    elif m+f>=80:
        print("A")
    elif 80>=m+f>=65:
        print("B")
    elif 65>=m+f>=50:
        print("C")
    elif 50>=m+f>=30 and r>=50:
        print("C")
    elif 50>=m+f>=30 and r<50:
        print("D")
    else:
        print("F")
    

Measured memory_bytes: 7736
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
using ll = long long;
const int mod = 998244353;
struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a; }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> l(k), r(k);
    rep(i, k) cin >> l[i] >> r[i];

    vector<mint> dp(n + 1); //動的計画法
    vector<mint> dpsum(n + 1); //累積和

    dp[1] = 1;
    dpsum[1] = 1;

    for (int i = 2; i <= n; ++i) {
        rep(j, k) {
            // [l[i], r[i]]
            int li = i - r[j];
            int ri = i - l[j];
            if (ri < 0) continue;
            li = max(li, 1); //マイナスにならないように
            dp[i] += dpsum[ri] - dpsum[li - 1];  // dp[li]~dp[ri];
        }
        dpsum[i] = dpsum[i - 1] + dp[i];
    }

    cout << dp[n] << endl;
    return 0;
}

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

int main(){
  
  int N;
  cin >> N;
  int a[N];
  for(int i = 0; i<N; i++){
    cin >> a[i];
  }
    sort(a, a+N);
    reverse(a, a+N);
    int A = 0, B = 0;
    for (int i = 0; i<N; i++){
      if(i%2==0){
        A += a[i];
      }else{
        B += a[i];
      }
    }
      cout << A - B << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
//#define int long long
const int MAX_N = 100100;
const long long INF = 1e18;

signed main() {
    int n;
    cin >> n;
    vector<long long> a(n);
    vector<long long> dp(MAX_N, INF);
    for (int i = 0; i < n; i++) cin >> a[i];
    reverse(a.begin(), a.end());
    
    for (int i = 0; i < n; i++) {
        *upper_bound(dp.begin(), dp.end(), a[i]) = a[i];
    }
    int ans = lower_bound(dp.begin(), dp.end(), INF) - dp.begin();
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;

	if (m == 1)
	{
		cout << "IMPOSSIBLE" << endl;
		return 0;
	}

	vector<bool> l1(n, false), l2(n, false);

	for(int i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
		if (a == 1) l1[b] = true;
		if (b == n) l2[a] = true;
	}

	for(int i = 2; i < n; i++)
	{
		if(l1[i] && l2[i])
		{
			cout << "POSSIBLE" << endl;
			return 0;
		}
	}

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


Measured memory_bytes: 256
using System;

    class Program
    {
    static void Main(string[] args)
    {
        int h = int.Parse(Console.ReadLine());
        int[] j = new int[h];
        string kl = Console.ReadLine();
        string imaw;
        int imamade = 0;
        for (int q = 0; q < h; q++)
        {
            imaw = (kl.Substring(q, 1));
            if (imaw == "D") { imamade -= 1; }
            else { imamade += 1; }
            j[q] = imamade;
        }
        Array.Sort(j);
        if (j[h - 1] > 0)
        {
            Console.WriteLine(j[h - 1]);
        }
        else { Console.WriteLine("0"); }
    }

    }



Measured memory_bytes: 2776
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60

vector<vector<int>> G(100001);

bool isfound[100001];
int top() {
	// 深さ優先探索でtopを探す
	stack<int> S;
	S.push(1);
	int res = 0;
	while (!S.empty() && res == 0) {
		int pos = S.top();
		S.pop();
		isfound[pos] = true;

		bool flag = false; // 次に行く先があるか
		for (int i = 0; i < G[pos].size(); i++) {
			if (!isfound[G[pos][i]]) {
				S.push(G[pos][i]);
				flag = true;
			}
		}

		if (!flag) res = pos;
	}

	return res;
}

int number[100001];
int c[100001];

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

	int N; cin >> N;
	for (int i = 0; i < N - 1; i++) {
		int tmp1, tmp2; cin >> tmp1 >> tmp2;
		G[tmp1].push_back(tmp2);
		G[tmp2].push_back(tmp1);
	}
	for (int i = 0; i < N; i++) cin >> c[i];
	sort(c, c + N);

	int start = top();

	// 割り振り
	int num = N - 1;
	stack<int> S;
	S.push(start);
	while (!S.empty()) {
		int pos = S.top();
		S.pop();
		number[pos] = c[num];
		num--;

		for (int i = 0; i < G[pos].size(); i++) {
			if (number[G[pos][i]] == 0) S.push(G[pos][i]);
		}
	}

	for (int i = 1; i <= N; i++) isfound[i] = false;
	ll sum = 0LL;
	queue<int> Q;
	Q.push(start);
	isfound[start] = true;
	while (!Q.empty()) {
		int pos = Q.front();
		Q.pop();
		
		for (int i = 0; i < G[pos].size(); i++) {
			if (!isfound[G[pos][i]]) {
				isfound[G[pos][i]] = true;
				Q.push(G[pos][i]);
				sum += min(number[pos], number[G[pos][i]]);
			}
		}
	}

	cout << sum << endl;
	for (int i = 1; i <= N; i++) cout << number[i] << " ";
	cout << endl;

	return 0;
}

Measured memory_bytes: 3200
import java.util.*;
import java.io.*;
public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			String[] input = br.readLine().split(" ");
			int a = Integer.parseInt(input[0]);
			int b = Integer.parseInt(input[2]);
			String op = input[1];
			if (op.equals("+")){
				System.out.println(a + b);
			} else if (op.equals("-")){
				System.out.println(a - b);
			} else if (op.equals("*")){
				System.out.println(a * b);
			} else if (op.equals("/")){
				System.out.println(a / b);
			} else if (op.equals("?")){
				break;
			}			
		}
		
	}
}

Measured memory_bytes: 16920
#include<bits/stdc++.h>
using namespace std;
long long N;
int main(){
	scanf("%lld",&N);
long long sum=0,m;
m=N;
while(N){
	sum+=N%10;
	N/=10;
}
if(m%sum==0)
printf("Yes\n");
else
printf("No\n");



}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int X,Y,Z;
    cin >> X >> Y >> Z;
    cout << Z  << " "<< X  << " "<< Y << endl;



}


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

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

ans=0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=gcd(a,b,c)
            

print(ans)

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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    string A, B;
    cin >> A >> B;
    string S = "EQUAL";
    if (A.length() > B.length())
        S = "GREATER";
    else if (A.length() < B.length())
        S = "LESS";
    else
    {
        REP(i, A.length())
        {
            if (A[i] == B[i])
                continue;
            if (A[i] > B[i])
                S = "GREATER";
            else
                S = "LESS";
            break;
        }
    }
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long   
#define endl "\n"   
#define N 2000005  
int a[N] , b[N];
 std::vector<int> pos ,neg;
int main(){     
	#ifndef ONLINE_JUDGE
    // for getting input from input.txt     
    freopen("input.txt", "r", stdin);    
    // for writing output to output.txt  
    freopen("output.txt", "w", stdout);
#endif
       ios_base::sync_with_stdio(false);  
       cin.tie(NULL);  
 int x;
 cin>>x;
 if(x == 0){
 	cout<<1<<endl;
 }
 else if(x == 1){
 	cout<<0<<endl;
 }
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
#define elif else if
const ll INF = 1LL << 60;

int main(){
  ll N,a;
  cin >> N;
  a = N % 10;
  if (a == 3) {
    cout << "bon" << endl;
  }
  elif (a == 0 || a == 1 || a == 6 || a == 8) {
    cout << "pon" << endl;
  }
  else {
  cout << "hon" << endl;
  }
}

Measured memory_bytes: 3572