akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string.h>
#include <algorithm>
#include <cstring>
#include <queue>
#include <assert.h>
#include <cmath>
#include <deque>
#include <set>
#include <unordered_map>
#include <complex>
#include <fstream>
#include <map>
using namespace std;
using ll = long long;
using ld = long double;
const int mxn = 5e5+10;
int c[mxn];

int block_size;

struct Query {
    int l, r, idx;
    bool operator<(Query other) const
    {
        return make_pair(l / block_size, r) <
               make_pair(other.l / block_size, other.r);
    }
};
int ans = 0;
int cnt[mxn];

inline void add(int i) {
	cnt[c[i]]++; if(cnt[c[i]]==1) ans++;
}

inline void remove(int i) {
	cnt[c[i]]--; if(cnt[c[i]]==0) ans--;
}

inline int get_answer() {
	return ans;
}

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

	int n, Q; cin>>n>>Q; for(int i=0; i<n; i++) cin>>c[i];
	vector<Query> queries(Q);
	block_size = ceil(sqrt(n))+10;
	for(int i=0; i<Q; i++) {
		cin>>queries[i].l>>queries[i].r; queries[i].idx = i;
		queries[i].l--; queries[i].r--;
	}
	vector<int> answers(Q, 0);
	sort(begin(queries), end(queries));
	int cur_l = 0;
    int cur_r = -1;
    for (Query q : queries) {
        while (cur_l > q.l) {
            cur_l--;
            add(cur_l);
        }
        while (cur_r < q.r) {
            cur_r++;
            add(cur_r);
        }
        while (cur_l < q.l) {
            remove(cur_l);
            cur_l++;
        }
        while (cur_r > q.r) {
            remove(cur_r);
            cur_r--;
        }
        answers[q.idx] = get_answer();
    }

    for(int i=0; i<Q; i++) {
    	cout << answers[i] << '\n';
    }

	return 0;
}

Measured memory_bytes: 15512
import math
def py():
    print("yes")
def pn():
    print("no")
def iin():
    x = int(input())
    return x

neko = 1
nya = 1
nuko = 0

h = iin()
while h > 1:
    h //= 2
    neko += 1
print(2**neko-1)

Measured memory_bytes: 9204
import java.util.*;

public class Main {
    static int modP = 1000000007;
    static long inf  = 1 << 61;

    static int n,m,r;
    static int[] R;
    static long[][] dist;
    static long ans = inf;
    static boolean[] visited;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        m = in.nextInt();
        r = in.nextInt();
        R = new int[r];
        for(int i = 0; i < r; i++) R[i] = in.nextInt()-1;

        visited = new boolean[r];
        Arrays.fill(visited, false);

        dist = new long[n][n];
        for(int i = 0; i < n; i++) {
            Arrays.fill(dist[i], inf);
            dist[i][i] = 0;
        }
        for(int i = 0; i < m; i++) {
            int a = in.nextInt()-1;
            int b = in.nextInt()-1;
            int c = in.nextInt();
            dist[a][b] = c;
            dist[b][a] = c;
        }

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

        dfs(1, -1, 0);
        print(ans);
    }

    static void dfs(int cnt, int last, long d) {
        if(cnt == r+1) {
            ans = Math.min(ans, d);
            return;
        }

        for(int i = 0; i < r; i++) {
            if(!visited[i]) {
                visited[i] = true;
                if(last == -1) dfs(cnt+1, i, 0);
                else           dfs(cnt+1, i, d + dist[R[last]][R[i]]);
                visited[i] = false;
            }
        }
    }

    static void print(String s) {
        System.out.println(s);
    }

    static void print(int i) {
        System.out.println(i);
    }

    static void print(long i) {
        System.out.println(i);
    }
}

class P {
    int x, y;
    P(int x, int y) {
        this.x = x;
        this.y = y;
    }
}

class E {
    int from, to;
    long w;
    E(int from, int to, long w) {
        this.from = from;
        this.to = to;
        this.w = w;
    }
}


Measured memory_bytes: 47868
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int bit = 0;
        for (int i=0; i<N; i++) {
            bit |= sc.nextInt();
        }
        System.out.println(Integer.numberOfTrailingZeros(bit));
    }
}

Measured memory_bytes: 36144
import java.util.*;
import java.math.*;
public class Main {
	static int[] color;
	static int[] component;
	static int component_count;
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Map<String, Integer> map = new TreeMap<>();
		int n = Integer.parseInt(in.next());
		for(int i = 0; i < n; i++) {
			String cur = in.next();
			if(map.containsKey(cur)) {
				int val = map.get(cur);
				map.put(cur, val + 1);
			}else map.put(cur, 1);
		}
		int cnt = 0;
		List<String> ans = new ArrayList<>();
		for(Map.Entry<String, Integer> entry : map.entrySet()) {
			if((int)entry.getValue() == cnt) {
				ans.add(entry.getKey());
			}else if((int)entry.getValue() > cnt) {
				cnt = entry.getValue();
				ans.clear();
				ans.add(entry.getKey());
			}
		}
		Collections.sort(ans);
		for(int i = 0; i < ans.size(); i++) {
			System.out.println(ans.get(i));
		}
	}
} 


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

