akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i = 0; i < n; i++)

int main() {
	int k, n;
	cin >> k >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	int dif = 0;
	rep(i, n - 1) {
		int now = a[i + 1] - a[i];
		dif = max(dif, now);
	}
	dif = max(k - a[n - 1] + a[0], dif);
	cout << k - dif << endl;
	return 0;
}

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

namespace lec09C
{
    class Program
    {
        static int size;
        public const int INF = 2000000009;

        static void Main(string[] args)
        {
            //setting part
            size = 0;
            int[] array = new int[2000000];
            bool flag = true;


            //main part
            while (flag)
            {
                string input = Console.ReadLine();
                string[] split = input.Split(' ');

                if (split[0] == "insert")
                {
                    MaxHeapInsert(array, int.Parse(split[1]));
                }
                if (split[0] == "extract")
                {
                    int k = HeapExtractMax(array);
                    Console.WriteLine("{0}", k);
                }
                if (split[0] == "end")
                {
                    flag = false;
                }
            }


            Console.ReadLine();
        }

        static void MaxHeapInsert(int [] arr, int key)
        {
            size++;
            arr[size-1] = -1 * INF;
            HeapIncreaseKey(arr, key);
        }

        static void HeapIncreaseKey( int [] arr , int key)
        {
            int i = size;
            if (key < arr[i-1])
            {
                Console.WriteLine("HeapIncreaseKey Error");
            }
            arr[i-1] = key;
            while (i > 1 && arr[(int)(i /2) -1] < arr[i -1])
            {
                int temp = arr[(int)(i / 2) - 1];
                arr[(int)(i / 2) - 1] = arr[i - 1];
                arr[i - 1] = temp;
                i = i/2;
            }
        }

       static int HeapExtractMax(int [] arr)
        {
            if (size < 1)
            {
                Console.WriteLine("HeapExtractMax Error");
            }
            int max = arr[0];
            arr[0] = arr[size - 1];
            size--;
            MaxHeapify(arr,1);
            return max;
        }

        static void BuildMaxHeap(int[] arr)
        {
            for (int i = size / 2; i > 0; i--)
            {
                MaxHeapify(arr, i);
            }
        }

        static void MaxHeapify(int[] arr, int i)
        {
            int l = i * 2;
            int r = i * 2 + 1;
            int largest;

            if (l <= size && arr[l - 1] > arr[i - 1])
            {
                largest = l;
            }
            else
            {
                largest = i;
            }
            if (r <= size && arr[r - 1] > arr[largest - 1])
            {
                largest = r;
            }

            if (largest != i)
            {
                int temp = arr[i - 1];
                arr[i - 1] = arr[largest - 1];
                arr[largest - 1] = temp;

                MaxHeapify(arr, largest);
            }
        }
    }
}



Measured memory_bytes: 24920
S = input()
T = str(S)
A=int(T[0:2])
B=int(T[2:4])
if 1<=A<=12:
  if 1<=B<=12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
elif 1<=B<=12:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3060
#include <stdio.h>
 
int gcd(int num1, int num2, int num3){
  	int sma_num;
  
	if((num1 - num2) < 0 && (num1 - num3) < 0){
    	sma_num = num1;
    } else if ((num2 - num3) < 0){
    	sma_num = num2;
    } else {
    	sma_num = num3;
    }
  
  	for(int i = sma_num; i >= 0; i--){
    	if((num1 % i) == 0 && (num2 % i) == 0 && (num3 % i) == 0){
        	return i;
        } else {
        	continue;
        }
    }
}
 
int main(void){
  	int k, result;
  	int sum = 0;
  
	scanf("%d", &k);
  
  	for(int a = 1; a <= k; a++){
    	for(int b = 1; b <= k; b++){
        	for(int c = 1; c <= k; c++){
  				result = gcd(a, b, c);
              	sum += result;
            }
        }
    }
  
  printf("%d", sum);
}

Measured memory_bytes: 1732
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int L[] = new int[N];
		for(int i = 0; i < N; i++) {
			L[i] = sc.nextInt();
		}
		
		long ans = 0;
		Arrays.sort(L);
		for(int i = 0; i < N; i++) {
			for(int j = i + 1; j < N; j++) {
				for(int k = j + 1; k < N; k++) {
					if(L[i] + L[j] > L[k]) {
						ans++;
					} else {
						break;
					}
				}
			}
		}
		System.out.println(ans);
	}
}


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

