akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    S = list(lines.pop(0))
    S.sort()
    S = ''.join(S)
    if S == 'abc':
        print('Yes')
    else:
        print('No')

#
# main
#
lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Measured memory_bytes: 3060
import math
n,k=map(int,input().split())
p=1/2
p0=1/n
pp=0
M=math.ceil(math.log2(k))
m=math.ceil(math.log2(k/n))
for i in range(1,min(k+1,n+1)):
    pp+=p0*(p**math.ceil(math.log2(k/i)))
if n>k:
    pp+=p0*(n-k)
print(pp)

Measured memory_bytes: 3064
fn main() {
    let mut sc = Scanner::new();
    let h = sc.usize_read();
    let w = sc.usize_read();
    let sh = sc.usize_read();
    let sw = sc.usize_read();

    if h % sh == 0 && w % sw == 0 {
        println!("No");
    } else if h % sh == 0 {
        let row = create_one(w, sw);
        println!("Yes");
        for _ in 0..h {
            for &r in &row {
                print!("{} ", r);
            }
            println!();
        }
    } else {
        let column = create_one(h, sh);
        println!("Yes");
        for &c in &column {
            for _ in 0..w {
                print!("{} ", c);
            }
            println!();
        }
    }
}

fn create_one(w: usize, sw: usize) -> Vec<i64> {
    let mut sum: Vec<i64> = vec![10000000; w + 1];
    sum[0] = 0;
    for i in 0..(w + 1 - sw) {
        sum[i + sw] = sum[i] - 1;
    }
    (0..w).map(|i| sum[i + 1] - sum[i]).collect()
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        Scanner {
            ptr: 0,
            length: 0,
            buf: vec![0; 1024],
            small_cache: vec![0; 1024],
        }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool {
        b == b'\n' || b == b'\r' || b == b'\t' || b == b' '
    }

    fn read_vec<T>(&mut self, n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        (0..n).map(|_| self.read()).collect()
    }

    fn usize_read(&mut self) -> usize {
        self.read()
    }

    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)])
                    .parse()
                    .unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}


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

bool reachable(int &n, int x, int y) {
  if (x >= 0 && x < 2 && y >= 0 && y < n) {
    return true;
  }
  return false;
}

int search(vector<vector<int>> &board, int &n, int x, int y, int sum) {
  sum += board.at(x).at(y);
  // ベースケース
  if (x == 1 && y == n - 1) {
    return sum;
  }

  // 再帰ステップ
  // 縦軸に移動
  int p1 = 0;
  if (reachable(n, x + 1, y)) {
    p1 = search(board, n, x + 1, y, sum);
  }
  // 横軸に移動
  int p2 = 0;
  if (reachable(n, x, y + 1)) {
    p2 = search(board, n, x, y + 1, sum);
  }

  return max(p1, p2);
}

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

  vector<vector<int>> board(2, vector<int>(n));
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < n; j++) {
      cin >> board.at(i).at(j);
    }
  }

  int ans = search(board, n, 0, 0, 0);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3636
// BFSを用いたトポロジカルソート
// 計算量 O(V + E) 
// reference Programming Contest Challenge Book Second Edition
// verify https://onlinejudge.u-aizu.ac.jp/courses/library/5/GRL/1/GRL_4_B

#include <bits/stdc++.h>

using  ll = long long;
using ull = unsigned long long;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};
constexpr ll kINF = 1152921504606846976;//2^60
constexpr double kEPS = 1e-6;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define rep(i,n) REP(i,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep(i,n) RREP(i,n)
#define mp make_pair
#define fi first
#define sc second

// --!!!!ここからコピペする!!!!--

template<typename T> struct Edge {
  int to;
  Edge(int to_) : to(to_) {}
};

template<typename T,template <typename ELEM> class EDGE> struct AdListGraph {
  vector<vector<EDGE<T>>> G;

  vector<bool> used;
  vector<int> deg;
  int V;//0,...,|V|-1

  AdListGraph (int V_) {
    Init(V_);
  }

  void Init(int V_) {
    V = V_;

    G.clear();
    G.resize(V);
  }

  // https://faithandbrave.hateblo.jp/entry/20080310/1205149207
  template <typename FROM, class... Args>
  void AddEdge(FROM from, Args&&... arg) {
    G[from].emplace_back(arg...);
  }

  template<typename ID_TYPE>
  bool TopologicalSort (vector<ID_TYPE>& sorted) { // 成功ならtrue 失敗(DAG出ない)ならfalseを返す
    used.clear();
    used.resize(V, false);
    deg.clear();
    deg.resize(V, 0);
    sorted.clear();

    for (const auto& v : G) 
      for (const auto& e : v)
        deg[e.to]++;

    queue<int> que;

    rep (i, V) if (deg[i] == 0) {used[i] = true; que.push(i);}


    while(!que.empty()) {
      int i = que.front();
      que.pop();
      sorted.emplace_back(i);

      for (auto& e: G[i]) {
        deg[e.to]--;
        if (!used[e.to] && deg[e.to] == 0) {
          used[e.to] = true;
          que.push(e.to);
        }
      }
    }

    return !((int)sorted.size() == V);
  }

};

using ll = long long;

int main() {
  ll V,E;
  cin >> V >> E;
  AdListGraph<ll, Edge> G(V);
  rep(i,E) {
    ll s,t;
    cin >> s >> t;
    G.AddEdge(s,t);
  }

  vector<int> ans;

  G.TopologicalSort(ans);

  for (auto v : ans) {
    cout << v << endl;
  }
  return 0;
}



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

int main(){
    int N;
    bool end = false;
    cin >> N;
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            if(i*j == N) {
                cout << "Yes" << "\n";
                end = true;
            }
            if(end) break;
        }
        if(end) break;
    }
    if(!end) cout << "No" << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//define