using namespace std;

int const N = 1234567;
int a[N], used[N], d[N], ans[N];
set<pair<int, int> > f;
int cn;

void inc(int v) {
  f.erase({d[v], v});
  ++d[v];
  f.insert({d[v], v});
}

void add(int x) {
  used[x] = cn;
  ans[cn++] = x;
  inc(0);
}

int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < q; i++) {
    scanf("%d", a + i);
    --a[i];
  }
  for (int i = 0; i < m; i++) used[i] = -1;
  cn = 0;
  for (int i = 0; i < n; i++) f.insert({0, i});
  for (int i = q - 1; i >= 0; i--) {
    if (used[a[i]] < 0) {
      add(a[i]);
      continue;
    }
    auto it = f.lower_bound({used[a[i]], -1});
    if (it == f.end() || it->first != used[a[i]]) {
      continue;
    }
    inc(it->second);
  }
  int mn = m;
  for (int i = 0; i < n; i++) {
    mn = std::min(mn, d[i]);
  }
  for (int i = 0; i < m; i++) {
    if (used[i] < 0) {
      add(i);
    }
  }
  for (int i = mn; i + 1 < m; i++) {
    if (ans[i] > ans[i + 1]) {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
}


Measured memory_bytes: 6528
import java.util.Scanner;

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

	int a = scan.nextInt();
	int b = scan.nextInt();
	int c = scan.nextInt();
	int d = scan.nextInt();

	int ab = Math.abs(a-b);
	int bc = Math.abs(b-c);
	int ca = Math.abs(c-a);

	if(ca <= d){
	    System.out.println("Yes");
	}else{
	    if(ab <= d && bc <= d){
		System.out.println("Yes");
	    }else{
		System.out.println("No");
	    }
	}
    }
}
	


Measured memory_bytes: 21716
#define rep(i,n) for (int i = 0; i < n; i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = (1 << 31) - 1;


