akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
// __builtin_ctz : no of trailing zeros
#define ll long long
#define pp pair<ll,ll>
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
ll max(ll x, ll y)
{
    return x>y ? x : y;
}
ll min(ll x, ll y)
{
    return x<y ? x : y;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;cin >> n;cout << (n+1)/2;
    }

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

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = sc.nextInt();
        int [] a = new int[n + 1];
        Arrays.fill(a, -1);
        int first = -1; int second = -1;
        for (int i = 0; i < n + 1; i++) {
            int x = sc.nextInt();
            if (a[x] != -1) {
                first = a[x];
                second = i;
            }
            a[x] = i;
        }
        initFac(n + 3);
        for (int i = 1; i <= n + 1; i++) {
            long none = (n - 1 < i ? 0 : nck(n - 1, i) % mod);
            long two = (i - 2 < 0 ? 0 : nck(n - 1, i - 2) % mod);
            long one = (n - 1 < i - 1 ? 0 : 2 * nck(n - 1, i - 1)) % mod;
            int edges = first + (n - second);
            one = (one - (edges < i - 1 ? 0 : nck(edges, i - 1)) % mod) % mod;
            if (one < 0) one += mod;
            long res = (none + (one + two) % mod) % mod;
            out.println(res);
        }
        out.close();
    }

    static long[] fac;
    static long mod = (long) 1e9 + 7;

    static void initFac(long n) {
        fac = new long[(int)n + 1];
        fac[0] = 1;
        for (int i = 1; i <= n; i++) {
            fac[i] = (fac[i - 1]  * i) % mod;
        }
    }



    static long nck(int n, int k) {
        if (n < k)
            return 0;
        long den = inv((int) (fac[k] * fac[n - k] % mod));
        return fac[n] * den % mod;
    }

    static long pow(long b, long e) {
        long ans = 1;
        while (e > 0) {
            if (e % 2 == 1)
                ans = ans * b % mod;
            e >>= 1;
            b = b * b % mod;
        }
        return ans;
    }

    static long inv(long x) {
        return pow(x, mod - 2);
    }


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}

Measured memory_bytes: 50432
#include <iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int a[25], b[25], c[25];
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (int i = 1; i <= n; i++) {
        cin >> b[i];
    }
    for (int i = 1; i <= n - 1; i++) {
        cin >> c[i];
    }

    for (int i = 1; i <= n; i++) {
        int key = a[i];
        ans += b[key];
        if (i != 1 && key - 1 == a[i - 1])ans += c[key - 1];
    }
    cout << ans << endl;
    return 0;

}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
using namespace std;

int main()
{
    int n;
    cin >> n;
    int H[n];
    rep(i,n) cin >> H[i];
    int tmp=0, ans=0;
    rep(i,n)
    {
        if(H[i]>=tmp)
        {
            ans++;
            tmp = H[i];
        }
    }
    cout << ans << endl;
    return 0;
}

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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var X = GetLongNum();

            if (400 <= X && X <= 599)
            {
                Console.WriteLine(8);
            }
            else if (600 <= X && X <= 799)
            {
                Console.WriteLine(7);
            }
            else if (800 <= X && X <= 999)
            {
                Console.WriteLine(6);
            }
            else if (1000 <= X && X <= 1199)
            {
                Console.WriteLine(5);
            }
            else if (1200 <= X && X <= 1399)
            {
                Console.WriteLine(4);
            }
            else if (1400 <= X && X <= 1599)
            {
                Console.WriteLine(3);
            }
            else if (1600 <= X && X <= 1799)
            {
                Console.WriteLine(2);
            }
            else if (1800 <= X && X <= 1999)
            {
                Console.WriteLine(1);
            }
        }

        private static long[] GetLongNumArray()
        {
            var input = Console.ReadLine().Split(' ');
            return input.Select(x => long.Parse(x)).ToArray();
        }

        private static long GetLongNum()
        {
            return long.Parse(Console.ReadLine());
        }

        private static string[] GetStringArray()
        {
            return Console.ReadLine().Split(' ');
        }

        private static string GetString()
        {
            return Console.ReadLine();
        }
    }
}


Measured memory_bytes: 27520
n, a, b = map(int, input().split())

rslt = 0
for i in range(1,n+1):
    s = str(i)
    sum = 0
    for j in s:
        # sum += int(j)
        sum = sum + int(j)
    if sum >= a and sum <= b:
        rslt += i

print(rslt)