#define int long long
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
#define elif else if
//vectordefine
#define vint vector<int>
#define vc vector<char>
#define vtr vector<string>
#define pb(n) push_back(n)
//queuedefine
#define qint queue<int>
#define qc queue<char>
#define qstr queue<str>
//mapdefine
#define mint map<int>
#define mc map<char>
//pairdefine
#define pint pair<int,int>
#define pis pair<int,str>
#define pic pair<int,char>
#define pci pair<char,int>
#define mod 100000007
//main
signed main(){
  int N,M,O,P,count=0,count2=mod,count3=0,stack=0;
  str S,T;
  cin>>N>>M;
  vint b(N);rep(0,N)cin>>b[i];
  vint a(N+1);a[0]=0;
  rep(1,N+1){
    a[i]=a[i-1]+b[i-1];
  }
  rep(0,N+1)if(M>=a[i])count+=1;
  cout<<count<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		int MAX_NUM = 13;	// カード番号の最大値
		Scanner scan = new Scanner(System.in);
		int i, j;
		// インプット用配列
		int[][] input_cards = new int[4][13];
		int mark = 0;	// カードの記号
		int num = 0;	// カードの番号
		String str = scan.nextLine();
		String[] input_card = new String[2];
		// ループカウンタ用変数
		int cards_amount = Integer.parseInt(str);

		// S=0 H=1 C=2 D=3
		// input_cardsに値を突っ込む
		for(i=0; i < cards_amount; i++){
			str = scan.nextLine();
			input_card = str.split(" ");

			// 0番目要素でアルファベット判別
			if(input_card[0].equals("S")){
				mark = 0;
			} else if(input_card[0].equals("H")){
				mark = 1;
			} else if(input_card[0].equals("C")){
				mark = 2;
			} else if(input_card[0].equals("D")){
				mark = 3;
			} else{
				System.out.println("不正な値が入力されました。\n処理を終了します。");
				break;
			}
			// 1番目要素で数字変換
			num = Integer.parseInt(input_card[1]);
			if(MAX_NUM < num){
				System.out.println("不正な値が入力されました。\n処理を終了します。");
				break;
			}

			input_cards[mark][num-1] = num;
		}
		// input_cardsが0の要素で出力
		for(i=0; i < 4; i++){
			for(j=0; j<MAX_NUM; j++){
				if(input_cards[i][j] == 0){
					switch(i){
						case 0:
							System.out.println("S "+ (j+1));
							break;
						case 1:
							System.out.println("H "+ (j+1));
							break;
						case 2:
							System.out.println("C "+ (j+1));
							break;
						case 3:
							System.out.println("D "+ (j+1));
							break;

					}
				}
			}
		}

	}
}


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

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

constexpr int MOD = 1e9+7;

constexpr int COMB_MAX = 110000;
ll fac[COMB_MAX], finv[COMB_MAX], inv[COMB_MAX];

void initComb(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < COMB_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;
    }
}

ll comb(int n, int k){
    if(n == -1 && k == -1) return 1;
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(void){
    Cin(int, n, k);
    initComb();
    
    for(int i = 1; i <= k; i ++){
        ll ans = comb(k-1, i-1);
        ans = (comb(n-k-1, i-2) + 2*comb(n-k-1, i-1) + comb(n-k-1, i)) % MOD * ans % MOD;
        //Cout(comb(n-k-1, i-2), " ", 2*comb(n-k-1, i-1), " ", comb(n-k-1, i));
        Cout(ans);
    }
    
}




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

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define RREP(i,a) for(int i = a;i >= 0;i--)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))
#define xyrange(x, minX, maxX, y, minY, maxY) (range(x, minX, maxX) && range(y, minY, maxY))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;
typedef vector<PII> VPII;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
const int INF = 0x3f3f3f3f;