int main() {
	int n, m;
	cin >> n >> m;
	vector<int> a(n*m,0), b(n*m,0);
	int p;
	rep(i, n) {
		cin >> p;
		p--; a[p]++;
	}
	rep(i, m) {
		cin >> p;
		p--; b[p]++;
	}
	int x=0, y=0;
	ll ans = 1;
	rep(i, n*m) {
		int j = n * m - i - 1;
		if (!a[j] && !b[j]) {
			ans *= x * y - i;
		}
		else {
			if (a[j]) x++; 
          	if (b[j]) y++;
			if (a[j] && !b[j]) ans *= y;
			if (!a[j] && b[j]) ans *= x;
		}
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8064
#include<iostream>
using namespace std;
void BubbleSort(int S[],int N){
  bool flg;
  do{
    flg =false;
    for(int i=0;i<N-1;i++){
      if(S[i]>S[i+1]){
        int tmp =S[i];
        S[i]=S[i+1];
        S[i+1]=tmp;
        flg = true;
      }
    }
  }while(flg);
}
int main(){
  int n,m,p;
  cin >>n>>m>>p;
  int station[m];
  for(int i=0;i<m;i++){
    cin >>station[i];
  }
  BubbleSort(station,m);
  for(int i=0;i<m;i++){
    station[i]=station[i]-p;
    if(station[i]<0){
      station[i]+=n;
    }
  }
  BubbleSort(station,m);
  int ans[2+2*m];
  ans[0]=station[m-1];
  ans[1]=n-station[0];
  for(int i=0;i<m-1;i++){
    ans[i*2+2]=station[i]*2+n-station[i+1];
    ans[i*2+3]=(n-station[m-1-i])*2+station[m-2-i];
  }
    ans[(m-1)*2+2]=station[m-1]*2+n-station[0];
    ans[(m-1)*2+3]=(n-station[m-1-m+1])*2+station[m-2-m+1];
  BubbleSort (ans,2+2*m);
  cout << ans[0]*100<<endl;
}

Measured memory_bytes: 3152
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
const int N = 1e5 + 10;
vector<int> gr[N];
int depth[2][N]; // depth[0] is for chaser. depth[1]  is for runaway.
void dfs(int node, int from, int val, int *v){
    v[node] = val;
    for(auto it: gr[node]){
        if(it != from) dfs(it, node, val + 1, v);
    }
    return ;
}
int main(){
    int n, x, y, u, v;
    scanf("%d %d %d", &n, &u, &v);
    for(int i = 1; i < n; i++){
        scanf("%d %d", &x, &y);
        gr[x].push_back(y);
        gr[y].push_back(x);
    }
    dfs(u, 0, 0, depth[0]);
    dfs(v, 0, 0, depth[1]);
    int ma = 0;
    for(int i = 1; i <= n; i++){
        if(depth[0][i] < depth[1][i] && depth[1][i] > ma) ma = depth[1][i];
    }
    printf("%d", ma - 1);

}


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

    const int MOD = 1000000007;
    const double PI = acos(-1); 

    //long long
    using ll = long long;

    //出力系
    #define print(x) cout << x << endl
    #define yes cout << "Yes" << endl
    #define YES cout << "YES" << endl
    #define no cout << "No" << endl
    #define NO cout << "NO" << endl
    
    // begin() end()
    #define all(x) (x).begin(),(x).end()

    //for
    #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

    //最大公約数（ll）
    ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

    //素因数分解
    vector<pair<ll, int>>factorize(ll n){
      vector<pair<ll, int>> res;
      for(ll i = 2; i * i <= n; ++i){
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
          n /= i;
          res.back().second++;
        }
      }
    if(n != 1) res.emplace_back(n, 1);
    return res;
    }



  // // 二分探索(最小値を出す問題は疑う)
  // bool C(ll x){
  //     ll res = 0;
  //     for(int i = 0; i < N; ++i){
  // 		res += max(0ll, A[i]-x/F[i]);
  //     }
  //     return res <= K;
  // }

  //   ll binary_search(ll ok, ll ng){
  //     while(abs(ok - ng) > 1){
  //       ll mid = (ok + ng) / 2;
  //       if(C(mid)) ok = mid;
  //       else ng = mid;
  //     }
  //     return ok;
  //   }


  int main(){
    string S;
    cin >> S;
    string target = S.substr(0, 4);
    (target == "YAKI") ? yes : no;
  }

Measured memory_bytes: 256
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

(defun main ()
  (let* ((n (read))
         (a (read))
         (b (read))
         (c (read))
         (ls (make-array n :element-type 'uint15))
         (min-cost most-positive-fixnum))
    (dotimes (i n) (setf (aref ls i) (read)))
    (loop for is from 0 below (expt 4 n)
          do (loop with set1 = 0
                   with set2 = 0
                   with set3 = 0
                   with set1-size = 0
                   with set2-size = 0
                   with set3-size = 0
                   for i from 0 below n
                   for mask = 3 then (ash mask 2)
                   do (let ((value (ash (logand mask is) (* -2 i))))
                        (cond ((= value 1)
                               (incf set1-size)
                               (incf set1 (aref ls i)))
                              ((= value 2)
                               (incf set2-size)
                               (incf set2 (aref ls i)))
                              ((= value 3)
                               (incf set3-size)
                               (incf set3 (aref ls i)))
                              ((zerop value) nil)
                              (t (error "Huh"))))
                   finally (unless (or (zerop set1-size)
                                       (zerop set2-size)
                                       (zerop set3-size))
                             (let* ((merge-cost (* 10 (+ (- set1-size 1)
                                                         (- set2-size 1)
                                                         (- set3-size 1))))
                                    (cost (+ merge-cost
                                             (abs (- a set1))
                                             (abs (- b set2))
                                             (abs (- c set3)))))
                               (when (< cost min-cost)
                                 (setf min-cost cost))))))
    (println min-cost)))

#-swank(main)


Measured memory_bytes: 20064
from math import ceil
a,b,c=map(int,input().split())
l=[]
l.append(a)
l.append(b)
l.append(c)
l.sort()

v=2*l[-1]-l[0]-l[1]
if l[0]%2==l[1]%2:
    print(int(v/2))
else:
    print(ceil(v/2)+1)


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

using namespace std;

typedef long long int ll;

int main()
{
	ll a,b,x,cnt=0;
	cin  >> a >> b >> x;
	
	cnt = (b/x)-(a/x);

	if(a % x == 0){
		cnt++;
	}

	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main{

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

		int second = sc.nextInt();

		System.out.println((second / 3600) + ":" + ((second%3600)/60) + ":" + (second % 60));

		sc.close();

	}

}


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

string s;

int main(){
    cin >> s;
    char s_x[200000];
    int idx[200000];

    int s_x_length = 0;
    for(int i = 0; i < s.length(); i++){
        if(s[i] != 'x'){
            idx[s_x_length] = i;
            s_x[s_x_length++] = s[i];
        }
    }
    s_x[s_x_length] = '\0';

    bool is_palindrome = true;
    for(int i = 0; i < s_x_length; i++){
        if(s_x[i] != s_x[s_x_length - i - 1]){
            is_palindrome = false;
        }
    }
    if(!is_palindrome){
        cout << -1 << endl;
        return 0;
    }

    int ans = 0;
    int start = -1, end = s.length();
    while(start < end){
        int x_before = 0, x_after = 0;
        start++;
        end--;
        while(s[start] == 'x'){
            x_before++;
            start++;
        }
        while(s[end] == 'x'){
            x_after++;
            end--;
        }
        ans += abs(x_before-x_after);
    }
    cout << ans << endl;
}

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

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


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
    // freopen("1.txt", "r", stdin);
    int N;
    cin >> N;

    vector<double> p(N + 1);
    for(int i = 1; i <= N; ++i) cin >> p[i];

    int L = N / 2;
    vector<vector<double> > dp(N + 1, vector<double>(L + 1, 0));
    dp[0][0] = 1.0;

    for(int i = 1; i <= N; ++i) {
        for(int j = 0; j <= min(i, L); ++j) {
            dp[i][j] = dp[i - 1][j] * (1.0 - p[i]);
            if(j > 0)
                dp[i][j] += dp[i - 1][j - 1] * p[i];
        }
    }
    double sum = 0;
    for(int i = 0; i <= L; ++i) sum += dp[N][i];
    printf("%.10f\n", 1 - sum);
    return 0;
}


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

using namespace std ;

int main()
{

    int a[3], sum = 0, k ;

    cin >> a[0] ;

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

    sort(a,a+3) ;

    for(int i=1 ; i<3 ; i++)sum = sum + (a[i]-a[i-1]) ;

    cout << sum << endl ;

}


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

using namespace std;
int linearSearch(vector<int> int_array,int val){
    int_array.push_back(val);
    int i = 0;
    int key = val;
    while(int_array[i] != key){
        i++;
        if(i == int_array.size()-1) return -1;
    }
    return i;
}

int main(){
    int len_array1,len_array2;
    int counter = 0;
    cin >> len_array1;
    vector<int> objective_array(len_array1,0);
    for(int i = 0;i < len_array1;i++) cin >> objective_array[i];

    cin >> len_array2;
    vector<int> search_array(len_array2,0);
    for(int i = 0;i < len_array2;i++){
        cin >> search_array[i];
        if(linearSearch(objective_array,search_array[i]) >= 0) counter++;
    }
    cout << counter << "\n";

    return 0;   
}


Measured memory_bytes: 3120
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=100000;
const int MAXM=100000;

int n,m;
int e[MAXM][2];
vector<pair<int,int>> adj[MAXN];
vector<pair<int,int>> ans;

int par[MAXN],parid[MAXN];
bool visited[MAXN];
int post[MAXN],npost;
void dfs(int at) {
	assert(!visited[at]); visited[at]=true;
	REPSZ(i,adj[at]) {
		int to=adj[at][i].first,id=adj[at][i].second; if(visited[to]) continue;
		par[to]=at,parid[to]=id; dfs(to);
	}
	post[npost++]=at;
}


int outdeg[MAXN];
bool done[MAXM];


bool solve() {
	if(m%2==1) return false;
	REP(i,n) visited[i]=false;
	par[0]=-1,parid[0]=-1; npost=0; dfs(0);
	REP(i,n) assert(visited[i]);
	assert(npost==n);
	
	ans.clear();
	REP(i,n) outdeg[i]=0;
	REP(i,m) done[i]=false;
	REP(i,n) if(parid[i]!=-1) done[parid[i]]=true;
	REP(i,m) if(!done[i]) { int a=e[i][0],b=e[i][1]; ++outdeg[a]; ans.PB(MP(a,b)); }
	REP(_,n) {
		int at=post[_];
		if(parid[at]==-1) { assert(outdeg[at]%2==0); continue; }
		int a=at,b=par[at]; assert(b!=-1);
		if(outdeg[at]%2==0) swap(a,b);
		++outdeg[a]; ans.PB(MP(a,b));
	}
	REP(i,n) assert(outdeg[i]%2==0);
	return true;
}

void run() {
	scanf("%d%d",&n,&m);
	REP(i,m) { int a,b; scanf("%d%d",&a,&b); --a,--b; adj[a].PB(MP(b,i)); adj[b].PB(MP(a,i)); e[i][0]=a,e[i][1]=b; }
	if(!solve()) { printf("-1\n"); return; }
	REPSZ(i,ans) printf("%d %d\n",ans[i].first+1,ans[i].second+1);
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 14964
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;



int main(){
  ll ii,jj,kk;
  ll n,l,r,min,sum;
  vector<ll> h;

  cin >> n;
  h.resize(n);

  for(ii=0;ii<n;ii++){
    cin >> h[ii];
  }

  sum = 0;
  while(true){
    l = -1;
    r = -1;
    min = 101;

    for(ii=0;ii<n;ii++){
      //cout << "h[ii]" << h[ii] << endl;
      if(h[ii] != 0 && l == -1){
	l = ii;
      }
      if(h[ii] <= min && h[ii] != 0){
	min = h[ii];
      }
      if(l != -1 && h[ii] == 0){
	r = ii-1;
      }
      else if(l != -1 && ii == n-1){
	r = ii;
      }
	
      if(r != -1){
	break;
      }
    }
    //cout << "l:" << l << "r:" << r << endl;
    
    if(l == -1){
      break;
    }
    sum += min;
    
    for(ii=l;ii<=r;ii++){
      h[ii] -= min;
    }
  }

  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AMultiplication1 solver = new AMultiplication1();
        solver.solve(1, in, out);
        out.close();
    }

    static class AMultiplication1 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            out.println(a * b);
        }

    }
}



