akhauriyash/Code-Regression huggingface dataset:
//
// Created on 2020/06/02.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    vector<int>a;
    for (int i = 0; i < 5; ++i) {
        int temp;
        cin>>temp;
        a.push_back(temp);
    }
    int k;
    cin>>k;

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

            if(abs(a[j] - a[i]) > k){
                cout<<":("<<endl;
                return 0;
            }
        }
    }
    cout<<"Yay!"<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt()+11;
		int B=sc.nextInt()+11;
		A=A%13;
		B=B%13;
		if(A>B) {
			System.out.println("Alice");
		}
		else if(B>A){
			System.out.println("Bob");
		}
		else {
			System.out.println("Draw");
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9;
const int mod = 1e9+7;
using ll = long long;
using P = pair<ll, ll>;
vector<int> to[100005];
int cost[100005];
double PI = acos(-1);
int x[10];
int y[10];

double dist(ll i, ll j) {
    int xx = (x[i]-x[j])*(x[i]-x[j]);
    int yy = (y[i]-y[j])*(y[i]-y[j]);
    return sqrt(xx+yy);
}
map<ll, ll> prime_factors(ll n) {
    map<ll, ll> res;
    if(n == 1) { // n=1 の素因数分解は n^1
        res[n] = 1;
        return res;
    }
    for(ll i = 2, _n = n; i*i <= _n; ++i) {
        while(n % i == 0) {
            ++res[i]; // 素数i^{res[i]}
            n /= i;
        }
    }
    if(n != 1) res[n] = 1;
    return res;
}
signed main(){
    ll a, b;
    cin >> a >> b;

    map<ll,ll> m1 = prime_factors(a);
    map<ll,ll> m2 = prime_factors(b);

    if(a==1 && b==1) {
        cout << 1 << endl;
        return 0;
    }
    ll ans = 1;
    for(auto i=m1.begin(); i!=m1.end(); ++i) {
        for(auto j=m2.begin(); j!=m2.end(); ++j) {
            if(i->first == j->first) {
                ans++;

            }
        }
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 2560
n=gets.to_i
total=0
hash=Hash.new
n.times do 
  s = gets.chomp.split("").sort.join
  if(hash.has_key?(s))
    total += hash[s]
    num = hash[s] + 1
    hash[s] = num
  else
  	hash.store(s,1)
  end
end
puts total

Measured memory_bytes: 19836
N = int(input())
#n = (int(i) for i in input().split())

if N <= 111:
    print("111")
elif N > 111 and N <= 222:
    print("222")
elif N > 222 and N <= 333:
    print("333")
elif N > 333 and N <= 444:
    print("444")
elif N > 444 and N <= 555:
    print("555")
elif N > 555 and N <= 666:
    print("666")
elif N > 666 and N <= 777:
    print("777")
elif N > 777 and N <= 888:
    print("888")
elif N > 888 :
    print("999")


Measured memory_bytes: 38384
//2020-05-15 21:43:05
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; ++i)

using namespace std;
using ll = long long;

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> v;
    int a = 0, b = INT_MAX;
    rep(i, n){
        int ai; cin >> ai;
        v.push_back(ai);
         a = max(a, ai);
         b = min(b, ai);
    }
    if (a - b > 1){
        cout << "No" << endl;
        return 0;
    }
    int an = 0, bn = 0;
    rep(i, n){
        if (v[i] == a)an++;
        else bn++;
    }
    if (a == b){
        if (a == an-1){
            cout << "Yes" << endl;
            return 0;
        }
        bn = 0;
    }
    if (bn + 1 <= a && a <= bn+an/2)cout << "Yes";
    else cout << "No" << endl;
}

Measured memory_bytes: 1020
#include<string>
#include<math.h>
#include<iostream>
 
using namespace std;
 
int main()
{
	string S;
	cin >> S;
	if (S == "SUN")cout << 7 << endl;
	if (S == "MON")cout << 6 << endl;
	if (S == "TUE")cout << 5 << endl;
	if (S == "WED")cout << 4 << endl;
	if (S == "THU")cout << 3 << endl;
	if (S == "FRI")cout << 2 << endl;
	if (S == "SAT")cout << 1 << endl;
	return 0;
}

Measured memory_bytes: 256
import heapq

N, M = map(int, input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(A)

for _ in range(M):
    tmp_min = heapq.heappop(A)
    heapq.heappush(A, (-1)*(-tmp_min//2))

print(-sum(A))

Measured memory_bytes: 14180
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int main() {
  
   int n;
   cin >> n;
  
   
  
  
  if(n%2==0){
    cout << n << endl;
  }else{
     cout << n*2 << endl;
    
  }
  
  
  return 0;
}


Measured memory_bytes: 256
# C
N = int(input())

res_list = []
k = 0

while N != 0:
    if N % (2**(k+1)) != 0:
        N -= (-2)**k
        res_list.append("1")
    else:
        res_list.append("0")
    k += 1
if len(res_list) == 0:
    res_list.append("0")
    
print("".join(reversed(res_list)))

Measured memory_bytes: 3060
int main()
{
  int n, k;
  scanf("%d %d", &n, &k);
  int h[n], cnt = 0;
  for (int i = 0; i < n; i++)
  {
    scanf("%d", &h[i]);
    if (h[i] >= k)
      cnt++;
  }
  printf("%d", cnt);
}


Measured memory_bytes: 512
//
//  main.c
//  ITP1_9_C
//
//  Created by k16031kk on 2018/05/27.
//  Copyright © 2018年 AIT. All rights reserved.
//

#include <stdio.h>
#include <string.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int n, t_point=0, h_point=0;
    char taro[100];
    char hanako[100];
    
    scanf("%d", &n);
    
    for(int i=0; i<n; i++) {
        scanf("%s %s", taro, hanako);
        if(strcmp(taro, hanako)==0) {
            t_point++;
            h_point++;
        } else if(strcmp(taro, hanako)>0) {
            t_point+=3;
        } else if(strcmp(taro, hanako)<0) {
            h_point+=3;
        }
    }
    printf("%d %d\n", t_point, h_point);
    return 0;
}



Measured memory_bytes: 2044
#include <iostream>
#include <algorithm>
#include <vector>
#include <bitset>
using namespace std;
int n;
vector<int> a, b;

vector< int > dp;
int d2i(int bi, int usd){
    int id = bi;
    id *= (1<<n); id += usd;
    return id;
}

int f(int bi, int usd){
    if(usd == ((1<<n)-1)) return 0;
    int id = d2i(bi, usd);
    if(dp[id] != -1) return dp[id];
    int res = n*n, t = 0, s= 0;
    for(int i=0;i<n;i++) t += ((usd>>i)&1);
    for(int i=n-1;i>=0;i--){
        if(((usd>>i)&1) == 0){
            if(t > 0){
                int iv, bv;
                if((t+i)%2 == 0) iv = a[i];
                else iv = b[i];
                if((t+bi)%2 == 1) bv = a[bi];
                else bv = b[bi];

                if(iv < bv) continue;
            }
            int u = s;
            u += f(i, usd | (1<<i));
            if(res > u) res = u;
        }else{
            s++;
        }
    }

    //cerr << bi << " " << bitset<3>(usd) << " : " << res << endl;

    return dp[id] = res;
}

int main(void){
    cin >> n;
    a.assign(n, 0);
    b.assign(n, 0);

    for(int i=0;i<n;i++) cin >> a[i];
    for(int i=0;i<n;i++) cin >> b[i];

    dp.assign(n*(1<<n), -1);
    int ans = f(0, 0);
    if(ans == n*n) ans = -1;

    cout << ans << endl;
}


Measured memory_bytes: 18688
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define MAXN 20
#define MAXM 60
using namespace std;
struct edge
{
	int to,w;
	edge(){};
	edge(int _to,int _w):to(_to),w(_w){};
};
vector<edge> G[MAXN+5];
int digit[MAXN+5],len;
void Work(int x)
{
	len=0;
	while(x)
	{
		digit[++len]=x%2;
		x/=2;
	}
}
int main()
{
	int L;
	scanf("%d",&L);
	Work(L);
	int n=len,m=0;
	for(int i=1;i<n;i++)
	{
		G[i].push_back(edge(i+1,0));
		G[i].push_back(edge(i+1,(1<<(n-i-1))));
		m+=2;
	}
	int totn=0;
	for(int i=len;i>=1;i--)
	{
		if(digit[i]==0)
			continue;
		totn+=(1<<(i-1));
		int edpos=-1;
		for(int j=i-1;j>=1;j--)
			if(digit[j]==1)
			{
				edpos=n-j+1;
				break;
			}
		if(edpos==-1)
			break;
		G[1].push_back(edge(edpos,totn));
		m++;
	}
	printf("%d %d\n",n,m);
	for(int i=1;i<=n;i++)
		for(int j=0;j<(int)G[i].size();j++)
			printf("%d %d %d\n",i,G[i][j].to,G[i][j].w);
	return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define vint(a,n) vint a(n); rep(i, n) cin >> a[i];
#define vll(a,n) vll a(n); rep(i, n) cin >> a[i];
#define ALL(n) begin(n),end(n)
#define RALL(n) rbegin(n),rend(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint=vector<int>;
using vll=vector<ll>;
using vbool=vector<bool>;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    int n; cin >> n;
    vint(a, n);

    vint ans(n, 0);
    for(int i=n-1; i>=0; i--){
        int t = i+1;
        int sum = 0;
        for(int j=i+t; j<n; j+=t) sum += ans[j];
        sum %= 2;
        if(sum != a[i]) ans[i]++;
    }

    int s = 0;
    rep(i, n) s += ans[i];
    pr(s);
    rep(i, n){
        if(ans[i]) cout << i+1 << " ";
    }
    cout << endl;
    return 0;}

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

int main(){
        int x,a,b;
        cin >> x >> a >> b;
        x=x-a;
        for(int i=0;i<10000;i++){
                if(x-b < 0){
                        break;
                }
                x=x-b;
        }
        cout << x<< endl;
        return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	a, b := readInt(), readInt()

	if a < 1 || a > 9 || b < 1 || b > 9 {
		fmt.Println(-1)
		return
	}
	fmt.Println(a * b)
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

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

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>

#define ll long long

using namespace std;

int main(void) {
	int N;
	cin >> N;
	map<int, int> seq;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		seq[a]++;
	}

	int ans = 0;
	for (auto itr = seq.begin(); itr != seq.end(); itr++) {
		if (itr->first <= itr->second) ans += itr->second - itr->first;
		else ans += itr->second;
	}
	cout << ans << endl;
	system("pause");
	return 0;
}

Measured memory_bytes: 4984
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;

int main(void) {
    string S, T;
    cin >> S >> T;

    int ans = numeric_limits<int>::max();
    for(int i=0; i+T.size()-1<S.size(); i++) {
        int tmp = 0;
        for(int j=0; j<T.size(); j++) {
            if(S[i+j] != T[j]) ++tmp;
        }
        ans = min(ans, tmp);
    }

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


Measured memory_bytes: 3624
//
//  CPlibrary
//
//  Created by Tanmay Singh on 3/03/2020.
// INDIAN INSTITUTE OF TECHNOLOGY (BHU) , VARANASI
//  Copyright © 2020 Tanmay Singh. All rights reserved.
//#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
 
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <climits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
 
#define FAST(); ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define mod 1000000007
typedef long long int  bigint ;
typedef std::vector< int > vi;
typedef std::vector< long long int > vll;
typedef std::vector< vi > vvi;
 
using namespace std;
int getDivisor( int N ){
    int ans = 0 ;
    while( N % 2 == 0 ){
        N /= 2 ;
        ans++ ;
    }
    return ans ;
}
int main(){
    FAST() ;
    int N ; cin >> N ;
    bigint ans = 0 ;
    for( int i = 0 ; i < N ; i++ ){
        int x ; cin >> x ;
        ans += (bigint)getDivisor(x) ;
    }
    cout << ans << endl ;
    return 0 ;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>

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

int main(){
  int n;cin>>n;
  vector<int> x(n), y(n), h(n);
  for(int i=0;i<n;i++){
    cin>>x[i]>>y[i]>>h[i];
  }
  bool found=false;
  pair<int, P> ans;
  for(int i=0;i<=100;i++){
    for(int j=0;j<=100;j++){
      bool valid=true;
      int es_h=-1;
      for(int k=0;k<n;k++){
        if(h[k]!=0){
          if(es_h==-1)es_h=h[k]+abs(i-x[k])+abs(j-y[k]);
          else if(es_h!=h[k]+abs(i-x[k])+abs(j-y[k])){
            valid=false;break;
          }
        }
      }
      for(int k=0;k<n;k++){
        if(h[k]==0 && es_h-abs(i-x[k])-abs(j-y[k])>0){valid=false;break;}
      }
      if(valid){found=true;ans=make_pair(es_h, P(i, j));break;}
    }
    if(found)break;
  }
  cout<<ans.second.first<<" "<<ans.second.second<<" "<<ans.first<<endl;
}


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

int N, W, v[105], w[105], dp[105][10005];

void update(int used, int wgt, int val) {
    if(dp[used][wgt] < val) dp[used][wgt] = val;
}

int main() {
    int i;
    
    cin >> N >> W;
    for(i=0; i<N; i++) cin >> v[i] >> w[i];
    
    if(w[0] <= W) dp[0][w[0]] = v[0];
    for(int used=1; used<N; used++) {
        for(int wgt=0; wgt<=W; wgt++) {
            int d_wgt = w[used];
            int d_val = v[used];
            update(used, wgt, dp[used-1][wgt]);
            if(wgt - d_wgt < 0) continue;
            update(used, wgt, dp[used-1][wgt-d_wgt]+d_val);
        }
    }
    
    int m=0;
    for(i=0; i<=W; i++) if(dp[N-1][i] > m) m = dp[N-1][i];
    cout << m << endl;
}



Measured memory_bytes: 6984
main () {
    unsigned long long n, count, d;

    scanf("%llu", &n);

    if (n % 2 == 1) {
        puts("0");
        return 0;
    }

    count = n / 10, d = 5;
    n /= 10;
    while (1)
    {
        if (n / d == 0) break;
        count += n / d;
        d *= 5;
    }

    printf("%llu\n", count);
}


Measured memory_bytes: 128
#include <stdio.h>

int		my_sqrt(int X)
{
	int		mid, max;

	max = X;
	mid = X / 2;
	while (max > mid + 1)
	{
		if (mid * mid > X)
		{
			max = mid;
			mid /= 2;
		}
		else
			mid = (max + mid) / 2;
	}
	return (mid);
}

int		is_prime(int X)
{
	int		mid;
	int		i;

	i = 2;
	mid = my_sqrt(X);
	while (i < mid)
	{
		if (X % i == 0)
			return (0);
		i++;
	}
	return (1);
}

int		main()
{
	int		X;
	int		prime;

	prime = 0;
	scanf("%d\n", &X);
	while (!prime)
	{
		if (is_prime(X))
			prime = X;
		X++;
	}
	printf("%d\n", prime);

	return (0);
}


Measured memory_bytes: 128
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//vector
using vi = vector<int>;
using vii = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

//constant
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

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

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// DP
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }




// ***************************************


int main(){

    ll N;
    cin >> N;

    vll A(N + 1, 1);

    FOR(i, 1, N + 1){
        for(ll j = 2; i * j <= N; j++){
            A[i * j]++;
        }
    }

    ll ans = 0;
    FOR(i, 1, N + 1){
        ans += i * A[i];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 81392
N = int(input())
A = [int(i) for i in input().split()]    
for i in range(1, N):
    print(" ".join(map(str, A))) 
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
        A[j + 1] = A[j]
        j -= 1
    A[j + 1] = v
print(" ".join(map(str, A)))    

Measured memory_bytes: 7748
n, q = map(int, input().split())
s = input()
count = [0]*(n+1)
flag = [False]*(n+1)
for i in range(1, n):
  count[i+1] = count[i]
  if s[i-1]=="A" and s[i] == "C":
    flag[i] = True
    count[i+1] += 1
    
for _ in range(q):
  l, r = map(int, input().split())
  ans = count[r]-count[l-1]
  if flag[l-1]:
    ans -= 1
  print(ans)

Measured memory_bytes: 6900
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


int main() {
    int n;
    cin>>n;
    int fib[50];
    fib[0]=1;
    fib[1]=1;
    for(int i=2;i<50;i++) fib[i]=fib[i-1]+fib[i-2];

    cout<<fib[n]<<endl;
}




Measured memory_bytes: 3088
#include<stdio.h>

int main(void){
  int a,b,c=0;
  scanf("%d",&a);
  scanf("%d",&b);
  if(a>b) c=2*a-1;
  else if(a==b) c=2*a;

  else c=2*b-1;
  printf("%d",c);
  return 0;
}
      
  



Measured memory_bytes: 128
import sys

def main():
    input = sys.stdin.readline
    O = str(input().strip())
    E = str(input().strip())

    ans = ''
    for i in range(len(O)):
        if i == len(O) - 1 and len(O) != len(E):
            ans += O[i]

        else:
            ans += O[i]
            ans += E[i]

    return ans


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 3060
N = int(input())
sum_all = (1+N)*N/2
sum_fizz = ((N-N%3)+3)*(N-N%3)/3/2
sum_buzz = ((N-N%5)+5)*(N-N%5)/5/2
sum_fizzbuzz = ((N-N%15)+15)*(N-N%15)/15/2

sum = sum_all - sum_fizz - sum_buzz + sum_fizzbuzz
print(int(sum))


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int n;cin>>n;

    int result = 0;

    FOR(i,1,n+1){
        if(i%2==0){
            continue;
        }
        int yakusuu = 0;
        FOR(j,1,i+1){
            if(i%j==0){
                yakusuu++;
            }
        }
        if(yakusuu==8){
            result++;
        }
        //dump(i)
        //dump(yakusuu)
    }
    cout<<result<<endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

int main(){
	
	vector<int> A(9);
	for(int i=0;i<9;i++)cin>>A[i];
	
	vector<bool> B(9,false);
	
	int N;
	cin>>N;
	
	for(int i=0;i<N;i++){
		int t;
		cin>>t;
		for(int j=0;j<9;j++){
			if(t==A[j])B[j]=true;
		}
	}
	
	vector<vector<int>> check{{0,1,2},{3,4,5},{6,7,8},{0,3,6},{1,4,7},{2,5,8},{0,4,8},{2,4,6}};
	
	for(int i=0;i<check.size();i++){
		bool f = true;
		for(int j=0;j<3;j++){
			if(!B[check[i][j]])f=false;
		}
		if(f){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	
	cout<<"No"<<endl;
	
	return 0;
}


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

namespace D
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var S = new string[2].Select(x => x = Console.ReadLine()).ToArray();
            var p = 1000000007;

            // v : 3C1 = 3
            // h : 3C2 = 6
            // v+h : 2
            // v+v : 2
            // h+v : 1
            // h+h : 3

            var order = new List<bool>();
            for (var i = 0; i < N; i++)
            {
                var tmp = S[0][i] == S[1][i];
                order.Add(tmp);
                if (!tmp) i++;
            }

            var answer = order[0] ? 3L : 6L;
            for (var i = 1; i < order.Count; i++)
            {
                if (order[i - 1]) answer *= 2;
                else if (!order[i]) answer *= 3;
                answer %= p;
            }

            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 28340
#include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    while(N != 0){
        vector<vector<int>> G(N,vector<int> (N,0));
        for(int i=0; i<N; i++){
            int k;
            cin >> k;
            for(int j=0; j<k; j++){
                int a;
                cin >> a;
                a--;
                G[i][a] = 1;
            }
        }
        vector<int> leak(N,false);
        int k;
        cin >> k;
        for(int i=0; i<k; i++){
            int a;
            cin >> a;
            a--;
            leak[a] = true;
        }
        vector<bool> did(N,true);
        for(int i=0; i<N; i++){
            if(!leak[i]) continue;
            for(int j=0; j<N; j++){
                if(!G[j][i]) did[j] = false;
            }
        }
        vector<int> ans;
        for(int i=0; i<N; i++){
            if(did[i]) ans.push_back(i);
        }
        if(ans.size() == 1){
            cout << ans[0]+1 << endl;
        }else{
            cout << -1 << endl;
        }
        cin >> N;
    }
    return 0;
}


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

int n;
int a[200010];
vector<int> graph[200010];
int ans[200010];

int tree[800010], S;
void update(int idx, int val){
    idx += S-1; tree[idx] = val;
    for(idx>>=1;idx;idx>>=1){
        tree[idx] = max(tree[idx<<1], tree[(idx<<1)+1]);
    }
}
int get_max(int l, int r){
    l += S-1; r += S-1;
    int ret = 0;
    while(l<r){
        if((l&1) == 1){ ret = max(ret, tree[l]); ++l; }
        if((r&1) == 0){ ret = max(ret, tree[r]); --r; }
        l>>=1; r>>=1;
    }
    if(l==r) ret = max(ret, tree[l]);
    return ret;
}

void dfs(int node, int par, int prev_max){
    int x = get_max(1, a[node]-1);
    int prev = tree[a[node]+S-1];
    ans[node] = max(prev_max, x+1);
    update(a[node], x+1);
    for(auto nex : graph[node]){
        if(nex == par) continue;
        dfs(nex, node, ans[node]);
    }
    update(a[node], prev);
}

int main()
{
    scanf("%d", &n);
    set<int> nums;
    for(int i=1; i<=n; ++i){ scanf("%d", &a[i]); nums.insert(a[i]); }
    map<int,int> idx; int c=0;
    for(auto x : nums){ ++c; idx[x] = c; }
    for(int i=1; i<=n; ++i) a[i] = idx[a[i]];
    for(S=1;S<c;S<<=1);
    for(int i=1; i<n; ++i){
        int x, y;
        scanf("%d%d", &x, &y);
        graph[x].push_back(y);
        graph[y].push_back(x);
    }
    dfs(1, 0, 0);
    for(int i=1; i<=n; ++i) printf("%d\n", ans[i]);
}

Measured memory_bytes: 46196
/******************************************************************************
 
рассвет. 
 
*******************************************************************************/
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define rapgame ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define all(a) (a).begin(),(a).end()
#define srt(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int> 
#define vplli vector <pair <lli,lli> >
#define vvi vector <vector <int> >
#define vvlli vector <vector <lli> >
#define vvpii vector <vector <pair <int,int>> >
#define fr(i,n) for (int i = 0; i < (n); ++i)
#define frbig(i,n) for (lli i = 0; i < (n); ++i)
#define fra(i,a,n) for (int i = a; i < (n); ++i)
#define run(c,s) for(auto c:s) 
#define read(n) int n; cin >> n;
#define readchar(n) char n; cin >> n;
#define readstr(n) string n; cin >> n;
#define readarr(a,n) fr(i,n) cin >> a[i];
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;
 
const lli MOD=1e9+7;
const lli MAXN=1e5+1;
const ld PI=acos(-1);

vvi g(MAXN);
bool used[MAXN];

void dfs(int v){
    used[v]=1;
    run(to,g[v]){
        if(!used[to]){
            dfs(to);
        }
    }
}

int main(){
    rapgame
    //freopen("brokeday.in", "r", stdin);
    //freopen("richday.out", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--){
        read2(n,m);
        int ans=0;
        fr(i,m){
            read2(a,b);read(c);
            g[a].pb(b);
            g[b].pb(a);
        }
        fr(i,n){
            if(!used[i+1]){
                dfs(i+1);
                ans++;
            }
        }
        cout << ans;
    }
    return 0;
}

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

#define ll long long

int main()
{

//    int t=10;

  //  while(t--){
   ll n,k;

   cin>>n>>k;


   if(n*500>=k)cout<<"Yes"<<endl;
   else cout<<"No"<<endl;

    //}



    return 0;
}



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

public class hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        var b0 = new List<int>();
        var b1 = new List<int>();
        line = Console.ReadLine().Trim().Split(' ');
        for (int i = 0; i < n; i++)
            if (line[i] == "0") b0.Add(i);
            else b1.Add(i);

        line = Console.ReadLine().Trim().Split(' ');
        var p0 = new List<int>();
        var p1 = new List<int>();
        var pos = 0;
        var wsum = 0;
        for (int i = 0; i < m; i++)
        {
            var w = int.Parse(line[i]);
            if (i % 2 == 0) getPos(p0, pos + wsum, w);
            else getPos(p1, pos + wsum, w);
            wsum += w;
        }
        var ans = new List<int>();
        if (b0.Count() == p0.Count()) ans.Add(getAns(b0, p0));
        if (b0.Count() == p1.Count()) ans.Add(getAns(b0, p1));
        if (b1.Count() == p0.Count()) ans.Add(getAns(b1, p0));
        if (b1.Count() == p1.Count()) ans.Add(getAns(b1, p1));
        Console.WriteLine(ans.Min());
    }
    public static int getAns(List<int> a, List<int> b)
    {
        var ret = 0;
        for (int i = 0; i < a.Count(); i++)
            ret += Math.Abs(a[i] - b[i]);
        return ret;
    }
    public static void getPos(List<int> a, int pos, int w)
    {
        for (int i = 0; i < w; i++)
            a.Add(i + pos);
    }
}


Measured memory_bytes: 8192
fun main(args: Array<String>) {
    val s = readLine()!!
    val result = Array<Int>(s.length) { 0 }
    var count = 0

    for (i in s.indices) {
        if (s[i] == 'R') {
            count += 1
        } else {
            result[i] += count / 2
            result[i - 1] += (count + 1) / 2
            count = 0
        }
    }

    for (i in s.lastIndex downTo 0) {
        if (s[i] == 'L') {
            count += 1
        } else {
            result[i] += count / 2
            result[i + 1] += (count + 1) / 2
            count = 0
        }
    }

    println(result.joinToString(" "))
}

Measured memory_bytes: 41788
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define f first
#define s second
#define si(x)   scanf("%d",&x)
#define sl(x)   scanf("%I64d",&x)
#define CLR(x)  memset(x,0,sizeof(x))
#define RESET(x,a) memset(x,a,sizeof(x))
#define pi pair<int,int>
#define pb push_back
#define mp make_pair
#define debug(x) cerr<<">value ("<<#x<<") : "<<x<<endl;

char s[1005];
set< char > ss,ww;

int main()
{
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    int t,n,m,i,j;
    scanf("%s",s);
    n=strlen(s);
    for(i=0;i<n;i++)
    {
        if(s[i]=='N'||s[i]=='S')
        ss.insert(s[i]);
        else
            ww.insert(s[i]);
    }
    i=ss.size();
    if(i==2)
        i=0;
    j=ww.size();
    j%=2;
    i=i+j;
    puts(i?"No":"Yes");
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main{
	public static void main(String[] args){
		BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));
		try{

			//文字列を読み取る。
			String[] strLine = insBR.readLine().split(" ");

			//小数点を鑑みて、double型に変換する。
			List<Double> list = new ArrayList<Double>();
			for(int i = 0; i < strLine.length; i++){
				list.add(Double.parseDouble(strLine[i]));
			}

			double dbBottom = list.get(0);
			double dbSide = list.get(1);
			double dbActAngle = list.get(2);
			double dbAngle = dbActAngle * Math.PI / 180;

			//面積。
			double dbSin = Math.sin(dbAngle);
			double dbArea = dbBottom * dbSide * dbSin / 2.0;
			String strArea = String.format("%1$.5f", dbArea);

			//残りの辺
			double dbPowAnother = dbBottom * dbBottom + dbSide * dbSide - 2 * dbBottom * dbSide * Math.cos(dbAngle);
			double dbAnother = Math.sqrt(dbPowAnother);
			double dbSum = dbBottom + dbSide + dbAnother;
			String strSum = String.format("%1$.5f", dbSum);

			//高さ。
			double dbHeght = dbArea / dbBottom * 2.0;
			String strHeght = String.format("%1$.5f", dbHeght);

			//出力。
			System.out.println(strArea);
			System.out.println(strSum);
			System.out.println(strHeght);

		}catch(IOException e){
			e.printStackTrace();
		}catch(NumberFormatException e){
			e.printStackTrace();
		}

	}

}



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

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

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

const long p = 1_000_000_000 + 7;

void main(){
    long N, T;
    readlnTo(N, T);
    auto t = readLongs();
    long ans = 0;

    foreach(i; iota(N-1)) {
        ans += min(t[i+1]-t[i], T);
    }
    ans += T;
    writeln(ans);
}



Measured memory_bytes: 10968
import numpy as np

n, s = map(int, input().split())
a = [int(i) for i in input().split()]

mod = 998244353
dp = np.zeros(s+1, dtype='i8')
dp[0] = 1
for aa in a:
    tmp = 2 * dp % mod
    tmp[aa:] += dp[:-aa]
    tmp %= mod
    dp = tmp
print(dp[s])


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

typedef unsigned uint;
typedef long long INT;
typedef unsigned long long UINT;
const int INF = 1001001001;
const INT INFLL = 1001001001001001001LL;

 int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
INT lin() { INT x; scanf("%lld", &x); return x; }


int main(){
    int a, b, c;
    double fa, fb, fc;
    char sa[128], sb[128], sc[128];

    int K = in();

    std::vector<int> lunlun(100, -1);
    lunlun[0] = -1;  // 番兵.
    lunlun[1] = 0;
    for (int i = 0; i < K; ++i) {
        // j桁目のインクリメントを試みる.
        int j = 1;
        while(lunlun[j] != -1) {
            // 9はインクリメント不可.
            if (lunlun[j] == 9) {
                ++j;
                continue;
            }

            // 隣が1つ大きいか同じか.
            if (lunlun[j-1] == -1 || lunlun[j] <= lunlun[j-1]) {
                if (lunlun[j+1] == -1 || lunlun[j] <= lunlun[j+1]) {
                    ++lunlun[j];
                    break;
                }
            }
            ++j;
        }
        if (lunlun[j] == -1) {
            // 見つからなかったので1とする).
            lunlun[j] = 1;
        }


        // j桁目より下は最小ルンルン数. j桁目-1, j桁目-2, ...000で埋める.
        int now = lunlun[j];
        for (int k = j - 1; k > 0; k = k - 1) {
            now = max(now - 1 , 0);
            lunlun[k] = now;
        }

    }

    INT nMul = 1;
    INT nAns = 0;
    for (int n : lunlun) {
        if (n == -1) continue;
        nAns += n * nMul;
        nMul *= 10;
    }

    printf("%ld", nAns);

    return 0;
}







Measured memory_bytes: 256
#define MOD_TYPE 1

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;

#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using Int = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
//constexpr ll MOD = 1;
constexpr int INF = (int)1e9 + 10;
constexpr ll LINF = (ll)4e18;
constexpr double PI = acos(-1.0);
constexpr double EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
template <typename T, typename U>
constexpr istream &operator>>(istream &is, pair<T, U> &p) noexcept
{
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename U>
constexpr ostream &operator<<(ostream &os, pair<T, U> &p) noexcept
{
  os << p.first << " " << p.second;
  return os;
}
#pragma endregion

void solve()
{
  ll x, k, d;
  cin >> x >> k >> d;
  if (x < 0)
    x *= -1;
  ll t = CEIL(x, d);
  if (t > k)
  {
    cout << x - k * d << "\n";
  }
  else
  {
    x -= t * d;
    k -= t;
    if (k % 2 == 1)
      x += d;
    cout << abs(x) << "\n";
  }
}

int main()
{
  init_main();
  solve();
}


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

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

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let ab = read_vec::<u64>();
    let (a,b) = (ab[0],ab[1]);
    let ans = if (a+b >= 10){
        "error".to_string()
    } else {
        (a+b).to_string()
    };
    println!("{}",ans );
}

Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

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

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


#define ll long long
#define MOD 1000000007
#define INF (int)1e9
#define EPS 1e-9
/*
    2.cpp
*/

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n; cin>>n;
    ll x=0;
    x+=(n/500)*1000;
    n%=500;
    x+=(n/5)*5;
    cout<<x<<"\n";
    return 0;
}



Measured memory_bytes: 256
from heapq import heappush, heappop


def dijkstra(s):
    '''
    始点sから各頂点への最短距離を求める
    '''
    d = [float("inf")] * 10
    d[s] = 0
    used = [False] * 10
    used[s] = True
    edgelist = []

    for e in edge[s]:
        heappush(edgelist, e)

    while edgelist:
        cost, v = heappop(edgelist)
        if used[v]:
            continue
        d[v] = cost
        used[v] = True
        for e in edge[v]:
            if not used[e[1]]:
                heappush(edgelist, [e[0] + d[v], e[1]])

    return d


h, w = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(10)]
a = [list(map(int, input().split())) for _ in range(h)]

