akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>

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

using namespace std;

int me,n,a[252];

void bfs(int s,bool *vis){
	rep(x,n) vis[x]=(x==s);

	int Q[252],head=0,tail=0;
	Q[tail++]=s;
	while(head<tail){
		int x=Q[head++];
		for(int d=1;d<=me;d++){
			int xx=min(x+d,n-1);
			xx=max(min(xx+a[xx],n-1),0);
			if(!vis[xx]){
				vis[xx]=true;
				Q[tail++]=xx;
			}
		}
	}
}

int main(){
	while(scanf("%d",&me),me){
		scanf("%d",&n);
		rep(i,n) scanf("%d",a+i+1);
		n+=2;
		a[0]=a[n-1]=0;

		bool vis[252];
		bfs(0,vis);

		if(!vis[n-1]){ puts("NG"); continue; }

		bool ok=true;
		rep(s,n) if(vis[s]) {
			bool vis2[252];
			bfs(s,vis2);
			if(!vis2[n-1]){ ok=false; break; }
		}
		puts(ok?"OK":"NG");
	}

	return 0;
}

Measured memory_bytes: 1012
N = int(input())

a = [list(map(int, input().split())) for i in range(N)]

for i in range(N):
    if i == 0:
        if (a[i][0] - a[i][1] - a[i][2]) % 2 != 0 or (a[i][0] - a[i][1] - a[i][2]) < 0:
            print("No")
            exit()
    else:
        if (a[i][0] - a[i][1] - a[i][2]) % 2 != 0 or (a[i][0]- a[i-1][0]) -( (a[i-1][1] + a[i-1][2] )-(a[i][1] + a[i][2])) < 0:
            print("No")
            exit()
print("Yes")

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

public class Main {
    static int[] dp, a;
    static int m, L;
    public static void main(String[] args)throws IOException {
        Scanner sc = new Scanner(System.in);
        //BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        int a = sc.nextInt(), b =sc.nextInt(), c = sc.nextInt();
        boolean flag = a==b&&a==c;
        String ans = flag?"Yes":"No";
        System.out.println(ans);
    }
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define what_is(x) cerr << #x << " is " << x << endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;

int n;
int lenOfn(int n){
	int cnt = 0;
	while(n>0){
		n /= 10;
		cnt++;
	}
	return cnt;
}
int main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	cin >> n;
	int len = lenOfn(n);
	int ans = 0;
	if (len == 1) ans = n;
	else if (len == 2) ans = 9;
	else if (len == 3) ans = 9 + n-99;
	else if (len == 4) ans = 9 + 900;
	else if (len == 5) ans = 9 + 900 + n-10000+1;
	else if (len == 6) ans = 9 + 900 + 90000;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N, M, X, Y;
		N = sc.nextInt();
		M = sc.nextInt();
		X = sc.nextInt();
		Y = sc.nextInt();
		int x[] = new int[N];
		int y[] = new int[M];
		int max = X;
		int min = Y;
		for (int i = 0; i < N; i++) {
			x[i] = sc.nextInt();
			if (max < x[i]) {
				max = x[i];
			}
		}
		for (int i = 0; i < M; i++) {
			y[i] = sc.nextInt();
			if (min > y[i]) {
				min = y[i];
			}
		}
		sc.close();
		if (min - max > 0) {
			System.out.println("No War");
		} else {
			System.out.println("War");
		}
	}
}


Measured memory_bytes: 23252
Y = [-1, 0]; X = [0, -1]
H, W = gets.split.map(&:to_i)
areas = []
H.times do
  areas << gets.chomp.split('')
end
dp = Array.new(H+1){Array.new(W+1, 0)}
dp[H-1][W-1] = 1
(H-1).downto(0) do |i|
  (W-1).downto(0) do |j|
    next if (i == H-1 && j == W-1) || areas[i][j] == "#"
    dp[i][j] = dp[i+1][j] + dp[i][j+1]
  end
end
puts dp[0][0] % (10**9 + 7)

Measured memory_bytes: 225788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a;cin>>a;
    string b;cin>>b;
    ll b100 = (b[0]-'0')*100+(b[2]-'0')*10+(b[3]-'0');
    cout<<a*b100/100<<endl;
    return 0;
}

Measured memory_bytes: 3648
def A():
    w = ['Sunny', 'Cloudy', 'Rainy']
    today = input()
    index = w.index(today)
    if index == 2:
        index = -1
    print(w[index+1])

def B():
    odd = 'RUD'
    even = 'LUD'

    s = input()
    for i in range(len(s)):
        if (i+1)%2 == 0:
            if s[i] not in even:
                print('No')
                return
        else:
            if s[i] not in odd:
                print('No')
                return
        
    print('Yes')

def C():
    temp = [int(i) for i in input().split()]
    N = temp[0]
    K = temp[1]
    Q = temp[2]
    points = {}

    for i in range(N):
        points[i] = 0

    for i in range(Q):
        num = int(input())
        points[num-1] += 1

    for i in points.keys():
        if K - (Q - points[i]) > 0:
            print('Yes')
        else:
            print('No')
    
C()


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

int main() {
  int a, b;
  cin >> a >> b;
  
  if (a >= b){
  for (int i = 0; i < a; i++) {
   if(i == a-1) cout << b << endl;
   else cout << b;
   }
  }
  else if (a < b){
  for (int i = 0; i < b; i++) {
   if(i == b-1) cout << a << endl;
   else cout << a;
   }
  }
}

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

typedef long long int ll;

const int N = 2e5+7;

ll ft[N];

void upd(int x, ll p)
{
  for(;x < N; x += x&-x)
    ft[x] = max(ft[x], p);
}