Measured memory_bytes: 35936
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

a, b, n = map(int, input().split())
if b == 1:
    print(0)
    sys.exit(0)

import math
ans = n
if b - 1 <= n:
    ans = b - 1
print(math.floor((a * ans)/(b)) - (a * math.floor((ans)/b)))


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

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }

    vector<int> D(N - 1);
    for (int i = 0; i < N - 1; i++)
    {
        D.at(i) = A.at(i + 1) - A.at(i);
    }

    int res = 1;
    bool pos = false, neg = false;
    for (int i = 0; i < N - 1; i++)
    {
        if (D.at(i) > 0)
        {
            if (neg)
            {
                res++;
                neg = false;
            }
            else
            {
                pos = true;
            }
        }
        else if (D.at(i) < 0)
        {
            if (pos)
            {
                res++;
                pos = false;
            }
            else
            {
                neg = true;
            }
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX;
using namespace std;
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;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;



int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
	
	int n,k,i,ipos,ans=0,ansmin=100000000;
	cin>>n>>k;
	int a[n];
	rep(i,n){
		cin>>a[i];
		if(a[i]==1) ipos=i;
	}
	int l=ipos,r=(n-1-ipos);
	
	cout<<(n-2)/(k-1)+1<<endl;
	
	
	
	
	
	
	
	
//////////////////////////////////////////////////////
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = (ll)a;i < (ll)b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = (ll)b-1LL;i >= (ll)a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<60);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  a=abs(a);
  b=abs(b);
  if(a==0)return b;
  if(b==0)return a;
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long A, long long B){
  cout<<A*B<<endl;
}