const int maxn = 1000100;

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

    // array went thru the step by 1
    // sure made out of {0,1,2} from then on
    vector<int> a;
    rep(i, s.size() - 1) {
        a.push_back(abs(s[i] - s[i + 1]));
    }
    int n = a.size();

    // # of times n! can be devided by 2
    vector<ll> cnt(maxn, 0);
    for (int i = 1; i < maxn; i++) {
        int num = i;
        int toAdd = 0;
        while (num % 2 == 0) {
            toAdd++;
            num /= 2;
        }
        cnt[i] = cnt[i - 1] + toAdd;
    }

    ll parity = 0;
    rep(i, n) {
        ll val = cnt[n - 1] - cnt[i] - cnt[n - i - 1];
        if (val > 0) continue;
        parity += a[i];
    }

    // if the parity is odd, the answer is 1
    if (parity & 1) {
        cout << 1 << endl;
        return 0;
    }

    // if there is 1 in a, the answer is 0
    rep(i, n) {
        if (a[i] == 1) {
            cout << 0 << endl;
            return 0;
        }
    }

    parity = 0;
    rep(i, n) {
        ll val = cnt[n - 1] - cnt[i] - cnt[n - i - 1];
        if (val > 0) continue;
        parity += a[i] / 2;
    }
    cout << (parity & 1 ? 2 : 0) << endl;
}

Measured memory_bytes: 16940
from collections import deque
used = [0]*(3**10)


while True:
	s = raw_input()
	if s=="0":
		break
	n=len(s)
	t=0
	for i in range(len(s)):
		t*=3
		if s[i]=="r":
			t+=0
		if s[i]=="g":
			t+=1
		if s[i]=="b":
			t+=2
	f=0
	for i in range(3**n):
		used[i]=0
	tq=[t]
	q=deque(tq)
	used[t]=1
	ans=-1
	cnt=0
	while len(q)>0:
		qs=len(q)
		for o in range(qs):
			top=q.popleft()
			v=[0]
			v.pop()
			for i in range(n):
				v.append(top%3)
				top/=3
			ok=1
			a=v[0]
			for i in range(n):
				if v[i]!=a:
					ok=0
			if ok==1:
				f=1
				ans=cnt
				break
			for i in range(n-1):
				if v[i]!=v[i+1]:
					t1=v[i]
					t2=v[i+1]
					v[i]=3-t1-t2
					v[i+1]=3-t1-t2
					tmp=0
					for j in range(n):
						tmp*=3
						tmp+=v[j]
					if used[tmp]==0:
						q.append(tmp)
						used[tmp]=1
					v[i]=t1
					v[i+1]=t2
		if f==1:
			break
		else:
			cnt+=1
	if ans==-1:
		print "NA"
	else:
		print ans

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

using namespace std;

int main() {
    double n, k;
    cin >> n >> k;

    double ans = 0;
    for(int i = 1; i < n+1; i++) {
        double count = 0;
        bool ok = true;
        int j = i;
        while(ok){
            if(j < k){
                j = j * 2;
                count++;
            }
            else if (j >= k){
                double z = pow(0.5, count);
                ans = ans + 1 / n * z;
                ok = false;
            }
        }
        
    }
    cout << setprecision(13) << ans << endl;

    return 0;
}

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

int main()
{
    long a, b, c, d;
    long ans;
    // scanf("%d", &x);
    cin >> a >> b >> c >> d;
    long aa, cc;
    aa = c / b;
    if (c % b > 0)
    {
        aa++;
    }
    cc = a / d;
    if (a % d)
    {
        cc++;
    }
    if (aa > cc)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

const int maxn = int(2e5)+5;

int A[maxn], B[maxn];

int main(void)
{
	int n;
	scanf("%d", &n);
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &A[i]);
		B[i] = A[i];
	}
	sort(B, B+n);

	int cent = n/2-1;
	for(int i = 0;i < n;i++)
	{
		if(A[i] <= B[cent]) printf("%d ", B[cent+1]);
		else printf("%d ", B[cent]);
	}
	printf("\n");
}

Measured memory_bytes: 3712
N = int(input())
a_list = list(map(int,input().split()))

a_list.sort(reverse=True)
Asum = 0
Bsum = 0

for i in range(0,N,2):
    Asum += a_list[i]

for i in range(1,N,2):
    Bsum += a_list[i]

print(Asum-Bsum)


Measured memory_bytes: 2940
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    [N, M] = string_to_int(inputs[0])
    p = 2 ** M

    sum_t = ((N-M) * 100 + (1900 * M)) * p
    return sum_t


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int mod = (int)1e9 + 7, INF = (int)1e9;