Measured memory_bytes: 3060
use std::collections::*;
use std::io::*;
use std::*;
// template {{{
macro_rules! get {
    ($($t:tt),*; $n:expr) => {
        {
            let stdin = std::io::stdin();
            let ret = std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
                let line = line.unwrap();
                let mut it = line.split_whitespace();
                _get!(it; $($t),*)
            }).collect::<Vec<_>>();
            ret
        }
    };
    ($($t:tt),*) => {
        {
            let mut line = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut it = line.split_whitespace();
            _get!(it; $($t),*)
        }
    };
}
macro_rules! _get {
    ($it:ident; [char]) => {
        _get!($it; String).chars().collect::<Vec<_>>()
    };
    ($it:ident; [u8]) => {
        _get!($it; String).bytes().collect::<Vec<_>>()
    };
    ($it:ident; usize1) => {
        $it.next().unwrap().parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
    };
    ($it:ident; [usize1]) => {
        $it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
    };
    ($it:ident; [$t:ty]) => {
        $it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
    };
    ($it:ident; $t:ty) => {
        $it.next().unwrap().parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
    };
    ($it:ident; $($t:tt),+) => {
        ($(_get!($it; $t)),*)
    };
}
mod unionfind {
    pub struct Unionfind {
        par: Vec<i32>,
        group_count: usize,
    }
    impl Unionfind {
        pub fn new(n: usize) -> Self {
            Unionfind {
                par: vec![-1; n as usize],
                group_count: n as usize,
            }
        }
        fn find_root(&mut self, mut x: usize) -> usize {
            while self.par[x] >= 0 {
                x = self.par[x] as usize;
            }
            x
        }
        pub fn unite(&mut self, x: usize, y: usize) {
            let mut rx = self.find_root(x);
            let mut ry = self.find_root(y);
            if rx == ry {
                return;
            }
            if self.par[rx] > self.par[ry] {
                std::mem::swap(&mut rx, &mut ry);
            }
            self.par[rx] += self.par[ry];
            self.par[ry] = rx as i32;
            self.group_count -= 1;
        }
        pub fn is_same_group(&mut self, x: usize, y: usize) -> bool {
            self.find_root(x) == self.find_root(y)
        }
        pub fn get_group_size(&mut self, x: usize) -> usize {
            let rx = self.find_root(x);
            (-self.par[rx]) as usize
        }
        pub fn get_num_of_groups(&self) -> usize {
            self.group_count
        }
    }
}
// }}}
type UF = unionfind::Unionfind;

fn main() {
    let (n, m) = get!(usize, usize);
    let input = get!(usize1, usize1; m);
    let mut uf = UF::new(n);
    for i in 0..m {
        uf.unite(input[i].0, input[i].1);
    }
    let mut ans = 0;
    for i in 0..n {
        ans = ans.max(uf.get_group_size(i));
    }
    println!("{}", ans);
}


Measured memory_bytes: 6092
let o = read_line ()
let e = read_line ()

let leno = String.length o
let lene = String.length e

let solve n =
  let b = Buffer.create n in
  let rec aux i =
    if i >= n then Buffer.contents b
    else
      let () = Buffer.add_char b o.[i] in
      let () = Buffer.add_char b e.[i] in
      aux (succ i)
  in
  aux 0


let () =
  match leno - lene with
  | 0 -> solve leno |> print_endline
  | _ -> solve lene |> fun s -> Printf.printf "%s%c\n" s o.[lene]

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m-1); i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
#define fst first
#define snd second
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
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;}
template<typename T> inline int Log2(T& x) {int k; for(k=0; (T(1)<<k)<=x; ++k); return k;} // number of binary digits


// initialization
const int F_MAX = int(1e6)+10;
ll fac[F_MAX], finv[F_MAX], inv[F_MAX];
void binom_init() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < F_MAX; ++i) {
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}

// binom mod MOD
ll binom(int n, int k) {
  if (k < 0 || n < k) return 0;
  return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}



VV G;


// DP
struct ReRooting {
  struct DP {
    ll dp;
    int size;
    DP(ll dp=1, int size=0) : dp(dp), size(size) {}
  };
  DP f_merge(DP a, DP b) {
    return DP((a.dp * b.dp) % MOD * binom(a.size + b.size, a.size) % MOD, a.size + b.size);
  }
  DP f_trans(DP a) {
    return DP(a.dp, a.size+1);
  }

  vector<vector<DP>> dp;
  vector<DP> ans;

  ReRooting(int N) : dp(N), ans(N) {}

  DP dfs(int u, int p=-1) {
    int d = G[u].size();
    dp[u] = vector<DP>(d);
    DP res;
    rep(i, d) {
      int v = G[u][i];
      if (v == p) continue;
      dp[u][i] = dfs(v, u);
      res = f_merge(res, dp[u][i]);
    }
    return f_trans(res);
  }

  void dfs2(int u, const DP &pval=DP(), int p=-1) {
    int d = G[u].size();
    rep(i, d) if (G[u][i] == p) dp[u][i] = pval;

    vector<DP> res_l(d+1), res_r(d+1);
    rep(i, d)  res_l[i+1] = f_merge(res_l[i], dp[u][i]);
    drep(i, d) res_r[i] = f_merge(res_r[i+1], dp[u][i]);

    ans[u] = res_l[d];

    rep(i, d) {
      if (G[u][i] == p) continue;
      dfs2(G[u][i], f_trans(f_merge(res_l[i], res_r[i+1])), u);
    }
  }

  void build() {
    dfs(0);
    dfs2(0);
  }
};