int main(){
  cout<<setprecision(1000);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 3688
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
template<class T>inline bool CHMIN(T&a,T b){if(a > b){a = b;return true;}return false;}
template<class T>inline bool CHMAX(T&a,T b){if(a < b){a = b;return true;}return false;}
constexpr int INF = 1e18;

int gcd(int x,int y)
{
	if(x==0) return y;
	return gcd(y%x,x);
}
int lcm(int x, int y)
{
	return (x * y / gcd(x, y));
}

signed main(){
	int N,M;
	cin >> N >> M;
	vector<int>a(N);
	REP(i,N){
		cin >> a[i];
		a[i] >>= 1;
	}
	int beki = -1;
	REP(i,N){
		int cnt = 0;
		while(a[i] % 2 == 0){
			++cnt;
			a[i] >>= 1;
		}
		if(beki == -1)beki = cnt;
		else{
			if(beki != cnt){
				out(0);
				return 0;
			}
		}
	}
	REP(i,beki)M >>= 1;
	int l = 1;
	REP(i,N){
		l = lcm(l,a[i]);
		if(l > M){
			cout << 0 << endl;
			return 0;
		}
	}
	out((M / l + 1) / 2);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int x; cin >> x;
    int sum = 0;
    for (int t = 1; t <= 1e9; t++) {
        sum += t;
        if (sum >= x) {
            cout << t << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#define inf 1e13+1
using namespace std;
long long int f(long long int b,long long int n) 
{
    if (n<b) 
        return n;
    else 
        return f(b,floor(n/b))+(n%b);
}
//wow
long long int n,s,b,p,ans=inf;
int main(void) 
{
    cin>>n>>s;
    if (n==s) 
    {
        cout<<n+1;
        return 0;
    }
    long long int sqrtn=sqrt(n)+100;
    for (b=2;b<=sqrtn;b++) 
        if (s==f(b,n)) 
        {
            cout<<b;
            return 0;
        }
    for (p=1;p<sqrtn;p++) 
    {
        if ((s-n)%p!=0) 
            continue;
        b=(n-s)/p+1;
        if (b<2) 
            continue;
        if (s==(f(b,n))) 
            ans=min(ans,b);
    }
    if (ans<inf) cout<<ans;
    else cout<<-1;
    return 0;
}//haha

Measured memory_bytes: 256
from collections import deque

K = int(input())
q = deque([9,8,7,6,5,4,3,2,1])
while K>1:
    a = q.pop()
    if a % 10 != 0:
        q.appendleft(10*a + ((a%10)-1))
    q.appendleft(10*a + a%10)
    if a % 10 != 9:
        q.appendleft(10*a + ((a%10)+1))
    K -= 1

print(q.pop())

Measured memory_bytes: 12384
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
#define N_MAX 1000
#define ll long long int
using namespace std;

int main() {
	int N; cin >> N;
	vector<double> x(N);
	vector<string> u(N);
	for (int i = 0; i < N; i++) {
		cin >> x[i];
		cin >> u[i];
	}

	double ans = 0;
	for (int i = 0; i < N; i++) {
		if (u[i] == "JPY") ans += x[i];
		else ans += (380000 * x[i]);
	}

	cout << setprecision(18)<< ans << endl;
}


Measured memory_bytes: 768
import math
import sys
#n = int(input())
n, k = map(int, input().split())
h = list(map(int, input().split()))

if n <= k:
    print("0")
else:
    h.sort()
    ans = 0
    for i in range(n-k):
        ans += h[i]

    print(ans)





Measured memory_bytes: 27300
#include<bits/stdc++.h>
using namespace std;
int f[]={5,7,5,7,7};
int n;
int t[50];
string str;

int solve(){
  for(int i=0;i<n;i++){
    int a=i,j;
    for(j=0;j<5;j++){
      int b=0;
      while(b<f[j])b+=t[a++];
      if(b>f[j])break;
    }
    if(j==5)return i;
  }
  return 0;
}

int main(){
  while(1){
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++){
      cin>>str;
      t[i]=str.size();
    }
    cout<<solve()+1<<endl;
  }
  return 0;
}

Measured memory_bytes: 1200
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine().trim());
        int res=Math.abs(n-1);
        System.out.println(res);






    }



}


