akhauriyash/Code-Regression huggingface dataset:
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::cmp::{min, max};

struct Scanner<R: Read> {
    reader: R,
    buffer: String,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader, buffer: String::new() }
    }

    // fn line(&mut self) -> String {
    //     self.buffer = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
    //         .skip_while(|&c| c == '\n' || c == '\r')
    //         .take_while(|&c| !(c == '\n' || c == '\r'))
    //         .collect::<String>();
    //     self.buffer.clone()
    // }

    fn read_buffer(&mut self) {
        self.buffer = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
    }

    fn safe_read<T: FromStr>(&mut self) -> Option<T> {
        self.read_buffer();
        if self.buffer.is_empty() {
            None
        } else {
            self.buffer.parse::<T>().ok()
        }
    }

    fn read<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.safe_read() {
            s
        } else {
            writeln!(std::io::stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }

    fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.read()).collect()
    }

    fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item=U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(104_857_600)
        .spawn(solve)
        .unwrap()
        .join()
        .unwrap();
}

fn solve() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let n = sc.read();
    let mut list: VecDeque<u32> = VecDeque::new();

    for _ in 0..n {
        let com: String = sc.read();
        match com.as_str() {
            "insert" => {
                let x = sc.read();
                list.push_front(x);
            },
            "delete" => {
                let x: u32 = sc.read();
                let pos = list.iter().position(|&e| e == x).unwrap_or(list.len());
                let mut tail = list.split_off(pos);
                tail.pop_front();
                list.append(&mut tail);
            },
            "deleteFirst" => {
                list.pop_front();
            },
            "deleteLast" => {
                list.pop_back();
            },
            _ => panic!(),
        }
    }

    println!("{}", list.iter().join(" "));
}



Measured memory_bytes: 21312
#include <iostream>

using namespace std;

int main() {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  // s -> t
  for (int i = 0; i < ty - sy; ++i)
    cout << "U";
  for (int i = 0; i < tx - sx; ++i)
    cout << "R";

  // t -> s
  for (int i = 0; i < ty - sy; ++i)
    cout << "D";
  for (int i = 0; i < tx - sx; ++i)
    cout << "L";

  // s -> t
  cout << "L";
  for (int i = 0; i < ty - sy + 1; ++i)
    cout << "U";
  for (int i = 0; i < tx - sx + 1; ++i)
    cout << "R";
  cout << "D";

  // t -> s
  cout << "R";
  for (int i = 0; i < ty - sy + 1; ++i)
    cout << "D";
  for (int i = 0; i < tx - sx + 1; ++i)
    cout << "L";
  cout << "U" << endl;
}


Measured memory_bytes: 3596
import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
	while(kbd.hasNext()){
	    int n = kbd.nextInt();
	    if(n!=0){
		solve(n);
	    }
	}
    }

    static void solve(int n){
        String[][] group = new String[n][1050];
	visit = new boolean[n];
	int i, j, k=0, g=0;
	String a, p;
	while(g<n){
	    String len = kbd.next();
	    p = "";
	    for(i=0; i<len.length(); i++){
		a = len.substring(i, i+1);
		if(a.equals(":") || a.equals(",") || a.equals(".")){
		    group[g][k++] = p;
		    p = "";
		}
		else {
		    p += a;
		}
	    }
	    k=0;
	    g++;
	}

	int cnt = 0;
	String[] men = new String[1050];
	boolean TF = true;
	boolean[] x = new boolean[n];
	Arrays.fill(x, false);
	x[0] = true;
    

	cGroup(x, group, n, 0);

    

	for(g=0; g<n; g++){
	    for(i=1; group[g][i] != null; i++){
		TF = true;
		p = group[g][i];
		//System.out.println(p);

		// テ」ツつーテ」ツδォテ」ツδシテ」ツδ療・ツ青催」ツ?ィテァツュツ嘉」ツ?療」ツ?妥」ツつ古」ツ?ーテゥツ」ツ崚」ツ?ーテ」ツ??
		for(j=0; j<n; j++){
		    if(x[g] && group[j][0].equals(p)){
			//System.out.println(p);
			TF = false;
		    }
		}

		// テヲツ猟「テ」ツ?ォテヲツ閉ーテ」ツ?暗」ツ?淌」ツ?禿」ツ?ィテ」ツ?ョテ」ツ?づ」ツつ凝・ツ青催・ツ可催」ツ??」ツ?」テ」ツ?淌」ツつ嘉ゥツ」ツ崚」ツ?ーテ」ツ??
		for(j=0; men[j]!=null; j++){
		    if(men[j].equals(p)){
			//System.out.println(p);
			TF = false;
		    }
		}

		// テヲツ閉ーテ」ツ?暗」ツ?ヲテ」ツ??」ツ??」ツつーテ」ツδォテ」ツδシテ」ツδ療」ツ?ァテ」ツ??」ツ?凝」ツ?、テゥツ」ツ崚」ツ?ーテ」ツ?陛」ツつ古」ツ?ヲテ」ツ??」ツ?ェテ」ツ?妥」ツつ古」ツ?ー
		if(TF && x[g]){
		    //System.out.println(p);
		    men[cnt] = p;
		    cnt++;
		}
	    }
	}

	System.out.println(cnt);
    }



    static void cGroup(boolean[] x, String[][] group, int n, int m){
	int i, j;
	for(i=1; group[m][i] != null; i++){
	    String p = group[m][i];
	    //System.out.println(p);
	    
	    //テ」ツ?禿」ツ?ョテ」ツつーテ」ツδォテ」ツδシテ」ツδ療」ツ?ッテヲツ閉ーテ」ツ?暗」ツ?ヲティツ可ッテ」ツ??」ツ?凝ッツシツ?
		for(j=0; j<n; j++){
		    if(x[m] && !x[j] && group[j][0].equals(p)){
			//System.out.println(p);
			x[j] = true;
			cGroup(x, group, n, j);
		    }
		}
	}
    }

    static boolean[] visit;
}