int main() {
  binom_init();
  int N; cin >> N;

  G = VV(N);
  for (int i = 0; i < N-1; ++i) {
    int u, v; cin >> u >> v;
    u--; v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }

  ReRooting reroot(N);
  reroot.build();
  
  rep(i, N) cout << reroot.ans[i].dp << endl;
  return 0;
}


Measured memory_bytes: 58868
n = int(input())
CSF = [list(map(int, input().split())) for i in range(n-1)]

ans = [0 for i in range(n)]

for i in range(n):
    cnt = 0
    for j in range(i, n-1):
        c, s, f = CSF[j][0], CSF[j][1], CSF[j][2]
        if cnt < s:
            cnt = s
        elif cnt % f != 0:
            cnt = (cnt//f + 1) * f
        cnt += c
    ans[i] += cnt

for a in ans:
    print(a)


Measured memory_bytes: 3188
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args){
		FastScanner sc = new FastScanner();
		String a = sc.next();
		String b = sc.next();

		b = b.substring(0,b.length() - 1);

		System.out.println(a.equals(b) ? "Yes" : "No");
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

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

int main() {
  string S,T;
  cin >> S >> T;
  int n=S.size();
  string M;
 
  for(int i=0; i<n; i++){
    if(S.at(i)==T.at(i)){
      M="Yes";
    }
    else{
      M="No";
      break;
    }
  }
  cout << M << endl;

}


Measured memory_bytes: 3628
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>
#include <valarray>
#include <fstream>

using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i,a,n) for(LL i = (a); i < (LL)(n); ++i)
#define REM(i,a,n) for(LL i = ((n) - 1); i >= (a); --i)
#define FLOAT fixed << setprecision(16)
#define SPEEDUP {cin.tie(0); ios::sync_with_stdio(false);}
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const string INFSTR = "\x7f";
const double EPS = 1.0e-9;

void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(dest, dest + N, val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
template<class T>
T Compare(T left, T right) { return left > right ? 1 : (left < right ? -1 : 0); }
istream& Ignore(istream& ist) { string s; ist >> s; return ist; }
bool Inside(int i, int j, int h, int w) { return i >= 0 && i < h && j >= 0 && j < w; }
// all_of
// partial_sum, adjacent_difference

#ifdef ONLY_MY_ENVIR
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#include "Range.h"
#include "Global.h"
#include "Flow_Solver.h"
#include "Tree.h"
#include "Suffix_Array.h"
#include "Geometry.h"
#include "Matrix.h"
#endif

#ifdef __GNUC__
typedef __int128 LLL;
istream& operator>> (istream& ist, __int128& val) { LL tmp;  ist >> tmp; val = tmp; return ist; }
ostream& operator<< (ostream& ost, __int128 val) { LL tmp = val; ost << tmp; return ost; }
#endif

#if 1234567891
#include <array>
#include <random>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

int N, K;
int A[5000];

bool Judge(int omit) {
	bitset<5001> dp;
	dp[0] = 1;

	REP(i, 0, N) {
		if (i == omit) continue;
		dp |= dp << A[i];
	}

	bool ng = 0;
	REP(i, max(K - A[omit], 0), K) {
		ng |= dp[i];
	}
	return !ng;
}

int main() {
	cin >> N >> K;
	REP(i, 0, N) {
		cin >> A[i];
	}
	sort(A, A + N);

	int lo = -1;
	int hi = N;
	while (hi - lo > 1) {
		int mid = (hi + lo) / 2;
		if (Judge(mid)) {
			lo = mid;
		} else {
			hi = mid;
		}
	}

	cout << hi << endl;
	return 0;
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    l=parseMap(split(readline())) |> sort
    ans=0
    for i in 1:2n
        if i%2==1
            ans+=l[i]
        end
    end
    println(ans)
end
main()

Measured memory_bytes: 168972
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n[] = new int[3];
		n[0] = sc.nextInt();
		n[1] = sc.nextInt();
		n[2] = sc.nextInt();
		Arrays.sort(n);
		System.out.println(n[0] + " " + n[1] + " " + n[2]);
	}
}


Measured memory_bytes: 26300
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<tuple>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

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

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = INF+7;