int N, M, C;
VVI as;
VI bs;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M >> C;
    rep (i, M) {
        int b;
        cin >> b;
        bs.pb(b);
    }
    rep (i, N) {
        VI array;
        rep (j, M) {
            int a;
            cin >> a;
            array.pb(a);
        }
        as.pb(array);
    }
    int ans = 0;
    rep (i, N) {
        int sum = 0;
        rep (j, M) {
            sum += as[i][j] * bs[j];
        }
        if (sum + C > 0) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
h,w=[int(i) for i in input().split()]

masu=[]
for i in range(h):
    gyou=list(input())
    if gyou!=["."]*w:
        masu.append(gyou)
        
def rotate(masu):
    m=len(masu)
    n=len(masu[0])
    rotatemasu=[]
    for i in range(n):
        gyou=[]
        for j in range(m):
                gyou.append(masu[m-j-1][i])
        if gyou!=["."]*m:
            rotatemasu.append("".join(gyou))
        
    return rotatemasu
for i in range(4):
    masu=rotate(masu)
for i in masu:
    print(i)

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

int main() {
    int N, K;
    cin >> N >> K;
    double sum = 0;
    for(int i = 1; i <= N; i++) {
        int j = i;
        double coin = 1;
        while(j < K) {
            coin /= 2;
            j *= 2;
        }
        sum += (1 / (double)N) * coin;
    }
    printf("%.12f", sum);
    return 0;
}

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

using namespace std;

int main(void){
  int n, k;
  cin >> n >> k;
  int ans = 0;
  
  vector<int> a(n);
  for(int i = 0;i < n;i++) cin >> a[i];
  
  sort(a.begin(), a.end(), greater<int>());
  
  for(int i = 0;i < k;i++) ans += a[i];
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    double i,f;
    int j;
    while(scanf("%lf",&i) != EOF){
        f=i;
        for(j=2;j<=10;j++){
            if(j % 2==0){
                i=i*2;
            }
            else if(j % 2==1){
                i=i/3;
            }
            f=f+i;
        }
        printf("%f\n",f);
    }
    return (0);
}

Measured memory_bytes: 648
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int main(){
  int N, cm = 2147483647;
  cin >> N;
  priority_queue<int, vector<int>, greater<int> >Q;
  for(int i = 0; i < N; i++){
    int a;
    cin >> a;
    Q.push(a);
  }
  for(int i = 0; i < N; i++){
    int x, c = 0;
    x = Q.top();
    Q.pop();
    while(true){
      if(x % 2 == 0){
        x = x / 2;
        c++;
        if(c >= cm)break;
      }else{
        break;
      }
    }
    if(cm > c)cm = c;
  }
  cout << cm;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int ch(int M,int x){
  if(M>1&&x==1)
    return 3;
  if(M>1&&x==0)
    return 1;
  if(M>1&&x==2)
    return 6;
  if(M==1){
    if(x>3)
      return 0;
    if(x==3)
      return 1;
    if(x==2)
      return 3;
  }
  if(M*2>x)
    return ch(M-1,x-3)+max(3*min(M*2+1-x,x),0);
  else
    return ch(M-1,x-3)+max(3*min(M*2+1-x,x)-3,0);
}
int main(){
  int a,b;
  cin >> a >> b;
  cout << ch(a,b) << endl;
}

Measured memory_bytes: 256
import numpy as np

def main():
    n = int(input())
    ball = [list(map(int, input().split(' '))) for i in range(n)]
    ball = np.array(ball, dtype=int)
    if n == 1:
        print(1)
        exit()

    l1 = []
    for i in range(len(ball)):
        for j in range(len(ball)):
            if i == j: continue
            dis1 = ball[i] - ball[j]
            l1.append(list(dis1))

    c1 = []
    for i in range(len(l1)):
        c1.append(l1.count(l1[i]))
    m1 = np.max(np.array(c1, dtype=int))

    print(n-m1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 12616
N = gets.to_i
as = gets.split " "

bs = Array.new(N, 0)

i = N
while (i > 0)
	i -= 1
	j = i
	sum = 0
	while (j < N)
		sum += bs[j].to_i
		j += (i + 1)
	end
	bs[i] = 1 if (sum % 2) != as[i].to_i
end

ans = []
(0...N).each do |i|
	ans << (i + 1) if (bs[i] == 1)
end

puts ans.size
puts ans.join " "


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

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  string s, t;
  cin >> s >> t;
  int ret = 0;
  for(int i=0; i<3; i++) if(s[i] == t[i]) ret++;
  cout << ret << "\n";

}


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 = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int min = a[0];
        for (int i = 1; i < n; i++) {
            min = gcd(min, a[i]);
        }
        System.out.println(min);
    }

    public static int gcd(int a, int b) {
        if( b == 0 ) return a;
        return gcd(b, a % b);
    }
}

Measured memory_bytes: 59508
#include <stdio.h>
#include <string>
#include <vector>
#include <map>
#include <utility>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mp make_pair

int n, vis[256], rk[256];
map<string, int> dict;
vector<pair<int, int> > g[256];

int of(const string& s) {
    if (dict.count(s) == 0) dict[s] = n++;
    return dict[s];
}

bool visit(int at, int r) {
    if (vis[at]) return rk[at] == r;
    vis[at] = 1;
    rk[at] = r;
    rep (i, g[at].size()) {
        if (!visit(g[at][i].first, r+g[at][i].second)) return false;
    }
    return true;
}

int main() {
    for (;;) {
        int m;
        scanf("%d", &m);
        if (m == 0) return 0;
        n = 0;
        dict.clear();
        rep (i, 256) g[i].clear();
        rep (_, m) {
            static char a[32], b[32];
            int x;
            scanf(" 1 %s = 10^%d %s", a, &x, b);
            const int u = of(a);
            const int v = of(b);
            g[u].push_back(mp(v, -x));
            g[v].push_back(mp(u, x));
        }
        rep (i, n) vis[i] = 0;
        bool ans = true;
        rep (i, n) if (!vis[i]) {
            if (!visit(i, 0)) ans = false;
        }
        puts(ans ? "Yes" : "No");
    }
}