int main(void) {
	int a, b, c, na, nb, nc, ans;

	scanf("%d%d%d", &a, &b, &c);

	ans = 0;
	while (1) {
		if (a % 2 + b % 2 + c % 2 > 0) {
			break;
		}
		na = b / 2 + c / 2;
		nb = c / 2 + a / 2;
		nc = a / 2 + b / 2;
		if (a == na && b == nb && b == nc) {
			printf("-1\n");
			return 0;
		}
		ans++;
		a = na;
		b = nb;
		c = nc;
	}

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

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
  int i,j,len,c;
  string s;
  while(cin >> s){
    len=s.size();
    for(i=0;i<len;i++){
      if(s[i]=='@'){
        c=s[i+1]-'0';
	for(j=0;j<c;j++){
	  cout << s[i+2];
	}
	i+=2;
      }
      else cout << s[i]; 
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1172
#include<bits/stdc++.h>
using namespace std;
int a,b;char s[99];
int main(){
	scanf("%d%d%s",&a,&b,s);
	for(int i=0; i<a+b+1; i++){
		if(!(i==a && s[i] == '-' || i!=a && s[i]>='0' && s[i]<='9')){
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

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

    int max = 1;

    for (int i = 2; pow(i, 2) <= X; i++){
        for (int j = 2; pow(i, j) <= X; j++){
            int dig = pow(i, j);
            if (max < dig){
                max = dig;
            }
        }
    }
    
    cout << max << endl;
    

    return 0;
}

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


int main()
{
  

   ll n,k;
   cin>>n>>k;
   ll arr[n];
   for(ll i=0;i<n;i++)
        cin>>arr[i];
    sort(arr,arr+n);
    ll total = 0;
    for(ll i=0;i<k;i++)
        total += arr[i];
    cout<<total;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define pp pair<int,int>
#define fi first
#define se second
#define maxx 400012
#define ll long long
#define pb push_back
#define mp make_pair
#define lb lower_bound
const int mod=998244353;
using namespace std;

int a,b,c;

void input(){
//    freopen("TEST.INP","r",stdin);
//    freopen("TEST.OUT","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>a>>b>>c;
    cout<<max(c-(a-b),0);

}

int main()
{
    input();

    return 0;
}


Measured memory_bytes: 256
// D - Handstand
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int solve(int N, int K, string &S){

	S += S[N-1]=='0'? "1":"0";//終端処理用

	vi sumC;//累積和
	sumC.push_back(0);//累積和の差分計算を簡略化するため
	if(S[0] == '0') sumC.push_back(0);//1 から始まるデータを想定して追加

	int count = 0;
	rpz(l, N){
		count++;
		if(S[l] != S[l+1]){
			sumC.push_back(count + sumC[sumC.size()-1]);
			count = 0;
		}
	}

	int n = sumC.size();
	if(n&1) sumC.push_back(sumC[n-1]);//1 で終わるデータを想定して追加
	n = sumC.size();

	// rpz(i,n){printf("%d) sum %d\n",i,sumC[i]);}puts("---");//

	int width = K*2 + 1;
	int ans = 1;
	if(width >= n) ans = N;
	else for(int l=0, r=width; r<n; r+=2, l+=2) ans = max(ans, sumC[r]-sumC[l]);//(l.r] 累積和の差分
	return ans;

}

int main(){
	int N,K; cin>>N>>K;
	string S; cin>>S;
	cout<< solve(N, K, S) <<endl;
}

Measured memory_bytes: 1020
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		double N = sc.nextDouble();
		double K = sc.nextDouble();
		double log = Math.log(N) / Math.log(K);
		
		if (Math.floor(log) == log) {
			System.out.println((int)(log + 1));
		} else {
			System.out.println((int)Math.ceil(log));
		}

	}
}

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

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define mod9 998244353
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define tests int t; cin>>t; while(t--)

typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<bool> vb;

void io(){ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
template<typename K>unordered_set<K>hashset(){unordered_set<K>s;s.max_load_factor(0.25);s.reserve(512);return s;}
template<typename K,typename V>unordered_map<K,V>hashmap(){unordered_map<K,V>m;m.max_load_factor(0.25);m.reserve(512);return m;}

const ll inf = 10000000000000ll;

int ceil_div(int x, int y) {
    return 1 + ((x - 1) / y);
}

int main() {
    io();
    ll a,b,c;
    cin >> a >> b >> c;

    if ((c-a-b>0) && (2*a*b < a*a + b*b + c*c - 2*a*c - 2*b*c)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int  a,b;
    scanf("%d %d",&a,&b);
    if(a < b){
        printf("a < b\n");

    }
    else if(a>b){
        printf("a > b\n");
    }
    else if(a==b){
        printf("a == b\n");
    }
        return 0;
        }

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n, k; cin >> n >> k; string s; cin >> s;
    vll C;
    ll now = 1, cnt = 0;
    rep(i, n) {
        if (s[i] == (char)(now + '0')) cnt++;
        else {
            C.push_back(cnt);
            now = 1 - now;
            cnt = 1;
        }
    }
    C.push_back(cnt);
    //for (auto elem : C) cout << elem << " "; cout << endl;
    if (C.size() % 2 == 0) C.push_back(0);

    ll m = C.size();
    vll S(m + 1); rep(i, m) S[i + 1] = S[i] + C[i];

    // for (auto elem : S) cout << elem << " "; cout << endl;

    ll ans = 0;
    for (int i = 0; i < m; i += 2) {
        ll left = i;
        ll right = min(i + 2 * k + 1, m);
        ans = max(ans, S[right] - S[left]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2164
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <numeric>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<((x))<<endl
#define fi first
#define se second

#define INF 2147483600
#define long long long

int main(){
  string str;
  cin>>str;
  cout<<str.substr(0,5)<<" "<<str.substr(6,7)<<" "<<str.substr(14,5)<<endl;

  return 0;
}


Measured memory_bytes: 764
#include <stdio.h>
#define INFTY 100000001
#define MAX 2000000

void maxHeapify(int);
int extract(void);
void increaseKey(int,int);
void insert(int);

int H,A[MAX+1];

int main(){

  int key;
  char com[10];

  while(1){

    scanf("%s",com);
    if( com[0] == 'e' && com[1] == 'n' ) break;
    if( com[0] == 'i' ){
      scanf("%d",&key);
      insert(key);
    } else {
      printf("%d\n",extract());
    }
  }
  return 0;
}

void maxHeapify(int i){

  int left,right,largest,tmp=0;
  left = 2 * i;
  right = 2 * i + 1;

  if( left <= H && A[left] > A[i] ) largest = left;
  else largest = i;
  if( right <= H && A[right] > A[largest] ) largest = right;

  if( largest != i ){
    tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;
    maxHeapify(largest);
  } 

}
int extract(){

  int maxv;
  if( H < 1 ) return -INFTY;
  maxv = A[1];
  A[1] = A[H--];
  maxHeapify(1);
  return maxv;
  
}

void increaseKey(int i, int key){

  int tmp=0;
  if( key < A[i] ) return;
  A[i] = key;
  while( i > 1 && A[i/2] < A[i] ){
    tmp = A[i];
    A[i] = A[i/2];
    A[i/2] = tmp;
    i = i/2;
    
  }
}

void insert(int key){

  H++;
  A[H] = -INFTY;
  increaseKey(H,key);
  
}



Measured memory_bytes: 5604
package main

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

var n, ans int

func judge753(x int) bool {
	dic := map[int]struct{}{}
	for x != 0 {
		dic[x%10] = struct{}{}
		x /= 10
	}
	if len(dic) == 3 {
		return true
	}
	return false
}

func dfs(x int) {
	if x > n {
		return
	}
	if judge753(x) {
		ans++
	}
	for _, v := range [...]int{3, 5, 7} {
		dfs(x*10 + v)
	}
}

func main() {
	io := newIo()
	defer io.Flush()

	n = io.NextInt()
	dfs(0)
	io.Println(ans)
}

type io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *io) Flush() {
	_ = io.writer.Flush()
}

func (io *io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, _ := io.reader.ReadLine()
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *io) NextString() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *io) NextInt() int {
	i, _ := strconv.Atoi(io.NextString())
	return i
}

func (io *io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}


Measured memory_bytes: 4480
#include <iostream>
#include <algorithm>
#include <utility>
#include <map>
#include <vector>
#include <cstring>
#include <climits>
#include <queue>
#include <cmath>
#include <iomanip>
#include <set>
#include <bitset>

using namespace std;

typedef long long LL;
typedef pair<int, int> pii;

int main() {
	ios::sync_with_stdio(false);
  int a; cin >> a;
  cout << a + a * a + a * a * a << endl;
}

Measured memory_bytes: 3588
//mapで実装
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
using namespace std;

int main(){
    map<string,int> mp;
    int N,M;
    cin>>N;
    string str;
    for(int i=0;i<N;i++){
        cin>>str;
        auto itr = mp.find(str);
        if(itr!=mp.end()) itr->second++;
        else mp[str]=1;
    }
    cin>>M;
    for(int i=0;i<M;i++){
        cin>>str;
        auto itr = mp.find(str);
        if(itr!=mp.end()) itr->second--;
    }
    
    int ans=0;
    for(auto itr=mp.begin();itr!=mp.end();itr++) ans=max(ans,itr->second);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F;
		var a = G;
		Array.Sort(a, (x, y) => y.CompareTo(x));
		int A = 0, B = 0;
		for (var i = 0; i < N; i += 2) A += a[i];
		for (var i = 1; i < N; i += 2) B += a[i];
		Console.WriteLine(A - B);
	}
}


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

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

			String in = br.readLine();
			String chr[] = in.split(" ");
			int five = 0;
			int seve = 0;
			for (int i = 0; i < chr.length; i++) {
				if (Integer.parseInt(chr[i]) == 5) {
					five++;
				} else if (Integer.parseInt(chr[i]) == 7) {
					seve++;
				} else {
					break;
				}
			}
			if (five == 2 && seve == 1) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}
}

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()
typedef pair<ll, ll>    P;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    set<int> st;
    REP(i, n) {
        cin >> a[i];
        st.insert(a[i]);
    }
    int kosu = 0;
    bool flag = true;
    REP(i, n) {
        if(a[i] != 0) {
            flag = false;
        } else {
            kosu++;
        }
    }
    if(flag) {
        cout << "Yes" << endl;
        return 0;
    }

    if(n % 3 != 0) {
        cout << "No" << endl;
        return 0; 
    }

    if((st.size() == 2) && (kosu == n/3)) {
        int tmp = 0;
        REP(i, n) {
            if(a[i] != 0) {
                tmp = a[i];
            } 
        }
        REP(i, n) {
            if(a[i] != 0) {
                if(tmp != a[i]) {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
        cout << "Yes" << endl;
        return 0;
    }

    if(st.size() == 3) {
        int idx = 0;
        vector<int> tmp(3);
        for(auto i: st) {
            tmp[idx] = i;
            //cout << i << endl;
            idx++;
        }
        int x = 0, y = 0, z = 0;
        REP(i, n) {
            if(a[i] == tmp[0]) x++;
            else if(a[i] == tmp[1]) y++;
            else z++;
        }
        if((x == n/3) && (y == n/3) && (z == n/3)) {
            if((tmp[0] ^ tmp[1] ^ tmp[2]) == 0) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }



    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<ll, ll>;
using iii = pair<ii, ll>;
#define vt vector
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) a * b / gcd(a, b)
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;
// const ll N = ;

ll x, k, d;

ll up(ll x, ll y) {
    return x % y == 0 ? x / y : x / y + 1;
}

ll modulo(ll x, ll y) {
    return x < 0 ? x + up(abs(x), y) * y : x % y;
}

void solve() {
    cin >> x >> k >> d;
    x = abs(x);
    if(x / d > k) {
        x -= k * d;
        k = 0;
    } else {
        k -= x / d;
        x = modulo(x, d);
    }
    if(k & 1) cout << abs(min(x - d, x + d)) << "\n";
    else cout << x << "\n";
}

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

Measured memory_bytes: 3648
"""
最大限傾けたとき、水と接している面は横から見ると台形ないし三角形となる
水と接している面の面積 x/a が a*b/2 より大きい場合は台形となり、以下の場合は三角形となる

台形の場合

最大限傾けたとき、水と接している台形の上辺の長さをnとすると
(n+b)*a/2 = x/a
n = 2*x/(a**2) - b
求める角度をthetaとすると
tan(theta) = (b-n)/a
theta = arctan((b-n)/a)

三角形の場合

最大限傾けたとき、水と接している三角形の底辺の長さをnとすると
n*b/2 = x/a
n = 2*x/(a*b)
求める角度をthetaとすると
tan(theta) = b/n
theta = arctan(b/n)
"""

import sys
sys.setrecursionlimit(10**6)

a,b,x = map(int, input().split())

import numpy as np

if x/a > a*b/2:
    n = 2*x/(a**2) - b
    theta = np.arctan((b-n)/a) # radian表記なので戻り値の範囲は[-pi/2, pi/2]
    theta = np.rad2deg(theta)
else:
    n = 2*x/(a*b)
    theta = np.arctan(b/n)
    theta = np.rad2deg(theta)

print(theta)

Measured memory_bytes: 12488
#include <iostream>

inline const char * getConditionStr(int a, int b)
{
  if (a < b)
    return "<";
  if (a > b)
    return ">";
  else
    return "==";
}

int main()
{
  int a = 0, b = 0;
  std::cin >> a >> b;

  std::cout << "a " << getConditionStr(a, b) << " b" << std::endl;

  return 0;
}

Measured memory_bytes: 1156
def main():
    n,z,w = map(int,input().split())
    a = list(map(int,input().split()))
    ans = 0
    if n == 1:
        ans = abs(w-a[0])
    else:
        ans = max(abs(a[-1] - w),abs(a[-2] - a[-1]))
    
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
#include <iostream>
using namespace std;
int main(void){
    int E,Y;
    cin>>E>>Y;
    if(E==0) {
        if(1868<=Y&&Y<=1911)   cout<<"M"<<Y-1867;
        if(1912<=Y&&Y<=1925)   cout<<"T"<<Y-1911;
        if(1926<=Y&&Y<=1988)   cout<<"S"<<Y-1925;
        if(1989<=Y&&Y<=2016)   cout<<"H"<<Y-1988;
    }
    if(E==1) cout<<1867+Y;
    if(E==2) cout<<1911+Y;
    if(E==3) cout<<1925+Y;
    if(E==4) cout<<1988+Y;
    cout<<endl;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
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; }

ll MOD = 1000000007;

int main(void){
  int x; cin >> x;
  if(x >= 30) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0; 
}


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

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] d = new int[n];
		for (int i = 0; i < n; i++) {
			d[i] = sc.nextInt();
		}
		sc.close();

		Arrays.parallelSort(d);

		for (int i = 12; i >= 0; i--) {
			int[] a = new int[n + 1];
			System.arraycopy(d, 0, a, 1, n);
			boolean flg = true;
			label:
			for (int j = 0; j <= n; j++) {
				for (int j2 = 0; j2 < j; j2++) {
					if (diff(a[j], a[j2]) < i) {
						if (a[j] != 0) {
							a[j] = 24 - a[j];
						}
						flg = false;
						break;
					}
				}
				if (!flg) {
					flg = true;
					for (int j2 = 0; j2 < j; j2++) {
						if (diff(a[j], a[j2]) < i) {
							flg = false;
							break label;
						}
					}
				}
			}
			if (flg) {
				System.out.println(i);
				return;
			}
		}
	}

	static int diff(int a, int b) {
		if (a > b) {
			int c = a;
			a = b;
			b = c;
		}
		int d1 = b - a;
		int d2 = a + 24 - b;
		return Math.min(d1, d2);
	}
}


Measured memory_bytes: 24148
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
using namespace std;

int main() {

	unsigned long long r;
	unsigned long long D;
	unsigned long long xval;
	cin >> r;
	cin >> D;
	cin >> xval;

	unsigned long long ans = xval;
	for (int i = 1; i <= 10; i++) {
		ans = r * ans - D;
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <deque>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main() {
  int n; cin >> n;
  vector<int> a(n+1), b(n);
  rep(i, n+1) cin >> a[i];
  rep(i, n) cin >> b[i];
  ll ans = 0;
  rep(i, n+1) {
    if(i == 0) {
      ans += min(a[i], b[i]);
      b[i] -= min(a[i], b[i]);
    } else if(i == n) {
      ans += min(a[n], b[n-1]);
    } else {
      ans += min(a[i], b[i-1]);
      a[i] -= min(a[i], b[i-1]);
      ans += min(a[i], b[i]);
      b[i] -= min(a[i], b[i]);
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
n,m = map(int,input().split())
x = [list(map(int,input().split())) for i in range(n)]
y = [list(map(int,input().split())) for i in range(m)]
for a,b in x:
  l = [abs(a-c)+abs(b-d) for c,d in y]
  print(l.index(min(l))+1)

Measured memory_bytes: 3060
import numpy as np
N,D = map(int,input().rstrip().split(' '))
X = []
for i in range(N):
    X.append(list(map(int,input().rstrip().split(' '))))
r = []
for i in range(N):
    for j in range(i+1,N):
        ran = 0
        for l in range(D):
            ran += abs(X[i][l] - X[j][l]) **2
        r.append(ran)
r = [i for i in np.sqrt(r) if i % 1 == 0]
print(len(r))

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

using namespace std;
// (setq-default c-basic-offset 2)

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

  int na = (a + d - 1) / d;
  int nb = (c + b - 1) / b;

  if (na >= nb)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3580
#include <iostream>
#include <cmath>


static const double EPS = 1e-9;
using namespace std;

class Vector {
private:

public:
  double x, y;
  Vector():x(0), y(0){}; //Default constructor
  //Constructor
  Vector(double x_, double y_) {
    this->x = x_;
    this->y = y_;
  }
};


int main(){
  int w, h, x, y;
  cin >> w >> h >> x >> y;
  double W = double(w);
  double H = double(h);
  Vector p(x, y);
  Vector cent(W/2.0, H/2.0);

  double max_area = (W * H) / 2;
  int has_other = 0;

  if ((abs(cent.x - p.x) < EPS) && (abs(cent.y - p.y) < EPS)) {
    has_other = 1;
  }

  cout << max_area << " " << has_other << endl;

  return 0;
}


Measured memory_bytes: 256
<?php

$n = (int)trim(fgets(STDIN));
$mod = 1000000007;
if ($n === 3) {
	echo 61;
	exit();
}
$strs = ['A', 'C', 'G', 'T'];
$lasts = [];
for ($i=0; $i < 4; $i++) { 
	for ($j=0; $j < 4; $j++) { 
		for ($k=0; $k < 4; $k++) { 
			$tmp = $strs[$i] . $strs[$j] . $strs[$k];
			if (!in_array($tmp, ['AGC', 'ACG', 'GAC'])) {
				if (isset($lasts[$tmp])) {
					$lasts[$tmp] += 1;
				}else{
					$lasts[$tmp] = 1;
				}
			}
		}
	}
}
$comb = $lasts;
// var_dump($comb);
for ($m=3; $m < $n; $m++) { 
	$tmp_comb = [];
	foreach ($comb as $k => $v) {
		$next = $strs;
		if ($k === 'AGG') {
			$next = ['A', 'G'];
		}elseif ($k === 'AGG') {
			$next = ['A', 'G', 'T'];
		}elseif ($k === 'AGT') {
			$next = ['A', 'G', 'T'];
		}elseif (substr($k, 1, 2) === 'AC') {
			$next = ['A', 'C', 'T'];
		}elseif (substr($k, 1, 2) === 'AG') {
			$next = ['A', 'G', 'T'];
		}elseif (substr($k, 1, 2) === 'GA') {
			$next = ['A', 'G', 'T'];
		}
		foreach ($next as $s) {
			$tmp_three = substr($k, 1, 2) . $s;
			if (isset($tmp_comb[$tmp_three])) {
				$tmp_comb[$tmp_three] += $v % $mod;
			}else{
				$tmp_comb[$tmp_three] = $v % $mod;
			}
		}
	}
	$comb = $tmp_comb;
}
$sum = 0;
foreach ($comb as $val) {
	$sum += $val % $mod;
}
echo $sum % $mod;

Measured memory_bytes: 4604
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int N;

    cin >> N;

    int B[N];

    for ( int i = 0; i < N-1; i ++ ) cin >> B[i];

    int sum = 0;

    sum += B[0];
    for ( int i = 1; i < N-1; i ++ ) {
        if ( B[i-1] <= B[i] ) {
            sum += B[i-1];
        } else {
            sum += B[i];
        }
    }
    sum += B[N-2];

    cout << sum << endl;



    return 0;
}

Measured memory_bytes: 256
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;let mut next =||{iter .next () .unwrap () } ;input_inner !{next ,$($r ) *} } ;($($r :tt ) *) =>{let stdin =std ::io ::stdin () ;let mut bytes =std ::io ::Read ::bytes (std ::io ::BufReader ::new (stdin .lock () ) ) ;let mut next =move ||->String {bytes .by_ref () .map (|r |r .unwrap () as char ) .skip_while (|c |c .is_whitespace () ) .take_while (|c |!c .is_whitespace () ) .collect () } ;input_inner !{next ,$($r ) *} } ;}
macro_rules !input_inner {($next :expr ) =>{} ;($next :expr ,) =>{} ;($next :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($next ,$t ) ;input_inner !{$next $($r ) *} } ;}
macro_rules !read_value {($next :expr ,($($t :tt ) ,*) ) =>{($(read_value !($next ,$t ) ) ,*) } ;($next :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($next ,$t ) ) .collect ::<Vec <_ >>() } ;($next :expr ,chars ) =>{read_value !($next ,String ) .chars () .collect ::<Vec <char >>() } ;($next :expr ,usize1 ) =>{read_value !($next ,usize ) -1 } ;($next :expr ,$t :ty ) =>{$next () .parse ::<$t >() .expect ("Parse error" ) } ;}

const MOD: i64 = 1000000007;

fn main() {
   input! {
      n: usize,
      k: usize,
      a: [usize; n]
   }
   let mut dp = vec![vec![0i64; k + 1]; n + 1];
   for i in 0..n + 1 {
      dp[i][0] = 1;
   }
   for i in 0..n {
      for j in 1..k + 1 {
         dp[i + 1][j] = dp[i][j] + dp[i + 1][j - 1];
         if j > a[i] {
            dp[i + 1][j] -= dp[i][j - a[i] - 1];
         }
         if dp[i + 1][j] < 0 {
            dp[i + 1][j] += MOD;
         } else {
            dp[i + 1][j] %= MOD;
         }
      }
   }
   println!("{}", dp[n][k]);
}


Measured memory_bytes: 106748
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////



int main(){
    
    int n;
    cin >> n ;
    int a[n];
    inrep(n,a);
    
    rep(i,0,n){
	if(a[i]&1){
	    
	}else{
	    if(a[i]%3 != 0 && a[i]%5 != 0){
		P("DENIED");
		ret 0;
	    }
	}
    }
    P("APPROVED");
    return  0;
}


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

using namespace std;

int n, m;
bool gr[800][800];
vector<int> color;
vector< pair<int, int> > paircnts;

void wrong()
{
    printf("-1\n");
    exit(0);
}

void dfs(int u, int& c0, int& c1)
{
    for (int v = 1; v <= n; ++v) {
        if (gr[u][v] == 0 && u != v) {
			if (color[v] >= 0) {
				if (color[v] == color[u]) wrong();
				continue;
			}
            color[v] = color[u] ^ 1;

            if (color[v] == 0) ++c0;
            else ++c1;

            dfs(v, c0, c1);
        }
    }
}

int main()
{
    scanf("%d %d", &n, &m);
    memset(gr, 0, sizeof gr);
    for (int i = 0; i < m; ++i) {
        int u, v; scanf("%d %d", &u, &v);
        gr[u][v] = gr[v][u] = 1;
    }

	color.assign(n+1, -1);

    for (int i = 1; i <= n; ++i) {
        if (color[i] < 0) {
            color[i] = 0;
            int c0 = 1, c1 = 0;
            dfs(i, c0, c1);
            paircnts.push_back({c0, c1});
        }
    }

    int maxdp = n/2+1;
    bool dp[maxdp + 1];
    memset(dp, 0, sizeof dp);
    dp[0] = 1;
    for (pair<int, int> p : paircnts) {
        for (int i = maxdp; i >= 0; --i) {
			bool nxt = 0;
            if (i >= p.first) nxt |= dp[i - p.first];
            if (i >= p.second) nxt |= dp[i - p.second];
			dp[i] = nxt;
        }
    }

//    for (int i = 0; i <= maxdp; ++i) cerr << dp[i]; cerr << endl;

    int ans = 1e9;
    for (int i = 0; i <= maxdp; ++i) {
        if (dp[i]) {
        	int j = n - i;
        	int cur = ((i * (i-1)) + (j * (j-1))) / 2;
			ans = min(ans, cur);
        }
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 896
//(・ω・)
#include <stdio.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, atoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
#include <sstream> //istringstream
#include <stdlib.h>
#include <list>
#include <iterator>//std::advance()
using namespace std;
int main(){
    string n;
    cin >> n;
    long long sum=0;
    for(int i=0; i<n.size(); i++){
        sum+=(n[i]-'0');
    }
    if(sum%9==0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3744
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)


A,B,C,D=map(int,input().split())
c_div = B//C - (A-1)//C
d_div = B//D - (A-1)//D
cd_div = B//lcm(C,D) - (A-1)//lcm(C,D)
ans = (B-A+1) - c_div - d_div + cd_div
print(ans)

Measured memory_bytes: 3064
#include <cmath>
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
    int n; double x[100000], y[100000];
    
    scanf("%d", &n);
    
    for(int i = 0; i < n; i++)
    {
        scanf("%lf", &x[i]);
        scanf("%lf", &y[i]);
    }
    
    pair<double, double> p1[100000], p2[100000];
    
    for(int i = 0; i < n; i++)
    {
        p1[i] = make_pair(x[i], y[i]);
    }
    
    for(int i = 0; i < n; i++)
    {
        p2[i] = make_pair(y[i], x[i]);
    }
    
    sort(p1, p1 + n);
    sort(p2, p2 + n);
    
    double sqr_ans = 100000000.0;
    
    const int loops = 111;
    
    for(int i = 0; i < n - 1; i++)
    {
        int r = min(loops, n - i - 1);
        
        for(char j = 1; j <= r; j++)
        {
            double distance_ = (p1[i + j].first - p1[i].first) * (p1[i + j].first - p1[i].first) + (p1[i + j].second - p1[i].second) * (p1[i + j].second - p1[i].second);
        
            sqr_ans = min(distance_, sqr_ans);
        }
    }
    
    for(int i = 0; i < n - 1; i++)
    {
        int r = min(loops, n - i - 1);
        
        for(char j = 1; j <= r; j++)
        {
            double distance_ = (p2[i + j].first - p2[i].first) * (p2[i + j].first - p2[i].first) + (p2[i + j].second - p2[i].second) * (p2[i + j].second - p2[i].second);
        
            sqr_ans = min(distance_, sqr_ans);
        }
    }
    
    printf("%.9f\n", sqrt(sqr_ans));
    
    return 0;
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  const int MX = 55556;
  vector<bool> isp(MX, true);
  isp[0] = isp[1] = false;
  VI ps;
  for(int i=2;i<MX;++i){
	if(isp[i]){
	  ps.PB(i);
	  for(int j=i+i;j<MX;j+=i)
		isp[j] = false;
	}
  }

  int N;
  cin >> N;
  VI ans;
  for(int x: ps){
	if(x % 5 == 1)
	  ans.PB(x);
	if(SZ(ans) == N) break;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <stack>
#include <cctype>
#include <algorithm>
using namespace std;
const double PI = 3.14159265358979323846;

int main() {
	float R;
	cin >> R;

	cout << 2.0 * PI * R << endl;
	return 0;
}

Measured memory_bytes: 3788
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;

long long GCD(long long a, long long b) {
    if(b == 0)
        return a;
    else
        return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
    long long g = GCD(a, b);
    return a / g * b;
}
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;
}
int main() {
    int N;
    cin >> N;
    vector<int> x(N);
    vector<int> sortx(N);
    rep(i, 0, N) {
        cin >> x[i];
        sortx[i] = x[i];
    }
    sort(sortx.begin(), sortx.end());
    int mae = sortx[N / 2 - 1];
    int ato = sortx[N / 2];
    // cout << mae << ato << endl;
    rep(i, 0, N) {
        if(x[i] <= mae) {
            cout << ato << endl;
        } else {
            cout << mae << endl;
        }
    }
}


Measured memory_bytes: 3712
local n=io.read("n")
local a={}
for i=1,n do
    a[i]=io.read("n")
end
local motode=1000
for i=1,n-1 do
    if a[i]<a[i+1] then
        local torihiki=motode//a[i]
        motode=motode+(a[i+1]-a[i])*torihiki
    end
end
print(motode)

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

signed main(){
  int N, M, K; cin >> N >> M >> K;
  bool ok = false;
  for(int i = 0; i <= N; i++){
    for(int j = 0; j <= M; j++){
      int x = i * M + j * N - 2 * i * j;
      if(x == K) ok = true;
    }
  }
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
from collections import deque
n = int(input())
l = deque()

for i in range(n):
    cmd = input().split()
    if cmd[0] == "insert":
        l.appendleft(cmd[1])
    elif cmd[0] == "delete":
        if cmd[1] in l:
            l.remove(cmd[1])
    elif cmd[0] == "deleteFirst":
        l.popleft()
    elif cmd[0] == "deleteLast":
        l.pop()
    
print(" ".join(l))



Measured memory_bytes: 69736