Measured memory_bytes: 32468
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S, T, U;
  int A, B;
  cin >> S >> T >> A >> B >> U;
  
  
  if (S==U) {
    cout << (A-1) << " " << B << endl;
    
  }
  
  else {
    cout << A << " " << (B-1) << endl;
  }
  
}


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

map<char, int> sz;
map<char, map<int, int> > arr;
int c;

int f(string& s) {
	if(isdigit(s[c])) {
		string t;
		while(c < s.size() && isdigit(s[c])) t += s[c++];
		return atoi(t.c_str());
	}
	char a = s[c];
	if(arr.count(a) == 0) return -1;
	c += 2;// a[
	int idx = f(s);
	if(idx == -1) return -1;
	if(sz[a] <= idx) return -1;
	if(arr[a].count(idx) == 0) return -1;
	assert(s[c] == ']');
	c++; // ]
	return arr[a][idx];
}

bool ass(string& s) {
	char a = s[c];
	if(arr.count(a) == 0) return false;
	c += 2; // a[
	int idx = f(s);
	if(idx == -1) return false;
	if(sz[a] <= idx) return false;
	assert(s[c] == ']');
	c += 2; // ]=
	int num = f(s);
	if(num == -1) return false;
	arr[a][idx] = num;
	return true;
}

bool dec(string& s) {
	char a = s[c];
	c += 2;
	int size = f(s);
	if(size == -1) return false;
	sz[a] = size;
	arr[a] = map<int, int>();
	return true;
}

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

	while(1) {
		string s;
		vector<string> v;
		while(cin >> s, s != ".") {
			v.push_back(s);
		}
		if(v.size() == 0) break;
		arr.clear();
		sz.clear();
		int cnt = 0;
		for(int i = 0; i < v.size(); i++) {
			s = v[i];
			c = 0;
			// assign
			if(s.find('=') != -1) {
				if(!ass(s)) {
					cnt = i + 1;
					break;
				}
			}
			// declaration
			else {
				if(!dec(s)) {
					cnt = i + 1;
					break;
				}
			}
		}
		cout << cnt << endl;
	}
}

Measured memory_bytes: 3212
#include <iostream>

using namespace std;

unsigned long long power_aux(unsigned long long base, unsigned long long exponent, unsigned long long accumulator) {
  if (exponent == 0) {
    return accumulator % 1000000007;
  } else if (base >= 1000000007 || accumulator >= 1000000007) {
    return power_aux(base % 1000000007, exponent, accumulator % 1000000007);
  } else if (exponent % 2 == 0) {
    return power_aux(base * base, exponent/2, accumulator);
  } else {
    return power_aux(base, exponent - 1, accumulator * base);
  }
}

unsigned long long int power(unsigned long long base, unsigned long long exponent) {
  return power_aux(base, exponent, 1);
}

int main() {
  unsigned long long base, exponent;
  cin >> base >> exponent;
  cout << power(base, exponent) << endl;
}
  

Measured memory_bytes: 1156
N = gets.chomp.to_i
A = gets.chomp.split(" ").map(&:to_i)

A.each do |a|
  if a % 2 == 0 && (a % 3 != 0 && a % 5 != 0)
    puts "DENIED"
    exit
  end
end
puts "APPROVED"


Measured memory_bytes: 1788
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))

typedef long long ll;

int main(){
    int n; cin >> n;
    vector<int> x(n);
    rep(i,n) cin >> x[i];
    ll ans = 1000000000000;
    for(int i=1;i<=100;i++){
        long long int t = 0;
        rep(j,n) t = t + (x[j]-i) * (x[j]-i);
        ans = min(t,ans);
    }
    cout << ans << endl;
}

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

int gsd(int x,int y){
  if(y==0) return x;
  return gcd(y,x%y);
}
int main(){
  int x;
  cin>>x;
  cout<<360/gcd(x,360)<<endl;
}

Measured memory_bytes: 3588
#include<iostream>
using namespace std;int x[9999],y,n,q,r,i,j;int main(){cin>>n;for(i=0;i<n;i++){cin>>x[i];}cin>>q;for(i=0;i<q;i++){cin>>y;for(j=0;j<n;j++){if(y==x[j]){r++;break;}}}cout<<r<<endl;}

Measured memory_bytes: 1204
#include<iostream>
#include<string>
#include<cmath>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <vector>


using namespace std;