struct edge{int to,cost;};

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

	string s;
	cin >> s;
	string tmp(s);

	int ans=INF;
	for(char c='a';c<='z';c++){
		bool yet=true;
		int cnt=0;
		s = tmp;
		int len=s.size();

		while(yet){
			string ss(100,'A');
			yet=false;
			for(int i=0;i<len-1;i++){
				if(s[i] == c || s[i+1] == c) ss[i]=c;
				else{
					ss[i] = s[i];
					yet=true;
				}
			}
			if(cnt==0 && !yet){
				cout << "0\n";
				return 0;
			}
			cnt++;
			s = ss;
			len--;
		}
		ans = min(ans,cnt);
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
from functools import reduce

A, B = map(int, input().split())
if A == B:
    result = A
else:
    result_top = reduce(lambda acc, n: acc ^ n, range(A, (int(A/4)+1) * 4))
    result_tail = reduce(lambda acc, n: acc ^ n, range(int(B/4) * 4, B + 1))
    result = result_top ^ result_tail

print("{}".format(result))


Measured memory_bytes: 3572
s = input()
s_len = len(s)
s1 = s[0:int((s_len - 1) / 2)]
s2 = s[int((s_len + 3) / 2) - 1:s_len]
if s1 == s1[::-1] and s2 == s2[::-1] and s == s[::-1]:
    print('Yes')
else:
    print('No')


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

using namespace std;

int main()
{
    //freopen("in", "r", stdin);
    //freopen("out", "w", stdout);

    long long x;
    scanf("%lld", &x);

    long long res = x / 11 * 2 + (x % 11 > 6 ? 2 : (x % 11 ? 1 : 0));
    printf("%lld\n", res);
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
const int MOD = 1e9 + 7;

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

	int n;cin>>n;
    vector<ll> v(n);
	map<ll,ll> mp;
	for(int i=0;i<n;i++){
		cin>>v[i];
	}
	ll last=0,cnt=0;
	sort(v.begin(),v.end());
	v.push_back(-1);
	ll res=0;
	vector<P> w;
	for(int i=0;i<n+1;i++){
		if(v[i]!=last){
			if(cnt!=0) w.push_back(P(last,cnt));
			last=v[i];
			cnt=1;
		}
		else cnt++;
	}
	for(int i=0;i<(int)w.size();i++){
		ll f=w[i].first,s=w[i].second;
        //cout<<f<<" "<<s<<endl;
		if(f<=s) res+=(s-f);
		else res+=s;
	}
	cout<<res<<endl;
}


Measured memory_bytes: 4108
#include <iostream>
#include <vector>
#include <string>
typedef long long int lli;
using namespace std;
int main(){
    int h,w;
    cin>>h>>w;
    vector<string> v;
    for(int i=0;i<h;i++){
        string s;
        cin>>s;
        v.push_back(s);
    }
    vector<vector<lli>> dp(h,vector<lli>(w,0));
    dp[0][0]=1;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(i==0 and j==0) continue;
            else if(i==0 and j>0){
                if(v[i][j]=='.') dp[i][j]=dp[i][j-1];
                else dp[i][j]=0;
            }
            else if(i>0 and j==0){
                if(v[i][j]=='.') dp[i][j]=dp[i-1][j];
                else dp[i][j]=0;
            }
            else{
                if(v[i][j]=='.'){
                    dp[i][j]=(dp[i-1][j]+dp[i][j-1])%1000000007;
                }
                else dp[i][j]=0;
            }
        }
    }
    if(dp[h-1][w-1]<0) dp[h-1][w-1]+=1000000007;
    cout<<dp[h-1][w-1]<<endl;
    return 0;
}

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

int main() {
  int W,A,B;
  cin >> W >> A >> B;
  if(min(A,B)+W > max(A,B)){
    cout << 0 << endl;
  }
  else{
  cout << min(abs(A+W-B),abs(B+W-A)) << endl;
  }
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    ll X,Y; cin >> X >> Y;
    int ans = 0;

    while(X<=Y){
        X*=2;
        ans++;
    }
    cout << ans << endl;

    return 0;
}

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

const int INF = 1e+9;
double eps = 1e-10;

int main() {
	int n, f, f1 = -1, f2 = -1, a, a1 = -1, a2 = -1, t, x, y, x1, y1, x2, y2;
	bool t1 = false, t2 = false;
	int ans1_d = -1, ans2_d = -1, ans1_s = INF, ans2_s = INF;
	cin >> n;
	for(int i = 0; i < n; ++i){
		scanf("%d%d%d%d%d", &f, &a, &t, &x, &y);
		if(t == 0){
			if(t1){
				if(a1 != a){
					int d = pow(x - x1, 2.0) + pow(y - y1, 2.0);
					int s = f - f1;
					if(ans1_d < d){
						ans1_d = d;
						ans1_s = s;
					}
					else if(d == ans1_d){
						ans1_s = min(ans1_s, s);
					}
				}
			}
			f1 = f;
			a1 = a;
			x1 = x;
			y1 = y;
			t1 = true;
			t2 = false;
		}
		else{
			if(t2){
				if(a2 != a){
					int d = pow(x - x2, 2.0) + pow(y - y2, 2.0);
					int s = f - f2;
					if(ans2_d < d){
						ans2_d = d;
						ans2_s = s;
					}
					else if(ans2_d == d){
						ans2_s = min(ans2_s, s);
					}
				}
			}
			f2 = f;
			a2 = a;
			x2 = x;
			y2 = y; 
			t1 = false;
			t2 = true;
		}
	}
	if(ans1_d == -1)
		cout << "-1" << " " << "-1" << endl;
	else
		cout << fixed << sqrt(ans1_d) << " " << ans1_s / 60.0 << endl;
	if(ans2_d == -1)
		cout << "-1" << " " << "-1" << endl;
	else
		cout << fixed << sqrt(ans2_d) << " " << ans2_s / 60.0 << endl;
	return 0;
}

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

using namespace std;

typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define ll	long long
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())

