akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define double long double
#define pii pair<int, int>
#define FOR(i, a, b) for(int i = a; i < (int)(b); ++i)
#define all(x) x.begin(), x.end()
#define deb(x) cout << (#x) << " is " << (x) << endl;
const int mod = 1000 * 1000 * 1000 + 7;
using namespace std;

inline int add(int a, int b){
	a += b;
	// if(a >= mod)
    //     a -= mod;
    a %= mod;
	return a;
}
 
inline int sub(int a, int b){
    // if (a < b) {
    //     a /= 0;
    // }
	a -= b;
	if(a < 0) {
        a += mod;
        // a /= 0;
    }
    // a %= mod;
	return a;
}

int32_t main() {
    int n, k;
    cin >> n >> k;
    int a[n + 1];
    FOR(i, 1, n + 1) {
        cin >> a[i];
    }
    int d[n + 1][k + 1];
    int p[n + 1][k + 1];
    memset(d, 0, sizeof(int) * (n + 1) * (k + 1));
    memset(p, 0, sizeof(int) * (n + 1) * (k + 1));
    FOR(i, 0, a[1] + 1) {
        d[1][i] = 1;
    }
    p[1][0] = d[1][0];
    FOR(i, 1, k + 1) {
        p[1][i] = add(p[1][i - 1], d[1][i]);
    }
    FOR(i, 2, n + 1) {
        FOR(j, 0, k + 1) {
            if (j - a[i] > 0) {
                d[i][j] = sub(p[i - 1][j], p[i - 1][j - a[i] - 1]);
            }
            else {
                d[i][j] = p[i - 1][j];
            }

            if (d[i][j] < 0) {
                d[i][j] /= 0;
            }

            if (j > 0) {
                p[i][j] = add(p[i][j - 1], d[i][j]);
            }
            else 
                p[i][j] = d[i][j];
                
        }
    }
    cout << d[n][k];
    return 0;
}

Measured memory_bytes: 161332
from itertools import accumulate
from collections import defaultdict


def main():
    n = int(input())
    prime_counter = defaultdict(int)  # key ^ value
    acc = tuple(accumulate(range(1, 42)))  # because 10^12 < 2^39

    def facs(n):
        yield 2
        max_x = int((n ** 0.5 - 3) / 2 + 1)
        for x in range(max_x):
            yield x * 2 + 3

    for fac in facs(n):
        while n % fac == 0:
            n //= fac
            prime_counter[fac] += 1
            # ここで if fac * fac > n: braek を入れると，
            # 計算量の少ないケースでは早く，多いケースでは遅くなる。
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter.values():
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9684
#include <stdio.h>

int max(int a,int b){
  if(a > b){
    return a;
  }
  return b;
}

int main(void){
  int N,a;
  int counter = 0;
  int ans = 0;
  int flag[9] = {0,0,0,0,0,0,0,0,0};
  scanf("%d",&N);

  for(int i = 0;i < N;i++){
    scanf("%d",&a);
    if(a < 400) flag[0] = 1;
    else if(a < 800) flag[1] = 1;
    else if(a < 1200) flag[2] = 1;
    else if(a < 1600) flag[3] = 1;
    else if(a < 2000) flag[4] = 1;
    else if(a < 2400) flag[5] = 1;
    else if(a < 2800) flag[6] = 1;
    else if(a < 3200) flag[7] = 1;
    else flag[8]++;
  }


  for(int i = 0;i < 8;i++){
    if(flag[i]) counter++;
  }
  printf("%d %d\n",max(1,counter),counter+flag[8]);
  return 0;
}

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

#define ll long long int
#define pb emplace_back
#define mod 1000000007
#define inf 1e16

double dp[301][301][301];

double solve(ll one, ll two, ll three, ll n){
    // cout<<one<<" "<<two<<" "<<three<<endl;
    if(one<0 || two<0 || three<0){
        return 0;
    }
    if(dp[one][two][three]!=-1){
        return dp[one][two][three];
    }
    if(one+two+three==0){
        return 0;
    }
    double p1 = double(one)/n;
    double p2 = double(two)/n;
    double p3 = double(three)/n;
    double p0 = double(n-one-two-three)/n;
    return dp[one][two][three] = (1 + p1*solve(one-1, two, three, n) + p2*solve(one+1, two-1, three, n) + p3*solve(one, two+1, three-1, n))/(1-p0);
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    cout<<fixed<<setprecision(9);
    
    ll n;
    cin>>n;
    ll one = 0, two = 0, three = 0;
    for(ll i=0; i<n; i++){
        ll ai;
        cin>>ai;
        one+=(ai==1);
        two+=(ai==2);
        three+=(ai==3);
    }
    for(ll i=0; i<301; i++){
        for(ll j=0; j<301; j++){
            for(ll k=0; k<301; k++){
                dp[i][j][k] = -1;
            }
        }
    }
    cout<<solve(one, two, three, n)<<"\n";
}


Measured memory_bytes: 213376
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    vector<long int> h(n);
    for(int i=0;i<n;i++){
        cin >> h[i];
    }
    bool ok = true;
    for(int i=n-1;i>0;i--){
        if(h[i-1]-h[i]>=1){
            --h[i-1];
            if(h[i-1]-h[i]>=1){
                ok=false;
                break;
            }
        } 
    }

    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1024
