akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  double prob;
  int even = 0;
  int odd = 0;
  for(int i = 1; i <= n; i++){
    if(i % 2 == 0){
      even += 1;
    }
    else odd += 1;
  }
  prob = (double)odd/n;
  cout << prob;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define RREP(i,a,n) for(int i=(a),i##_len=(n);i<i##_len;++i)
#define MAT1d(V,T,a) vector<T> V (a)
#define MAT2d(V,T,a,b) vector<vector<T>> V (a, vector<T>(b))
#define MAT3d(V,T,a,b,c) vector<vector<vector<T>>> V (a, vector<vector<T>>(b, vector<T>(c)))

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
string to_string(vector<bool>::reference b) { return to_string(bool(b)); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; }

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L" << to_string(__LINE__) << ":" <<#__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  using pair = pair<ll, ll>;
  vector<pair> w;
  w.reserve(N);
  REP(i,N) {
    ll a,b;
    cin >> a >> b;
    w.push_back(make_pair(a,b));
  }
  sort(w.begin(), w.end(), [](const pair& x, const pair& y) {
        return x.second < y.second;
      });
  ll t = 0;
  for(auto& x:w) {
    t += x.first;
    if (t > x.second) {
      cout << "No" << endl;
      return  0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 3456
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<string> vs;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

long long gcd(long long a, long long b){
    if(b == 0){
        return a;
    }
    return gcd(b, a % b);
}

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

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

int main(){
    int rate;
    cin >> rate;
    if (rate < 1200) {
        cout << "ABC" << endl;
    } else {
        cout << "ARC" << endl;
    }
    return 0;
}


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

class Program {

	public void Proc() {
		string inpt = Console.ReadLine();
		char[] c = inpt.ToCharArray();
		string s = c[0] == 'W' ? "WB" : "BW";
		int n = CountString(inpt, s);
		int ans = n == 0 ? 0 :
			c[0] == c[inpt.Length-1] ? 2*n : 2*n-1;
		Console.WriteLine(ans);
	}

	public static int CountString(string s, string r) {
		return (s.Length - s.Replace(r, "").Length) / 2;
	}

	static void Main(string[] args) {
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 4568
#include<iostream>
#include<vector>
using namespace std;
int main(){
	int n;
	cin >> n;
	vector<int> v(n, 0);
	for(int i = 0; i < n - 1; i++){
		int a;
		cin >> a;
		v[a - 1]++;
		}
		
	for(int i = 0; i < n; i++){
		cout << v[i] << "\n";
		}
	}

Measured memory_bytes: 4048
// -*- coding:utf-8-unix -*-

use proconio::input;
use std::collections::HashMap;

fn main() {
    input! {
        n: usize,
    }

    let mut hm = HashMap::new();
    for _ in 0..n {
        input! {
            a: String,
        }
        let mut b: Vec<char> = a.chars().collect();
        b.sort();
        let counter = hm.entry(b).or_insert(0 as u64);
        *counter += 1;
    }

    let mut ans: u64 = 0;
    for (_, v) in hm.iter() {
        if v % 2 == 0 {
            ans += ((v / 2) * (v - 1)) as u64;
        } else {
            ans += ((v - 1) / 2 * v) as u64;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 15064
#include <iostream>
#include <vector>
#include <utility>

template<typename T>
inline T input(){T t; std::cin >> t; return t;}

class time{
    int hour;
    int minute;
public:
    time(int h, int m):hour(h), minute(m){}
    time(const time&) = default;
    friend std::ostream& operator<<(std::ostream& os, const time& t){
        os << t.hour << ':';
        if(t.minute < 10)
            os << '0';
        return os << t.minute;
    }
    friend bool operator==(const time& lhs, const time& rhs){
        return lhs.hour == rhs.hour && lhs.minute == rhs.minute;
    }
    friend bool operator!=(const time& lhs, const time& rhs){
        return !(lhs == rhs);
    }
    friend bool operator<(const time& lhs, const time& rhs){
        return lhs.hour < rhs.hour || ( lhs.hour == rhs.hour && lhs.minute < rhs.minute);
    }
    friend bool operator>(const time& lhs, const time& rhs){
        return rhs < lhs;
    }
    friend bool operator<=(const time& lhs, const time& rhs){
        return !(rhs < lhs);
    }
    friend bool operator>=(const time& lhs, const time& rhs){
        return !(lhs < rhs);
    }
};

std::vector<class time> create_times(){
    auto N = input<int>();
    std::vector<class time> vec;
    vec.reserve(N);
    while(N--){
        const auto h = input<int>();
        const auto m = input<int>();
        vec.emplace_back(h, m);
    }
    return std::move(vec);
}

std::vector<class time> merge_times(const std::vector<class time>& i, const std::vector<class time>& t){
    std::vector<class time> dest;
    dest.reserve(i.size() + t.size());
    auto iit = i.begin();
    auto tit = t.begin();
    const auto ie = i.end();
    const auto te = t.end();
    while(iit != ie && tit != te){
        if(*iit == *tit){
            dest.emplace_back(*iit);
            ++iit;
            ++tit;
            continue;
        }
        auto& it = *iit < *tit ? iit : tit ;
        dest.emplace_back(*it++);
    }
    if(iit == ie && tit != te)
        while(tit != te)
            dest.emplace_back(*tit++);
    if(tit == te && iit != ie)
        while(iit != ie)
            dest.emplace_back(*iit++);
    return std::move(dest);
}

int main(){
    std::ios::sync_with_stdio(false);
    const auto iimoriyama = create_times();
    const auto tsurugajou = create_times();
    const auto merged = merge_times(iimoriyama, tsurugajou);
    for(auto&& x : merged){
        std::cout << x;
        if(x != *merged.rbegin())
            std::cout << ' ';
    }
    std::cout << std::endl;
}

Measured memory_bytes: 1204
import java.util.Scanner;

//Blur
public class Main{

	int[][] dir = {{0,0},{-1,0}, {0,-1},{0,1},{1,0},{-1,-1},{-1,1},{1,-1},{1,1,},{-2,0},{0,-2},{0,2},{2,0}};
	int[] num = {0, 5, 9, 13};
	int[][] a, res;
	int L, V;

	boolean f(int i, int j, int k, int drop){
		if(V==0)return true;
		if(k==L)return false;
		if(!check(i, j))return false;
		if(drop<1)return f(i, j+1, k, 3);
		if(i==9)return false;
		if(j==9)return f(i+1, 1, k, 3);
		if(a[i][j]==0)return f(i, j+1, k, 3);
		if(e(i, j, drop)){
			for(int K=0;K<num[drop];K++)a[i+dir[K][0]][j+dir[K][1]]--;
			res[k][0] = j;
			res[k][1] = i;
			res[k][2] = drop;
			V-=num[drop];
			if(f(i, j, k+1, drop))return true;
			V+=num[drop];
			for(int K=0;K<num[drop];K++)a[i+dir[K][0]][j+dir[K][1]]++;
		}
		return f(i, j, k, drop-1);
	}
	
	boolean check(int i, int j){
		i-=2;
		if(j<3){
			i--; j=9;
		}
		else j-=3;
		while(0<=i && 0<=j){
			if(a[i][j]>0)return false;
			if(j==0){
				i--; j=9;
			}
			else j--;
		}
		return true;
		
	}
	
	boolean e(int i, int j, int drop){
		for(int k=0;k<num[drop];k++){
			int ni = i+dir[k][0], nj = j+dir[k][1];
			if(ni<0||9<ni||nj<0||9<nj||a[ni][nj]==0)return false;
		}
		return true;
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		a = new int[10][10];
		L = sc.nextInt();
		V = 0;
		for(int i=0;i<10;i++)for(int j=0;j<10;j++){
			a[i][j]=sc.nextInt();
			V+=a[i][j];
		}
		res = new int[L][3];
		f(1, 1, 0, 3);
		for(int[]r:res)System.out.printf("%d %d %d\n", r[0], r[1], r[2]);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 182904
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
using namespace std;

const long long MOD = 1000000007;


int main() {
  int N, M,X;
  cin >> N >> M >> X;
  vector<int> cost(N);
  vector<vector<int>> A(N,vector<int>(M));

  REP(n,N){
    cin >> cost[n];
    REP(m,M){
      cin >> A[n][m];
    }
  }

  int ansmax = 100000000;
  int ans = ansmax;
  // Exhaustive search for bit
  for (int bit = 0; bit < (1<<N); ++bit){
    vector<int> S(N);
    REP(n,N) S[n] = 0;
    for (int i = 0; i < N; ++i) if (bit & (1<<i)) S[i] = 1;

    vector<int> rikai(M);
    REP(m,M) rikai[m] = 0;
    int money = 0;
    REP(n,N){
      if (S[n] == 1){
        money += cost[n];
        REP(m,M){
          rikai[m] += A[n][m];
        }
      }
    }

    bool flag = true;
    REP(m,M){
      if (rikai[m] < X) flag = false;
    }

    if (flag == true) {
      ans = min(ans,money);
    }

  }

  if (ans == ansmax){
    cout << -1 << endl;
  }else{
    cout << ans << endl;
  }

}


Measured memory_bytes: 3636
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint,time,random
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

def cal(T):
    res = 0
    last = [0] * 26
    for day in range(D):
        t = T[day]; t -= 1
        last[t] = 0
        res += s[day][t]
        for i in range(26):
            if i == t: continue
            last[i] += 1
            res -= c[i] * last[i]
    return res
def check_change(td,tq):
    global score,res
    old_q = res[td]
    res[td] = tq
    now = cal(res)
    if now > score:
        score = now
    else:
        res[td] = old_q
def out():
    global res
    for x in res:
        print(x)
    quit()

start_time = time.time()
n = 26
D = inp()
c = inpl()
s = []
max_s = []
for i in range(D):
    tmp = inpl()
    mx = 0; ind = -1
    for j in range(n):
        if tmp[j] > mx:
            mx = tmp[j]
            ind = j
    max_s.append(ind+1)
    s.append(tmp)

last = [0] * n
res = [-1] * D
for d in range(D):
    ans = -1
    mx = -INF
    for i in range(n):
        now = s[d][i]
        for j in range(n):
            if i == j: continue
            now -= s[d][j] * (last[j]+1)
        if now > mx:
            mx = now
            ans = i
    res[d] = ans+1
    for j in range(n):
        last[j] += 1
        if j == ans: last[j] = 0
score = cal(res)
# print(now_score)
for x in itertools.combinations(range(D), 2):
    if time.time() - start_time > 1.83: out()
    old = []
    if sum(x^y for x,y in zip(res,max_s)) == 0: continue
    for i in range(2):
        old.append(res[x[i]])
        res[x[i]] = max_s[x[i]]
    now = cal(res)
    if now > score:
        score = now
    else:
        for i in range(2):
            res[x[i]] = old[i]
while True:
    if time.time() - start_time > 1.83: out()
    td,tq = random.randrange(0,D), random.randrange(1,n+1)
    check_change(td,tq)


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

int main(){
    int n;
    cin >> n;
    vector<int> vec(n);

    for(int i=0; i<n; i++){
        cin >> vec.at(i);
    }
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());

    int a = 0, b = 0;
    for(int i=0; i<n; i+=2){
        a += vec.at(i);
    }
    for(int i=1; i<n; i+=2){
        b += vec.at(i);
    }

    cout << a - b << endl;
    
    return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	// read standard input
	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan(){
		// read line
		text := stdin.Text()
		// input value := "4 5 6"
		slice := strings.Split(text, " ")
		sum := 0
		for _, v := range slice {
			a, _ := strconv.Atoi(v)
			sum = sum + a
		}
		if sum >= 22 {
			fmt.Print("bust")
		} else if sum <= 21 {
			fmt.Print("win")
		}
	}
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
    private static final long MODVAL = 1000000007L;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        List<String> ls = new ArrayList<>();
        ls.add("a");
        for(int i=1; i<N; i++) {
            List<String> tmp = new ArrayList<>();
            for(String before : ls) {
                Set<String> ss = new HashSet<>();
                for(int k=0; k<before.length(); k++) {
                    ss.add(before.substring(k, k+1));
                }
                for(String s : ss) {
                    String ts = before + s;
                    tmp.add(ts);
                }
                int idx = ss.size();
                String plus = before + "abcdefghijkl".substring(idx, idx+1);
                tmp.add(plus);
            }
            ls = tmp;
        }
        for(String tmp : ls) {
            System.out.println(tmp);
        }
    }
}


Measured memory_bytes: 59504
import java.util.*;

public class Main{
    private static final Scanner scan = new Scanner(System.in);
    static boolean flag = false;

    public static void main(String[] args){

        int n = scan.nextInt();
        int[] d = new int[6];
        Dice[] dices = new Dice[n];


        for(int i = 0; i < n ; i++){
            for(int j = 0; j < 6; j++){
                d[j] = scan.nextInt();
            }
            Object objs = d;
            dices[i] = new Dice((Object) objs);
        }

        boolean ans = true;
        for(int i = 0; ans && i < n; i++){
            for(int j = i + 1; j < n; j++){
                if(dices[i].equals(dices[j])){
                    ans = false;
                    break;
                }
            }
        }
        System.out.println(ans? "Yes" : "No");
    }
}

class Dice{

    int[] _d = new int[6];
    public static final int
        TOP = 0, SOUTH = 1, EAST = 2,
        WEST = 3, NORTH = 4, BOTTOM = 5; // ?????°

    public Dice(Object  ...obj){ // ?????????????????????
        for(int i = 0; i < 6; i++){
            if(obj[0] instanceof int[]){
                int[] d = (int[]) obj[0];
                _d[i] = d[i];
            }
        }
    }

    public int[] showAll(){
        return _d;
    }

    @Override
    public boolean equals(Object obj){
        boolean result = false;
        Dice dice = (Dice) obj;
        for(int i = 0; i < 4; i++){
            for(int j = 0; j < 4; j++){
                if(Arrays.equals(showAll(), dice.showAll())){
                    result = true;
                    break;
                }
                dice.rollEast();
            }
            for(int j = 0; j < 4; j++){
                if(Arrays.equals(showAll(), dice.showAll())){
                    result = true;
                    break;
                }
                dice.rollNorth();
            }
            if(Arrays.equals(showAll(), dice.showAll())){
                result = true;
                break;
            }
            dice.rollRight();
        }
        return result;
    }

    public void rollSouth(){
        int tmp = _d[TOP];
        _d[TOP] = _d[NORTH];
        _d[NORTH] = _d[BOTTOM];
        _d[BOTTOM] = _d[SOUTH];
        _d[SOUTH] = tmp;
    }

    public void rollNorth(){
        int tmp = _d[TOP];
        _d[TOP] = _d[SOUTH];
        _d[SOUTH] = _d[BOTTOM];
        _d[BOTTOM] = _d[NORTH];
        _d[NORTH] = tmp;
    }

    public void rollEast(){
        int tmp = _d[TOP];
        _d[TOP] = _d[WEST];
        _d[WEST] = _d[BOTTOM];
        _d[BOTTOM] = _d[EAST];
        _d[EAST] = tmp;
    }

    public void rollWest(){
        int tmp = _d[TOP];
        _d[TOP] = _d[EAST];
        _d[EAST] = _d[BOTTOM];
        _d[BOTTOM] = _d[WEST];
        _d[WEST] = tmp;
    }

    public void rollRight(){
        int tmp = _d[SOUTH];
        _d[SOUTH] = _d[WEST];
        _d[WEST] = _d[NORTH];
        _d[NORTH] = _d[EAST];
        _d[EAST] = tmp;
    }
}

Measured memory_bytes: 29296
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i=0; i<int(n); i++)
using V = vector<int>;
using VV = vector<V>;
const int MOD = 998244353;

int main() {
  int N, S; cin >> N >> S;
  V a(N);
  rep(i, N) cin >> a[i];

  VV dp(N+1, V(S+1));
  rep(r, N) rep(s, S+1) {
    dp[r+1][s] = dp[r][s];
    dp[r+1][s] += (s >= a[r]) ? dp[r][s-a[r]] : 0;
    dp[r+1][s] += (s == a[r] || s == 0) ? 1 : 0;
    dp[r+1][s] %= MOD;
  }

  int ans = 0;
  rep(r, N) (ans += dp[r+1][S]) %= MOD;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 35584
N = int(input())
S = input()

counter = []
for i in range(1, N):
    temp = []
    temp.append(S[0:i])
    temp.append(S[i:N])
    matched_set = list(set(temp[0]) & set(temp[1]))
    counter.append(len(matched_set))

print(max(counter))

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(void){ 
  int K; 
  cin >> K;
  int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}; 
  cout << a[K-1] << endl;
 return 0; 
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

int n, m;
int a, b;

int main(){
	scanf("%d %d %d %d", &n, &m, &a, &b);
	printf("%d\n", n * m - a * m - n * b + a * b);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  long long int sum=0;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
  cin>>a[i];
  sort(a,a+n);
  for(int i=n-1;i>=0;i--)
  {
    sum+=a[i];
    k--;
    if(k==0)
    break;
  }
  cout<<sum;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<"!"<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin>>n;
  vector<pair<ll,ll>>pll(n);
  for(auto &a:pll)cin>>a.F>>a.S;
  reverse(ALL(pll));
  ll now=0;
  for(auto a:pll){
    now+=(a.S-(now+a.F)%a.S)%a.S;
  }
  cout<<now<<endl;
  return 0;
}


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

int main() {
    // your code goes here
    ll h, n, a, sum = 0;
    cin >> h >> n;
    for(ll i = 0; i < n; i++) {
        cin >> a;
        sum += a;
    }
    if (sum >= h) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int sum(int);

int main(){

    int n;
    cin>>n;
    cout<<(n%sum(n)==0?"Yes":"No")<<endl;
    
    return 0;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i < n; i++)
#define rep3(i, x, n) for(int i = x; i > n; i--)
const long long MOD = 1e9+7;
const long long INF = 1e15;
typedef long long ll;
typedef pair<ll, ll> P;

int main(){
    int H, W, A, B;
    cin >> H >> W >> A >> B;
    rep(i, H){
        if(i < B){
            rep(j, W){
                if(j < A) cout << 1;
                else if(j < W-1) cout << 0;
                else cout << 0 << endl;
            }
        }
        else{
            rep(j, W){
                if(j < A) cout << 0;
                else if(j < W-1) cout << 1;
                else cout << 1 << endl;
            }
        }
    }
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)




int H, W, N;
int U[505050];
//-----------------------------------------------------------------------------------
int E[32][505050];
void pre() {
	rep(i, 1, 32) rep(y, 0, H) rep(x, 0, W)
		E[i][y*W + x] = E[i - 1][E[i - 1][y*W + x]];
}
//-----------------------------------------------------------------------------------
int dis[505050];
bool chk(int t) {
	rep(i, 0, N) dis[i] = U[i];

	int i = 0;
	while (0 < t) {
		if (t % 2) rep(j, 0, N) dis[j] = E[i][dis[j]];
		t /= 2;
		i++;
	}

	set<int> s;
	rep(j, 0, N) s.insert(dis[j]);
	return s.size() == N;
}
//-----------------------------------------------------------------------------------
#define INF INT_MAX/2
int main() {
	cin >> H >> W >> N;
	rep(y, 0, H) rep(x, 0, W) {
		int a, b; scanf("%d%d", &a, &b);
		E[0][y*W + x] = a*W + b;
	}
	rep(i, 0, N) {
		int a, b; scanf("%d%d", &a, &b);
		U[i] = a*W + b;
	}

	pre();

	int lo = 0, hi = INF;
	while (lo + 1 != hi) {
		int md = (lo + hi) / 2;
		if (chk(md)) lo = md;
		else hi = md;
	}
	if (hi == INF) hi = -1;
	cout << hi << endl;
}

Measured memory_bytes: 48260
#include <iostream>
#include <string>

using namespace std;


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

Measured memory_bytes: 256
W,H,N=map(int,input().split())
top = H
right = W
left = 0
bot = 0
for i in range(N):
  x,y,a = map(int,input().split())
  if a == 1 and left < x:
    left = min(x,right)
  elif a == 2 and x < right:
    right = max(x,left)
  elif a == 3 and bot < y:
    bot = min(y,top)
  elif a == 4 and y < top:
    top = max(y,bot)
print((right - left)*(top - bot))

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


void solve() {
    int i,j,k,l,r,x,y; string s;
    bool exit = false;
    int A,B;
    cin>>A>>B;
    if(A<=8&&B<=8){
        cout<<"Yay!"<<endl;
    }else{
        cout<<":("<<endl;
    }
    /*cin>>N;
    vector<ll> V;
    FOR(x,N+1) {
            FOR(y,N+1) {
                    ll ret=1;
                    FOR(i,x) ret*=2;
                    FOR(i,y) ret*=5;
                    V.push_back(ret);
            }
    }
    sort(ALL(V));
    FORR(v,V) cout<<v<<endl;*/
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}



Measured memory_bytes: 256
import java.util.*;

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

        int X = sc.nextInt();

        if(X==3){
            System.out.println("YES");
        }
        else if(X==5){
            System.out.println("YES");
        }
        else if(X==7){
            System.out.println("YES");
        }
        else{
            System.out.println("NO");
        }

    }
}

Measured memory_bytes: 21716
#include<stdio.h>
int main(){
	int n;
	char str[10000];
	//A gede 65 Z gede 90 INGETTTT 65 90 65 90 65 90 65 90
	
	scanf("%d", &n);
	scanf("%s", str);
	
	for(int i=0; str[i]!='\0'; i++){
		if(str[i]+n>90) printf("%c", str[i]+n-26);
		else printf("%c", str[i]+n);
	}
	
}
		


Measured memory_bytes: 1616
import java.util.Scanner;

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

        int ans = 1000;
        boolean flag = false;
        int c;
        int t;
        for (int i = 0; i < N; i++) {
            c = sc.nextInt();
            t = sc.nextInt();

            if (t <= T && c <= ans) {
                ans = c;
                flag = true;
            }
        }

        if (flag) {
            System.out.println(ans);
        } else {
            System.out.println("TLE");
        }
    }
}


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

string s;
int x=0;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>s;
	for(int i=0;i<4;i++){
		if(s[i]=='+')
			x++;
		else
			x--;
	}
	cout<<x;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
using ll = int64_t;
using P = pair<ll,ll>;
ll INF = 1000000007;
// ll INF = 9223372036854775807;
// ll INF = 998244353;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    string s;
    cin >> s;
    ll res = 0;
    rep(i,s.size()) res += s.at(i)=='1';
    cout << res << endl;
}

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

#define    int               long long int
 #define    bp(x)         __builtin_popcount(x)
#define  ld         long double
 #define  f(i,j,n)            for(int i = j; i <= n; i++)
#define  r(i,n,j)       for(int i = n; i >= j; i--)
 #define  all(container)       container.begin() , container.end()
#define  sz(container)   (int)container.size()
 #define  ff             first
#define  ss             second
 #define  pii      pair <int , int>
#define  sp(x)       setprecision(x)
#define  mod   998244353
#define  endl  "\n"
 #define  pb    push_back
#define  mp    make_pair
 #define  T     int ttt; cin >> ttt; while(ttt--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

int vis[100005];
deque<int>v;
int32_t main()
{
    fast
    int n,ini,m;  cin>>n>>ini>>m;
    vis[ini] = 1;
    v.pb(ini);
    int ans=0,rem=0,temp=0;
    f(i,1,n-1) 
    {
        int x = (v[i-1] * v[i-1]) % m;
        if(vis[x]) 
        {
            rem = n-i;
            temp = x;
            break;
        }
        vis[x] = x;
        ans += x;
        v.pb(x);
    }  
    ans=ans+ini;
    if(rem) {
        while(v.front() != temp) v.pop_front();
        int l= sz(v);
        int res = rem%l;
        int tot = rem/l;
        int sum = 0;
        for(auto i : v) sum += i;

        ans += (tot * sum);
        f(i,0,res-1)
        ans += v[i];
    }
    cout<<ans;
}

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

int main(){
    int N,i;
    double x,Total;
    string u;
    cin >> N;
    x=0;
    for(i=0;i<N;i++){
        cin >> x >> u;
        if(u=="JPY"){
            Total += x;
        }
        else if(u=="BTC"){
            Total += x*380000.0;
        }
    }
    cout << Total << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int main()
{
    //int t;cin>>t;while(t--)
    {
        ll b,c,d,i,j,k,l,m,n,cnt=0,sum=0;
        char a;
        cin>>a;
        if(a>='a' && a<='z')
            cout<<'a'<<endl;
        if(a>='A' && a<='Z')
            cout<<'A'<<endl;



    }
}


Measured memory_bytes: 3620
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,f;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(a<c) e=c;
	else e=a;
	if(b<d) f=b;
	else f=d;
	if(e>f) printf("0\n");
	else printf("%d\n",f-e);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main () {
  long long A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  long long count = 0;
  if(C * 2 < A + B) {
    int mini = min(X, Y);
    count += mini * 2 * C;
    X -= mini;
    Y -= mini;
    if(X > Y) {
      if (C * 2 > A)  count += A * X;
      else count += C * 2 * X;
    } else {
      if (C * 2 > B)  count += B * Y;
      else count += C * 2 * Y;
    }
  } else {
    count += X * A;
    count += Y * B;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define adj_list vector<vi>
#define endl "\n"
#define INF_INT 2e9
#define INF_LL 2e18
#define matmax 25
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define pi pair<int, int>
#define pii pair<int, pair<int, int> >
#define pl pair<ll, ll>
#define pll pair<ll, pair<ll, ll> >
#define vi vector<int>
#define vl vector<ll>
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long int ll;

int lsone(int n)
{
	return (n&-n);
}

ll pow1(ll a, ll b)
{
	if (b == 0)
		return 1ll;
	else if (b == 1)
		return a;
	else
	{
		ll x = pow1(a, b/2);
		x *= x;
		x %= mod;
		if (b%2)
		{
			x *= a;
			x %= mod;
		}
		return x;
	}
}

int h, w, a, b;
ll fact[220000], factinv[220000];
int main()
{
	fastio;		

	fact[0] = 1;
	factinv[0] = 1;
	for (int i = 1; i <= 200000; i++)
	{
		fact[i] = fact[i-1]*i;
		fact[i] %= mod;

		factinv[i] = pow1(fact[i], mod-2);
	}

	cin>>h>>w>>a>>b;

	if (0)
	{
		ll ans = (fact[h+w-2]*factinv[h-1])%mod;
		ans *= (factinv[w-1]);
		ans %= mod;

		ll rem = (fact[h+b-2]*factinv[h-1])%mod;
		rem *= (factinv[b-1]);
		rem %= mod;

		ll rem2 = (fact[(h+w-2)-(h+b-2)]*factinv[w-b])%mod;

		rem = rem*rem2;
		rem %= mod;

		ans = (ans + mod - rem)%mod;

		cout<<ans<<"\n";
	}
	else
	{
		ll ans = (fact[h+w-2]*factinv[h-1])%mod;
		ans *= (factinv[w-1]);
		ans %= mod;

		ll rem = 0;

		for (int i = 0; i <= b-1; i++)
		{	
			if (i == b-1)
			{
				ll curr = (fact[h-a+i]*factinv[h-a])%mod;
				curr *= (factinv[i]);
				curr %= mod;
				ll curr2 = (fact[(h+w-2)-(h-a+i)]*factinv[(h-1)-(h-a)])%mod;
				curr2 *= (factinv[(w-1)-i]);
				curr2 %= mod;

				curr = (curr*curr2)%mod;

				rem += curr;
				rem %= mod;
			}
			else
			{
				ll curr = (fact[h-a+i]*factinv[h-a])%mod;
				curr *= (factinv[i]);
				curr %= mod;
				ll curr2 = (fact[(h+w-2) - (h-a+1+i)]*factinv[(h-1)-(h-a+1)])%mod;
				curr2 *= (factinv[(w-1)-i]);
				curr2 %= mod;

				curr = (curr*curr2)%mod;

				rem += curr;
				rem %= mod;
			}
		}

		//cout<<ans<<" "<<rem<<"\n";

		ans = (ans + mod - rem)%mod;

		cout<<ans<<"\n";
	}

	return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define rep(i, a) for(int i=0; i<int(a); i++)
#define all(x) begin(x), end(x)
#define VI vector<int>
using namespace std;
typedef long long LL;

const int MAX_N=100005;
VI A;
map<int,int> M;

int main() {
    int n;
    cin >> n;
    A.resize(n);
    rep(i, n) cin >> A[i], M[A[i]]++;

    int ans = n, count=0;
    for(auto a:M) {
        if(a.second==2) count++;
        if(a.second > 2) {
            if(a.second%2==0) {
                ans -= a.second - 2;
                M[a.first] = 2;
                count++;
            } else {
                ans -= a.second - 1;
                M[a.first] = 1;
            }
        }
    }
    if(ans > 2) {
        if(count % 2) count++;
        ans -= count;
    }
    cout << ans << endl;
    return 0; 
}

Measured memory_bytes: 5376
#include<stdio.h>

long long int calculate(int length)
{
	int i;
	long long int fans=0,ans=1;
	
	for(i=1;i<=length;i++)
	{
		ans*=26;
		fans+=ans;
	}
	
	return fans;
}

int main(void)
{
  long long int number,x;
	int length=1,i;
  char *str;
  
  scanf("%lld",&number);
  
  while(number>calculate(length))
  {
    length++;
  }
  
  str=(char *)malloc(sizeof(char)*length);
  x=number-calculate(length-1)-1;
  
  for(i=0;i<length;i++)
  {
  	str[i]='a'+x%26;
    x/=26;
  }
  
  for(i=length-1;i>=0;i--)
  {
    printf("%c",str[i]);
  }
	
	free(str);
  
  return 0;
}

Measured memory_bytes: 2092
// In the name of God

#include <bits/stdc++.h>

using namespace std;

#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define debug(x) cout << #x ": " << x << endl;

int main() {
	IOS
	int n;
	cin >> n;
	long long ans = 0;
	for(int i=0; i<n; i++) {
		long long x;
		cin >> x;
		ans = __gcd(ans, x);
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

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

	unsigned N;
	cin >> N;

	double value = 0;
	double x;
	string u;
	for (unsigned i = 0; i < N; ++i) {
		cin >> x;
		cin >> u;
		if (u == "JPY") {
			value += x;
		}
		else {
			value += x * 380000.0;
		}
	}

	cout << value;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>
#include <list>
#include <set>
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
using namespace std;
using ll = long long;
const int INF = 1e9 + 1;
ll MOD = 1e9+7;

string N;
ll ans = 0;

void rec(string num){
    if(num != "" && stoi(num) <= stoi(N) && num.find('3') != std::string::npos && num.find('5') != std::string::npos && num.find('7') != std::string::npos){
        ans++;
    }

    if(num.size() == N.size()){
        return;
    }
    
    rec(num + '3');
    rec(num + '5');
    rec(num + '7');
    return;
}

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

    int N;
    cin >> N;
    vector<ll> vx(N), vy(N), vh(N);
    int si = -1;
    
    REP(i, N){
        cin >> vx[i] >> vy[i] >> vh[i];
        if(vh[i] > 0){
            si = i;
        }
    }
    
    ll ans_x = -1, ans_y = -1, ans_h = -1;
    REP(x, 101){
        REP(y, 101){
            ll h = vh[si] + abs(x - vx[si]) + abs(y - vy[si]);
            bool ok = true;
            REP(i, N){
                if(vh[i] > 0 && h - vh[i] != abs(x - vx[i]) + abs(y - vy[i])){
                    ok = false;
                }
                if(vh[i] == 0 && h > abs(x - vx[i]) + abs(y - vy[i])){
                    ok = false;
                }
            }
            if(ok){
                ans_x = x;
                ans_y = y;
                ans_h = h;
            }
        }
    }
    cout << ans_x << " " << ans_y << " " << ans_h << endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;


public class Main {
    static int pow(int a, int b){
        int ans = 1;
        for(int i=0; i<b; i++) ans *= a;
        return ans;
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

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

        long cycle = 1900*M+100*(N-M);
        int trial = pow(2, M);
        System.out.println(cycle*trial);
    }
}


Measured memory_bytes: 21972
import math

a,b=list(map(int,input().split()))
min_num=min(a,b)
gcd=[]

def prime(n):
  if n==1:
    return True
  for i in range(2,int(math.sqrt(n))+1):
    if n%i==0:
      return False
  return True

for i in range(1,int(math.sqrt(min_num)+1)):
  if a%i==0:
    if b%i==0:
      gcd.append(i)
    if b%(a//i)==0:
      gcd.append(a//i)

prime_list=[]
for i in gcd:
  if prime(i):
    prime_list.append(i)
if a==1 or b==1:
  print(len(prime_list)-1)
else:
  print(len(prime_list))


    


      
  


Measured memory_bytes: 3280
import java.util.*;

class Node{
	int key;
	int parent = -1;
	int left = -1;
	int right = -1;
	public Node(int key){
		this.key = key;
	}
}

class Tree{
	Node[] nodes;
	int root = -1;

	public Tree(int n){
		nodes = new Node[n];
	}

	public void printPreorder(){
		printPre(root);
		System.out.println();
	}

	private void printPre(int id){
		if(id == -1)
			return;
		System.out.print(" " + nodes[id].key);
		printPre(nodes[id].left);
		printPre(nodes[id].right);
	}

	public void printInorder(){
		printIn(root);
		System.out.println();
	}

	private void printIn(int id){
		if(id == -1)
			return;
		printIn(nodes[id].left);
		System.out.print(" " + nodes[id].key);
		printIn(nodes[id].right);
	}

	public void insert(int i, int key){
		nodes[i] = new Node(key);
		insert(i);
	}

	private void insert(int z){
		int y = -1;
		int x = root;
		while(x != -1){
			y = x;
			if(nodes[z].key < nodes[x].key)
				x = nodes[x].left;
			else
				x = nodes[x].right;
		}
		nodes[z].parent = y;

		if(y == -1)
			root = z;
		else if(nodes[z].key < nodes[y].key)
			nodes[y].left = z;
		else
			nodes[y].right = z;
	}
}

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

		Tree t = new Tree(n);

		for(int i = 0; i < n; i++)
			if(scan.next().equals("insert"))
				t.insert(i, scan.nextInt());
			else{
				t.printInorder();
				t.printPreorder();
			}

		scan.close();
		System.exit(0);
	}
}

Measured memory_bytes: 219208
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Collection;
import java.util.LinkedList;
import java.util.Queue;

class Main{
          public static void main(String[] args) {
                  Scanner scan = new Scanner(System.in);
                  int N = scan.nextInt();
                  int result = 0;
                  for (int i = 1; i <= N; i++) {
                          result += i;
                  }
                  System.out.println(result);
                  }
}


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i,n){
		int b;
		cin >> b;
		--b;
		a[b] = i;
	}
	set<ll> st;
	st.insert(-1);
	st.insert(n);
	ll ans = 0;
	rep(i,n){
		auto idx = st.lower_bound(a[i]);
		ll r = *idx;
		ll l = *(--idx);
		ans += (i+1) * (a[i] - l) * (r - a[i]);
		st.insert(a[i]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 14272
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <random>
#include <chrono>
#include <string>
#include <cstring>
#include <bitset>
#include <cassert>
#include <queue>
#include <deque>
#include <memory>

//#pragma comment(linker, "/STACK:16777216")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,abm,mmx,avx,avx2,popcnt,tune=native")

using namespace std;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

#define ll long long
#define ull unsigned long long
//#define double long double
#define int ll
//#define int ull
//#define int short
//#define int unsigned short
//#define int unsigned int
#define mp make_pair
#define F first
#define S second
#define pii pair<int, int>
#define hash hash228
const int SZ = 2e5 + 4;
const double EPS = 1e-7;
const int mod = 1e9 + 7;
const int hashpow = 2;
const int inf = 2e9;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int x;

inline void read() {
    cin >> x;
}

inline void solve() {
    for (int i = -1000; i <= 1000; ++i) {
        for (int j = -1000; j <= 1000; ++j) {
            if (i * i * i * i * i - j * j * j * j * j == x) {
                cout << i << " " << j << "\n";
                return;
            }
        }
    }
}

signed main() {

#ifdef __LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif

//    int t;
//    cin >> t;
//    for (int i = 0; i < t; ++i) {
    read();
    solve();
//    }

    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int dp[100000];
int arr[100000];
int n;
int solve(int indx){
    if(indx == n)
        return 0;

    if(indx == n-1)
        return 0;

    if(dp[indx] != -1 )
        return dp[indx];
    if(indx == n-2)
       return dp[indx]= solve(indx+1) + abs(arr[indx] - arr[indx+1]);



   return dp[indx] = min(solve(indx+1)+abs(arr[indx] - arr[indx+1]), solve(indx+2)+abs(arr[indx] - arr[indx+2]));

}







int main() {

    cin >> n;

    for(int i=0;i<n;i++){
        cin >> arr[i];
    }

    memset(dp, -1 , sizeof(dp));
    cout << solve(0);
    return 0;
}


Measured memory_bytes: 6772
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[] = new int[n];
		int max = 0;
		int freq[] = new int[n];
		for(int i=0;i<n;i++) {
			a[i] = sc.nextInt();
			max = Math.max(max,a[i]);
			freq[a[i]]++;
		}
		if(max==1) {
			if(n>2) {
				System.out.println("Impossible");
			}
			else {
				if(freq[1]!=2) {
					System.out.println("Impossible");
				}
				else {
					System.out.println("Possible");
				}
			}
			return;
		}
		if(max%2==0) {
			if(freq[max/2]!=1) {
				System.out.println("Impossible");
				return;
			}
			for(int i=0;i<max/2;i++) {
				if(freq[i]>0) {
					System.out.println("Impossible");
					return;
				}
			}
			for(int i=max/2+1;i<=max;i++) {
				if(freq[i]<2) {
					System.out.println("Impossible");
					return;
				}
			}
			System.out.println("Possible");
			return;
		}
		else {
			if(freq[(max+1)/2]!=2) {
				System.out.println("Impossible");
				return;
			}
			for(int i=0;i<(max+1)/2;i++) {
				if(freq[i]>0) {
					System.out.println("Impossible");
					return;
				}
			}
			for(int i=(max+1)/2;i<=max;i++) {
				if(freq[i]<2) {
					System.out.println("Impossible");
					return;
				}
			}
			System.out.println("Possible");
			return;
		}
	}
}


Measured memory_bytes: 36156
#include <stdio.h>

int main(void)
{
	int want[100];
	int blood[100];
	int n, k;
	
	while (1){
		scanf("%d%d", &n, &k);
		if (n == 0 && k == 0) break;
		
		for (int i = 0; i < k; i++){
			scanf("%d", &blood[i]);
		}
		for (int i = 0; i < k; i++){
			want[i] = 0;
		}
		for (int i = 0; i < n; i++){
			for (int j = 0; j < k; j++){
				int m;
				
				scanf("%d", &m);
				want[j] += m;
			}
		}
		
		int i;
		for (i = 0; i < k; i++){
			if (want[i] > blood[i]){
				break;
			}
		}
		printf("%s\n", i == k ? "Yes" : "No");
		
	}
	
	return (0);
}

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

long long n;
vector<long long> a;

long long solve();

int main() {
  cin >> n;
  a.resize(n);
  for (auto &p : a) cin >> p;
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long res = 0, now = 0;
  for (auto p : a) {
    if (now > p) res += now - p;
    now = max(now, p);
  }
  return res;
}

Measured memory_bytes: 4736
#include<iostream>
#include<string>
#include<ctype.h>
using namespace std;
int main() {
	string str;
	getline(cin, str);
	int len = str.length();
	for (int i = 0; i < len; i++) {
		if (isalpha(str[i])) {
			if (islower(str[i])) {
				str[i] = toupper(str[i]);
			}
			else if (isupper(str[i])) {
				str[i] = tolower(str[i]);
			}
		}
	}
	cout << str << endl;
	return 0;
}

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

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

    vector<int> a(4);
    a.at(3) = abcd % 10;
    abcd /= 10;
    a.at(2) = abcd % 10;
    abcd /= 10;
    a.at(1) = abcd % 10;
    abcd /= 10;
    a.at(0) = abcd %= 10;

    for (int op = 0; op < (1<<3); op++) {
        int total = a.at(0);
        vector<char> ops(3);
        for (int j = 0; j < 3; j++) {
            if (op & (1<<j)){
                total += a.at(j + 1);
                ops.at(j) = '+';
            } else {
                total -= a.at(j + 1);
                ops.at(j) = '-';
            }
        }
        if (total == 7) {
            cout << a.at(0) << ops.at(0) << a.at(1) << ops.at(1) << a.at(2) << ops.at(2) << a.at(3) << "=7" <<endl;
            break;

        }
    }

}

Measured memory_bytes: 256