int main() {
	ll n, a, b;
	cin>>n>>a>>b;
	ll q = n/(a+b);
	ll r = n%(a+b);
	ll x = r > a ? a : r;
	cout<< q*a + x;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int a[N];
int n;
int calc(int x) {
//	printf("%d\n", x);
   int res = 0;
   for(int i = 0; i < n; ++i) {
		res+= (a[i]-x)*(a[i]-x);
   }
   return res;
}
int main(){
 	//freopen("in", "r", stdin);
  	//freopen("out", "w", stdout);
	int tc;
	//scanf("%d", &tc);
	tc = 1;
	int h = -200;
	int l = 200;
	for(int tt = 1 ; tt <= tc; ++tt){
		scanf("%d", &n);
		for(int i = 0; i < n; ++i){
		 	scanf("%d", a+i);
		 	if(a[i] < l)l = a[i];
		 	if(a[i] > h)h = a[i];
	  	}
	  	int ans =(int)1e9;
	  	for(int i = l; i <=h; ++i)ans = min(ans, calc(i));
	  	printf("%d\n", ans);
	//	fprintf(stderr, "caso de teste %d resolvido\n", tt);
	//	fflush(stderr);
	}
	
	return 0;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i*500 + j*100 + k*50 == x:
        ans += 1
print(ans)

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

int main() {
	int n,i,k,j;
	cin>>n>>k;
	int ht[n];
	for(i=0;i<n;i++)
	{
	    cin>>ht[i];
	}
	int dp[n];
	dp[0]=0;
	dp[1]=abs(ht[1]-ht[0]);
	for(i=2;i<=n;i++)
	{
	    dp[i]=INT_MAX;
	    for(j=1;j<=min(i,k);j++)
	    {
	        dp[i]=min(abs(ht[i-j]-ht[i])+dp[i-j],dp[i]);
	    }
	}
	cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 4376
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define ff first
#define ss second
#define prec(y,x) fixed<<setprecision(y)<<x
#define inf 1e18
#define pi 3.1415926535

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	char c;
	cin >> c;
	int u = c - 91;
	if (u < 0)
		cout << "A";
	else
		cout << "a";
	return 0;
}


Measured memory_bytes: 3628
# -*- coding: utf-8 -*-

def input_converter(key_string):
    key_string = key_string.replace('A', '1')
    key_string = key_string.replace('T', '2')
    key_string = key_string.replace('C', '3')
    key_string = key_string.replace('G', '4')
    return int(key_string)


class HashTable(object):
    def __init__(self, hash_size = 2 ** 26):
        self.hash_size = hash_size
        self.hash_array = [None] * self.hash_size

    def insert_value(self, data, key):
        collision_number = 0
        next_index = self.hash_function(key, collision_number)
        while self.hash_array[next_index] is not None:
            collision_number += 1
            next_index = self.hash_function(key, collision_number)
        # print self.hash_array[next_index]
        self.hash_array[next_index] = data

    def search_value(self, data, key):
        collision_number = 0
        next_index = self.hash_function(key, collision_number)
        next_data = self.hash_array[next_index]
        while True:
            if (next_data is None) or (collision_number > self.hash_size):
                return False
            elif next_data == data:
                return True
            else:            
                collision_number +=1
                next_index = self.hash_function(key, collision_number)
                next_data = self.hash_array[next_index]

    def hash_function(self, key, collision_number):
        def h1(key):
            return key % self.hash_size
    
        def h2(key):
            return key % (self.hash_size - 1)

        return (h1(key) + collision_number * h2(key)) % self.hash_size


def main():
    input_size = int(raw_input())
    hash_table = HashTable()
    counter = 0
    while counter < input_size:
        command, key = raw_input().split(' ')
        if command == 'insert':
            hash_table.insert_value(key, input_converter(key))
        else:
            if hash_table.search_value(key, input_converter(key)):
                print 'yes'
            else:
                print 'no'
        counter += 1


if __name__ == '__main__':
    main()

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

int main() {
  long A, B, K;
  cin >> A >> B >> K;
  if (A < K) {
    K -= A;
    A = 0;
    if (B < K) {
      B = 0;
    } else {
      B -= K;
    }
  } else {
    A -= K;
  }
  cout << A << ' ' << B << endl;
}

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

int main()
{

  int n;
  cin >> n;

  int arr[n];
  long long int dp[n + 10];

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

  dp[0] = 0;
  dp[1] = abs(arr[1] - arr[0]);
  for (int i = 2; i < n; i++)
  {

    dp[i] = min(dp[i - 2] + abs(arr[i] - arr[i - 2]), dp[i - 1] + abs(arr[i] - arr[i - 1]));
  }

  cout << dp[n - 1];

  return 0;
}

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

typedef long long ll;

#define REP(i, N) for (int i = 0; i < (int)(N); i++)

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

int N;
string S;

tuple<int,int,int> Remainder(int x){
    int x0,x1,x2;
    x0 = x % 10; x /= 10;
    x1 = x % 10; x2 = x/10;
    return make_tuple(x2,x1,x0);
}

// 暗証番号 x を作れるか判定する
bool make( int x ){
    int x2,x1,x0;
    tie(x2,x1,x0) = Remainder(x);
    int count = 0;
    bool flg = false;
    for ( int i = 0; i < N; ++i){
        int num = S[i] - '0';
        if ( count == 0 and num == x2 ){
            count = 1;
        } else if ( count == 1 and num == x1 ){
            count = 2;
        } else if ( count == 2 and num == x0 ){
            flg = true;
            break;
        }
    }
    return flg;
}

int main() {
    cin >> N >> S;
    
    int ans = 0;
    for ( int i = 0; i < 1000; ++i){
        if ( make(i) ) ++ ans;
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3620
import numpy as np
import itertools
from copy import copy
def DetK(Column,Row,Colors):
  for i in Column:
    Colors[i,:] = "r"
  for j in Row:
    Colors[:,j] = "r"
  K=np.where(Colors=="#")[0].shape[0]
  return K
H,W,K=map(int,input().split())
Colors=[]
for i in range(H):
  Colors.append(np.array(list(input())))
Colors=np.array(Colors)
ans=0
for i in range(H+1):
  for j in range(W+1):
    Columns=list(itertools.combinations(range(H),i))
    Rows=list(itertools.combinations(range(W),j))
    for Column in Columns:
      for Row in Rows:
        if DetK(Column,Row,copy(Colors))==K:
          ans+=1
print(ans)


Measured memory_bytes: 27160
//Utkarsh.25dec
#include <bits/stdc++.h>
#define ll long long int 
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
using namespace std;
const int N=500023;
bool vis[N];
vector <int> adj[N];
void solve()
{
    ll n;
    cin>>n;
    vl v;
    map <ll,ll> cnt;
    ll dis=0;
    vl numbers;
    rep(i,n)
    {
        ll c;
        cin>>c;
        v.pb(c);
        if(cnt[c]==0)
        {
            dis++;
            numbers.pb(c);
        }
        cnt[c]++;
    }
    if(n==3)
    {
        if((v[0]^v[1])==v[2])
            cout<<"Yes";
        else
            cout<<"No";
        return;    
    }
    if(dis>3)
    {
        cout<<"No";
        return;
    }
    if(dis==3)
    {
        if(n%3!=0)
        {
            cout<<"No";
            return;
        }
        if(cnt[numbers[0]]==(n/3)&&cnt[numbers[1]]==(n/3)&&cnt[numbers[2]]==(n/3))
        {
            if((numbers[0]^numbers[1])==(numbers[2]))
                cout<<"Yes";
            else
                cout<<"No";
            return;
        }
        else
        {
            cout<<"No";
            return;
        }
    }
    else if(dis==2)
    {
        if(n%3!=0)
        {
            cout<<"No";
        }
        else
        {
            if(cnt[0]==(n/3))
                cout<<"Yes";
            else
                cout<<"No";
        }
        return;
    }
    else if(dis==1)
    {
        if(cnt[0]==n)
            cout<<"Yes";
        else
            cout<<"No";
    }
}
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
}

Measured memory_bytes: 18024
#include "bits/stdc++.h"
#define r(i,a,n) for(int i=a;i<(int)(n);i++)
using namespace std;
const int MAX_N = 1E+5;
typedef long long ll;
ll x[MAX_N];
ll dist[MAX_N];
int N;
ll X,D;


//自分が使った最大公約数を求める関数
int gcd(int a,int b){
  if(b == 0) return a;
  return gcd(b,a%b);
}

int main(){
        cin>>N>>X;
        r(i,0,N){
                cin>>x[i];
                dist[i]=abs(X-x[i]);
        }
        int divis=dist[0];
        r(i,1,N){
          	
                int r,n,m;
          			
          		   /* nとmの大小は関係ないはず
                   if(divis>dist[i]){
                   */
                        m=divis;
                        n=dist[i];
                    /*
                	}else{
                        m=dist[i];
                        n=divis;
                	}
          			*/
          
                while(m != 0){
                  		r=n%m;
                        n=m;
                        m=r;
                }
                divis = n;
        }
        D=divis;
        cout<<D<<endl;
        return 0;
}


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

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(vs) (ll)(vs.size())
#define rep(i,a,b) for (ll i=a;i<b;++i)
#define rep_(i,a,b) for (ll i=a;i>b;--i)
#define iter(i,c) for (auto i:c)
#define endl '\n'
const ll mod = 1e9 + 7;

const ll maxn = 1e5;

ll a, b, c, k;

void solve() {
	cin>>a>>b>>c>>k;
	while (b<=a) {b<<=1;--k;}
	while (c<=b) {c<<=1;--k;}
	if (k<0) cout<<"No";
	else cout<<"Yes";
}

void aux() {
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cout<<fixed<<setprecision(10);
	aux();
	ll _ = 1;
	// cin>>_;
	while(_--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 3648
import itertools
M, K = map(int, input().split())

if K >= (1 << M):
    print(-1)
    quit()

if M == 0:
    print(0, 0)
    quit()

if M == 1:
    if K == 0:
        print(0, 0, 1, 1)
    else:
        print(-1)
    quit()


A = [i for i in range(1 << M) if i != K]
print(*(A + [K] + A[::-1] + [K]))


Measured memory_bytes: 14216
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
const int INF=1000100010;
int main(){
int n,k;cin>>k>>n;
vector<int> a(n);
rep(i,n){
    cin>>a[i];
}
a.push_back(a[0]+k);
int l=0;
rep(i,n){
    l=max(l,a[i+1]-a[i]);
}
int ans=k-l;
cout<<ans<<endl;
}

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

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll blue = n/(a+b)*a;
  if (n%(a+b) == 0) cout << blue;
  else {
    if (n%(a+b) < a) blue += n%(a+b);
    else blue += a;
    cout << blue;
  }
}


Measured memory_bytes: 256
X, Y, R, G, W = map(int, input().split())
red = list(map(lambda x: (int(x), 0), input().split()))
green = list(map(lambda x: (int(x), 1), input().split()))
white = list(map(lambda x: (int(x), 2), input().split()))

apples = sorted(red + green + white, key=lambda x: x[0])

choice = X + Y
res = 0

while apples and choice:
    val, color = apples.pop()
    if color == 0:
        if X > 0:
            res += val
            X -= 1
            choice -= 1
        continue
    if color == 1:
        if Y > 0:
            res += val
            Y -= 1
            choice -= 1
        continue
    if color == 2:
        res += val
        choice -= 1

print(res)
            
    


Measured memory_bytes: 125164
// IlyM

#include <bits/stdc++.h>
#define pb push_back
#define sp " "
#define sl "\n"
#define fi first
#define se second
#define mp make_pair
#define sz(a) ((int)a.size())
#define tra(a,b) for (auto a:b) 
#define fo(a,b,c) for (int a=b;a<=c;a++) 
#define ms(a,b) memset(a,b,sizeof(a)) 
#define all(a) a.begin(),a.end()
#define rev(a) reverse(a.begin(),a.end())
#define bit(i,j) (i&(1<<j))

using namespace std;

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

const int N=2e5+5,mod=998244353;
int n,l;
string a[105];
int main()
{
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	cin>>n>>l;
	fo(i,0,n-1) cin>>a[i];
	sort(a,a+n);
	fo(i,0,n-1) cout<<a[i];
	return 0;
}


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

int main() {
  vector<int> vec(5);
  
  for (int i = 0; i < 5; i++) {
    cin >> vec.at(i);
  }
  
  int k;
  cin >> k;

  if(vec.at(4) - vec.at(0) > k) {
    cout << ":(" << endl;
  } else {
    cout << "Yay!" << endl;
  }
}


Measured memory_bytes: 256
// ABC155 B - Papers, Please
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  // 初期値
  int N, digit; 
  bool clearance = true;
  cin >> N;
  
  vector<int> papers(N);
  for (int i = 0; i < N; i++){
    cin >> papers.at(i);
  }
  
  // Main loop
  for (int i = 0; i < N; i++){
    digit = papers.at(i);
    
    if (digit % 2 == 0){
      if (digit % 3 == 0 || digit % 5 == 0){
        //
      } else {
        clearance = false;
        break;
      }
    }
  }
  
  if (clearance){
    cout << "APPROVED" << endl;
  } else {
    cout << "DENIED" << endl;
  }
  
  return 0;
}

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

using namespace std;

const int N = 200 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

int n;
int a[N];

bool read() {
    if (!(cin >> n))
        return false;

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

    return true;
}

void solve() {
    if (a[0] != 0) {
        cout << "-1\n";
        return ;
    }

    for (int i = 1; i < n; ++i)
        if (a[i] - a[i - 1] > 1) {
            cout << "-1\n";
            return ;
        }

    auto ans = 0ll;

    for (int l = 0; l < n; )
        if (a[l] == 0) {
            ++l;
        } else {
            for (int r = l; r <= n; ++r)
                if (a[r] != a[r - 1] + 1) {
                    if (a[r] == 0) {
                        ans += r - l;
                        a[r - 1] = 0;
                        l = r;
                        break;
                    }

                    ans += r - l;
                    l = r - a[r] + 1;
                }
        }

    cout << ans << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 1024
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
ll d[1010];
int main()
{
	int num, way;
	scanf("%d%d", &num, &way);
	vector<pi3>v;
	for (int i = 0; i < way; i++)
	{
		int za, zb, zc;
		scanf("%d%d%d", &za, &zb, &zc);
		za--, zb--;
		v.push_back(make_pair(make_pair(za, zb), zc));
	}
	fill(d, d + num, -1000000000000000000LL);
	d[0] = 0;
	for (int p = 0; p < num * 4; p++)
	{
		ll t = d[num - 1];
		for (int i = 0; i < v.size(); i++)d[v[i].first.second] = max(d[v[i].first.second], d[v[i].first.first] + v[i].second);
		if (t != d[num - 1] && p > num * 2)
		{
			printf("inf\n");
			return 0;
		}
	}
	printf("%lld\n", d[num - 1]);
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define sz(a) (int)a.size()
using namespace std;

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

	string s, t;
	cin >> s >> t;
	int ans = 0;
	rep(i, 3) if (s[i] == t[i]) ans++;
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	Scanner sc = new Scanner(System.in);
	int a,b,c,d,e,f,k,l,m,n,x,y,z;
	int ans;
	String[] S;

	Main(){
		// 整数の入力
		a = sc.nextInt();
		b = sc.nextInt();

		// 出力
		System.out.println((a-b)%2==0?(a+b)/2:"IMPOSSIBLE");
	}

	public static void main(String[] args){
		new Main();
	}
}

Measured memory_bytes: 21460
#include<bits/stdc++.h>
using namespace std;
int st(string s){
    int a=0;
    int z=s.size()-1;
    while(s.at(a)!='A'){
        a++;
    }
    while(s.at(z)!='Z'){
        z--;
    }
    


    return z-a+1;
}
int main(){
    string s;
    cin>>s;
    cout<<st(s)<<endl;
    
}

Measured memory_bytes: 3800
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner i=new Scanner(System.in);
		double r=i.nextDouble();
		double s=r*r*Math.PI;
		double l=r*2*Math.PI;
		System.out.printf("%.6f %.6f\n",s,l);
	}
}

Measured memory_bytes: 18992
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REP(a, b, m) for (ll a = (ll)(b); a < (ll)(m); a++)

int main()
{
    int a, b;
    cin >> a >> b;
    int ans = max(a + b, max(a - b, a * b));
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <vector>

#define MAX_N 10
#define MAX_D 10

using namespace std;

int X[MAX_N][MAX_D];
bool B[MAX_N]{};

int main() {
  int N, D;
  cin >> N >> D;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < D; ++j) {
      cin >> X[i][j];
    }
  }
  int cnt = 0;
  B[0] = true;
  B[1] = true;
  do {
    vector<int> v;
    for (int i = 0; i < N; ++i) {
      if (B[i])
        v.push_back(i);
    }
    int d = 0;
    for (int i = 0; i < D; ++i) {
      d += (X[v[0]][i] - X[v[1]][i]) * (X[v[0]][i] - X[v[1]][i]);
    }
    if (d == (int)(sqrt(d)) * (int)(sqrt(d))) {
      ++cnt;
    }
  } while (prev_permutation(B, B + N));
  printf("%d\n", cnt);
}

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

using namespace std;

typedef long long ll;

#define MOD (int)1e9+7
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()

ll powM(ll a,ll b,ll m )
{ 
  a%=m;
  ll ans=1;
  while(b>0)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}



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


ll n;cin>>n;

vl a(n+1);

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

  vvl dp(n+2,vl(n+1,0));

//dp[l][r]---all the cards from [l,r] have been distributed .

for(int l=n;l>=1;l--)
{
  for(int r=l;r<=n;r++)
  {
    dp[l][r]=max(a[l]-dp[l+1][r],a[r]-dp[l][r-1]);
  }
}

cout<<dp[1][n]<<"\n";




return 0;

}