Measured memory_bytes: 58260
#include <stdio.h>

int main(int argc, char *argv[])
{
    int elements[101][101] = {};
    int rows, columns;
    scanf("%d %d", &rows, &columns);
    for (int row = 0; row < rows; ++row)
    {
        for (int col = 0; col < columns; ++col)
        {
            scanf("%d", &elements[row][col]);
            const int element = elements[row][col];
            elements[row][columns] += element;
            elements[rows][col] += element;
        }
        elements[rows][columns] += elements[row][columns];
    }
    for (int row = 0; row < rows + 1; ++row)
    {
        for (int col = 0; col < columns + 1; ++col)
        {
            printf("%d%c", elements[row][col], col == columns ? '\n' : ' ');
        }
    }
    return 0;
}



Measured memory_bytes: 2084
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
#define N 1000000
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
ll ans,pre[N],suf[N]; int a[N],n,l;
void solve()
{	for(rint i=1;i<=n;i++) pre[i]=pre[i-1]+a[i];
	for(rint i=n;i>=0;i--) suf[i]=suf[i+1]+l-a[i];
	for(rint i=1;i<=n;i++)
	{	int le=(n+i)/2,ri=le+1; ll s=(pre[le]-pre[i-1]+suf[ri])*2LL;
		if((n-i-1)%2==0) s-=l-a[ri]; else s-=a[le]; ans=max(s,ans);
	}
}
int main()
{	cin>>l>>n;
	for(rint i=1;i<=n;i++) scanf("%d",&a[i]);
	ans=max(a[n],l-a[1]); if(n==1) return !printf("%lld",ans);
	solve(); reverse(a+1,a+n+1);//fgx;
	for(rint i=1;i<=n;i++) a[i]=l-a[i]; solve(); cout<<ans;
	return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vs vector<string>
#define mii map<int, int>

void show(auto a){
  int i = 1;
  while(i < a.size()){
    cout<<a[i]<<" ";
    i++;
  }
  cout<<endl;
}


int main(){
  ios_base::sync_with_stdio(false);

  int n, k;
  cin>>n>>k;
  vi a(n+1, 0);
  for(int i = 1; i<= n; i++) cin>>a[i];
  
  vi dp(n+1, 1e9);
  dp[1] = 0;
  for(int i = 2; i<=n; i++){
  	int j = max(1, i-k);
  	for(j; j<i; j++){
  		dp[i] = min(dp[i], dp[j] + abs(a[i] - a[j]));
  	}
  	// cout<<endl;

  }
  // show(dp);
  cout<<dp[n]<<endl;
}

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

int main() {
	int a, b, c, d, area1, area2;
	scanf("%d %d %d %d", &a, &b, &c, &d);
	
	area1 = a * b;
	area2 = c * d;
	
	if (area2 > area1) area1 = area2;
	
	printf("%d\n", area1);
	return 0;
}

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

#define pb push_back
#define fst first
#define snd second

#define fr(i,n)     for (int i = 0; i < n; i++)
#define frr(i,n)    for (int i = 1; i <= n; i++)

#define endl '\n'
#define gnl cout << endl
#define chapa cout << "oi meu chapa" << endl
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
//cout << setprecision(9)<<fixed;

#define dbg(x)  cout << #x << " = " << x << endl
#define all(x)  x.begin(),x.end()

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

const int INF = 0x3f3f3f3f;
const ll llINF = (long long)(1e18) + 100;   
const int MAXN = 2e3 + 10;
const ll mod=1e9+7;

int dist[MAXN][MAXN];
vi adj[MAXN];

void bfs(int v){
	queue<int> fila;
	fila.push(v);
	dist[v][v] = 0;

	int aux;
	while (!fila.empty()){
		aux = fila.front();
		fila.pop();
		for (int x : adj[aux])
			if (dist[v][x] == -1){
				dist[v][x] = dist[v][aux] + 1;
				fila.push(x);
			}	
	}
}

int ans[MAXN];

int32_t main(){
	fastio;
	int n, x, y;
	cin>>n>>x>>y;

	frr(i, n - 1){
		adj[i].pb(i + 1);
		adj[i + 1].pb(i);
	}

	adj[x].pb(y);
	adj[y].pb(x);

	frr(i, n)
		frr(j, n)
			dist[i][j] = -1;

	frr(i, n)
		bfs(i);

	for (int i = 1; i <= n; i++)
		for (int j = i + 1; j <= n; j++)
			ans[dist[i][j]]++;

	frr(i, n - 1)			
		cout<<ans[i]<<endl;
}

Measured memory_bytes: 16128
#include <stdio.h>
#define MAX 101
#define INF 10000000
#define NIL -1
#define BLACK 1
#define WHITE 0

void initializeSingleSource(int, int);
void dijkstra(int, int);

int d[MAX], pi[MAX], color[MAX], G[MAX][MAX];

int main(){
    int n, k, v, c, u;

    for(int i = 0; i < MAX; i++){
        for(int j = 0; j < MAX; j++){
            G[i][j] = INF;
        }
    }

    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%d%d", &u, &k);
        for(int j = 0; j < k; j++){
            scanf("%d%d", &v, &c);
            G[u][v] = c;
        }
    }

    dijkstra(n, 0);

    for(int i = 0; i < n; i++) printf("%d %d\n", i, d[i]);

    return 0;
}