Measured memory_bytes: 1108
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
  //#ifndef ONLINE_JUDGE
      // for getting input from input.txt
      //freopen("input.txt", "r", stdin);
      // for writing output to output.txt
      //freopen("output.txt", "w", stdout);
  //#endif
fast();
//ll  t;cin>>t;while(t--)
{
  ll a,b,k;
  cin>>a>>b>>k;
  set<ll>s;
  for(int i=a;i<a+k && i<=b;i++)
  {
   // s.insert(i);
    cout << i << endl;
  }
  int xx=max(a+k,b-k+1);
  for(int i=xx;i<=b;i++)
  {
    //s.insert(i);
    cout << i << endl;
  }
  /*for(auto it:s)
  {
    cout<<it<<endl;
  }*/
  
  //cout<<min(c,d)<<endl;
  
  

}
return 0;
}

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

int main() {
    int X;
    cin >> X;
    switch (X % 7) {
    case 0:
        cout << "thu";
        break;
    case 1:
        cout << "fri";
        break;
    case 2:
        cout << "sat";
        break;
    case 3:
        cout << "sun";
        break;
    case 4:
        cout << "mon";
        break;
    case 5:
        cout << "tue";
        break;
    default:
        cout << "wed";
    }
    cout << endl;
}


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

typedef long long int LLI;

int present[1000007];

void solve()
{
    int n;
    cin>>n;
    int ar[n];
    for(int i=0;i<n;++i) cin>>ar[i],present[ar[i]]++;
    int cnt=0;
    for(int i=0;i<n;++i){
        int num=ar[i];
        if(num==1){
            if(present[num]>1) cnt=0;
            else cnt=1;
            break;
        }
        if(present[num]>1) continue;
        bool suitable=true;
        for(int d=2;d*d<=num;++d){
            if(num%d==0){
                if(present[d] || present[num/d]){
                    suitable=false;
                    break;
                }
            }
        }
        if(suitable) cnt++;
    }
    cout<<cnt;
    return;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}

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

using namespace std;

long long n,x,y,sum,mn;
bool fl;

int main(){
	scanf("%lld",&n);
	mn=0x3f3f3f3f3f3f3f3fLL;
	for (int i=1;i<=n;++i){
		scanf("%lld%lld",&x,&y);
		if (x!=y) fl=1;
		sum+=y;
		if (x>y) mn=min(mn,y);
	}
	if (!fl){puts("0"); return 0;}
	printf("%lld\n",sum-mn);
	
	return 0;
}
			

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long MOD = 1000000007;
const long long inf = 1ll<<61;
typedef pair<int, int> P;
typedef pair<int ,P> PP;
struct edge { int to; int to2; int cost; };

signed main() {
	double w, h, x, y; cin >> w >> h >> x >> y;
	cout << w*h / 2 << " ";
	if (w == x * 2 && h == y * 2)cout << 1 << endl;
	else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define swap(a, b) a^=b^=a^=b

int main(){
	
	long long int a, b, c, A, B, temp, r, max=0, min=0;
	
	while(scanf("%lld %lld", &a, &b) != EOF){
		c = a*b;
		A = a;
		B = b;
		if(a>b) swap(a, b);
		r = b % a;
		while(r != 0){
			b = a;
			a = r;
			r = b % a;
		}
		max = a;
		
		min = c;
		while(min%A == 0 && min%B == 0 && max != 1){
			min = min/max;
		}
		printf("%lld %lld\n", max, min*max);
	}
		
	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
 
//LIFE IS NOT A PROBLEM TO BE SOLVED
 
#define rep(i,a,b) for( int i = (int) a; i < (int) b; i++ )
#define REP(i,a,b) for( int i = (int) a; i <= (int) b; i++ )
#define PER(i,a,b) for( int i = (int) a; i >= (int) b; i-- )
#define F first
#define S second
#define mk make_pair
#define pb push_back
#define debug(a) cout << #a << " = " << a << endl;
#define debug2(a,b) cout << #a << " = " << a << " --- " << #b << " = " << b << endl;
#define debugP(a) cout << a.F << " " << a.S << endl;
#define debugV(v, n) { rep( i, 0, n ) { if(i) printf(" "); printf("%d", v[i]); } printf("\n"); }
#define debugM(mat,n,m) rep( i, 0, n ){ rep( j, 0, m ) { if(j) printf(" "); printf("%d", mat[i][j]); } printf("\n"); }
#define debugMD(mat,n,m) rep( i, 0, n ){ rep( j, 0, m ) { if(j) printf(" "); printf("%.2lf", mat[i][j]); } printf("\n"); }
#define all(s) s.begin(), s.end()
 
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair <double, double> ii;
typedef pair <double, ii> iii;
 
const int MAX = 2e3+3;
const int mod = 1e9+7;
 
 
int main(){
	
	ll n; cin >> n;
	string ans;
	while(n){
		n--;
		int r = n%26;
		ans.pb(r+'a');
		n/=26;
	}
	reverse(all(ans));
	cout << ans << '\n';
	
	
	
    return 0;
}

Measured memory_bytes: 3624
N = int(raw_input())
U = [raw_input() for _ in range(N)]

M = int(raw_input())

is_lock = True

for _ in range(M):
    T = raw_input()
    if T not in U:
        print "Unknown %s" % T
    elif is_lock:
        is_lock = False
        print "Opened by %s" % T
    else:
        is_lock = True
        print "Closed by %s" % T



Measured memory_bytes: 4636
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
typedef long long ll;

int main(){
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]==',')s[i]=' ';
  }
  cout<<s<<endl;
}
    
    

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

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

	string t = s;
	fx(t.size()) {
		if (t[x]=='A') {
			t.erase(t.begin() + x);
			x--;
		}
	}
	
	if (t!="KIHBR") {
		ce("NO")
	}
	else {
		fx(s.size()) {
			if (s[x]!='A') {
				switch (s[x]) {
				case 'K':
					if (x>0&&s[x-1]!='A') {
						s.insert(s.begin()+x - 1,'A');
					}
					else if (x==0) {
						s.insert(s.begin() + x, 'A');
					}
					break;
				case 'H':
					if (x+1<s.size() && s[x + 1] != 'A') {
						s.insert(s.begin() + x + 1, 'A');
					}
					break;
				case 'B':
					if (x + 1<s.size() && s[x + 1] != 'A') {
						s.insert(s.begin() + x + 1, 'A');
					}
					break;
				case 'R':
					if (x + 1<s.size() && s[x + 1] != 'A') {
						s.insert(s.begin() + x + 1, 'A');
					}
					else if (x + 1>=s.size()) {
						s.insert(s.begin() + x + 1, 'A');
					}
					break;
				}
			}
		}
		if (s=="AKIHABARA") {
			ce("YES")
		}
		else {
			ce("NO")
		}
	}
    return 0;
}



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