// Last Change: 07/31/2019 16:50:24.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

const ll MOD = 1e9 + 7;

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

  size_t sSize = s.size();
  vector<vector<ll>> ketaDP(sSize, vector<ll>(13, 0));
  if (s[0] == '?') {
    for (int i = 0; i < 10; ++i) {
      ketaDP[0][i] = 1;
    }
  } else {
    ketaDP[0][s[0] - '0'] = 1;
  }

  for (size_t i = 1; i < sSize; ++i) {
    for (int j = 0; j < 13; ++j) {
      if (s[i] == '?') {
        for (int k = 0; k < 10; ++k) {
          int val = j * 10 + k;
          ketaDP[i][val % 13] = (ketaDP[i][val % 13] + ketaDP[i - 1][j]) % MOD;
        }
      } else {
        int val = j * 10 + (s[i] - '0');
        ketaDP[i][val % 13] = ketaDP[i - 1][j];
      }
    }
  }

  cout << ketaDP[sSize - 1][5] << endl;
}



Measured memory_bytes: 13632
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
double dp[3010][3010];
int main()
{
  int n;cin >> n;
  vector<double> p(n);
  rep(i,n) cin >> p[i];


  rep(i,n+1) rep(j,n+1) dp[i][j] = 0;
  dp[0][0] = 1;

  rep(i,n) {
    rep(j,n+1) {
      dp[i+1][j] += dp[i][j]*(1 - p[i]);
      if(j != n) dp[i+1][j+1] += dp[i][j]*p[i];
    }
  }
  
  double res = 0;
  for (int i = (n+1)/2; i <= n; ++i) {
    res += dp[n][i];
  }

  printf("%.9f\n", res);
  
  return 0;
}


Measured memory_bytes: 70784
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())
A, B, C = map(int, input().split())

if A > B :
  A, B = B, A
  
if A < C < B :
  print ("Yes")
else :
  print ("No")