//d[]:距離を保持する配列を初期化しておく
//ただし、d[0]は0にしておく。
//すなわち、0からsへの最短経路を求める
void initializeSingleSource(int n, int s){
    for(int v = 0; v < n; v++){
        d[v] = INF;
        pi[v] = NIL;
        color[v] = WHITE;
    }
    d[s] = 0;
}

void dijkstra(int n, int s){
    int mincost, u;
    
    initializeSingleSource(n, s);

    while(1){
        mincost = INF;
        for(int i = 0; i < n; i++){
            if(color[i] != BLACK && d[i] < mincost){
                mincost = d[i];
                u = i;
            }
        }
        if(mincost == INF)break;
        color[u] = BLACK;
        for(int v = 0; v < n; v++){
            if(color[v] != BLACK && d[u] + G[u][v] < d[v]){
                pi[v] = u;
                d[v] = d[u] + G[u][v];
            }
        }
    }
}



Measured memory_bytes: 2112
N = int(input())
A = list(map(int, input().split()))

A.sort(reverse=True)

if N == 2:
    print(A[0])
else:
    ans = 0
    for i in range(N-1):
        if i == 0:
            ans += A[0]
        else:
            ans += A[(i+1)//2]
    print(ans)

Measured memory_bytes: 31376
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a,b,c,d;
	string s;
	cin>>n>>a>>b>>c>>d>>s;
	for(int i=a-1;i<c-2;i++)
		if(s.substr(i,2)=="##"){
			cout<<"No\n";
			return 0;
		} 
	for(int i=b-1;i<d-2;i++)
		if(s.substr(i,2)=="##"){
			cout<<"No\n";
			return 0;
		} 
	if(c<d){
		cout<<"Yes\n";
		return 0;
	}
	else {
		for(int i=b-2;i<d-1;i++)
		{
			if(s.substr(i,3)=="..."){
				cout<<"Yes\n";
				return 0;
			}
		}
		cout<<"No\n";
		return 0;
	}
	return 0;
} 

Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

const int N=100005; 

using namespace std;

int n; 
int a[N],nxt[N];
long long s[N];  
char opt[N]; 

int main(){
	int mk;
	long long cnt,ans;  
	scanf("%d",&n); 
	scanf("%d",&a[1]);
	opt[1]='+'; 
	for(int i=2; i<=n; ++i){
		scanf("\n%c",&opt[i]); 
		scanf("%d",&a[i]); 
	}
	s[n+1]=0; 
	for(int i=n; i>=1; --i) s[i]=s[i+1]+a[i]; 
	mk=n+1;
	for(int i=n; i>=1; --i){
		nxt[i]=(mk==n+1)?i:mk; 
		mk=(opt[i]=='-')?i:mk;
	}
	cnt=0;
	ans=-1ll<<60; 
	for(int i=1; i<=n; ++i){
		if(opt[i]=='-'){
			if(nxt[i]!=i) ans=max(ans,cnt+s[nxt[i]]-(s[i]-s[nxt[i]])); 	
			else ans=max(ans,cnt-s[nxt[i]]); 
		}
		cnt+=(opt[i]=='+')?a[i]:-a[i]; 
	}
	ans=max(ans,cnt); 
	printf("%lld\n",ans); 
	return 0; 
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define all(v) (v).begin(),(v).end()
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/

signed main(){
  int k;
  cin>>k;
  int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}; 


  cout<<a[k-1]<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define vl vector
#define pb push_back
using namespace std;
int main()
{
    ll n;
    cin>>n;
    ll freq[n+1]={0};
    for(ll i=0;i<n-1;i++)
    {
        ll a;
        cin>>a;
        freq[a]++;
    }
    for(ll i=1;i<n+1;i++) cout<<freq[i]<<endl;
}

Measured memory_bytes: 5168
#include <stdio.h>
#include <limits.h>

int main(void){
    int n, m;
    int i;
    int max = -INT_MAX;
    int min = INT_MAX;
    long int sum = 0;

    scanf("%d", &n);
 
    for(i = 0; i < n; i++){
        scanf("%d ", &m);
        sum += m;
        if(max < m) max = m;
        if(min > m) min = m;
    }
    printf("%d %d %ld\n", min, max, sum);
    return 0;
}

    

Measured memory_bytes: 604
import java.util.*;


public class Main{
	public static void main( String args[] ) {
		String resMes;
		Scanner scan = new Scanner( System.in);
		
		
		int array[] = new int[2];
		
		for( int i = 0; i < array.length;  i++) {
			array[i ] = scan.nextInt();

		}
		
		if(  ( array[0] * array[1] ) % 2 == 0 ){
			resMes = "Even";
		}
		else {
			resMes = "Odd";
			
		}
		
		System.out.println( resMes );
		
		scan.close();
		
	}
}

Measured memory_bytes: 22996
#include <iostream>
#include <stdlib.h>
#include <queue>
#include <cstring>
#define MAX_NUM 1010
using namespace std;
int H, W, N;
bool flag[MAX_NUM][MAX_NUM] = {false};

class Node
{
public:
	Node();
	Node(int x, int y, int step);
	~Node();
	int x;
	int y;
	int step;
};

Node::Node()
{
}

Node::Node(int x, int y, int step) {
	this->x = x;
	this->y = y;
	this->step = step;
}

Node::~Node()
{
}
int dir[4][2] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };
int BFS(char map[][MAX_NUM], int sx, int sy, int ex, int ey) {
	queue<Node> que;
	Node node(sx, sy, 0);
	que.push(node);
	flag[sx][sy] = true;
	while (!que.empty())
	{
		Node cur = que.front();
		que.pop();
		if (cur.x == ex && cur.y == ey)
		{
			return cur.step;
		}
		else
		{
			for (int i = 0; i < 4; i++)
			{
				int k = cur.x + dir[i][0];
				int v = cur.y + dir[i][1];
				if (k>=0&&k<H&&v>=0&&v<W&&map[k][v]!='X'&&!flag[k][v])
				{
					Node temp(k, v, cur.step + 1);
					que.push(temp);
					flag[k][v] = true;
				}
			}
		}
	}
	return -1;

}