#define int long long

signed main(){
    double a[200010] = {};

    int n, k;
    cin >> n >> k;

    for(int i = 0;i < n;i++){
        int b;
        cin >> b;
        a[i+1] = (double)(b+1.0)/2.0 + a[i];
    }

    double ans = 0;
    for(int i = 0;i+k <= n;i++){
        ans = max(ans, a[i+k]-a[i]);
    }

    printf("%.12lf\n", ans);

    return 0;
}



Measured memory_bytes: 1792
// D - Triangles
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define all(x) (x).begin(),(x).end()

int solve(int N, vi &L){
	sort(all(L));
	int ans = 0;
	rp(b, 0, N){
		int l = b + 1;
		int r = l;
		rp(a, 0, b){
			int maxL = L[a] + L[b];
			while(r<N && L[r] < maxL) r++;
			ans += max(0, r-l);
		}
	}
	return ans;
}

int main(){
	int N; cin>>N;
	vi L(N);
	rp(i, 0, N) cin>>L[i];
	cout<< solve(N, L) <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;
int dp[105][4][2];

int main(){
  string s;
  int K;
  cin >> s >> K;
  int n = s.size();
  dp[0][0][0] = 1;
  rep(i, n)rep(j, 4)rep(k, 2) {
    int nd = s[i] - '0';
    rep(d, 10) {
      int ni = i + 1, nj = j, nk = k;
      if(d != 0) ++nj;
      if(nj > K) continue;
      if (k == 0) {
        if(d > nd) continue;
        if(d < nd) nk = 1;
      }
      dp[ni][nj][nk] += dp[i][j][k];
    }
  }

  int ans = dp[n][K][0] + dp[n][K][1];
  cout << ans << endl;
}

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

int main()
{
	int n;
	cin>>n;
	long long ans = 0;
	for(int i=1;i<=n;i++){
		int head, tail;
		tail = i%10;
		if(i<10){
			head = i;
		}else if(i<100){
			head = i/10;
		}else if(i<1000){
			head = i/100;
		}else if(i<10000){
			head = i/1000;
		}else if(i<100000){
			head = i/10000;
		}else{
			head = i/100000;
		}
		if(tail==0) continue;
		if(head == tail){
			if(head<=n) ans++;
		}
		if(n<tail*10+head){
			continue;
		}else{
			ans++;
		}
		if(n<tail*100+head){
			continue;
		}else if(n<tail*100+90+head){
			int k= n-tail*100;
			k /= 10;
			ans += k;
			if(tail*100+k*10+head<=n){
				ans++;
			}
		}else{
			ans += 10;
		}
		if(n<tail*1000+head){
			continue;
		}else if(n<tail*1000+990+head){
			int k =  n-tail*1000;
			k /= 10;
			ans += k;
			if(tail*1000+k*10+head<=n){
				ans++;
			}
		}else{
			ans += 100;
		}
		if(n<tail*10000+head){
			continue;
		}else if(n<tail*10000+9990+head){
			int k = n- tail*10000;
			k/= 10;
			ans += k;
			if(tail*10000+k*10+head<=n) ans++;
		}else{
			ans += 1000;
		}
		if(n<tail*100000+head){
			continue;
		}else if(n<tail*100000+99990+head){
			int k=n-tail*100000;
			k /= 10;
			ans += k;
			if(tail*100000+k*10+head<=n) ans++;
		}else{
			ans += 10000;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
import Data.Array (listArray, (!))

solve n x ys = dp n (n*x) where
  memo = listArray ((0,n*50*(-1)),(n,n*50)) $ [dp j t | j <- [0..n], t <- [n*50*(-1)..n*50]]

  dp j t
    | j == 0 && t == n*x = 1
    | j >= 1 && (t - ys !! (j-1) < 0 || t - ys !! (j-1) > 2*n*x) = memo ! (j-1, t)
    | j >= 1 && 0 <= t - ys !! (j-1) && t - ys !! (j-1) <= 2*n*x = memo ! (j-1, t) + memo ! (j-1, t - ys !! (j-1))
    | otherwise = 0

main = do
  [n, a] <- fmap read <$> words <$> getLine :: IO [Int]
  xs <- fmap read <$> words <$> getLine :: IO [Int]
  let ys = fmap (\x -> x - a) xs in
    putStrLn (show (pred (solve n (maximum ys) ys)))


Measured memory_bytes: 27004
#include<bits/stdc++.h>
using namespace std;
int main(){
int64_t N,A;
  cin>>N>>A;
  vector<int64_t>X(N);
  for(int64_t i=0;i<N;i++){
  int64_t x; cin>>x;
    x-=A;
    X.at(i)=x;
  }vector<vector<int64_t>>dp(N+1,vector<int64_t>(5001,0));
  dp[0][2500]=1;
  for(int64_t i=1;i<=N;i++){
    for(int64_t j=2500-50*i; j<=2500+50*i;j++)
      dp[i][j]=dp[i-1][j]+dp[i-1][j-X.at(i-1)];
  }cout<<dp[N][2500]-1<<endl;
   return 0;
}


Measured memory_bytes: 2304
import java.util.*;
import java.io.*;
public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner inputs = new Scanner(System.in);
		int len = inputs.nextInt();
		int dis = inputs.nextInt();
		int[] vals = new int[len];
		for(int i = 0;i<len;i++) {
			vals[i] = inputs.nextInt();
		}
		int[] stones = new int[len];
		stones[0] = 0;
		stones[1] = Math.abs(vals[0]-vals[1]);
		int cost = Integer.MAX_VALUE;
		for(int i=2;i<len;i++) {
			cost = Integer.MAX_VALUE;
			for(int k=1;k<=dis;k++) {
				if(i-k>=0)
					cost = Math.min(cost, Math.abs(vals[i-k]-vals[i])+stones[i-k]);
			}
			stones[i] = cost;
		}
		System.out.println(stones[len-1]);
	}
}


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

int main()
{
	int a,b,c,d[100],e,sum=0;
	string s;
    cin>>a>>b>>c;
    e=0;
    for(int i=1;i<=100;i++)
	{
        if(a%i==0 && b%i==0)
        {
            d[e]=i;
            e++;

        }

    }
    reverse(d,d+e);
    
    cout<<d[c-1];
	
	return 0;
}
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
       int a,b;cin>>a>>b;
       if(a>b)
        swap(a,b);
       int s=16-a*2;
       if(2*(b-a)<=s)
        cout<<"Yay!";
       else cout<<":(";
    return 0;
   }

Measured memory_bytes: 3612
/**
 *    DP
 *    24.04.2020 09:14
**/

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, wmax, weight, value;
  vector<int> w, v;
  cin >> n >> wmax;
  for (int i = 0; i < n; i++) {
    cin >> weight >> value;
    w.push_back(weight);
    v.push_back(value);
  }
  vector<vector<long long>> dp (n + 1, vector<long long> (wmax + 1, 0));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= wmax; j++) {
      if (j >= w[i - 1]) {
        dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i - 1]] + v[i - 1]);
      }
      else dp[i][j] = dp[i - 1][j];
    }
  }
  cout << dp[n][wmax] << "\n";
  return 0;
}