Measured memory_bytes: 38256
#include <iostream>
using namespace std;
int n;
int a[1000000];
int b[2][2000000];
int gdb(int n,int m){
    int tmp;
    if(n == 0){
        return m;
    }
    if(m == 0){
        return n;
    }
    if(n<m){
        tmp = m;
        m = n;
        n = tmp;
    }
    while(m != 0){
        tmp = m;
        m = n%m;
        n = tmp;
    }
    return n;
}
int main(){
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    b[0][0] = 0;
    for(int i=0;i<n;i++){
        b[0][i+1] = gdb(b[0][i],a[i]);
    }
    b[1][n] = 0;
    for(int i=1;i<=n;i++){
        b[1][n-i] = gdb(b[1][n-i+1],a[n-i]); 
    }
    int ans = 0;
    for(int i=0;i<n;i++){
        int tans = gdb(b[0][i],b[1][i+1]);
        if(tans > ans){
            ans = tans;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int n, m;
    int num;
    string answer;
    cin >> n >> m;
    vector<int> problem(n, 0);//問題の正答チェック 1で正答済み
    vector<int> problemWA(n, 0);
    
    int ACpoint = 0;
    int WApoint = 0;

    for(int i = 0; i < m; i++){
        cin >> num;
        cin >> answer;
        if(answer == "AC"){
            problem.at(num - 1) = 1;
        }else{
            if(problem.at(num - 1) == 0){
                problemWA.at(num - 1) = problemWA.at(num - 1) + 1;
            }
        }
    }

    for(int i = 0; i < n; i++){
        if(problem.at(i) == 1){
            ACpoint++;
            WApoint = WApoint + problemWA.at(i);
        }
    }

    cout << ACpoint << " " <<WApoint << endl;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int N,M;cin>>N>>M;

    int K=M*1900+(N-M)*100;
    cout<<K*(1<<M)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>

#define rep_ui(k,n)      for(ui  i = (k); i < (n); ++i)
#define rep_si(k,n)      for(int i = (k); i < (n); ++i)
#define rep_ul(k,n)      for(ul  i = (k); i < (n); ++i)
#define rep_sl(k,n)      for(ll  i = (k); i < (n); ++i)
#define rep_ui_down(k,n) for(ui  i = (k); i > (n); --i)
#define rep_si_down(k,n) for(int i = (k); i > (n); --i)
#define rep_ul_down(k,n) for(ul  i = (k); i > (n); --i)
#define rep_sl_down(k,n) for(ll  i = (k); i > (n); --i)

#define rep_uj(k,n)      for(ui  j = (k); j < (n); ++j)
#define rep_sj(k,n)      for(int j = (k); j < (n); ++j)
#define rep_uj_down(k,n) for(ui  j = (k); j > (n); --j)
#define rep_sj_down(k,n) for(int j = (k); j > (n); --j)

#define rep(k,n)         rep_ui(k,n)

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

template<class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vc)
{
  for (auto it = vc.begin(); it != vc.end(); ++it)
  {
    if (std::next(it) == vc.end())
      os << *it;
    else
      os << *it << ' ';
  }
  return os;
}

template<class T1, class T2>
inline
std::ostream & operator<<(std::ostream & os, const std::pair<T1, T2> & p)
{
  return os << p.first << ' ' << p.second;
}

void solve(void)
{
  using std::string;
  using std::vector;
  using std::map;
  using std::pair;
  using std::cin;
  using std::cout;
  ui H{}, W{}; cin >> H >> W;
  vector<vector<char>> vc(H, vector<char>(W));
  rep(0, H)
  {
    string s{}; cin >> s;
    rep_uj(0, W)
      vc[i][j] = s[j];
  }

  rep(0, H)
  {
    ui cnt{};
    rep_uj(0, W)
      if(vc[i][j] == '.') ++cnt;
    if(cnt == W)
    {
      rep_uj(0, W)
        vc[i][j] = ' ';
    }
  }
  rep_uj(0, W)
  {
    ui cnt{};
    rep(0, H)
      if(vc[i][j] == '.' || vc[i][j] == ' ') ++cnt;
    if(cnt == H)
    {
      rep(0, H)
        vc[i][j] = ' ';
    }
  }

  rep(0, H)
  {
    ui flg{};
    rep_uj(0, W)
    {
      if(vc[i][j] != ' ')
      {
        cout << vc[i][j];
        flg = true;
      }
    }
    if(flg) cout << '\n';
  }
  // cout << ans << '\n';
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>

using namespace std;

int main() {
  map<int,int> mymap;
  int n;
  cin>>n;
  int tmp;
  int maxn = 1;
  for (int i = 0; i < n; i++) {
    cin>>tmp;
    mymap[tmp]++;
  }

  for (auto m : mymap) {
    int num = m.first;
    int res = m.second;
    if (mymap.find(num + 1) != mymap.end()) {res += mymap[num + 1];}
    if (mymap.find(num + 2) != mymap.end()) {res += mymap[num + 2];}
    maxn = max(res,maxn);
  }
  cout<<maxn;
  return 0;
}

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

int main()
{
  int n;
  cin >> n;
  bool flag = false;
  while (n >= 1) {
    if (n % 7 == 0) flag = true;
    n -= 4;
    if (n == 0) flag = true;
  }

  if (flag) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;

}


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

#define MOD 998244353
#define comb(n,r) (fact[(n)]*(div[(r)]*div[(n)-(r)]%MOD)%MOD)

using namespace std;

long long exp(long long base, long long pw)
{
	long long temp;
	long long rvalue = 1;

	temp = base;

	while (pw)
	{
		if (pw % 2)
		{
			rvalue = rvalue*temp%MOD;
		}

		temp = temp*temp%MOD;

		pw /= 2;
	}

	return rvalue;
}

int main()
{
	long long n;
	long long fact[200001], div[200001];
	vector<long long> bits;
	vector<long long> depth[100001];
	long long temp;

	temp = MOD - 2;

	while (temp)
	{
		bits.push_back(temp % 2);

		temp /= 2;
	}

	scanf("%lld", &n);

	fact[0] = 1;
	div[0] = 1;
	fact[1] = 1;
	div[1] = 1;

	for (long long i = 2; i <= n * 2; i++)
	{
		long long temp;

		div[i] = 1;
		fact[i] = fact[i - 1] * i%MOD;

		temp = fact[i];

		for (int j = 0; j < bits.size(); j++)
		{
			if (bits[j])
			{
				div[i] = div[i] * temp%MOD;
			}

			temp = temp*temp%MOD;
		}
	}

	for (long long i = 0; i < n; i++)
	{
		long long input;

		scanf("%lld", &input);

		depth[input].push_back(i);
	}

	if (depth[0].size() != 1 || depth[0][0] != 0)
	{
		printf("0\n");

		return 0;
	}

	long long acc = 1;
	long long sol = 1;

	for (long long i = 1; i < n; i++)
	{
		if (depth[i].empty() && acc != n)
		{
			printf("0\n");

			return 0;
		}

		sol = sol*exp(depth[i-1].size(),depth[i].size()) % MOD;

		acc += depth[i].size();

		if (acc == n)
		{
			break;
		}
	}

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

	return 0;
}

Measured memory_bytes: 5760
import sys
sys.setrecursionlimit(10**6)
N, *A = map(int, open(0).read().split())
dic = [[] for i in range(N+1)]
for i in range(N-1):
  dic[A[i]] += [i+2]
def solve(n):
  if len(dic[n])==0:
    return 0
  ls = []
  for e in dic[n]:
    ls += [solve(e)]
  ls.sort(reverse=True)
  return max(ls[i]+i+1 for i in range(len(ls)))

print(solve(1))

Measured memory_bytes: 140004
//problem_a.go

package main

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

const (
	mod = 1000000007
)

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

// -----------------------------------------

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getIntSlice(n int) []int {
	ns := []int{}
	for i := 0; i < n; i++ {
		ns = append(ns, getInt())
	}
	return ns
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func getStringSlice(n int) []string {
	ss := []string{}
	for i := 0; i < n; i++ {
		ss = append(ss, getString())
	}
	return ss
}

func sortIntSlice(ns []int) []int {
	sort.Sort(sort.IntSlice(ns))
	return ns
}

func rsortIntSlice(ns []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(ns)))
	return ns
}

// -----------------------------------------

func solve() {
	n, r := getInt(), getInt()

	if n < 10 {
		fmt.Fprintln(wr, r+(100*(10-n)))
	} else {
		fmt.Fprintln(wr, r)
	}
}

// -----------------------------------------

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#ifndef _DEBUG
#define main_ main
#endif
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)

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

template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
	return left.second > right.second;
}