ll qry(int x)
{
  ll res = 0;
  for(;x;x-=x&-x)
    res = max(res, ft[x]);
  return res;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  
  int n; cin >> n;
  
  vector<ll> h(n), w(n);
  
  for(ll& i: h) cin >> i;
  for(ll& i: w) cin >> i;
  
  
  ll ans = 0;
  

  for(int i=0;i<n;++i)
  {
    ll q = qry(h[i]), tmp;
    ans = max(ans, tmp = q + w[i]);
    upd(h[i], tmp);
    //~ for(int j=1;j<10;++j)
      //~ cerr << setw(2) << ft[j] << ' ';
    //~ cerr << endl;
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 4992
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        int b[] = new int[n];
        int d[] = new int[n];
        int count = 0;// 負の数の個数
        long wa = 0; // 負の数の総和
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {

            b[i] = sc.nextInt();
            d[i] = a[i] - b[i];
            if (d[i] < 0) {
                wa += d[i];
                count++;
            }
        }

        Arrays.sort(d);
        int ans = 0;
        for (int i = n - 1; i >= 0; i--) {
            if (wa >= 0) {
                break;
            }
            wa += d[i];
            ans++;
        }
        if (wa < 0) {
            System.out.println(-1);
        } else {
            System.out.println(ans + count);
        }
    }
}


Measured memory_bytes: 77980
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<queue>
#include<string>
#include<iostream>

#define maxn 200005
#define INF 0x3f3f3f3f

using namespace std;

inline long long getint()
{
    long long num=0,flag=1;char c;
    while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;
    while(c>='0'&&c<='9')num=num*10+c-48,c=getchar();
    return num*flag;
}

int n;
long long m;
long long a[maxn];
long long sum[maxn];
long long ans;
inline bool cmp(long long a,long long b){return a>b;}

inline bool check(int mid)
{
	int now=n;
	long long num=0;
	for(int i=1;i<=n;i++)
	{
		while(a[i]+a[now]<mid&&now)now--;
		num+=now;
	}
	return num>=m;
}

inline void solve(int mid)
{
	long long mn=INF;
	int now=n;
	long long num=0;
	for(int i=1;i<=n;i++)
	{
		while(a[i]+a[now]<mid&&now)now--;
		ans+=a[i]*now+sum[now];
		if(now)mn=min(mn,a[i]+a[now]);
		num+=now;
	}
	printf("%lld\n",ans-(num-m)*mn);
}

int main()
{
	n=getint(),m=getint();
	for(int i=1;i<=n;i++)a[i]=getint();
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++)sum[i]=a[i]+sum[i-1];
	int l=0,r=INF;
	while(l<r)
	{
		int mid=(l+r)>>1;if(mid==l)mid++;
		if(check(mid))l=mid;
		else r=mid-1;
	}
	solve(l);
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
//////////////////////////////////////////////////
// Range Query - RSQ and RAQ with Lazy Segment Tree
// https://www.slideshare.net/iwiwi/ss-3578491
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_H&lang=jp

struct StarrySkyTree{
    // for vertex n
    // par (n-1)/2
    // chi 2n+1,2n+2

    // index i
    // bottom vertex n+i-1

    int segn2; // imply actually vertex number
    vector<ll> data,lazy; 
     
    StarrySkyTree(int n){
        segn2=1;
        while(segn2<n) segn2*=2; //必要分2^Mを取る
         
        data.resize(segn2*2,0);
        lazy.resize(segn2*2,0);
    }
    
    void eval(int k,int l,int r){
        if (lazy[k] != 0){ // lazy nonzero
            data[k] += lazy[k]; // itself
            
            if (r-l > 1){
                lazy[2*k+1] += lazy[k] ;
                lazy[2*k+2] += lazy[k] ;
            }

            lazy[k] = 0;
        }
    }

    ll query(int a,int b,int l=0,int r=-1,int k=0){
        if(r<0) r=segn2; // when calling function at first
        eval(k,l,r);

        if (r <= a || b <= l) return INT_MAX; //disjoint
        if (a <= l && r <= b) return data[k]; //include
        
        ll vl = query(a,b,l,(l+r)/2,k*2+1);
        ll vr = query(a,b,(l+r)/2,r,k*2+2);
        return min(vl,vr);
    }
     
    
    void update(int a,int b ,ll x, int l = 0, int r=-1,int k = 0){
        if(r==-1) r=segn2;

        eval(k,l,r);
        
        if (b <= l || r <= a) return;

        if (a <= l && r <= b){
            lazy[k] += x;
            eval(k,l,r);
        }else{
            //一部のみ含むとき，子ノードを計算してその結果をもらう
            update(a,b,x,l,(l+r)/2,2*k+1);
            update(a,b,x,(l+r)/2,r,2*k+2);
            data[k] = min(data[2*k+1] , data[2*k+2]);
            
        }
        
    }
};

// 0-indexed
// sum [s,t) --> s,t+1
// update [s,t,x) --> s,t+1,x

int main(){
    int N,q;
    SCD2(N,q);
    StarrySkyTree seg(N);

    REP(i,q){
        int d; SCD(d);
        if (d==0){
            int s,t,x;
            SCD3(s,t,x);
            seg.update(s,t+1,x);
        }else{
            int s,t; SCD2(s,t);
            
            PRINTLLD(seg.query(s,t+1));
        }
    }
}



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

template <typename... Args>
std::string format(const std::string &fmt, Args... args) {
  size_t len = std::snprintf(nullptr, 0, fmt.c_str(), args...);
  std::vector<char> buf(len + 1);
  std::snprintf(&buf[0], len + 1, fmt.c_str(), args...);
  return std::string(&buf[0], &buf[0] + len);
}