Measured memory_bytes: 80256
# run on python 3.4.3
from sys import stdin


def main():
    c = [0,0]
    c[0] = list(stdin.readline())
    c[1] = list(stdin.readline())
    ans = True
    for i in range(3):
        if c[0][i] != c[1][2 - i]:
            ans = False
    print(['NO', 'YES'][ans])


main()


Measured memory_bytes: 3060
using System;
class Program
{
	static void Main(string[] args)
	{
		String[] str = Console.ReadLine().Split(' ');
		int N = int.Parse(str[0]);
		int T = int.Parse(str[1]);

		String[] str1 = new string[2];
		int c;
		int t;
		int smallcost = 0;

		for(int i=0; i < N; i++)
		{
			str1 = Console.ReadLine().Split(' ');
			c = int.Parse(str1[0]);
			t = int.Parse(str1[1]);

			if (T >= t)
			{
             	if(smallcost == 0) smallcost = c;
				if(smallcost > c) smallcost = c;
			}
        }

		string result = "TLE";
      
		if(smallcost > 0)
		{
			result = smallcost.ToString();
		}

		Console.WriteLine(result);
	}
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	string A,B,C;
	cin >> A >> B >> C;
	if (A[A.size() - 1] == B[0] && B[B.size() - 1] == C[0]){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
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 = sc.nextInt();
		int[] a= new int[n];
		String[] s=new String[n];
		int count=0,max=0;;

		for(int i=0;i<n;i++) {
			s[i]=sc.next();
		}
		Arrays.parallelSort(s);
		for(int i=0;i<n-1;i++) {
			if(s[i].equals(s[i+1])) {
				count++;
			}else {
				if(count!=0)count++;
				max=Math.max(count, max);
				count=0;
			}
		}
		if(count!=0) {
			count++;
			max=Math.max(count, max);
		}
		count=0;
		for(int i=0;i<n-1;i++) {
			if(s[i].equals(s[i+1])) {
				count++;
			}else {
				if(count!=0)count++;
				if(count==max) {
					System.out.println(s[i]);
				}
				count=0;
			}
		}
		if(count!=0)count++;
		if(count==max) {
			System.out.println(s[n-1]);
		}
		/*for(String buff:s) {
			System.out.println(buff);
		}
		System.out.println(max+" "+count);*/
	}
}