edge = [[] for _ in range(10)]
for i in range(10):
    for j in range(10):
        edge[i].append([c[i][j], j])
        edge[j].append([c[j][i], i]) 

dist = []
for i in range(10):
    dist.append(dijkstra(i))

res = 0
for i in range(h):
    for j in range(w):
        if a[i][j] >= 0:
            res += dist[a[i][j]][1]

print(res)

Measured memory_bytes: 74036
n = int(input())

b = list(map(int,input().split()))

ans = []

for i in list(reversed(range(n))):
    for j in list(reversed(range(i+1))):
        if (b[j] == j+1):
            ans.append(j+1)
            del b[j]
            break
        if j == 0:
            print("-1")
            exit()

ans = list(reversed(ans))

for i in range(n):print(ans[i])

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;

// main() 是程序开始执行的地方

int main()
{
	int R[MAX], n;

	cin >> n;
	for (int i = 0; i < n; i++) cin >> R[i];
	
	int maxv = -2000000000;
	int minv = R[0];

	for (int i = 1; i < n; i++)
	{
		maxv = max(maxv, R[i] - minv);
		minv = min(minv, R[i]);
	}

	cout << maxv << endl;
	return 0;
}


Measured memory_bytes: 3880
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  string a,b,c;cin >> a >> b >> c;
  a[0] += 'A' -'a';
  b[0] += 'A' -'a';
  c[0] += 'A' -'a';
  cout << a[0] << b[0] << c[0] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <bits/stdc++.h>