int main()
{
	int sx, sy, arr[10][2];
	char map[MAX_NUM][MAX_NUM];
	while (cin >> H >> W >> N && H && W)
	{
		for (int i = 0; i < H; i++)
		{
			for (int j = 0; j < W; j++)
			{
				cin >> map[i][j];
				if (map[i][j] == 'S')
				{
					map[i][j] = '.';
					sx = i;
					sy = j;
				}
				if (isdigit(map[i][j]))
				{
					int index = map[i][j] - '0';
					arr[index][0] = i;
					arr[index][1] = j;
				}
			}
		}
		arr[0][0] = sx;
		arr[0][1] = sy;
		int res = 0;
		for (int i = 0; i+1 <= N; i++)
		{
			memset(flag, false, sizeof(flag));
			res += BFS(map, arr[i][0], arr[i][1], arr[i + 1][0], arr[i + 1][1]);
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 4984
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://atcoder.jp/contests/abc113/tasks/abc113_d>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

const ll MOD = 1e9+7;
template<class Type>
Type solve(Type res = Type()){
    ll H,W,K; cin >> H >> W >> K; K--;
    vector<vector<ll>> dp(H+1,vector<ll>(W));
    dp[0][0] = 1;
    for(int i = 0; i < H;i++){
        for(int j = 0; j < W;j++){
            if(dp[i][j] == 0) continue;
            for(int k = 0; k < (1<<(W-1));k++){
                [&]{
                    for(int l = 0; l < (W-2);l++){
                        if(((k>>l)&3)==3) return;
                    }
                    
                    if(j!=0 && (k>>(j-1))&1){
                        (dp[i+1][j-1] += dp[i][j])%=MOD;
                    }else if((k>>j)&1){
                        (dp[i+1][j+1] += dp[i][j])%=MOD;
                    }else{
                        (dp[i+1][j] += dp[i][j])%=MOD;
                    }
                }();
            }
        }
    }
    res = dp[H][K];
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 256
#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[i];}
  
  int num=0, count=0;
  for(int i=0; i<N; i++){
    num=a[num]-1;
    count++;
    if(num==1){break;}
  }
  
  if(count==N){cout<<"-1";}
  else{cout<<count;}
}


Measured memory_bytes: 640
n = int(input())
a = list(map(int,input().split()))
a.sort()
maxkouho = a[-1]
k = maxkouho/2
maxans = 10**18
ans = 0
for i in range(n-1):
	s = abs(a[i]-k)
	if s < maxans:
		maxans = s
		ans = a[i]
print(maxkouho, ans)

Measured memory_bytes: 14428
import java.io.*;

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

		int S=Integer.parseInt(str);
		
		int h,m,s;
		
		h=S/3600;
		m=(S-h*3600)/60;
		s=S%60;
		
		System.out.println(h+":"+m+":"+s);
	}
}

Measured memory_bytes: 24444
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int a,b;
    cin>>a>>b;
    cout<<(a+b+1)/2<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int  a[100000];
int main(){
    int i, r=0, l=0, n, lmin=100000;
    long s, sum=0;
    scanf("%d %d", &n, &s);
    for(i=0; i<n; i++)scanf("%d", &a[i]);
    while(r<=n){
        if(sum>=s){
            if(lmin>r-l)lmin=r-l;
            sum-=a[l++];
        }
        else if(sum<s)sum+=a[r++];
    }
    if(r-l>n&&sum<s)lmin=0;
    printf("%d\n", lmin);
    return 0;
}

Measured memory_bytes: 3128
#include <iostream>

using namespace std;

int main(void) {
    double ans = 0.0;
    int N;
    cin >> N;
    while(N--) {
        double A;
        cin >> A;
        ans += 1.0 / A;
    }

    cout << 1.0 / ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>

int main() {
  int N, A, B;
  std::cin >> N >> A >> B;

  int maxn{std::min(A, B)};
  int minn{std::max(0, A + B - N)};

  std::cout << maxn << ' ' << minn << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <queue>
#include <stack>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <vector>
#include <bits/stdc++.h>
#define ll long long
#define debug(a) cout<<" ++ "<<a<<" ++ "<<endl;
using namespace std;
struct node
{
	int x,y;

} s[55];
bool cmp(node a,node b)
{
	return a.x<a.y;
}
int main()
{
	int n,m;
	while(cin>>n>>m)
	{
		int a[5];
		memset(a,-1,sizeof(a));
		int flag = 1;
		if(m == 0)
		{
			if(n == 1)
				cout<<0;
			else if(n == 2) cout<<10;
			else cout<<100;
		}
		else
		{
			for(int i=0; i<m; i++)
			{
				int x,y;
				cin>>x>>y;
				if(a[x] != -1 && a[x] != y) flag = 0;
				if(n!=1 && x==1 && y==0) flag = 0;
				a[x] = y;
			}
			if(flag == 0) cout<<-1;
			else
			{
				if(n == 1)
				{
					if(a[1] == -1 ) a[1] = 0;
					cout<<a[1];
				}
				else if(n==2)
				{
					if(a[1] == -1) a[1] = 1;
					if(a[2] == -1) a[2] = 0;
					cout<<a[1]<<a[2];
				}
				else if(n == 3)
				{
					if(a[1] == -1) a[1] = 1;
					if(a[2] == -1) a[2] = 0;
					if(a[3] == -1) a[3] = 0;
					cout<<a[1]<<a[2]<<a[3];
				}
			}
			
		}
		cout<<endl;
	}

	return 0;
}

/**
1 2
2 0
1 0

1 2
2 0
2 1

2 0


2 1
2 0

2 2
2 1
3 1

3 0

3 1
1 0

3 2
2 0
3 1

-----

1 2
2 0
1 0
0

1 2
2 0
2 1
-1

2 0
10


2 1
2 0
10

2 2
2 1
3 1
11

3 0
100

3 1
1 0
-1

3 2
2 0
3 1
101
**/


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d", $lh, $lw);
fscanf(STDIN, "%d %d", $sh, $sw);

$ans = $lh*$lw;
$height = $sh*$lw;
$width = $sw*$lh - $sh*$sw;

echo $ans-$height-$width;
?>

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

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

using namespace std;

class mint{
	static const int MOD=998244353;
	int x;
public:
	mint():x(0){}
	mint(long long y){ x=y%MOD; if(x<0) x+=MOD; }

	mint& operator+=(const mint& m){ x+=m.x; if(x>=MOD) x-=MOD; return *this; }
	mint& operator-=(const mint& m){ x-=m.x; if(x<   0) x+=MOD; return *this; }
	mint& operator*=(const mint& m){ x=1LL*x*m.x%MOD; return *this; }
	mint& operator/=(const mint& m){ return *this*=inverse(m); }
	mint operator+(const mint& m)const{ return mint(*this)+=m; }
	mint operator-(const mint& m)const{ return mint(*this)-=m; }
	mint operator*(const mint& m)const{ return mint(*this)*=m; }
	mint operator/(const mint& m)const{ return mint(*this)/=m; }
	mint operator-()const{ return mint(-x); }

	friend mint inverse(const mint& m){
		int a=m.x,b=MOD,u=1,v=0;
		while(b>0){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); }
		return u;
	}

	friend istream& operator>>(istream& is,mint& m){ long long t; is>>t; m=mint(t); return is; }
	friend ostream& operator<<(ostream& os,const mint& m){ return os<<m.x; }
	int to_int()const{ return x; }
};

mint operator+(long long x,const mint& m){ return mint(x)+m; }
mint operator-(long long x,const mint& m){ return mint(x)-m; }
mint operator*(long long x,const mint& m){ return mint(x)*m; }
mint operator/(long long x,const mint& m){ return mint(x)/m; }

mint pow(mint m,long long k){
	mint res=1;
	for(;k>0;k>>=1,m*=m) if(k&1) res*=m;
	return res;
}

int main(){
	int n; scanf("%d",&n);
	vector<int> a(n);
	rep(i,n) scanf("%d",&a[i]);

	int sum=accumulate(a.begin(),a.end(),0);

	mint dp[2][90001];
	dp[0][0]=1;
	rep(i,n){
		int curr=i%2,next=(i+1)%2;
		rep(j,sum+1) dp[next][j]=0;

		rep(j,sum+1) dp[next][j]=2*dp[curr][j];
		rep(j,sum-a[i]+1) dp[next][j+a[i]]+=dp[curr][j];

		rep(j,sum+1) dp[curr][j]=dp[next][j];
	}

	mint dp2[90001];
	dp2[0]=1;
	rep(i,n) for(int j=sum;j>=a[i];j--) dp2[j]+=dp2[j-a[i]];

	mint res=0;
	for(int j=(sum+1)/2;j<=sum;j++) res+=3*dp[n%2][j];
	if(sum%2==0) res-=3*dp2[sum/2];
	cout<<pow(mint(3),n)-res<<'\n';

	return 0;
}


Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int r = 0;
	for (int i = 0; i < N; ++ i) {
		int x;
		cin >> x;
		if (!(A <= x && x < B)) ++ r;
	}
	cout << r << endl;
}


Measured memory_bytes: 256
s,t=list(input()),list(input())
n=len(s)
num=0
ans_t=[]
if s[0]==t[-1] and s[1]==t[0]:
    ans_t=s[1:]+[s[0]]
else:
    for j in range(n-1):
        if s[0]==t[j] and s[1]==t[j+1]:
            num=j
            for i in range(num):
                ans_t.append(s[n-num+i])
            for i in range(n-num):
                ans_t.append(s[i])
print('Yes' if t==ans_t or s==t else 'No')

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline

mod = 998244353
N, K = map(int, input().split())
L, R = zip(*[list(map(int, input().split())) for _ in range(K)])
dp = [0] * (N + 1)
dp[1] = 1
dp[2] = -1
x = 0
for i in range(1, N):
    x = (x + dp[i]) % mod
    for j in range(K):
        if i + L[j] > N:
            continue
        dp[i + L[j]] = (dp[i + L[j]] + x) % mod
        if i + R[j] + 1 <= N:
            dp[i + R[j] + 1] = (dp[i + R[j] + 1] - x) % mod
x = (x + dp[N]) % mod
print(x)

Measured memory_bytes: 69688
/*
 * Talk is cheap, show me the code.
 * Author:  JiangDingyuan
 * Created Time:  2017/9/2 20:55:43
 * File Name: 12345.cpp
 */
#include <time.h>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#define PI acos(-1.0)
#define LL long long
#define bug printf("bug!\n");
#define RD freopen("in.txt", "r", stdin);
#define LD freopen("out.txt", "w", stdout);

using namespace std;
int a[200000],sum;
int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) scanf("%d",&a[i]);
    for (int i = 1; i < n; i++) 
        if (i==a[i]) { swap(a[i],a[i+1]); sum++; }
    if (a[n]==n) sum++;
    cout << sum <<endl;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