Measured memory_bytes: 72860
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');

            int pos = 0;
            int total = 0;
            int[] p = new int[N + 2];

            p[0] = 0;
            p[N + 1] = 0;
            for (int i = 0; i < N; i++)
            {
                p[i + 1] = int.Parse(s[i]);
                total += Math.Abs(p[i] - p[i+1]);
            }
            total += Math.Abs(p[N]);

            for (int i = 0; i < N; i++)
            {
                int ans = total;

                ans -= (Math.Abs(p[i] - p[i + 1]) + Math.Abs(p[i + 1] - p[i + 2]));
                ans += (Math.Abs(p[i] - p[i + 2]));

                Console.WriteLine(ans);
            }
        }
    }
}


Measured memory_bytes: 26844
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new A().doIt();
//		new B().doIt();
//		new C().doIt();
//		new D().doIt();
	}
	class A{
		void doIt() {
			int N = sc.nextInt();
			int K = sc.nextInt();
			int X = sc.nextInt();
			int Y = sc.nextInt();
			
			int ans = 0;
			if(N <= K)ans = X*N;
			else ans = X*K + Y*(N - K);
			System.out.println(ans);
		}
	}
}


Measured memory_bytes: 21972
import java.util.*;

//update 2020/1/1 23:01

public class Main{

  static Scanner sc = new Scanner(System.in);
  static StringBuilder sb = new StringBuilder();

  public static void main(String[] args) {

    int A = nextInt();
    int B = nextInt();
    int M = nextInt();
    int[] a = new int[A];
    for(int i=0;i<A;i++){
      a[i] = nextInt();
    }
    int[] b = new int[B];
    for(int i=0;i<B;i++){
      b[i] = nextInt();
    }

    int ans = min(a)+min(b);

    for(int i=0;i<M;i++){
      int x = nextInt();
      int y = nextInt();
      int c = nextInt();

      ans = Math.min(ans,(a[x-1]+b[y-1]-c));
    }

    System.out.println(ans);

  }
  /*
    static String toSmall(String s){
      char c = s.charAt(0);
      //if(Character.isUpperCase(c)){
      if(c<=90){
        c += 32;
      }
      return String.valueOf(c);
    }
    static String toBig(String s){
      char c = s.charAt(0);
      //if(Character.isLowerCase(c)){
      if(c>=97){
        c -= 32;
      }
      return String.valueOf(c);
    }
  */

  static String toSmall(String s){
    return s.toLowerCase();
  }

  static String toBig(String s){
    return s.toUpperCase();
  }

  static String next(){
    return sc.next();
  }

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

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

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

  static String[] splitString(String s){
    return s.split("");
  }

  static char[] splitChar(String s){
    return s.toCharArray();
  }

  static int charToInt(char a){
    return a - 48;
  }

////////////////////////////////////////////
  public static int max(int[] a){
    int lng = a.length;
    int max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
  public static long max(long[] a){
    int lng = a.length;
    long max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
////////////////////////////////////////////

////////////////////////////////////////////
  public static int min(int[] a){
    int lng = a.length;
    int min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
  public static long min(long[] a){
    int lng = a.length;
    long min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
////////////////////////////////////////////

}


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

typedef long long ll;

const int maxn = 1e5 + 5;

ll get(ll x) {
  if (x < 0) {
    return 0;
  }
  switch (x & 3) {
    case 0: return x;
    case 1: return 1;
    case 2: return x + 1;
    case 3: return 0;
  }
}

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

  ll A, B;
  while (cin >> A >> B) {
    cout << (get(B) ^ get(A - 1)) << "\n";
  }
}


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

int main() {
  int n;
  cin >> n;
  
  int64_t ans=0;
  for(int i=1;i<=n;i++){
    if(i%3==0 || i%5==0) continue;
    ans+=i;
  }
  
  cout << ans <<endl;
}

Measured memory_bytes: 3620
import java.util.*;
public class Main{
  public static void main(String []args){
  Scanner sc = new Scanner(System.in);

  int n = sc.nextInt();
  int[] data  =new int[n];

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

  Arrays.sort(data);

  for (int i = 0;i<n-1 ;i++ ) {
    if (data[i]==data[i+1]) {
      System.out.println("NO");
      System.exit(0);
    }
  }
  System.out.println("YES");


}
}


Measured memory_bytes: 66444
import java.util.*;
//import java.util.stream.Collectors;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int m = Integer.parseInt(sc.next());
		n = n > 1 ? combination(n, 2) : 0;
		m = m > 1 ? combination(m, 2) : 0;
		System.out.println(n + m);
	}
	
	//nCr
	public static int combination(int n, int r){
		int num = 1;
		for(int i=1; i<=r; i++){
			num = num * (n - i + 1) / i;
		}
		return num;
	}
}


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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b+c || b == c+a || c == a+b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


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

int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  
  if(s.at(k-1) == 'A')
    s.at(k-1) = 'a';
  else if(s.at(k-1) == 'B')
    s.at(k-1) = 'b';
  else
    s.at(k-1) = 'c';
  