#include <iomanip>
#include <numeric>
#include <utility>
#include <map>
#include <algorithm>
using namespace std;

long long GCD(long long a, long long b)
{
    if (b > a)
        swap(a, b);
    if (a % b == 0)
        return b;
    return GCD(b, a % b);
}
long long LCM(long long a, long long b)
{
    return a * b / GCD(a, b);
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long a, b;
    cin >> a >> b;
    cout << LCM(a, b) << "\n";
}


Measured memory_bytes: 256
main = do
  [h,w] <- map read . words <$> getLine :: IO [Int]
  let ho = (h `div` 2) + (h `mod` 2)
  let he = h `div` 2
  let wo = w `div` 2 + (w `mod` 2)
  let we = w `div` 2 
  print $ if (h == 1 || w == 1)
           then 1
           else (ho * wo) + (he * we)


Measured memory_bytes: 508
M, D = map(int, input().split())

ans = 0

for i in range(1, M+1):
    for j in range(10, D+1):
        d10 = int(str(j)[0])
        d1 = int(str(j)[1])
        if i == d10*d1 and d10 >=2 and d1 >= 2:
            ans += 1
            #print(i, j)
            #print(d10, d1)
if D <= 9:
    ans = 0

print(ans)




Measured memory_bytes: 3060
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

A,B,C = inpl()
ans = 0
while True:
    if A%2==1 or B%2==1 or C%2==1:
        print(ans)
        break
    elif A==B==C:
        print(-1)
        break
    A,B,C = (B+C)//2, (A+C)//2, (A+B)//2
    ans += 1


Measured memory_bytes: 4456