int main(){
    int flag=0;
    ll n,x,y;
    cin >> n;
    for(int a=1; a<=3500; a++){
        if(flag)break;
        for(int b=a; b<=3500; b++){
            x = 4*a*b - n*a - n*b;
            y = n*a*b;
            if(x>0 && y>x && y%x==0){
                ll c = y/x;
                cout << a <<" "<< b <<" "<< c << endl;
                flag = 1;
                break;
            }
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef long long ll; 

int N;
const int MAX_N = 10;
int p[MAX_N];

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) cin >> p[i];
    sort(p, p+N, greater<int>());
    int ans = p[0] / 2;
    for (int i = 1; i < N; i++) ans += p[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>

using namespace std;

typedef pair<int,int> pii;
typedef vector<int> vi;

int main () {
    int w, s;
    cin >> s >> w;
    if (w >= s)
        cout << "unsafe" << endl;
    else
    {
        cout << "safe" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(int i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;
const int mod = 1000000007;

class mint{
  public:
  ll x;
  mint(ll x = 0):x((x % mod + mod) % mod){};
  mint pow(ll y) const {
    mint res(1);
    mint a(x);
    while(y>0){
      if(y&1) res *= a;
      a *= a;
      y >>= 1;
    }
    return res;
  }
  mint inv() const{ return pow(mod-2); }
  mint& operator+= (const mint a) noexcept {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-= (const mint a) noexcept {
    if((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*= (const mint a) noexcept {
    (x *= a.x) %= mod;
    return *this;
  }
  mint& operator/= (const mint a) noexcept {
    return (*this) *= a.inv();
  }
  mint operator+ (const mint a) const noexcept {
    mint res(*this);
    return res += a;
  }
  mint operator- (const mint a) const noexcept {
    mint res(*this);
    return res -= a;
  }
  mint operator* (const mint a) const noexcept {
    mint res(*this);
    return res *= a;
  }
  mint operator/ (const mint a) const noexcept{
    mint res(*this);
    return res /= a;
  }
};

class comb{
  public:
  vector<mint> fact, ifact;
  comb(int n): fact(n+1), ifact(n+1){
    fact[0] = 1;
    for(int i = 1; i <= n; i++) fact[i] = fact[i-1] * i;
    ifact[n] = fact[n].inv();
    for(int i = n; i >= 1; i--) ifact[i-1] = ifact[i] * i;
  }
  mint operator()(int n, int k) const noexcept{
    if(k < 0 || n < k) return 0;
    return fact[n] * ifact[k] * ifact[n-k];
  }
};

int main(void){
  ll n, m, k;
  cin >> n >> m >> k;

  comb c(n*m);
  mint sum = 0;
  REP(d, n) sum += d*(n-d)*m*m;
  REP(d, m) sum += d*(m-d)*n*n;
  sum *= c(n*m-2, k-2);
  cout << sum.x << endl;
  return 0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<cmath>
#include<cstdio>

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

using namespace std;
using ll =long long;
using P = pair<int,int>;

int main(int argc, const char * argv[]) {
    ll a;
    string b;
    cin >> a >> b;
    
    for(ll i=b.size()-1; i>=0; i--){
        if(b[i]=='.'){
            b.erase(i, 1);
        }
    }
    long long bb = stoi(b);
    a = a * bb;

    cout << a / 100;
    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
using intl = int64_t;
using graph = vector<vector<int> >;
int main(){
    int n,k;
    cin >> n >> k;

    vector<intl> h;
    for(int i=0;i<n;i++){
        intl f;
        cin >> f;
        h.push_back(f);
    }

    if(n<=k) {
        cout << 0 << endl;
        return 0;
    }

    sort(h.begin(),h.end());
    reverse(h.begin(),h.end());

    intl sum=0;
    for(int i=k;i<n;i++){
        sum += h.at(i);
    }
        
    cout << sum << endl;
}


Measured memory_bytes: 5368
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
ll m[501][501];
int main() {
	int h, w, a, b; cin >> h >> w >> a >> b;
	rep1(i, h) {
		rep1(j, w) {
			m[i][j] = 4000;
		}
	}
	for (int i = a; i <= h; i += a) {
		for (int j = b; j <= w; j += b) {
			m[i][j] = -4000 * (a * b - 1) - 1;
		}
	}
	ll sum = 0;
	rep1(i, h) {
		rep1(j, w) {
			sum += m[i][j];
		}
	}
	if (sum > 0) {
		cout << "Yes" << endl;
		rep1(i, h) {
			rep1(j, w) {
				if (j > 1)cout << " ";
				cout << m[i][j];
			}
			cout << endl;
		}
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

int pcnt(int x) {
    return __builtin_popcount(x);
}

int f(int x) {
    if (x == 0) return 0;
    return f(x%pcnt(x)) + 1;
}

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> x(n);
    rep(i, n) x[i] = s[i] - '0';
    // 1 の合計
    int pc = 0;
    rep(i, n) pc += x[i];
    vector<int> ans(n);
    rep(b, 2) {
        int npc = pc;
        // pc は1を足すか引くか2種類しかない
        if (b == 0) npc++; else npc--;
        if (npc <= 0) continue; // 例外処理：npcが0以下の時は何もしない( 0 )
        //　元の割った余りを求める
        int r0 = 0;
        rep(i, n) {
            r0 = (r0*2)%npc;
            r0 += x[i];
        }
        int k = 1;
        for (int i = n-1; i >= 0; --i) { // x(i) を先頭から確認する
            if (x[i] == b) { // b: 0 or 1
                int r = r0;
                if (b == 0) r = (r+k)%npc;
                else r = (r-k+npc)%npc;             
                ans[i] = f(r) + 1;
            }
            k = (k*2)%npc; // 反転する位の余りを計算していく
        }
    }

    rep(i, n) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 5160
from fractions import gcd
from functools import reduce


def gcd_list(num):
    return reduce(gcd, num)

n, x = map(int, input().split())
x_list = list(map(int, input().split()))
x_list.append(x)

x_list.sort()

tmp = [0]*n
for i in range(n):
    tmp[i] = x_list[i+1]-x_list[i]


print(gcd_list(tmp))


Measured memory_bytes: 88172
def main():
    n,k,s = map(int,input().split())
    ans = []
    if s<10**9:
        for i in range(k):
            ans.append(str(s))
        for i in range(k,n):
            ans.append(str(s+1))
        print(' '.join(ans))
    else:
        for i in range(k):
            ans.append(str(s))
        for i in range(k,n):
            ans.append(str(1))
        print(' '.join(ans))


if __name__=='__main__':
    main()


Measured memory_bytes: 13464
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
 int main(){
  int n; cin >> n;
  vector<double> v(n); rep(i,n) cin >> v[i];
  sort(v.begin(),v.end());
  rep(i,n-1) v[i+1] = (v[i] + v[i+1]) / 2;
  cout << v[n-1];
  
  
  return 0;
 }


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

ll dfs(ll n, ll X, vector<ll>& patty, vector<ll>& burger) {
    if (n == 0) return (X==1) ? 1 : 0;
    if (n == 1) return max(min(X-1, 3LL), 0LL);
    if (X <= burger[n-1] + 1)
        return dfs(n-1, X-1, patty, burger);
    else if (X == burger[n-1] + 2)
        return patty[n-1] + 1;
    else if (X > burger[n-1] + 2)
        return patty[n-1] + 1 + dfs(n-1, X-(burger[n-1]+2), patty, burger);
}
int main() {
    ll n, x;
    cin >> n >> x;
    vector<ll> patty(n+1, 0);
    vector<ll> burger(n+1, 0);

    patty[0] = burger[0] = 1;
    for(int i = 1; i <= n; i++) {
        patty[i] = patty[i-1] * 2 + 1;
        burger[i] = burger[i-1] *2 + 3;
        // cout << patty[i] << " " << burger[i] << endl;
    }
    cout << dfs(n, x, patty, burger) << endl;
    return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstring>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
	if (a<b) { return gcd(b, a); }
	else if (a%b) { return gcd(b, a%b); }
	else { return b; }
}
int main() {
	ll N, M;
	cin >> N;
	string s;
	string t;
  	map<string, ll>mp;
	for (ll i = 0; i < N; i++) {
		cin >> s;
        mp[s]++;
	}
	cin >> M;
	for (ll i = 0; i < M; i++) {
		cin >> t;
      	mp[t]--;
    }
  	ll ans=0;
	for (auto p : mp) {
      	ll x=p.second;
		if(x>ans) ans=x;
	}
	cout << ans << endl;

}








Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

signed main(){
	int x, a;
	cin >> x >> a;

	if(x < a) cout << 0 << endl;
	else cout << 10 << endl;
}


Measured memory_bytes: 764
def task_b():
    r, g, b, n = map(int, input().split())
    c = 0
    for i in range(n // r + 1):
        ni = n - r * i
        for j in range(ni // g + 1):
            nj = ni - g * j
            if nj % b == 0:
                c += 1
    print(c)
task_b()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	int n,k; cin>>n>>k;
	VL x(n),y(n),xs(n),ys(n);
	rep(i,n){
		cin>>x[i]>>y[i]; xs[i]=x[i]; ys[i]=y[i];
	}
	sort(ALL(xs)); sort(ALL(ys));
	ll ans=(xs[n-1]-xs[0])*(ys[n-1]-ys[0]);
	for(int x1=0; x1<n; x1++){
		for(int y1=0; y1<n; y1++){
			for(int x2=x1+1; x2<n; x2++){
				for(int y2=y1+1; y2<n; y2++){
					ll l=xs[x1], r=xs[x2], b=ys[y1], u=ys[y2];
					int cnt=0;
					rep(i,n){
						if(l<=x[i]&&x[i]<=r&&b<=y[i]&&y[i]<=u) cnt++;
					}
					if(cnt>=k) chmin(ans,1LL*(r-l)*(u-b));
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {
    string s;
    cin >> s;
    vector<bool> ok(26);
    for (int i = 0; i < (int)s.size(); i++) {
        ok[s.at(i) - 'A'] = true;
    }
    if (((ok['N' - 'A'] ^ ok['S' - 'A']) == 0) && ((ok['W' - 'A'] ^ ok['E' - 'A']) == 0)) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

//    , .―--　..__＿
//    ∠´ : . : . : . : . : : . .　..｀ヽ
//        / : .::::） : . : . : . : r::―::.--‐''´.ヽ
//        / : .:: : / : . : . : . : . : .{::::::::::::.:. : . : . : : ..i
//        , . - ‐ﾊ : . : . : . : . : . : . : . : . : . : .!::::::::. : . : . : . : . : : .._l
//        / . : . : . : . : / :: : ｀ヽ : . : .__＿＿; , :. : . - ―　''´　l｀ヽ、
//    { .:. : .::::ヽ:::::::::::::::::::::::::::::::::: : : : : : .ﾉ　　ヽ
//    丶. : .::::::＼ : __:::::::::::::::::::::::_; _; _; _,. - ‐'　　　ノ
//    ト.､::::::::::::￣￣￣::::::.:. : . : . : . : . : : ___,,.r''´ : .ヽ、
//    lｲ / ｢ / Tﾊー‐ｒ‐ - ､‐,‐ r; ￢ｒ‐ ､ : . / : . : .; ､:.｢｀
//    l｀ー''　　 ､_　ヾヽハ; ﾊく　 }'　ヽ! ｀
//    !￣´　　　_, ´:く
//    , へ、 _　　　　　　 ／ : . : . : . : . : . : ＼
//    ７, ﾊ＞, ｀二__, , ィ : ヽヽ : . : . : r､厂
//    〃 : .!: | 〉r'´ ,〃:. .〉、ヽ!
//        / '.:.::ｌ:l}_ﾊ.//:.:. :/: .ヽ
//        , ';フ::.|:l! l//､:.:. /:.:., -ヽ
//        ハ:: : . : . : | : |//:.:.ヾ:､':.:/:. :　i
//        i : . : .l＼::!:: / : . : . : _; .ノ:. : / : . : . : . : l
//        l : . : . : | ｏ : ヽ!':.／:. : : :.:.l:.:.:.: :　l
//        l : . : .:: : !::. : . : . : l / : . : . : : .O : . : . | . : .::. : . : .l
//        r':.:.::l::.:.:.:.|:.:.:.:.:.:.:.:.:.:.:.:|.:::::::.:. .l
//        ｒﾍ : ___ | : O : . : ..!::::::::. : . : . : . : . : . : . : .ｌ:::::::::: : . : . |
//        rﾀ八_ｒj} | :. : . : .::::!:::::::::::: : . : O : . : . : | :::::::::::: : rへ
//        !ｌ{ ｶ }rｸﾞ ｌ : . : .:::::: | ::::::::::::::. : . : . : . : . : {:::::::::::::}'っ }
//        片f - '´　l:.:.:::::::|::::::::::::::::.:.:.:.:_こｰ￢t～´
//        ‘ｰ''　 　 !.:::::::::: | ::::::::::::::::::／　ハ_, r':.|
//        | :::::: : r - ､::::::::::::／ / '}::.:.:.|
//        !:::::: : ヽ_ry､r'´　　 ,r' | ::::. : . : !
//        ､:: : _rく｀, ィ{ _,､　 /　　　|:::::. : . : !
//        Ｙ二ｒX{ ,V⊥ｒ';rｰ'＾Yj,r - ‐'7
//        Ｔノヘ.Yr‐､Yっｧヮぅゝ - ‐'
//        〈:. : .:::: : とﾍこﾉｒ7´r; : ﾉﾆﾌ
//        ,ゝ､:: : __;; :Yゝ,rクｒｔくゝ'{
//        ／::::::::::_; .rク　＾^'}Ｊヽ':::〈
//        ‘､__; . - _'r‐'´　 　 くｒ― - ､ﾉ
//        ｀￣´ | :::::::: }
//    t､__::; .ｸ
//    ｀ー'´

int N, K, X, Y;
//-----------------------------------------------------------------
int main() {
    cin >> N >> K >> X >> Y;

    int ans;
    if (N <= K) ans = N * X;
    else ans = K * X + (N - K) * Y;

    cout << ans << endl;
}

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

const auto gcu = getchar_unlocked;
const auto pcu = putchar_unlocked;
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
_T _DEF(T,in,int c){T n=0;int m=1;while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_DEF(int, in){return in<int>(gcu());}
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
_T _SCAN(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_DEF(bool, scan, char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_SCAN(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_OUT(string s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b,m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=n%10*m+'0',n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _OUT(vector<T> v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
_HT _OUT(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _OUTL(T&&... t){out(move(t)...);outl();}
struct range{
	int e,b=0,s=1; range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
	struct it { int v, s; it (int _v, int _s) : v(_v), s(_s) {} operator int()const{return v;} operator int&(){return v;} int operator*()const{return v;}
		it& operator++(){v+=s;return *this;} }; it begin() {return {b, s};} it end() {return {e, s};}};

int main() {
	outl((in() + in()) / 2);
}


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

using namespace std;

const int N = 50 + 10;

int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, -1, 1};
char a[N][N];
int w, h;

int main() {
    cin >> h >> w;
    for (int i = 1; i <= h; i++)
	for (int j = 1; j <= w; j++)
	    cin >> a[i][j];
    for (int i = 1; i <= h; i++)
	for (int j = 1; j <= w; j++)
	    if (a[i][j] == '#') {
		int res = 0;
		for (int k = 0; k < 4; k++)
		    if (a[i + dx[k]][j + dy[k]] == '#')
			res++;
		if (!res)
		    return cout << "No", 0;
	    }
    return cout << "Yes", 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>

using namespace std;

int main(){
  int n,k;
  cin>>n>>k;
  bool d[10];
  for(int i = 0;i<10;i++){
    d[i] = false;
  }
  for(int i = 0;i<k;i++){
    int t;
    cin>>t;
    d[t] = true;
    
  }
  string tmp = to_string(n);
  int ans = n;
  while(true){
    bool flag = false;
    for(int i = 0;i<(int)tmp.size();i++){
      if(d[tmp[i]-'0'])
        break;
      if(i == (int)tmp.size()-1)
	flag = true;	
    }
    if(flag)
      break;
    n++;
    tmp = to_string(n);
  }

  cout<<n<<endl;
    
    
  return 0;
}


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

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

Measured memory_bytes: 3704
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <regex>
#include <set>
#include <cmath>
#include <sstream>
#include <numeric>
#include <set>

int main()
{
    long long n;
    std::cin >> n;

    long long count = 0;
    for(long long i = 0; i < n; i++)
    {
        if(i % 2 == 0)
            count++;
    }

    std::cout << (double) count / (double)n;


    return EXIT_SUCCESS;
}


Measured memory_bytes: 512