int main() {
  int n, pt;
  string st;
  cin >> n;
  vector<pair<pair<string, int>, int>> spi(n);
  for(int i = 0; i < n; i++) {
    cin >> spi.at(i).first.first >> spi.at(i).first.second;
    spi.at(i).first.second *= -1;
    spi.at(i).second = i + 1;
  }
  sort(spi.begin(), spi.end());
  for(int i = 0; i < n; i++)
    cout << spi.at(i).second << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int x, y, z;
int main() {
	int n, k, i, den = 1;
	cin >> n >> k;
	for (i = 0;i < n;i++) {
		if (den * 2 >= den + k) {
			den += k;
		}
		else {
			den *= 2;
		}
	}
	cout << den << endl;
}

Measured memory_bytes: 256
// +build ignore
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []byte {
	return []byte(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

func gcd(x, y int) int {
	if x%y != 0 {
		return gcd(y, x%y)
	}
	return y
}

func run(input io.Reader, output io.Writer) int {
	sc := NewScanner()
	N := sc.nextInt()
	M := sc.nextInt()
	H := make([]int, N+1)
	good := make(map[int]struct{}, 0)
	for i := 1; i <= N; i++ {
		H[i] = sc.nextInt()
	}

	for i := 0; i < M; i++ {
		a := sc.nextInt()
		b := sc.nextInt()
		switch {
		case H[a] > H[b]:
			good[b] = struct{}{}
		case H[a] < H[b]:
			good[a] = struct{}{}
		default:
			good[a] = struct{}{}
			good[b] = struct{}{}
		}
	}

	fmt.Println(N - len(good))

	return 0
}

func main() {
	os.Exit(run(os.Stdin, os.Stdout))
}


Measured memory_bytes: 7572
#include<stdio.h>
 
int main(){
     
    double s,m;
     
    while( scanf("%lf",&s) != EOF ){
        scanf("%lf",&m);
         
        while(1){
            if(s<35.50 && m<71.00){
                printf("AAA\n");
                break;
            }
            else if(s<37.50 && m<77.00){
                printf("AA\n");
                break;
            }
            else if(s<40.00 && m<83.00){
                printf("A\n");
                break;
            }
            else if(s<43.00 && m<89.00){
                printf("B\n");
                break;
            }
            else if(s<50.00 && m<105.00){
                printf("C\n");
                break;
            }
            else if(s<55.00 && m<116.00){
                printf("D\n");
                break;
            }
            else if(s<70.00 && m<148.00){
                printf("E\n");
                break;
            }
            else if(s>=70.00 || m>=148.00){
                printf("NA\n");
                break;
            }
        }
    }
     
return 0;
}

Measured memory_bytes: 1036
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m; cin >> n >> m;
    char a[n][n],b[m][m];
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++) cin >> a[i][j];
    }
    for(int i=0; i<m; i++){
        for(int j=0; j<m; j++) cin >> b[i][j];
    }
 
    bool exist=false;
    for(int yi=0; yi<n; yi++){
        for(int xi=0; xi<n; xi++){
            if(yi+m-1>=n or xi+m-1>=n) continue;
 
            bool match=true;
            for(int y=0;y<m;y++){
                for(int x=0;x<m;x++){
                    if(a[yi+y][xi+x]!=b[y][x]) match=false;
                }
            }
            if(match) exist=true;
 
        }
    }
    if(exist)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

ll pow(ll x, ll y, ll mod) {
    if (y == 0) {
        return 1;
    }
    if (y % 2 == 0) {
        return pow(x * x % mod, y / 2, mod) % mod;
    } else {
        return x * pow(x, y - 1, mod) % mod;
    }
}

void Main() {
    ll N; cin >> N;
    map<ll, ll> A;
    rep(i, N){
        ll tmp;
        cin >> tmp;
        if (A.find(tmp) != A.end()){
            A[tmp]++;
        } else {
            A[tmp] = 1;
        }
    }
    bool flag = true;
    for (auto a: A){
        if (a.first == 0){
            if (N % 2 == 0){
                flag = false; break;
            } else {
                if (a.second != 1){flag = false; break;}
            }
        } else {
            if (a.second != 2){flag = false; break;}
        }
    }
    ll ans = flag ? pow(2, N / 2, MOD) : 0;
    cout << ans << endl;
}

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


Measured memory_bytes: 4224
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = List.range n `To m
let (++-) n m = if n >= m then List.range n `Downto m else []
let (++^) n m = if n < m then List.range n `To (pred m) else []

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (1 ++ n)

let scan_list ?sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv

let scan_array ?sep cnv = Array.of_list @@ scan_list ?sep cnv

let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list ?sep conv);
  arr

let rec powerset e =
  match Enum.get e with
  | None -> Enum.singleton @@ Enum.empty ()
  | Some v ->
    let f = powerset e in
    let g = Enum.clone f in
    EnumL.map f ~f:(fun x -> let y = Enum.clone x in push y v; y)
    |>  Enum.append g

let permutations l =
  let rec aux l =
    let rec interleave x = function
      | [] -> [[x]]
      | (hd::tl) as lst ->
        (x::lst) ::
        (ListL.map ~f:(List.cons hd)  @@ interleave x tl)
    in
    match l with
    | [] -> [[]]
    | hd::tl -> List.concat @@ List.map (interleave hd) @@ aux tl in
  let l = List.sort (List.compare Int.compare) @@ aux @@ List.of_enum l in
  List.enum % ListL.map ~f:List.enum @@ l

let intersection l =
  EnumL.filter ~f:(fun x -> EnumL.exists ~f:((=) x) @@ Enum.clone l)

let zip l m =
  let n = min (List.length l) (List.length m) in
  List.combine (List.take n l) (List.take n m)

let lower_bound n f =
  let rec aux l u =
    if u - l > 1 then
      let m = (l + u) / 2 in
      if f m then aux l m
      else aux m u
    else u in aux (-1) n

let between n x m = n <= x && x < m

let s = scan "%s" id

let () =
  ListL.map (0 ++^ String.length s) ~f:(fun i ->
      ListL.map (1++String.length s) ~f:(fun len ->
          if i + len <= String.length s then
            if ListL.for_all
                (String.to_list (String.sub s i len)) ~f:(fun c ->
                    c ='A' || c ='C' || c ='G' || c = 'T') then len
            else 0
          else 0))
  |> List.concat |> List.max
  |> Printf.printf "%d\n"


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  int dp[n];
  memset(dp, 0, sizeof(dp));
  for(int i=0; i<n; ++i){
    cin >> arr[i]; 
  }
  dp[1]=abs(arr[0]-arr[1]);
  for(int i=2; i<n; ++i){
    dp[i]=min(dp[i-1]+abs(arr[i-1]-arr[i]),dp[i-2]+abs(arr[i-2]-arr[i]));
  }
  cout << dp[n-1];
  return 0;
}

Measured memory_bytes: 4300
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1e9+7;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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;
}

mat matmul(mat &A,mat &B){
    mat C(A.size(),vec(B[0].size(),0));
    rep(i,A.size()){
        rep(k,B.size()){
            rep(j,B[0].size()){
                C[i][j]=(C[i][j]+A[i][k]*B[k][j])%MOD;
            }
        }
    }
    return C;
}

mat matpow(mat A,ll n){
    mat B(A.size(),vec(A.size()));
    rep(i,A.size()) B[i][i]=1;
    while(n>0){
        if (n&1) B=matmul(B,A);
        A=matmul(A,A);
        n>>=1;
    }
    return B;
}

int main(){
    ll N,K;
    cin >> N >> K;
    mat G(N,vec(N));
    rep(i,N) rep(j,N) cin >> G[i][j];
    mat H=matpow(G,K);
    ll ans=0;
    rep(i,N) rep(j,N) ans=(ans+H[i][j])%MOD;
    cout << ans << endl;
}

Measured memory_bytes: 384
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String str = sc.next();
		String str2 = sc.next();
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < N; i++) {
			sb.append(str.charAt(i));
			sb.append(str2.charAt(i));
		}
		System.out.println(sb.toString());
	}
}

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

const double PI = acos(-1);

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

ll func(ll n) {
	ll ans = 0;
	while (n > 0) {
		n /= 10;
		ans++;
	}
	return ans;
}

void solve_abc_c() {
	ll n, m;
	ll x;
	ll a;
	string s;
	string s_ans;
	ll l_ans = 0;
	double d_ans = 0;
	
	cin >> n;
	
	ll j;
	l_ans = INF;
	rep1(i, sqrt(n)) {
		if (n % i != 0) continue;

		j = n / i;
		l_ans = min(l_ans, max(func(i), func(j)));
	}

	cout << l_ans << "\n";
}

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

	solve_abc_c();

	return 0;
}


Measured memory_bytes: 3680
#include <cmath>
#include <cstdio>
#include <limits>
#include <tuple>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;

struct hilo {
  ll high;
  ll low;
};

int main() {
  ios::sync_with_stdio(false);
  ll k;
  cin >> k;
  vector<ll> a(k);
  rep(i, k) cin >> a.at(i);
  bool isNone = false;

  vector<hilo> hl(k);
  if (a.at(k - 1) == 2) {
    hl.at(k - 1).high = 3;
    hl.at(k - 1).low = 2;
  }
  else isNone = true;

  for (int i = k - 2; i >= 0; --i) {

    if (hl.at(i + 1).low % a.at(i) == 0 or hl.at(i + 1).high % a.at(i) == 0
        or hl.at(i + 1).low / a.at(i) * a.at(i) != hl.at(i + 1).high / a.at(i) * a.at(i)) {
      hl.at(i).high = static_cast<ll>(floor(double(hl.at(i + 1).high) / double(a.at(i)) + 1) * a.at(i) - 1);
      hl.at(i).low = static_cast<ll>(ceil(double(hl.at(i + 1).low) / double(a.at(i)))) * a.at(i);
    } else {
      isNone = true;
      break;
    }

  }
  if (isNone) cout << -1 << endl;
  else cout << hl.at(0).low << " " << hl.at(0).high << endl;

  return 0;
}

Measured memory_bytes: 2560
#include<cstdio>
#include<cmath>

int main(){
	int n;
	double xa,ya,ra,xb,yb,rb;
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf", &xa,&ya,&ra,&xb,&yb,&rb);
		double d = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
		int a = 0;
		if(d <= ra + rb){
			a++;
		}
		if(d + rb < ra){
			a++;
		}
		if(d + ra < rb){
			a++;
			a *= -1;
		}
		printf("%d\n", a);
	}
}

Measured memory_bytes: 1068
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(){
      int n,m;
      int a[100];
      int c[100];
      int p[100];
      int b[100][100];
      memset(p,0,sizeof(p));
      cin>>n>>m;
      REP(i,100)c[i]=1;
      REP(i,m)cin>>a[i];
      REP(i,m)REP(j,n)cin>>b[i][j];
      REP(i,m)REP(j,n)if(b[i][j]!=a[i])c[i]++;
      REP(i,m)REP(j,n)if(b[i][j]==a[i])if(j+1==a[i])p[j]+=c[i];else p[j]++;
      REP(i,n)cout<<p[i]<<endl;
}

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

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

const ll MAX = 10000000010;

void solve(void) {
  ll N; cin >> N;
  vector<ll> vec(N);
  rep(N, i) cin >> vec[i];

  map<ll, ll> bucket;
  rep(N, i) bucket[vec[i]]++;

  rep(N, i) {
    if(bucket[vec[i]] > 1) {
      cout << "NO" << endl;
      return;
    }
  }

  cout << "YES" << endl;
  return;
}


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

Measured memory_bytes: 14336
S['= r'],m[4]['= r'],W,z,d[4]={1,-1},k,i;f(i){m[k][i]=S[i]+47?0:m[k][i]?:1+f(i+d[k]);}main(t){for(d[2]-=d[3]=scanf("%*d%d",&W)+W;S[++i-~W]=~getchar(););for(;--i;z=fmax(z,1-t))for(t=k=4;k--;)t-=f(i-~W);printf("%d",z);}

Measured memory_bytes: 78464
s = input().split()
W = int(s[0])
H = int(s[1])
x = int(s[2])
y = int(s[3])
r = int(s[4])
a = 0
if x >= r:
  if y >= r:
    if W >= x+r:
      if H >= y+r:
        print("Yes")
        a = 3
if a!= 3:
  print("No")


Measured memory_bytes: 5596
#include<bits/stdc++.h>
#define ll long long
using namespace std;
char c[1015][1015]; ll _s[1015][1015+1015]; int _gg[1015][1015+1015],n,m;
struct P{int x,y;}a[1015*1015];vector<P>v1[1015],_v2[1015+1015];
#define s(x,y) _s[x][y+1015]
#define gg(x,y) _gg[x][y+1015]
#define v2(x) _v2[x+1015]
inline int S(int x1,int y1,int x2,int y2){if(x1>x2||y1>y2||x1<2||x2>n+m||y1<1-m||y2>n-1)return 0;
return s(x2,y2)-s(x2,y1-1)-s(x1-1,y2)+s(x1-1,y1-1);}
inline bool cmp1(P x,P y){return x.y<y.y;}inline bool cmp2(P x,P y){return x.x<y.x;}
int main()
{
	int t=0; ll s1=0,s2=0; cin>>n>>m;for(int i=1;i<=n;i++) scanf("%s",c[i]+1);
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) if(c[i][j]=='#')
		a[++t]=P{i+j,i-j},v1[i+j].push_back(a[t]),v2(i-j).push_back(a[t]),gg(i+j,i-j)++;
	for(int i=2;i<=n+m;i++) sort(v1[i].begin(),v1[i].end(),cmp1);
	for(int i=1-m;i<=n-1;i++) sort(v2(i).begin(),v2(i).end(),cmp2);
	for(int i=2;i<=n+m;i++) for(int j=1-m;j<=n-1;j++) s(i,j)=s(i-1,j)+s(i,j-1)-s(i-1,j-1)+gg(i,j);
	for(int i=2;i<=n+m;i++) for(int j=0;j<v1[i].size();j++) for(int k=j+1;k<v1[i].size();k++)
	{
		P x=v1[i][j],y=v1[i][k];int d=y.y-x.y;
		s1+=S(x.x+d,x.y+1,x.x+d,y.y-1)+S(x.x-d,x.y+1,x.x-d,y.y-1);
		s2+=S(x.x+d,x.y,x.x+d,x.y)+S(x.x+d,y.y,x.x+d,y.y)+S(x.x-d,x.y,x.x-d,x.y)+S(x.x-d,y.y,x.x-d,y.y);
	}
	for(int i=1-m;i<=n-1;i++) for(int j=0;j<v2(i).size();j++) for(int k=j+1;k<v2(i).size();k++)
	{
		P x=v2(i)[j],y=v2(i)[k];int d=y.x-x.x;
		s1+=S(x.x+1,x.y+d,y.x-1,x.y+d)+S(x.x+1,x.y-d,y.x-1,x.y-d);
		s2+=S(x.x,x.y+d,x.x,x.y+d)+S(y.x,x.y+d,y.x,x.y+d)+S(x.x,x.y-d,x.x,x.y-d)+S(y.x,x.y-d,y.x,x.y-d);
	}
	cout<<s1+s2/2;
}

Measured memory_bytes: 25600
using System;
class _0020
{
    public static void Main()
    {
        string str = Console.ReadLine();
        str = ToLarge(str);
        Console.WriteLine(str);
    }
    public static string ToLarge(string str)
    {
        char[] c = str.ToCharArray();
        for (int i = 0; i < c.Length; i++) if (c[i] >= 'a' && c[i] <= 'z') c[i] -= (char)0x20;
        return new string(c);
    }
}

Measured memory_bytes: 5256
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 55;
long long int dp[MAXN][MAXN*MAXN][MAXN], x[MAXN];
int main()
{
	int n,a;
	cin>>n>>a;
	for (int i = 1; i <= n; ++i)
	{
		cin>>x[i];
	}
	dp[0][0][0] = 1;
	int cmax = 0;
	for (int i = 1; i <= n; ++i)
	{
		cmax+=x[i];
		for (int j = 0; j <= cmax; ++j)
		{
			for (int k = 0; k <= n; ++k)
			{
				dp[i][j][k] = dp[i-1][j][k];
				if(j >= x[i])
					dp[i][j][k]+=dp[i-1][j-x[i]][k-1];
			}
		}
	}
	long long int ans = 0;
	for (int i = 1; i <= n; ++i)
	{
		ans+=dp[n][a*i][i];
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 27904
#include<stdio.h>

int main()
{
	int i;
	int a,b,w,n,temp,na,nb;
	int num[50];
	scanf("%d %d",&w,&n);
	for(i=0;i<w;i++){
		num[i]=i+1;
	}
	for(i=0;i<n;i++){
		scanf("%d,%d",&a,&b);
		temp=num[a-1];num[a-1]=num[b-1];num[b-1]=temp;
	}
	for(i=0;i<w;i++){
		printf("%d\n",num[i]);
	}
	return 0;
}


Measured memory_bytes: 2112
K = list(map(int, input().strip()))
D = int(input())
mod = 10**9+7

dp = [0]*D
dp[0] += 1
S = 0
for k in K:
    dp[S%D] -= 1
    dp2 = [0]*(D+10)
    for j, d in enumerate(dp):
        dp2[j] += d
        dp2[j+10] -= d
    for j in range(1, D+10):
        dp2[j] = (dp2[j-1] + dp2[j]) % mod
    for j in range(10):
        dp2[(D+j)%D] = (dp2[(D+j)%D] + dp2[D+j]) % mod 
    dp = dp2[:D]
    for j in range(k+1):
        dp[(S+j)%D] = (dp[(S+j)%D] + 1)%mod
    S += k
print((dp[0]-1)%mod)

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

int main () {
  string S;
  cin >> S;
  int ans = 700;
  for(char c: S) {
    if(c == 'o') ans += 100;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;

int main(){
    string s; cin >> s;
    string alphabet = "abcdefghijklmnopqrstuvwxyz";
    int n = s.size();
    int k; cin >> k;
    vector<int> ss(n,-1);
    rep(i,n) ss.at(i) = (26 - (int)(s.at(i) - 'a'))%26;
    rep(i,n-1){
        if(k>=ss.at(i)){
            k -= ss.at(i);
            ss.at(i) = 26;        
        }
    }
    rep(i,n) ss.at(i) = 26 - ss.at(i);
    ss.at(n-1) = (ss.at(n-1)+k)%26;
    /*
    rep(i,n){
        cout << ss.at(i) << " " ;
    }
    */
    rep(i,n){
        cout << alphabet.at(ss.at(i));
    }
}


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

bool ab[100000], ac[100000], bc[100000];

bool match(char c1, char c2)
{
    return (c1 == '?' || c2 == '?' || c1 == c2);
}

int main(void)
{
    string a, b, c;
    cin >> a >> b >> c;

    int al = a.length();
    int bl = b.length();
    int cl = c.length();
    
    rep(i, al)
    {
        rep(j, bl)
        {
            if (!match(a[i], b[j]))
                ab[i - j + 50000] = true;
        }
    }
    rep(i, al)
    {
        rep(j, cl)
        {
            if (!match(a[i], c[j]))
                ac[i - j + 50000] = true;
        }
    }
    rep(i, bl)
    {
        rep(j, cl)
        {
            if (!match(b[i], c[j]))
                bc[i - j + 50000] = true;
        }
    }

    int ans = 3 * m;

    for (int i = -2 * m; i < 2 * m; i++)
    {
        for (int j = -2 * m; j < 2 * m; j++)
        {
            if (!ab[i + 50000] && !ac[j + 50000] && !bc[j - i + 50000])
            {
                int l = min(0, min(i, j));
                int r = max(al, max(bl + i, cl + j));
                ans = min(ans, r - l);
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp(a, b) make_pair(a, b)
typedef pair<int, int> pii;
inline int lowbit(int x) { return (x & (-x));}
const int maxn = 2e5 + 10;
const ll mod = 1e9 + 7;
int d[maxn], a[maxn];
ll sum[maxn], tmp[maxn];
int main()
{
	int k, q;
	cin >> k >> q;
	for(int i = 0; i < k; ++i) cin >> d[i];
	for(int i = 1; i <= q; ++i)
	{
		int n, x, m;
		cin >> n >> x >> m;
		ll ret = x;
		for(int j = 0; j < k; ++j)
		{
			a[j] = d[j] % m;
			sum[j + 1] = sum[j] + a[j];
			tmp[j + 1] = tmp[j] + (a[j] == 0);
		}
		ret += sum[k] * ((n - 1) / k) + sum[(n - 1) % k];
		cout << n - 1 - (ret / m - x / m) - (tmp[k] * ((n - 1) / k) + tmp[(n - 1) % k]) << endl;
		 
	}
	return 0;
}
	

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

using ll=long long;

const int MAX = 2200000;
const long long MOD = 1000000007;
long long INF = 90000000001000;


int main() {

    int n;cin >> n;
    vector<int> p(n),q(n);
    for (int i = 0; i < n; ++i)
    {
       cin >> p[i];
       p[i]--;
    }
    for (int i = 0; i < n; ++i)
    {
       cin >> q[i];
       q[i]--;
    }
    
    int a,b;
    vector<int> r(n),o(n);
    for (int i = 0; i < n; ++i)
    {
       r[i] = i;
    }

    int cnt = 1;
    do{
        int flag = 1;
        
        for (int j = 0; j < n; ++j)
        {
           if(p[j]!=r[j]) {flag = 0;break;}

        }
        if(flag) a = cnt;
        else cnt++;
    } while(next_permutation(r.begin(),r.end()));
    cnt = 1;
    for (int i = 0; i < n; ++i)
    {
       o[i] = i;
    }
    do{
        int flag = 1;

        for (int j = 0; j < n; ++j)
        {
           if(q[j]!=o[j]) {flag = 0;break;}

        }
        if(flag) b = cnt;
        else cnt++;
    } while(next_permutation(o.begin(),o.end()));

cout << abs(a-b) << endl;
return 0;
}




Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int i, c, H, W, N;
    int ans;
    scanf("%d %d %d", &H, &W, &N);
    if (H < W)
    {
        for (i = 1; i <= H; i++)
        {
            c = i * W;
            if (c >= N)
            {
                ans = i;
                break;
            }
        }
    }
    else
    {
        for (i = 1; i <= W; i++)
        {
            c = i * H;
            if (c >= N)
            {
                ans = i;
                break;
            }
        }
    }

    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 128
var
	n,t,a,min,ans,x,s,i:longint;
begin
	read(n,t,a);
	t:=t*1000;
	a:=a*1000;
	min:=maxlongint;
	for i:=1 to n do
	begin
		read(x);
		s:=t-x*6;
		if abs(s-a)<min then
		begin
			min:=abs(s-a);
			ans:=i;
		end;
	end;
	writeln(ans);
end.

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

#define ll long long

#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl

#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;

#define INF 1000000000000000000
#define PI 3.14159265358979323846L

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll a[3];
    ll b[3];

    ll x[4];
    fill0(x);
    rep(i,3)
    {
    	cin >> a[i] >> b[i];
    	x[a[i]-1]++;
    	x[b[i]-1]++;
    }

    sort(x, x+4);

    if(x[0]==1 && x[1] == 1 && x[2] == 2)
    	cout << "YES" << endl;
    else
    	cout << "NO" << endl;
}


Measured memory_bytes: 256
K, A, B = map(int, input().split())

ans = 1
money = 0

if A+2 < B:
	if K <= A:
		ans += K
	else:
		K = K-(A-1)
		ans += A-1
		ans += int(K/2)*(B-A)
		if K%2==1:
			ans += 1

else:
	ans += K

print(ans)


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

int main(){
  int n, x, t;
  cin >> n >> x >> t;
  if(n % x == 0){
    cout << n / x * t << endl;
  } else{
    cout << ((n / x) + 1) * t << endl;
  }
  return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <string.h>

int main(void)
{
	char data[101];
	int num[] = {1, 5, 10, 50, 100, 500, 1000};
	int i, n;
	int ans;
	
	while (scanf("%s", data) != EOF){
		n = strlen(data);
		for (i = 0; i < n; i++){
			switch (data[i]){
				case 'I':
				data[i] = 0;
				break;
				
				case 'V':
				data[i] = 1;
				break;
				
				case 'X':
				data[i] = 2;
				break;
				
				case 'L':
				data[i] = 3;
				break;
				
				case 'C':
				data[i] = 4;
				break;
				
				case 'D':
				data[i] = 5;
				break;
				
				case 'M':
				data[i] = 6;
				break;
			}
		}
		
		ans = num[data[n - 1]];
		for (i = n - 1; i; i--){
			if (data[i] <= data[i - 1]){
				ans += num[data[i - 1]];
			}
			else {
				ans -= num[data[i - 1]];
			}
		}
		
		printf("%d\n", ans);
	}
	
	return (0);
}
	

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

signed main() {
	int a, b; cin >> a >> b;
	int c = __gcd(a, b);
	map<int, int> div;
	for (int i = 2; i * i <= c; i++) {
		while (!(c % i)) {
			div[i]++;
			c /= i;
		}
	}
	if (c != 1) {
		div[c]++;
	}
	cout << div.size() + 1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
/*文字列 str に対して、与えられた命令の列を実行するプログラムを作成してください。命令は以下の操作のいずれかです：

print a b: str の a 文字目から b 文字目までを出力する。
reverse a b: str の a 文字目から b 文字目までを逆順にする。
replace a b p: str の a 文字目から b 文字目までを p に置き換える。
 */
using namespace std;

int main(){
	string s;
	cin >> s;
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		string command;
		int a, b;
		cin >> command >> a >> b;
		if(command == "print"){
			for(int j = a; j <= b; j++){
				cout << s[j];
			}
			cout << endl;
		}else if(command == "reverse"){
			string part = "";
			for(int j = b; j >= a; j--) part += s[j];
			s.replace(a, b - a + 1, part);
		}else if(command == "replace"){
			string p;
			cin >> p;
			s.replace(a, b - a + 1, p);
		}
	}
	return 0;
}



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

using namespace std;

typedef long long int lli;

lli mod4(lli x) {
    lli res;

    switch(x%4) {
      case 0:
        res = x;
        break;
      case 1:
        res = 1;
        break;
      case 2:
        res = x + 1;
        break;
      case 3:
        res = 0;
        break;
    }

    return res;
}

int main() {
    lli a, b;

    cin >> a >> b;

    lli L = mod4(max(a-1, (lli)0)), R = mod4(b);

    cout << (L ^ R) << endl;

    return 0;
}


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

typedef long long ll;
const double EPS = 1e-9;
const ll mod = 1000000007;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)

int main(){
    int m1,d1,m2,d2;
    cin >> m1 >> d1 >> m2 >> d2;
    if (m1+1==m2 && d2==1) {
        cout << 1 << endl;
        return 0;
    }
    else{
        cout << 0 << endl;
    }
    return 0;
}


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

int main(){
	int a[8],b[4],i;
		for(i=0;i<8;i++){
			cin>>a[i];
		}
		b[0]=a[0];
		b[1]=a[2];
		b[2]=a[4];
		b[3]=a[6];
		for(i=0;i<4;i++){
		if(b[i]==1){
			b[i]=a[i*2+1]*6000;
		}if(b[i]==2){
			b[i]=a[i*2+1]*4000;
		}if(b[i]==3){
			b[i]=a[i*2+1]*3000;
		}if(b[i]==4){
			b[i]=a[i*2+1]*2000;
		}
		}for(i=0;i<4;i++){
		cout<<b[i]<<endl;
		}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
int main() {
    double ans = 0;
    int N;
    cin >> N;
    for(int i = 0; i < N; i++) {
        double a;
        cin >> a;
        ans += 1 / a;
    }
    ans = 1 / ans;
    cout << std::fixed << std::setprecision(10) << ans << endl;
    return 0;
}

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

bool kaibunn(string s) {
	for (int i = 0;i < (s.size() + 1) / 2;++i) {
		if (s.at(i) != s.at(s.size() - i - 1)) return false;
	}
	return true;
}

int main(){
	string S;
	cin >> S;
	cout << (kaibunn(S) && kaibunn(S.substr(0, (S.size() - 1) / 2)) && kaibunn(S.substr((S.size() + 3) / 2 - 1)) ? "Yes" : "No") << endl;
	return 0;
}

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

using namespace std;

using int64 = long long;

int main() {
  int64 N, P;
  cin >> N >> P;
  vector< int64 > divisor;
  for(int64 i = 1; i * i <= P; i++) {
    if(P % i == 0) {
      divisor.emplace_back(i);
      if(i * i != P) divisor.emplace_back(P / i);
    }
  }
  int64 ret = 1;
  for(auto &p : divisor) {
    if(p == 1) continue;
    __int128_t mul = 1;
    for(int64 i = 0; i < N; i++) {
      mul *= p;
      if(mul > P) break;
    }
    if(mul <= P && P % mul == 0) {
      ret = max(ret, p);
    }
  }

  cout << ret << endl;
}







Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int n, m, c, ans = 0;
	int b[20], a[20][20];

	scanf("%d %d %d", &n, &m, &c);
	for (int i = 0; i < m; ++i) {
		scanf("%d", &b[i]);
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			scanf("%d", &a[i][j]);
		}
	}

	int sum;
	for (int i = 0; i < n; ++i) {
		sum = 0;
		for (int j = 0; j < m; ++j) {
			sum += a[i][j] * b[j];
		}
		sum += c;
		ans += sum > 0 ? 1 : 0;
	}
	printf("%d", ans);

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define MN 5000
#define mod 1000000007
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int f[MN+5][MN+5],n,m;
char s[MN+5];
inline void R(int&x,int y){(x+=y)>=mod?x-=mod:0;}
int main()
{  
    n=read();scanf("%s",s+1);m=strlen(s+1);
    f[0][0]=1;
    for(int i=1;i<=m;++i) f[0][0]=1LL*f[0][0]*(mod+1)/2%mod;
    for(int i=1;i<=n;++i) for(int j=0;j<=i;++j)
        if(f[i-1][j]) R(f[i][j+1],2*f[i-1][j]%mod),R(f[i][max(0,j-1)],f[i-1][j]);
    printf("%d\n",f[n][m]);
    return 0;
}

Measured memory_bytes: 96384
n = int(input())
a = list(map(int, input().split()))
a.sort()
if a[0]==1:
    if n==1 or a[1]>1:
        print(1)
    else:
        print(0)
    exit(0)
ok = [True]*(10**6+1)
ans = 0
pre = -1
for i in a:
    if not ok[i]:
        continue
    if i==pre:
        ok[i] = False
        continue
    pre = i
    for j in range(i*2, 10**6+1, i):
        ok[j] = False
for i in a:
    if ok[i]:
        ans += 1
print(ans)

Measured memory_bytes: 121728
#include<stdio.h>
#include<stdlib.h>

int main(){
	int N,L,i,taste=0;
  scanf("%d %d",&N,&L);
  int *T=(int*)malloc(sizeof(int)*N);
  	for(i=0;i<N;i++)taste+=(L+i);
  if(L<=0 && L+N-1>=0)printf("%d\n",taste);
  else if(L>0)printf("%d\n",taste-L);
  else printf("%d\n",taste-(L+N-1));
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cassert>
#include<functional>
#include<set>
using namespace std ;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
typedef long long ll ;

int main(){
    int n,k ;
    cin >> n >> k ;
    int A[n] ;
    rep(i,n) A[i] = 0 ;
    rep(i,k){
        int d ;
        cin >> d;
        rep(j,d){
            int a ;
            cin >> a ;
            a-- ;
            A[a]++ ;
        }
    }
    int count =0 ;
    rep(i,n) if(A[i] == 0 )count++ ;
    cout << count << endl;
}

Measured memory_bytes: 3624
import heapq
import numpy as np

n, m = map(int, input().split())
a = list(map(int, input().split()))

a.sort()
a = np.array(a)
a = -1 * a
a = list(a)
heapq.heapify(a)

for i in range(m):
    temp = heapq.heappop(a)
    temp = int(temp/2)
    heapq.heappush(a, temp)

print(-1 * sum(a))

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  int c = 0;
  
  for(int i = 0; i < n - 2; i++){
    if(s.at(i) == 'A'){
      if(s.at(i+1) == 'B'){
        if(s.at(i+2) == 'C'){
          c++;
        }
      }
    }
  }
  cout << c << endl;
  
}

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

public class Program
{
  public static void Main()
  {
    var input = Console.ReadLine().Split();
    var a = int.Parse(input[0]);
    var b = int.Parse(input[1]);

    var max = Math.Max(a + b, Math.Max(a - b, a * b));
    Console.WriteLine(max);
  }
}


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

using namespace std;

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

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

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

    int upper = max(a,c);
    int lower = min(b,d);

    cout << max(0,(lower - upper)) << endl;

    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
       if(a==b) {
    	   System.out.println("a == b");
       }else if(a > b) {
    	   System.out.println("a > b");
       }else {
    	   System.out.println("a < b");
       }



    }

}


Measured memory_bytes: 26376
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
using namespace std;
int a,c=0;
signed main()
{
	cin>>a;
	if(a==1){
		cout<<0;
		return 0;
	}
	int b=sqrt(a);
	for(int i=1;i<b+1;i++){
		if(a%i==0){
			if(i>1&&a/(i-1)==a%(i-1)){
				c+=i-1;
			}
			if(a/(a/i-1)==a%(a/i-1)){
				c+=a/i-1;
			}
		}
	}
	cout<<c;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
int n;
  cin>>n;
  vector<int>moji(n);
rep(i,n)  cin>>moji.at(i);
  int counter=0;
rep(i,n-2){
	if(moji.at(i)< moji.at(i+1) &&moji.at(i+1)<moji.at(i+2)) counter++;
  	else if(moji.at(i)>moji.at(i+1) && moji.at(i+2)<moji.at(i+1))counter++;
}
  cout<<counter<<endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>

#define pb push_back
#define mp make_pair

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef unsigned long long ull;
typedef long long ll;

int main() {
	bool b[1000005] = {false};
	
	int count = 1;
	int k;
	cin >> k;
	
	while (!b[k]) {
		b[k] = true;
		if (k % 2 == 0) {
			k /= 2;
		} else {
			k = 3*k + 1;
		}
		count++;
	}
	
	cout << count << endl;
  return 0;
}

Measured memory_bytes: 1280
import math

a,b=[int(i) for i in input().split()]
# data の桁数を取得する
data_size = int (math.log10(b) + 1)

for i in range(data_size):
    a = a * 10

c = a + b
d = math.sqrt(c)

e = int(d)

if d - e == 0:
    print('Yes')
else:
    print('No')


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

int main(void)
{
  int n, dif = 0, max, index;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++)
    cin >> a[i];
  
  for (int i = 0; i < n; i++) {
    max = 0; index = -1;
    for (int j = 0; j < n; j++) {
      if (a[j] > max) {
        index = j; max = a[j];
      }
    }
    a[index] = -1;
    dif += max*(-i%2+0.5)*2;
  }
  
  cout << dif << endl;
}

Measured memory_bytes: 256
def inN():
    return int(input())
def inL():
    return list(map(int,input().split()))
def inNL(n):
    return [list(map(int,input().split())) for i in range(n)]

n = inN()
N = n % 10
if n % 10 == 3:
    print("bon")
elif n%10 == 0 or n%10 == 1 or N == 6 or N == 8:
    print("pon")
else:
    print("hon")

Measured memory_bytes: 61912