void init_global() {}

int main_() {
	char c;
	cin >> c;

	string ans = "consonant";
	if (c == 'a' || c == 'e' || c == 'i' ||
		c == 'o' || c == 'u') ans = "vowel";

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


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  int n;
  cin >> n;
  
  char s[4];
  int ac = 0, wa = 0, tle = 0, re = 0;
  for (int i = 0; i < n; i++)
  {
    cin >> s;
    switch(s[0])
    {
      case 'A': ac++; break;
      case 'W': wa++; break;
      case 'T': tle++; break;
      case 'R': re++; break;
    }
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
  
  return 0;
} 


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

int main(){
  long n,i,j,k,l,ans,cur,p,q;
  cin >> n;
  vector<pair<long,long>> x(n);
  for(i=0; i<n; i++){
    cin >> x[i].first >> x[i].second;
  }
  sort(x.begin(),x.end());
  
  ans=n;
  for(i=0; i<n; i++){
    for(j=i+1; j<n; j++){
      cur=n;
      p=x[j].first-x[i].first; q=x[j].second-x[i].second;
      for(k=0; k<n; k++){
        for(l=0; l<n; l++){
          if(x[l].first-x[k].first==p && x[l].second-x[k].second==q){
            cur--;
          }
        }
      }
      ans=min(ans,cur);
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int SIZE = 100001;
int A[SIZE];
int main(){
    int n, t; cin >> n >> t;
    int max_profit = 0, ans = 0;
    for (int i = 0; i < n; i++)
        cin >> A[i];
    int max_A = 0;
    for (int i = n-1; i > 0; i--)
    {
        max_A = max(A[i], max_A);
        if (max_profit < max_A - A[i-1]){
            ans = 1;
            max_profit = max_A - A[i-1];
        }
        else if (max_profit == max_A - A[i-1])
            ans++;
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 640
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, i321) => {
        read_value!($next, i32) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

//
// # Examples
//
// # integers
// input! { n: i32, m: i32, ... }
//
// # array
// input! { n: i32, v: [i32; n], }
//
// # matrix
// input! { n: i32, m: i32, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
//     h: i32,
//     w: i32,
//     board: [chars; h],
// }

// https://practice.contest.atcoder.jp/tasks/practice_1
//fn main() {
//    input!{
//        a: i32, b: i32, c: i32,
//        foo: chars,
//    }
//    let s: String = foo.into_iter().collect();
//    println!("{} {}", a+b+c, s);
//}
fn main() {
    input! { a: usize, b: usize }
    if (a*b)%2==0 { println!("Even"); } else { println!("Odd"); }
}

Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <map>
#include <cstdlib>
using namespace std;

#define MAX(i, j) ((i) > (j)) ? (i) : (j)
#define MIN(i, j) ((i) < (j)) ? (i) : (j)
#define ABS(i) (i) < 0 ? -(i) : i
#define PI (2 * acos(0))
#define SZ 100

char str[SZ];

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

    int i,  j, k, len;

    fgets(str, 25, stdin);
    len = strlen(str) - 1;

    if(str[len] == '\n'){
        str[len] = '\0';
    }

    if(str[5] == ',') str[5] = ' ';
    if(str[13] == ',') str[13] = ' ';

    printf("%s\n", str);

    return 0;

}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10000000)
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue

# import fractions

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = il()
    AB = {m + 1: [] for m in range(M+1)}
    for _ in range(M):
        a, b = il()
        AB[a].append(b)
        AB[b].append(a)

    visit = [0] * (N + 1)
    fifoqu = queue.Queue()
    fifoqu.put(1)

    while not fifoqu.empty():
        now = fifoqu.get()
        next = AB[now]
        for n in next:
            if visit[n] != 0:
                continue
            visit[n] = visit[now] + 1
            fifoqu.put(n)
    else:
        if visit[1] == 0:
            print('No')
            exit()
        else:
            visit[1] = 0
            print('Yes')
            for n in range(2, N + 1):
                deep = visit[n]
                rooms = AB[n]
                for room in rooms:
                    if visit[room] == deep - 1:
                        print(room)
                        break


if __name__ == '__main__':
    main()


Measured memory_bytes: 57100
#include <iostream>
#include<string>
#include<cstdio>
#include<string.h>
#include<vector>
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
const int N=110;
int tep[110];
int a[N][N];
//vector <vector<int> > a(1,vector<int >(1));
int t;

int main ()
{
    //std::ios::sync_with_stdio(false);
    int n;
    string s;
    cin>>s;
    int t=0;
    for(int i=0;i<3;i++){
        if(s[i]=='R'){
            t=1;
        for(i++;i<3;i++){
        if(s[i]=='R'){
            t++;
        }
        else{
            break;
        }
        }
        }
        if(t>0){
            break;
        }
    }
    cout<<t<<endl;
    return 0;
}

/*

*/


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

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

const ll INF=1LL << 60;

int main(){

  int N=0;
  cin>>N;
 
  int h[N+1][3];
  ll dp[N+1][3];
  rep(i,N+1){
	
    rep(k,3){
      cin>>h[i][k];
  	  dp[i][k]=-1;
    }
  }  
 
  rep(k,3)dp[0][k]=0;
  for(int i=1; i<N+1;i++){

    rep(j,3){
		rep(k,3){
      		if(j!=k)chmax(dp[i][j], dp[i-1][k]+h[i-1][j]);
    	}
    }
  }
  
  long long res = 0;
  for (int j = 0; j < 3; ++j) chmax(res, dp[N][j]);
  cout << res << endl;
  

}






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

typedef int64_t Int;
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << endl; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << std::endl;
}

int main() {
    Int n;
    cin >> n;
    vector<Int> a(n);
    for (Int i = 0; i < (Int)n; i++) {
        cin >> a[i];
    }
    Int sum = 0;
    for (Int i = 0; i < (Int)n; i++) {
        sum ^= a[i];
    }
    for (Int i = 0; i < (Int)n; i++) {
        cout << (sum ^ a[i]) << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 4784
#prime number
def is_prime(x):
    if x == 2:
        return True
    if x < 2 or x % 2 == 0:
        return False
    for i in range(3, int(x**0.5+1),2):
        if x % i == 0:
            return False
        
    return True

N = int(input())
cnt = 0
for _ in range(N):
    i = int(input())
    cnt += is_prime(i)
print(cnt)


Measured memory_bytes: 5668
#include <iostream>
#include <fstream>
#include <vector>
#include <climits>

#define NMAX 100001
using namespace std;

int DP[NMAX], n, initial[NMAX];

void read(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> initial[i];
    }
}

void solve(){
    for(int i = 2; i <= n; i++){
        DP[i] = INT_MAX;
    }

    for(int i = 1; i <= n-1; i++){
        DP[i + 1] = min(DP[i] + abs(initial[i] - initial[i+1]), DP[i+1]);
        if(i == i-1)break;
        DP[i + 2] = min(DP[i] + abs(initial[i] - initial[i+2]), DP[i+2]);


    }

    cout << DP[n] << '\n';
}

int main() {
    read();
    solve();
    return 0;
}

Measured memory_bytes: 1024
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <tuple>
# include <functional>
# include <utility>
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
long long int a = 0, b = 0, c = 0,d=0,ans=0, x = 0, y = 0, z = 0,n=0,m=0, maxy = 0, mini = 9999, counter = 0, endp = 0, checker = 0;

std::vector <char> vec{}, vecsec{}, vecth{};
long long int iremono[100001], sec[100001];
long long int iremono2[100001],check[100001];
std::vector<long long int>kinds{}, kaku{};
char islands[15][15];
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
bool okada = false, okada2 = false;
std::string output, output2, input,input2;
char rev[100001];


int ctoi(const char c) {
	if ('0' <= c && c <= '9') return (c - '0');
	return -1;
}
unsigned long long int LCM(unsigned long long int a, unsigned long long int b) {
	unsigned long long int i, j;
	i = a; j = b;
	while (true) {

		c = i % j;
		i = j;
		if (c != 0) {

			j = c;

		}
		else {
			break;
		}
	}
	return j * (a / j) * (b / j);
}
int kaizyo(int k) {
	int sum = 1;
	for (int i = 1; i <= k; ++i)
	{
		sum *= i;
	}
	return sum;
}
void dfs(int h, int w) {
	islands[h][w]='0';
	for (int i = 0; i < 4; i++) {
		if (h + dx[i] >= 0 && h + dx[i] <= 12 && w + dy[i] >= 0 && w + dy[i] <= 12 && islands[h + dx[i]][w + dy[i]] == '1') {
			dfs(h + dx[i], w + dy[i]);
		}
	}
}
int main()
{
	string a;
	while (cin >> a) {
		for (int i = 0; i < 12; i++) {
			for (int j = 0; j < 12; j++) {
				islands[i][j] = a[j];
			}
			if (i != 11) {
				cin >> a;
			}
		}
		int answer = 0;
		for (int i = 0; i < 12; i++) {
			for (int j = 0; j < 12; j++) {
				if (islands[i][j] == '1')dfs(i, j), answer++;
			}	
		}
		cout << answer << endl;
	}
}


Measured memory_bytes: 3140
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        long n = Long.parseLong(sc.next());
        long m = Long.parseLong(sc.next());
        sc.close();

        // 主処理
        long count = 0;
        if (m / 2 <= n) {
            count = m / 2;
        } else {
            long remainC = m - (n * 2);
            count = remainC / 4 + n;
        }
        long result = count;

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 21844
N = list(map(int, list(input())))

if N[0] > N[1]:
	print(N[0] * 111)
elif N[0] == N[1]:
	if N[1] >= N[2]:
		print(N[0] * 111)
	else:
		print((N[0] + 1) * 111)

else:
	print((N[0] + 1) * 111)

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

int main()
{
ll a , b ;
cin >> a >> b ;
ll te=1;
while(1){
  if(te>=b)break;
  te+=a-1;
  ans++;
}

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


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNIGNS 
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>

using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> pll;

int main(void)
{
	int x, a, b;
	cin >> x >> a >> b;
	cout << (x - a) % b;
	return 0;
}



Measured memory_bytes: 256
//
import java.math.*;
import java.util.*;
import java.io.*;
  
public class Main { 
  
    static BufferedReader in;
    static PrintWriter out = new PrintWriter(System.out);
    static String file = "../in";
    static int test = 10; // 0 for local testing, 1 for std input
    static int inf = 1_000_000, mod = 1_000_000_007;

    void swap(int[]ary, int i, int j)
    {
        int t = ary[i];
        ary[i] = ary[j];
        ary[j] = t;
    }
    
    String[] split() throws Exception
    {
        return in.readLine().split(" ");
    }

    int readInt() throws Exception
    {
        return Integer.valueOf(in.readLine());
    }

    int[] toIntArray() throws Exception
    {
        String[] sp = split();
        int n = sp.length;
        int[] ary = new int[n];
        for(int i = 0; i < n; i++) ary[i] = Integer.valueOf(sp[i]);
        return ary;
    }

    String reverse(String str)
    {
        return new StringBuilder(str).reverse().toString();
    }


    long pow(long a, int pow)
    {
        long res = 1;
        while(pow > 0)
        {
            if(pow % 2 != 0) {
                res *= a;
                res %= mod;
            }
            a = a * a;
            a %= mod;
            pow /= 2;
        }

        return res;
    }

    public static void main(String[] args) throws Exception
    {
        int _k = Integer.valueOf("1");
        if(test > 0) in = new BufferedReader(new InputStreamReader(System.in));
        else in = new BufferedReader(new FileReader(file));
        if(test < 0) {String[] str = in.readLine().split(" ");}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
        // System.out.println((-100 + 0) / 2);

        new Main().a();
        out.flush();
    }

    void a() throws Exception
    {
        int n = readInt();
        
        out.println((n + 1) / 2);
    }
}

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

int main(){
  int i,j,cnt;
  ll x;
  cin>>x;
  if(x%11==0)cout<<(x/11)*2;
  else if(x%11>6)cout<<2+(x/11)*2;
  else if(x%11<=6)cout<<1+(x/11)*2;
}

Measured memory_bytes: 256
#include <stdio.h>
int check(int a,int b,int c)
{
    //printf("[%d][%d][%d]\n",a,b,c);
    if(a != 14)return 0;
    else if(b == 23)return 1;
    else if(b == 1 && c == 10)return 1;
    else if(b == 19 && c == 19)return 1;
    else return 0;
}

int main()
{
    int longth,mem = 0;
    while(1)
    {
        char str[90] = {0};
        int mem1[90] = {0},mem2[90] = {0};
        if(scanf("%c",&str[0]) == -1)return 0;
        if(str[0] >= 'a' && 'z' >= str[0])mem1[0] = str[0] - 'a' + 1;
        for(int i = 1; i < 80; i++)
        {
            scanf("%c",&str[i]);
            if(str[i] == '\n')break;
            longth = i;
            if(str[i] >= 'a' && 'z' >= str[i])mem1[i] = str[i] - 'a' + 1;
        }
        for(int i = 0; i < longth; i++)
        {
            if(mem1[i] == 0);
            else if(mem1[i + 1] != 0)
            {
                if(mem1[i] <= mem1[i + 1])mem2[i] = mem1[i + 1] - mem1[i];
                else mem2[i] = 26 - mem1[i] + mem1[i + 1];
            }
        }
        /*for(int i = 0; i < longth; i++)
        {
            printf("[%d]",mem2[i]);
        }
        printf("\n");*/
        for(int i = 0; i < longth; i++)
        {
            if(mem2[i] != 0)/*printf("[%d]\n",i);*/if(check(mem2[i],mem2[i + 1],mem2[i + 2]))if(mem1[i] <= 20)mem = 20 - mem1[i];else mem = 26 - mem1[i] + 20;
            //else printf("no\n");
        }
        //printf("{{%d}}\n",mem);
        for(int i = 0; i < longth + 1; i++)
        {
            if(str[i] >= 'a' && 'z' >= str[i])printf("%c",(str[i] - 'a' + mem) % 26 + 'a');
            else printf("%c",str[i]);
        }
        printf("\n");
    }
}

Measured memory_bytes: 2496
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int K, T;
int a[110];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> K >> T;
  priority_queue<int> que;
  for (int i = 0; i < T; i++) {
    cin >> a[i];
    que.emplace(a[i]);
  }
  while (true) {
    if (que.size() == 0) {
      cout << 0 << endl;
      return 0;
    }
    if (que.size() == 1) {
      cout << que.top()-1 << endl;
      return 0;
    }
    int a = que.top(); que.pop();
    int b = que.top(); que.pop();
    a -= b;
    if (a) que.emplace(a);
  }

  return 0;
}

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

int N;
string S, A, B;
map<pair<string, string>, int> MP;

int main(void){
    
    cin >> N >> S;
    A = S.substr(0, N), B = S.substr(N);
    reverse(B.begin(), B.end());
    
    for(int r = N; r >= 0; --r){
        vector<bool> v(N);
        fill(v.end() - r, v.end(), true);
        do{
            string a, b;
            for(int i = 0; i < N; ++i){
                if(v[i]) a += A[i];
                else b += A[i];
            }
            ++MP[make_pair(a, b)];
        }while(next_permutation(v.begin(), v.end()));
    }
    
    ll ans = 0;
    for(int r = N; r >= 0; --r){
        vector<bool> v(N);
        fill(v.end() - r, v.end(), true);
        do{
            string a, b;
            for(int i = 0; i < N; ++i){
                if(v[i]) a += B[i];
                else b += B[i];
            }
            ans += MP[make_pair(b, a)];
        }while(next_permutation(v.begin(), v.end()));
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 91904
#include<bits/stdc++.h>
#define REP(i,x) for(int i=0,i##_len=(x);i<i##_len;++i)
#define rep(i,a,b) for(int i=(a),i##_len(b);i<i##_len;++i)
#define All(x) begin(x),end(x)
#define rAll(x) rbegin(x),rend(x)
using namespace std;
using ll = long long;

bool kaibun(string t){
    string tmp=t;
    reverse(All(tmp));
    return tmp==t;
}

int main(){
    string s;cin>>s;
    int N=s.size();
    if(kaibun(s)&&kaibun(s.substr(0,(N-1)/2))&&kaibun(s.substr((N+3)/2-1,(N-1)/2))){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<queue>
#include<functional>
#include<cmath>
#include<algorithm>
typedef  long long ll;
 
int main() {
	int a, b, h;
	std::cin >> a >> b >> h;
	std::cout << (a + b)*h / 2 << std::endl;
}

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

int main()
{
	int h, w;
	while (true) {
		cin >> h >> w;
		if (h == 0 && w == 0) { break; }
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (i == 0 || i == (h - 1)) { cout << '#'; }
				else if (j == 0 || j == (w - 1)) { cout << '#'; }
				else { cout << '.'; }
			}
			cout << endl;
		}
		cout << endl;
	}
    return 0;
}

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

int main(){
    int a,b; cin >> a >> b;
    int x_l = ceil(a / 0.08);
    int y_l = ceil(b / 0.1);
    int x_u = ceil((a+1) / 0.08);
    int y_u = ceil((b+1) / 0.1);
    vector<int> list1, list2;
    int i = x_l;
    while(i < x_u){
        list1.push_back(i);
        i++;
    }
    int j = y_l;
    while(j < y_u){
        list2.push_back(j);
        j++;
    }
    std::vector<int> list_inter; //list1とlist2の両方にある値 (積集合)
    std::set_intersection(list1.begin(), list1.end(), list2.begin(), list2.end(), std::back_inserter(list_inter));
    if(list_inter.empty()) cout << "-1" << endl;
    else cout << list_inter.at(0) << endl;
    return 0;
}


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

int main()
{
	string s;
	int s1=0,s2=0;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(i%2)
		{
			if(s[i]=='0') s1++;
			else s2++;
		}
		else
		{
			if(s[i]=='1') s1++;
			else s2++;
		}
	}
	cout<<min(s1,s2)<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    int X, Y;
    cin >> X >> Y;
    bool is = true;
    if((Y-2*X) % 2 == 0 && (Y-2*X) / 2 >= 0) is = true;
    else is = false;

    bool iss = true;
    if((4*X - Y) % 2 == 0 && (4*X - Y) / 2 >= 0) iss = true;
    else iss = false;

    if(is && iss) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);

    string S, T; cin >> S >> T;
    int N = S.size();
    int M = T.size();
    
    if (N < M) {
        cout << "UNRESTORABLE\n";
        return 0;
    }

    bool T_found = false;
    for (int i = N - M; 0 <= i; i--) {
        bool found = true;
        rep(j, M) {
            if (S[i + j] == '?') continue;
            if (S[i + j] != T[j]) {
                found = false;
                break;
            }
        }
        if (found) {
            T_found = true;
            rep(j, M) S[i + j] = T[j];
            break;
        }
    }
    if (!T_found) {
        cout << "UNRESTORABLE\n";
        return 0;
    }

    rep(i, N) {
        if (S[i] == '?') S[i] = 'a';
    }
    cout << S << '\n';

    return 0;
}

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

typedef long long ll;

int main () {
	int N;
	int cnt[4] = {0};
	cin >> N;
	for (int i=0; i<N; i++) {
		char str[10];
		cin >> str;
		switch (str[0]) {
			case 'A':
				cnt[0] ++;
				break;
			case 'W':
				cnt[1] ++;
				break;
			case 'T':
				cnt[2] ++;
				break;
			case 'R':
				cnt[3] ++;
				break;
		}
	}
	cout << "AC x " << cnt[0] << endl;
	cout << "WA x " << cnt[1] << endl;
	cout << "TLE x " << cnt[2] << endl;
	cout << "RE x " << cnt[3] << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll n;
    cin>>n;
    ll ans=0,n0=n;
    vector<ll>p,p0;
    rep(2,i,sqrt(n0)+1){
        bool t0=true,t=true;
        ll nj=-1;
        rep(0,j,(ll)p0.size()){
            if(i%p0[j]==0){
                //cout<<"p0:"<<p0[j]<<endl;
                //cout<<"p:"<<p[j]<<endl;
                if(p[j]!=i)t0=false;
                t=false;
                nj=j;
            }
        }
        if(n%i==0&&t0){
            n/=i;
            ++ans;
            if(t){
                p0.push_back(i);
                p.push_back(i*i);
            }
            if(nj!=-1)p[nj]*=p0[nj];
        }
        //cout<<n<<endl;
    }
    if(n> 1e6&&n!=1)++ans;
    cout<<ans;
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int std_in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;

ll add(ll x){
    if(x < 10) return x + 1;
    //if((x / 10) % 10 >= x % 10) return x + 1;
    string s = to_string(x);
    int len = s.length();
    int i = len - 1;
    while(i > 0 && (s[i - 1] < s[i] || s[i] == '9')) i--;
    if(i == 0 && s[0] == '9'){
        return x + 1;
    }else{
        s[i]++; i++;
        while(i < len){
            if(s[i - 1] == '0') s[i] = '0'; 
            else s[i] = s[i - 1] - 1;
            i++;
        }
        return stoll(s);
    }
}

signed main(){
    int K;
    cin >> K;
    ll ans = 0;
    REP(i, K){
        ans = add(ans);
        // if(ans < 10000) cerr << ans << endl;
    }
    PRINT(ans);
    return 0;
}

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

int main(){
    string a, b;
    int num;
    bool root = false;
    
    cin >> a >> b;
    num = stoi(a+b);

    for(int i=1; i<=1000; i++){
        if(num == i*i){
            root = true;
            break;
        }
    }

    if(root) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int H, W, i, j;
	while (1) {
		scanf("%d %d", &H, &W);
		if (H == 0 && W == 0) {
			break;
		}
		for (i = 0; i<H; i++) {
			for (j = 0; j<W; j++) {
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2048
import java.util.Scanner;


public class Main {


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

		int[] h = new int[101];

		while (sc.hasNext()) {
			h[Integer.parseInt(sc.next())]++;
		}

		long max = 0;
		for (int i = 0 ; i < 101 ; i++) max = Math.max(max, h[i]);

		for (int i = 0 ; i < 101 ; i++) if (max == h[i]) System.out.println(i);

	}
}

Measured memory_bytes: 17168
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

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

	int N=in();
	vector<int> V(N);
	REP(i,N) V[i]=in();
	vector<int> odd(100001,0),even(100001,0),ordx(100001),ordy(100001);
	for(int i=0,ei=N/2;i<ei;i++){
		even[V[2*i]]++;
		odd[V[2*i+1]]++;
	}
	iota(ALL(ordx),0);
	sort(ALL(ordx),[&](int x,int y){return even[x]>even[y];});
	iota(ALL(ordy),0);
	sort(ALL(ordy),[&](int x,int y){return odd[x]>odd[y];});

	if(ordx[0]!=ordy[0]){
		cout << (N-even[ordx[0]]-odd[ordy[0]]) << endl;
	}
	else{
		cout << min(N-even[ordx[0]]-odd[ordy[1]],N-even[ordx[1]]-odd[ordy[0]]) << endl;
	}
	
	return 0;
}


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

int main() {
    string s;
    cin >> s;
    if(s == "ARC"){
        cout << "ABC" << endl;
    }
    if(s == "ABC"){
        cout << "ARC" << endl;
    }
    
    return 0;
}


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

namespace ABC133C
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var l = input[0];
            var r = input[1] + 1;
            var r2 = l + 2020;
            var r3 = Math.Min(r, r2);

            var min = 9999;

            foreach (var x in Enumerable.Range(l, r3 - l))
                foreach (var y in Enumerable.Range(x + 1, r3 - x - 1))
                {

                    var result = (long)x * y % 2019;
                    if (min > result)
                    {
                        //Console.WriteLine($"{x} * {y} = {(long)x * y % 2019}");
                        min = (int)result;
                    }
                }

            Console.WriteLine(min);
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int N=3e5+9;
const int mod=1e9+7;

int main()
{
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,x,a[N];
    ll ans=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    sort(a+1,a+1+n);
    reverse(a+1,a+1+n);
    ans+=a[1];
    int c=n;
    c-=2;
    int i=2;
    while(c>0){
        if(c>=2){
            ans+=a[i]*2;
            c-=2;
            i++;
        }
        else {
            ans+=a[i];
            c--;
        }
    }
    cout<<ans<<'\n';

    


    return 0;
}



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

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)

using namespace std;
typedef long long ll;
typedef __int128_t dll;

int main() {
  ll n,m,a,b,p,q;
  cin>>n>>m>>a>>b>>p>>q;
  if (a == b && b == 1) {
    if (n > m/(p+q))
      cout << min(m%(p+q), ((p+q)-(m%(p+q)))%(p+q)) << endl;
    else
      cout << m-(p+q)*n << endl;
    return 0;
  }
  vector<ll> nums;
  dll pa = p, qb = q;
  REP(i,n) {
    if (pa + qb >= 2*m) break;
    nums.push_back(pa+qb);
    pa *= a;
    qb *= b;
  }
  int l = nums.size();
  int s1 = l/2, s2=l-s1;;
  vector<ll> lsr(begin(nums),begin(nums)+s1);
  vector<ll> gtr(begin(nums)+s1,end(nums));
  vector<ll> l1(1<<s1),l2(1<<s2);
  REP(i,1<<s1) REP(j,s1)
    if((i>>j)&1) l1[i] += lsr[j];
  REP(i,1<<s2) REP(j,s2)
    if((i>>j)&1) l2[i] += gtr[j];
  sort(begin(l2),end(l2));
  ll mn = m;
  REP(i,1<<s1) {
    auto itr = lower_bound(begin(l2),end(l2),m-l1[i]);
    if(itr!=end(l2)) mn=min(mn,(l1[i]+*itr)-m);
    if(itr!=begin(l2)) mn=min(mn,m-(l1[i]+*prev(itr)));
  }
  cout << mn << endl;
  return 0;
}

Measured memory_bytes: 25660