  cout << s << endl;
}

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

long long n, k;
vector<long long> p;

int main() {
  cin >> n >> k;
  p.resize(n);
  for (int i = 0; i < n; ++i) cin >> p[i];
  sort(p.begin(), p.end());
  long long res = 0;
  for (int i = 0; i < k; ++i) res += p[i];

  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3640
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx")
//#undef LOCAL
#include <bits/stdc++.h>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

#ifdef LOCAL
struct PrettyOS {
    ostream& os;
    bool first;
    template <class T> auto operator<<(T&& x) {
        if (!first) os << ", ";
        first = false;
        os << x;
        return *this;
    }
};
template <class... T> void dbg0(T&&... t) {
    (PrettyOS{cerr, true} << ... << t);
}
#define dbg(...)                                            \
    do {                                                    \
        cerr << __LINE__ << " : " << #__VA_ARGS__ << " = "; \
        dbg0(__VA_ARGS__);                                  \
        cerr << endl;                                       \
    } while (false);
#else
#define dbg(...)
#endif

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    return os << "P(" << p.first << ", " << p.second << ")";
}

template <class T> ostream& operator<<(ostream& os, const V<T>& v) {
    os << "[";
    for (auto d : v) os << d << ", ";
    return os << "]";
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n, m; ll l;
    cin >> n >> m >> l;
    
    VV<ll> di(n, V<ll>(n, TEN(18)));
    for (int i = 0; i < n; i++) {
        di[i][i] = 0;
    }
    for (int i = 0; i < m; i++) {
        int a, b; ll c;
        cin >> a >> b >> c; a--; b--;
        di[a][b] = di[b][a] = c;
    }
    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                di[i][j] = min(di[i][j], di[i][k] + di[k][j]);
            }
        }
    }

    VV<int> ans(n, V<int>(n, TEN(9)));
    for (int i = 0; i < n; i++) {
        ans[i][i] = 0;
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (di[i][j] <= l) ans[i][j] = 1;
        }
    }

    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                ans[i][j] = min(ans[i][j], ans[i][k] + ans[k][j]);
            }
        }
    }

    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int x, y;
        cin >> x >> y; x--; y--;
        int a = ans[x][y] - 1;
        if (a > TEN(8)) a = -1;
        cout << a << "\n";
    }
    return 0;
}


Measured memory_bytes: 1664
#include <iostream>

using namespace std;

int main(void){
  int K, X;
  cin >> K;
  cin >> X;

  int min, max;
  min = X - K + 1;
  max = X + K - 1;
  for(int i=min; i<=max; i++)
    cout << i << " ";
  cout << endl;


  return 0;
}


Measured memory_bytes: 256
N,M = map(int, input().split())
path = [[] for i in range(N)] 
for i in range(M):
    nums = list(map(int, input().split()))
    path[nums[0]-1].append(nums[1]-1)
    path[nums[1]-1].append(nums[0]-1)

memo = [] 
def search(idx, memo_str):
    if len(memo_str) == N and memo_str not in memo:
        memo.append(memo_str)
        return
    
    if str(idx) in memo_str:
        return
    
    tmp_memo = memo_str + str(idx)
    
    for num in path[idx]:
        search(num, tmp_memo)

search(0, '')

print(len(memo))

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()

const ll mod = 1000000000 + 7;
const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

int n;
int a[100000 + 5];

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    rep(i, n) cin >> a[i];
    sort(a, a + n);
    //reverse(a, a + n);
    int ans = 0;
    int i = n - 1;
    int cnt = 0;
    while (i > 0) {
        if (a[i] == a[i - 1]) {
            if (cnt == 0) {
                ans +=  a[i];
                i -= 2;
                cnt++;
            }
            else if (cnt == 1) {
                ans = ans * a[i];
                break;
            }
        }
        i--;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
N = int(input())
p = [int(i) for i in input().split()]
temp = 0

for i in range(N-2):
    if (p[i]<=p[i+1] and p[i+1]<p[i+2]) or (p[i]>p[i+1] and p[i+1]>=p[i+2]):
        temp += 1

print(temp)

Measured memory_bytes: 38384