int main()
{

  int A[4];
  for(int i=1;i<=3;i++)cin>>A[i];

  sort(A+1,A+4);

  int ans=0;


  if((A[2]-A[1])%2==0){
    ans+=(A[2]-A[1])/2;
    ans+=A[3]-A[2];
  }
  else{
    ans+=(A[2]-A[1])/2;
    ans+=A[3]+1-A[2]+1;
  }

  cout<<ans<<endl;

  return 0;
}


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

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

#define maxN 200011

struct aib {
    int n;
    int data[maxN];

    void init(int _n) {
        n = _n;
        memset(data, 0, sizeof(data));
    }

    int zrs(int x) {
        return (x & (x - 1)) ^ x;
    }

    void add(int pos, int v) {
        while (pos <= n) {
            data[pos] += v;
            pos += zrs(pos);
        }
    }

    int sum(int pos) {
        int ans = 0;
        while (pos > 0) {
            ans += data[pos];
            pos -= zrs(pos);
        }
        return ans;
    }
};

int n, i, odd, done;
char s[maxN];
vector<int> where[33];
bool used[maxN];
int pr[maxN];
aib work;
ll ans;

int main()
{
  //  freopen("test.in","r",stdin);

    scanf("%s", s + 1);
    n = strlen(s + 1);
    for (i = 1; i <= n; i++)
        where[s[i] - 'a'].pb(i);

    odd = -1;
    for (i = 0; i < 26; i++) {
        if (where[i].size() & 1) {
            if (odd == -1) {
                odd = i;
            } else {
                printf("-1");
                return 0;
            }
        }

        int p1 = 0;
        int p2 = where[i].size() - 1;
        while (p1 < p2) {
            pr[where[i][p1]] = where[i][p2];
            pr[where[i][p2]] = where[i][p1];
            p1++; p2--;
        }
    }

    work.init(n);
    for (i = 1; done < n / 2; i++) {
        if (used[i]) continue;
        if (pr[i] == 0) continue;

        done++;
        ans += 1LL * (i - done) - work.sum(i);
        ans += 1LL * (n - done + 1 - pr[i]) + (work.sum(pr[i]));
        used[i] = used[pr[i]] = true;
        work.add(pr[i], +1);
    }

    printf("%lld", ans);


    return 0;
}


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

int main(){
    int n;
    cin >> n;
    
    int a[n];
    for(int i = 0; i < n; i++)
        cin >> a[i];
    
    int ans = 0;
    for(int i = 1; i< n-1; i++){
        if(a[i-1]<a[i]&& a[i] < a[i+1])
            ans++;
        if(a[i-1]>a[i]&&a[i]>a[i+1])
            ans++;
    }
    cout << ans << endl;
    
        }



Measured memory_bytes: 256
<?php

$count = trim(fgets(STDIN));

$string = trim(fgets(STDIN));

$array = explode(" ", $string);

$count_odd = 0;
$count_fours = 0;

foreach ($array as $item)
{
    if ($item%2 == 1)
    {
        $count_odd++;
    }
    
    if ($item%4 == 0)
    {
        $count_fours++;
    }
}



if ($count_fours >= floor($count/2))
{
    echo "Yes";
} else if ($count_fours >= $count_odd)
{
    echo "Yes";
}
else
{
    echo "No";
   
}

echo "\n";
die();



Measured memory_bytes: 22056
#include<stdio.h>
#include <sstream>
#include <iostream>
#include <cstdlib>

using namespace std;

#define BUF_SIZE 1024
#define ARRAY_SIZE 100

int main(){

	int array[1000];
    int n;
    int change_count=0;

    scanf("%d", &n);
	for(int i = 0; i < n; i++){
        scanf("%d", &array[i]);
	}

	int tmp = 0;
	for(int i = n-1;i > 0;i--){
		for(int j = 0; j < i;j++){
			if(array[j] > array[j+1]){
				tmp = array[j+1];
				array[j+1] = array[j];
				array[j] = tmp;
				change_count++;
			}
		}
	}

	for(int i = 0; i < n; i++){
		if(i != n-1){
			printf("%d ",array[i]);
		}else{
			printf("%d\n",array[i]);
		}
	}
	printf("%d\n",change_count);
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
 
bool vector_finder(std::vector<ll> vec, ll number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) {
    return true;
  }
  else {
    return false;
  }
}

std::ostream &operator<<(std::ostream &dest, __int128_t value) {
  std::ostream::sentry s(dest);
  if (s) {
    __uint128_t tmp = value < 0 ? -value : value;
    char buffer[128];
    char *d = std::end(buffer);
    do {
      --d;
      *d = "0123456789"[tmp % 10];
      tmp /= 10;
    } while (tmp != 0);
    if (value < 0) {
      --d;
      *d = '-';
    }
    int len = std::end(buffer) - d;
    if (dest.rdbuf()->sputn(d, len) != len) {
      dest.setstate(std::ios_base::badbit);
    }
  }
  return dest;
}
 
 
int main() {
  ll N;
  cin >> N;
  vector<string> S(N);

  ll AC_num = 0;
  ll WA_num = 0;
  ll TLE_num = 0;
  ll RE_num = 0;


  ll ans = 0;
  for (ll i = 0; i < N; i++) {
    cin >> S.at(i);

    if (S.at(i) == "AC") {
      AC_num++;
    } else if (S.at(i) == "WA") {
      WA_num++;
    } else if (S.at(i) == "TLE") {
      TLE_num++;
    } else if (S.at(i) == "RE") {
      RE_num++;
    }
  }

  cout << "AC x " << AC_num << endl;
  cout << "WA x " << WA_num << endl;
  cout << "TLE x " << TLE_num << endl;
  cout << "RE x " << RE_num << endl;
  
  
  
  return 0;
}