Measured memory_bytes: 70784
import java.util.Scanner;

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

        int[] x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
        }

        long ans = Long.MAX_VALUE;
        for (int p = 1; p <= 100; p++) {
            long strength = 0;
            for (int i = 0; i < n; i++) {
                strength += ((x[i] - p) * (x[i] - p));
            }
            if (strength < ans) {
                ans = strength;
            }
        }

        System.out.println(ans);

    }

}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
int a[maxn];
int b[maxn];
int ans;
int main(){
	
	int n,i,t=0;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>a[i];
		t>a[i]?(ans+=t-a[i]):(ans+=a[i]-t);
		t=a[i];
	}
	ans+=abs(t);
	t=ans;
	for(i=1;i<=n;i++){
		ans=t;
		a[i-1]>a[i+1]?(ans+=a[i-1]-a[i+1]):(ans+=a[i+1]-a[i-1]);
		a[i-1]>a[i]?(ans-=a[i-1]-a[i]):(ans-=a[i]-a[i-1]);
		a[i]>a[i+1]?(ans-=a[i]-a[i+1]):(ans-=a[i+1]-a[i]);
		cout<<ans<<endl;
	}
	
	
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;


int main(){
  ll h, w;
  cin >> h >> w;
  
  if(h == 1 || w == 1)
    cout << 1 << endl;
  else if(h*w %2 == 1)
    cout << h*w/2 +1 << endl;
  else
  	cout << h*w/2 << endl;
}





Measured memory_bytes: 256
S=input()
is_true=True
for i in range(0,len(S),2):
    
    if S[i]!="R" and S[i]!="U" and S[i]!="D":
        is_true=False
        break
for i in range(1,len(S),2):
    
    if S[i]!="L" and S[i]!="U" and S[i]!="D":
        is_true=False
        break
print("Yes" if is_true==True else "No")

Measured memory_bytes: 3064