Measured memory_bytes: 6424
/*|In The Name of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;

int n;
int ar[N];

int get(int x){
    int best = 1e9;
    for(int i = 1; i <= n; i++){
        if(ar[i] > x)
            best = min(ar[i] , best);
    }
    return best;
}

int getways(int x){
    bool did = 0;
    int interval = 0;
    for(int i = 1; i <= n+1; i++){
        if(ar[i] >= x)
            did = 1;
        else if(did)
            did = 0 , interval++;
    }
    return interval;
}

int main(){
    scanf("%d" , &n);
    for(int i = 1; i <= n; i++){
        scanf("%d" , &ar[i]);
    }
    int x = 0;
    int cnt = 0;
    while(1){
        int getmn = get(x);
        if(getmn >= 1e9)
            break;
        int lastX = x;
        x = getmn;
        int ways = getways(x);
        cnt += ways * (x - lastX);
    }
    printf("%d\n" , cnt);
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    ll max_n = 1000000;
    ll c[max_n] = { 0 };
    for (int i1 = 0; i1 < n; ++i1) {
        int a;
        cin >> a;
        c[a-1] += 1;
        c[a] += 1;
        c[a+1] += 1;
    }

    ll max = 0;
    for (int i = 0; i < max_n; ++i) {
        if (max < c[i]) max = c[i];
    }
    cout << max << endl;


    return 0;
}


Measured memory_bytes: 8064
#include <cstdio>

typedef long long ll;

ll a, b, c, k;

int main(void) {
  scanf("%lld%lld%lld%lld", &a, &b, &c, &k);
  printf("%lld\n", k%2 == 0 ? a - b : b - a);
  return 0;
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
    	int A, B;
        void solve(InputReader in, PrintWriter out) {
            // write your code here
        	A = in.nextInt();
        	B = in.nextInt();
        	if (A >= 13) {
				out.println(B);
			} else if (A >= 6){
				out.println(B/2);
			} else {
				out.println(0);
			}
        }
        
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

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

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}


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

int main(){
  int N, K, d;
  cin >> N >> K;
  vector<int> S(N, 0);
  for(int i = 0; i < K; i++){
    cin >> d;
    int a;
    for(int j = 0; j < d; j++){
      cin >> a;
      S[a-1]++;
    }
  }
  int ans = 0;
  for(int i = 0; i < N; i++){
    if(S[i] == 0) ans++;
  }
  cout << ans << endl;
  return 0;
}

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 M = sc.nextInt();
    	int X = sc.nextInt();
    	int[] map = new int[N+1];
    	for (int i = 0; i < M; i++) {
    		map[sc.nextInt()] = 1;
    	}
    	int cost1 = 0;
    	int cost2 = 0;
    	for (int i = X+1; i < N; i++) {
    		cost1 += map[i];
    	}
    	for (int i = X-1; 0 < i; i--) {
    		cost2 += map[i];
    	}
    	System.out.println(Math.min(cost1, cost2));
    }
}

Measured memory_bytes: 21844
n = int(input())
f = [0]*60000
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            f[x**2+y**2+z**2+x*y+y*z+z*x-1]+=1
for i in range(n):
    print(f[i])

Measured memory_bytes: 9456
//#include"pch.h"
#include<iostream>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define N 1000010
ll f[N],cs[N],n;
int main() {
	cin >> n;
	f[0] = 1;
	cs[0] = 1;
	for (int i = 1;i <= n;i++) {
		f[i] = cs[i - 1];
		if (i - 2 >= 0)f[i] -= f[i - 2];
		cs[i] = (cs[i - 1] + f[i]) % mod;
		//cout << f[i] << endl;
	}
	ll ans = f[n]+f[n-1]*(n-1);
	for (ll i = 0;i < n - 1;i++) {
		ans = (ans + f[i] * ((n - 1)*(n - 1)%mod+(i+1)))%mod;
		//cout << (n - 1)*(n - 1) + (n - i - 1) << endl;
	}
	ans %= mod;
	if (ans < 0)ans += mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 15872
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Vishal Burman
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int sec = in.nextInt();
            int hour = sec / 3600;
            int remainder = sec - (hour * 3600);
            int min = remainder / 60;
            remainder = remainder - (min * 60);
            sec = remainder;
            out.println(hour + ":" + min + ":" + sec);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}




Measured memory_bytes: 24392