akhauriyash/Code-Regression huggingface dataset:
#![allow(unused)]

use std::{cell, cmp, collections, fmt, io, iter, ops, str};

use cell::{Cell, RefCell};
use cmp::Ordering::{Equal, Greater, Less};
use collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
use io::{Read, Write};

#[cfg(feature = "debug")]
macro_rules! debug {
    ($($args: tt)*) => { eprint!($($args)*) };
}

#[cfg(feature = "debug")]
macro_rules! debugln {
    ($($args: tt)*) => { eprintln!($($args)*) };
}

#[cfg(not(feature = "debug"))]
macro_rules! debug {
    ($($args:tt)*) => {};
}

#[cfg(not(feature = "debug"))]
macro_rules! debugln {
    ($($args:tt)*) => {};
}

macro_rules! vmax {
    ($x: expr, $y: expr) => { cmp::max($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::max($x, vmax!($($args),*)) };
}

macro_rules! vmin {
    ($x: expr, $y: expr) => { cmp::min($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::min($x, vmin!($($args),*)) };
}

fn main() {
    let _ = parse_line::<usize>();
    let mut a = parse_vec::<i32>();
    a.sort();
    println!("{}", a.last().unwrap() - a[0]);
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test() {
        //
    }
}

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().to_owned()
}

fn read_word() -> String {
    const CAPACITY: usize = 16;

    let mut stdin = io::stdin();
    let mut byte: [u8; 1] = [0];

    loop {
        let mut buf = Vec::with_capacity(CAPACITY);

        loop {
            let res = stdin.read(&mut byte);

            if res.unwrap_or(0) == 0 || byte[0] <= b' ' {
                break;
            } else {
                buf.push(byte[0]);
            }
        }

        if !buf.is_empty() {
            return String::from_utf8(buf).unwrap();
        }
    }
}

fn parse_line<T: str::FromStr>() -> T {
    read_line().parse().ok().unwrap()
}

fn parse_word<T: str::FromStr>() -> T {
    read_word().parse().ok().unwrap()
}

fn parse_vec<T: str::FromStr>() -> Vec<T> {
    read_line()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn flush() {
    io::stdout().flush();
}

fn next_prime(x: i32) -> i32 {
    for i in (x + 1).. {
        if is_prime(i) {
            return i;
        }
    }

    panic!("attempt to add with overflow");
}

fn is_prime(x: i32) -> bool {
    let ceil = f64::from(x).sqrt().ceil() as i32;
    x == 2 || (2..(ceil + 1)).all(|i| x % i != 0)
}


Measured memory_bytes: 4352
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int fx4[] = {1 , -1 , 0 , 0};
int fy4[] = {0 , 0 , 1 , -1};
int Kfx[]= {-2,-2,2,2,1,1,-1,-1}; ///knight move x - exis
int Kfy[]= {1,-1,1,-1,2,-2,2,-2}; ///knight move y- exis
int fx8[]= {1,1,1,0,0,-1,-1,-1};
int fy8[]= {0,1,-1,1,-1,0,1,-1};
#define ll long long int
#define pii pair<int,int>
#define llu unsigned long long
#define inf 1<<28
#define gama 0.57721566490
#define PI              acos(-1.0)
#define INF             0x7fffffff
#define MOD             1000000007
#define EPS             1e-7
#define all(r)(r).begin(),(r).end()
/*
bool status[mx];
void sieve(){
   long long int  i,j;
    for(i=2;i<=mx;i++)
    {
        status[i]=0;
    }
    for( i=2;i<=sqrt(mx);i++){
        if(status[i]==0)
        {
            for(j=i*i;j<=mx;j+=i){
                status[j]=1;
            }
        }
    }
}*/
ll BM( ll a , ll b , ll m )
{
    if ( b == 0 ) return 1 ;
    ll x = BM(a,b/2,m);
    x = (( x % m) * (x % m))%m;

    if( b % 2 ) x = (( x % m) * (a %m)) % m ;
    return x ;
}
#define dd double
#define sc scanf
#define pr printf
#define VI vector<int>
#define VS vector<string>
#define VC vector<char>
#define VLL vector<long long int>
#define FILE freopen("input.txt","rt",stdin); freopen("output.txt","w",stdout);
#define p_b push_back
#define mem(x,y) memset(x,y,sizeof(x))
#define F(i,a,b) for(i=a;i<=b;i++)
#define sc1(a) scanf("%d",&a)
#define scL1(a) scanf("%lld",&a)
#define scL2(a,b) scanf("%lld%lld",&a,&b)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define scL3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define fori(N)          for(int i = 0; i<(N); i++)
#define forj(N)         for(int j = 0; j<(N); j++)
#define fork(N)         for(int k = 0; k<(N); k++)
#define forl(N)         for(int l = 0; l<(N); l++)
#define ford(N)         for(int d = 0; d<(N); d++)
#define fori1(N)          for(int i = 1; i<=(N); i++)
#define forj1(N)         for(int j = 1; j<=(N); j++)
#define fork1(N)         for(int k = 1; k<=(N); k++)
#define ford1(N)         for(int d = 1; d<=(N); d++)
#define sqr(x)           (x)*(x)
#define TEST int test,te=0;sc1(test);
#define segment_tree int l=(n*2),r=(n*2)+1,mid=(l+r)/2
#define Mx 100005
#define mx 10005

int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,k,q;
    cin>>n>>k>>q;
    int arr[n+2];
    for(int i=1;i<=n;i++)arr[i]=k;
    int MM=-1;
    int t=q;
    while(t--){
        int x;
        cin>>x;
        arr[x]++;
    }
    for(int i=1;i<=n;i++){
        int x=arr[i]-q;
        if(x>0)pr("Yes\n");
        else pr("No\n");
    }

}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define Rep(i,a,b) for(register int i=(a);i<=int(b);++i)
#define Dep(i,a,b) for(register int i=(a);i>=int(b);--i)
#define rep(i,a,b) for(register int i=(a);i<int(b);++i)
#define mem(x,v) memset(x,v,sizeof(x))
#define fi first
#define se second
#define gc getchar
#define pc putchar
inline ll rd(){
    ll x=0,f=1;char c=gc();
    for(;!isdigit(c);c=gc())if(c=='-')f=-1;
    for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c^48);
    return x*f;
}
inline void write(ll x){if(x<0)x=-x,pc('-');if(x>=10)write(x/10);putchar(x%10+'0');}
inline void writeln(ll x){write(x);puts("");}
const int maxn = 2e6+233;
const int mod = 1e9+7;
int fac[maxn],inv[maxn];
int C(int n,int m){
	return 1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;
}
inline int qpow(int a,int b){
	int ans = 1;
	for(;b;b>>=1,a=1ll*a*a%mod)if(b&1)ans=1ll*ans*a%mod;
	return ans;
}
void init(int N){
	fac[0]=1;Rep(i,1,N)fac[i]=1ll*fac[i-1]*i%mod;
	inv[N]=qpow(fac[N],mod-2);Dep(i,N-1,0)inv[i]=1ll*inv[i+1]*(i+1)%mod;
}
int go(int sx,int sy,int tx,int ty){return C(tx+ty-sx-sy,tx-sx);}
void add(int &x,int  v){
	x+=v;
	if(x>=mod)x-=mod;
	if(x<0)x+=mod;
}
int x[7],y[7],sx[2],sy[2],opt[2];
int solve(int sx,int sy,int tx,int ty){
	int ans = 0;
	for(int i=x[3];i<=x[4];++i) add(ans,-1ll*go(sx,sy,i,y[3]-1) * go(i,y[3],tx,ty) % mod * (i+y[3]) % mod);
	for(int i=y[3];i<=y[4];++i) add(ans,-1ll*go(sx,sy,x[3]-1,i) * go(x[3],i,tx,ty) % mod * (i+x[3]) % mod);
	for(int i=x[3];i<=x[4];++i) add(ans,1ll*go(sx,sy,i,y[4]) * go(i,y[4]+1,tx,ty) % mod * (i+y[4]+1) % mod);
	for(int i=y[3];i<=y[4];++i) add(ans,1ll*go(sx,sy,x[4],i) * go(x[4]+1,i,tx,ty) % mod * (x[4]+1+i) % mod);
	return ans;
}
int main(){
	init(2000050);
	Rep(i,1,6) x[i] = rd();
	Rep(i,1,6) y[i] = rd();
	int ans = 0;
	rep(i,0,4){
		if(i==0) sx[0]=x[3]-x[1]  ,sy[0]=y[3]-y[1]  ,opt[0]=+1; else
		if(i==1) sx[0]=x[3]-x[2]-1,sy[0]=y[3]-y[1]  ,opt[0]=-1; else
		if(i==2) sx[0]=x[3]-x[1]  ,sy[0]=y[3]-y[2]-1,opt[0]=-1; else
		if(i==3) sx[0]=x[3]-x[2]-1,sy[0]=y[3]-y[2]-1,opt[0]=+1;
		sx[0]=x[3]-sx[0]-1,sy[0]=y[3]-sy[0]-1;
		rep(j,0,4){
			if(j==0) sx[1]=x[6]-x[4]  ,sy[1]=y[6]-y[4]  ,opt[1]=+1; else
			if(j==1) sx[1]=x[5]-x[4]-1,sy[1]=y[6]-y[4]  ,opt[1]=-1; else
			if(j==2) sx[1]=x[6]-x[4]  ,sy[1]=y[5]-y[4]-1,opt[1]=-1; else
			if(j==3) sx[1]=x[5]-x[4]-1,sy[1]=y[5]-y[4]-1,opt[1]=+1;
			sx[1]=x[4]+sx[1]+1,sy[1]=y[4]+sy[1]+1;
			add(ans,opt[0]*opt[1]*solve(sx[0],sy[0],sx[1],sy[1]));
		}			
	}writeln(ans);
	return 0;
}

Measured memory_bytes: 15872
fun main(args: Array<String>) {

    while (true) {
        val input = readLine()?.split(" ")
        val inputInt = arrayListOf<Int>()
        input?.forEach { inputInt.add(it.toInt()) }
        
        if (inputInt[0] == 0 && inputInt[1] == 0) return
        
        inputInt.sort()
        
        println("${inputInt[0]} ${inputInt[1]}")

    }

}



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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 1000000000 + 7
#define PI 3.14159265359

const long long INF = 100000;
typedef pair<int,int> P;
typedef long long ll;

using Graph = vector<vector<int>>;

typedef pair<int,int> P;

vector<int> dx = {1,0,-1,0};
vector<int> dy = {0,1,0,-1};

vector<vector<int>> d(22, vector<int>(22,-1));
vector<vector<int>> d2(22, vector<int>(22,-1));

//スタートから移動可能な点の距離をメモしていき、その最大値を返す

int bfs(int sx, int sy, int H, int W, vector<vector<char>> &maze) {
	d[sx][sy] = 0;
	queue<P> que;
	que.push(P(sx, sy));
	int iRes = 0;

	while (que.size()) {
		P p = que.front();
		que.pop();

		//上下四方向を探索
		for (int i = 0; i < 4; i++) {
			int nx = p.first + dx[i];
			int ny = p.second + dy[i];

			if (nx >= H || nx < 0 || ny >= W || ny < 0 || maze[nx][ny] == '#'
				|| d[nx][ny] != -1) continue;

			//移動可能な場合
			que.push(P(nx, ny));
			d[nx][ny] = d[p.first][p.second] + 1;
			iRes = max(d[nx][ny], iRes);
		}
	}

	return iRes;
}

int main() {
	int H, W;
	cin >> H >> W;
	vector<vector<char>> maze(H, vector<char>(W));

	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> maze[i][j];
		}
	}

	int iAns = 0;

	for (int sx = 0; sx < H; sx++) {
		for (int sy = 0; sy < W; sy++) {
			if (maze[sx][sy] != '#') {
				iAns = max(bfs(sx, sy, H, W, maze), iAns);
				d = d2;
			}
		}
	}

	cout << iAns << endl;
}


Measured memory_bytes: 256
var
 s:string;
 i,n,p1,p2,max:longint;
begin
 readln(n);
  readln(s);
   for i:=1 to length(s) do
    begin
     if s[i]='I' then inc(p1)
                else if s[i]='D' then inc(p2);
     if p1-p2>max then max:=p1-p2;
    end;
  if max<0 then write(0)
           else write(max);
end.


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <math.h>


using namespace std;

int height_cnt;

struct node
{
	int id;
	//int depth;
	//int height;
	//int degree;
	string type;
	int parent;
	int left;
	int right;
	int sibling;
};

node p[25];

int depth_search(int i)
{
	int cnt = 0;

	while(p[i].parent != -1)
	{
		cnt++;
		i = p[i].parent;
	}

	return cnt;
}

int height_search(int i)
{
	int hr,hl;
	hr = 0;
	hl = 0;

	if (p[i].left != -1)
	{
		hl = height_search(p[i].left) + 1;
	}
	if (p[i].right != -1)
	{
		hr = height_search(p[i].right) + 1;
	}

	return max(hr,hl);

}

int parent_search(int i)
{
	if (p[i].parent == -1)
	{
		p[i].type = "root";
		return -1;
	}else
	{
		return p[i].parent;
	}
}


int degree_search(int i)
{
	if (p[i].left != -1 && p[i].right != -1)
	{
		return 2;
	}else if (p[i].left != -1 || p[i].right != -1)
	{
		return 1;
	}else
	{
		p[i].type = "leaf";
		return 0;
	}
}

int sibling_id(int i)
{
	if (p[i].sibling == -1)
	{
		return -1;
	}else
	{
		return p[i].sibling;
	}
}

int main()
{
	int n,k,c,top,a,cur,no;
	int l,r;

	scanf("%d", &n);

	for(int i = 0; i < n; i++)
	{
		p[i].parent = -1;
		p[i].left = -1;
		p[i].right = -1;
		p[i].sibling = -1;
		p[i].type = "internal node";
	}

	for(int i = 0; i < n; i++)
	{
		scanf("%d %d %d", &no,&l,&r);

		if (l != -1)
		{
			p[no].left = l;
			p[l].parent = no;

		}
		if (r != -1)
		{
			p[no].right = r;
			p[r].parent = no;
		}
		if (l != -1 && r != -1)
		{
			p[l].sibling = r;
			p[r].sibling = l;
		}
	}


	for(int i = 0; i < n; i++)
	{
		height_cnt = -1;
		printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d",
			i, parent_search(i), sibling_id(i), degree_search(i), depth_search(i), height_search(i));
		printf(", %s\n", p[i].type.c_str());
	}

	return 0;
}
	

Measured memory_bytes: 3284
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt();
        int n = sc.nextInt();
        int ans = 0;
        if (n <= 99)
            ans = (int) (Math.pow(100, d)) * n;
        else
            ans = (int) (Math.pow(100, d)) * 101;
        System.out.println(ans);
    }
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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; }

int main(void){
    int H=3,W=3;
    int c[H][W]; REP(i,H)REP(j,W) cin >> c[i][j];
    REP(i,H-1)REP(j,W){
        c[i+1][j] -= c[0][j];
    }
    if(c[1][0] != c[1][1] || c[1][1] != c[1][2])
        cout << "No" << endl;
    else if(c[2][0] != c[2][1] || c[2][1] != c[2][2])
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <cmath>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define sz(x) int(x.size())

typedef long long ll;

using namespace std;

static const int MAX = 100001;

/******* c++14 don't include *******/

template<typename T>
T gcd(T a, T b){if( b == 0)return a; return gcd(b, a%b); }
template<typename T>
T lcm(T a, T b){return a*b/gcd(a,b); }

/*******                      *******/

int main(int argc, const char * argv[]) {
    // input from txt
    
    /////////
    //write//
    /////////
    
    string s;
    cin >> s;
    
    int zero_f = 0;
    rep(i, s.size()){
        int u = i+1;
        if(u%2==1){
            if(s[i] != '0')zero_f++;
        }
        else {
            if(s[i] != '1')zero_f++;
        }
    }
    
    int one_f = 0;
    rep(i, s.size()){
        int u = i+1;
        if(u%2==0){
            if(s[i] != '0')one_f++;
        }
        else {
            if(s[i] != '1')one_f++;
        }
    }
    
    cout << min(one_f, zero_f) << endl;
    
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
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;}
//int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int next_a(int aa,int ll){
	int t[ll];
	for(int i=0;i<ll;i++){
		t[i]=aa%10;
		aa/=10;
	}
	sort(t,t+ll);
	int ansmax=0;
	int k=1;
	for(int i=0;i<ll;i++){
		ansmax+=(k*t[i]);
		k*=10;
	}
	sort(t,t+ll,greater<int>());
	int ansmin=0;
	k=1;
	for(int i=0;i<ll;i++){
		ansmin+=(k*t[i]);
		k*=10;
	}
	return ansmax-ansmin;
}

vector<int> ans;
int a,L;
int main(){
	while(1){
		ans.clear();
		scanf("%d%d",&a,&L);
		if(a==0&&L==0)break;
		ans.push_back(a);
		int t=a;
		for(int i=0;i<21;i++){
			t=next_a(t,L);
			ans.push_back(t);
		}
		
		for(int i=1;i<=20;i++){
			for(int j=0;j<i;j++){
				if(ans[i]==ans[j]){
					printf("%d %d %d\n",j,ans[i],i-j);
					goto A;
				}
			}
		}
		A:;
	}
	return 0;
}


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

int main() {
  ll a,v,b,w,t;
  cin >> a >> v >> b >> w >> t;
  if(v <= w){
    cout << "NO";
    return 0;
  }
  ll dis=0,hayasa=0;
  dis = abs(a-b);
  hayasa = v-w;
  if(dis <= hayasa * t){
    cout << "YES";
  }
  else{
    cout << "NO";
  }
}

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

M = 10**6 + 1

cnt = [0] * M

for a in A:
    if cnt[a] != 0:
        cnt[a] += 1
        continue
    for b in range(a, M, a):
        cnt[b] += 1

ans = 0
for a in A:
    if cnt[a] == 1:ans += 1

print(ans)


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int gcd(int a, int b) {
	return b ? gcd (b, a % b) : a;
}

int main () {
	int N; cin >> N;
	vector<int> A(N);
	rep(i, N) cin >> A[i];

	int ans = gcd(A[0], A[1]);
	REP(i, 1, N-1) ans = gcd(ans, A[i+1]);
	cout << ans << endl;
}


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

public class Main {
    public static long[] find_goal(long N){
        for(long i = (long)Math.sqrt(N); i > 0;i--){
            if(N%i == 0){return new long[]{i,N/i};}
        }
        return new long[]{1,N};
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long[] a = find_goal(Long.parseLong(sc.next()));
        System.out.println(Arrays.stream(a).sum()-2);
    }
}

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


int main() {
    int a, b;
    cin >> a >> b;
    if((a&1) == (b&1)) cout << (a+b)/2 << endl;
    else cout << "IMPOSSIBLE\n";
}


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

using namespace std;

long long prime = 998244353LL;

long long pow_mod(long long a, long long r) {
    if (r == 0) return 1LL;
    if (r == 1) return a;
    long long y = pow_mod(a, r/2);
    if (r % 2 == 0) {
        return y * y % prime;
    }
    return y * y % prime * a % prime;
}

long long x = pow_mod(10, 18);

struct Graph {
    int n, m;
    vector<vector<int>> adj_list;
    vector<int> grundy;
    vector<long long> agg_grundy;
    Graph(int n): n(n), adj_list(n), grundy(n) {}
    void read() {
        cin >> m;
        for (int i = 0; i < m; ++i) {
            int a, b;
            cin >> a >> b;
            --a;
            --b;
            adj_list[a].push_back(b);
            adj_list[b].push_back(a);
        }
    }
    void calc_grundy() {
        int highest = 0;
        for (int i = n-1; i >= 0; --i) {
            set<int> neighbors;
            for (int j : adj_list[i]) {
                if (j > i) {
                    neighbors.insert(grundy[j]);
                }
            }
            grundy[i] = 0;
            while (neighbors.find(grundy[i]) != neighbors.end()) {
                ++grundy[i];
            }
            highest = max(highest, grundy[i]);
        }
        agg_grundy = vector<long long>(highest + 1, 0LL);
        long long y = x;
        for (int i = 0; i < n; ++i, y = y * x % prime) {
            agg_grundy[grundy[i]] = (agg_grundy[grundy[i]] + y) % prime;
        }
    }
};

vector<long long> combine_aggs(vector<long long>& a, vector<long long> b) {
    int n = 1;
    while (n < (int) a.size() || n < (int) b.size()) {
        n *= 2;
    }
    vector<long long> c(n, 0LL);
    for (int i = 0; i < (int) a.size(); ++i) {
        for (int j = 0; j < (int) b.size(); ++j) {
            c[i ^ j] = (c[i ^ j] + a[i] * b[j]) % prime;
        }
    }
    return c;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    Graph g1(n), g2(n), g3(n);
    g1.read();
    g2.read();
    g3.read();
    g1.calc_grundy();
    g2.calc_grundy();
    g3.calc_grundy();
    vector<long long> res = combine_aggs(g1.agg_grundy, combine_aggs(g2.agg_grundy, g3.agg_grundy));
    cout << res[0] << endl;
    return 0;
}


Measured memory_bytes: 16896
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  int a,b,c;
  int cnt[10000];
  memset(cnt,0,sizeof(cnt));
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a>>b>>c;
    if(a*a==b*b+c*c||b*b==a*a+c*c||c*c==a*a+b*b){
      cnt[i]=1;
    }
  }
  for(int i=0;i<n;i++){
    if(cnt[i]==1){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
  return(0);
}

Measured memory_bytes: 3116
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    s = S()
    t = [1] * n
    for i in range(n-1):
        c = s[i]
        u = [None] * (n-i-1)
        a = 0
        if c == '>':
            for j in range(n-i-1-1,-1,-1):
                a += t[j+1]
                a %= mod
                u[j] = a
        else:
            for j in range(n-i-1):
                a += t[j]
                a %= mod
                u[j] = a

        t = u

    return u[0] % mod


print(main())


Measured memory_bytes: 5592
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X; cin >> X;
    int x = 0;
    int cnt = 0;
    while(true) {
        if (x >= X) {
            cout << cnt << endl;
            return 0;
        }
        x += (++cnt);
    }

    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())

L = [0] * M
R = [0] * M
for i in range(M):
    L[i], R[i] = map(int, input().split())

if max(L) > min(R):
    print("0")
else:
    print(min(R) - max(L) + 1)

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

int	main()
{
	int	N;
	cin >> N;
	int64_t	sum = 0;
	for (int i = 1; i < N + 1; ++i) {
		for (int j = i; j < N + 1; j += i) {
			sum += j;
		}
	}
	cout << sum << endl;
}


Measured memory_bytes: 3616
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#define INF 1e9+7
#define rep(i,m,n) for(int i=m;i<n;i++)
#define mrep(i,m,n) for(int i=m;i>n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

int main() {

	ull edge[100000] = { 0 };
	int n;
	ull e1 = 0, e2 = 0;

	cin >> n;
	
	rep(i, 0, n) {
		cin >> edge[i];
	}

	sort(edge, edge + n);


	int c = 0;

	rep(i, 0, n) {
		c++;
		if (edge[i] != edge[i + 1]) {
			if (c >= 4) {
				e1 = edge[i]; e2 = edge[i];
			}
			else if (c >= 2) {
				e2 = e1;
				e1 = edge[i];
			}
			c = 0;
		}
	}
	
	
	cout << (ull)e1 * e2 << endl;

	return 0;
}

Measured memory_bytes: 1024
<?php
list($n,$m)=explode(" ",trim(fgets(STDIN)));
$tree=new UnionFind($n);
$i=0;
while($i<$m){
  list($a,$b)=explode(" ",trim(fgets(STDIN)));
  --$a;
  --$b;
  $tree->unite($a,$b);
  ++$i;
}
$i=0;
while($i<$n){
  $ans[$i]=$tree->size($i);
  ++$i;
}
echo max($ans);

//hideyuk1さんのをお借りしました
// Union-Find：同じグループに属するかどうかを判定する
class UnionFind
{
    private $par; // par[$i]:$iの親 自分が根の場合は自身のindexとなる
    private $size;

    function __construct($n)
    {
        for ($i = 0; $i < $n; $i++) {
            $this->par[$i] = $i; // 最初は全てが根
            $this->size[$i] = 1;
        }
    }

    function root($x)
    { // 根を返す
        if ($this->par[$x] === $x) return $x; // 根の場合
        return $this->par[$x] = $this->root($this->par[$x]); // 全ての枝の親を根にしながら再帰処理
    }

    function unite($x, $y)
    { // $xと$yの木を併合
        $ix = $this->root($x);
        $iy = $this->root($y);
        if ($ix === $iy) return;
        if ($this->size[$ix] < $this->size[$iy]) list($ix, $iy) = [$iy, $ix];
        $this->size[$ix] += $this->size[$iy];
        $this->par[$iy] = $ix; // $yの根を$xの根に付ける
    }

    function isSame($x, $y)
    { // $xと$yの根が同じか
        return $this->root($x) === $this->root($y);
    }

    function size($x)
    {
        return $this->size[$this->root($x)];
    }
}

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

using namespace std;


#define MAXN 101
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  cout << ((n-m)*100+m*1900)*(1<<m) << endl;
  return 0;
}


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

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    queue<char> q;
    int i;
    for(i=0;i<n;i++){
    	q.push(s[i]);
	}
	char f=q.front();
	q.pop();
	int ans=1;
	while(!q.empty()){
		if(q.front()!=f)ans++;
		f=q.front();
		q.pop();
	}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
  string S;
  int ans = 0;
  cin >> S;
  for (int i = 0; i < 4; i++) {
    if (S.at(i) == '+') {
      ans++;
    } else {
      ans--;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int> >;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  ll k;
  cin >> k;
  ll now = 0;
  ll cnt = 0;
  do{
    cnt++;
    now = (10*now + 7) % k;
    if(cnt >= 1000000) break;
  }while(now);
  if(now) cout << -1 << endl;
  else cout << cnt << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define inv(n, a) for(int i = 0; i < n; i++) cin >> a[i]
#define MOD 1000000007
#define INF 1e7
#define LINF 1e15
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
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; }
// 'a' = 97 'z' = 122 => 'a' = 0 'z' = 25

int main() {
    string s; cin >> s;
    int l = 0, r = s.length()-1;
    int ans = 0;
    while(r - l != 0 && r > l){
        bool lx = s[l] == 'x';
        bool rx = s[r] == 'x';
        if(s[l] != s[r]){
            if(lx) {
                l++;
                ans++;
            }else if(rx){
                r--;
                ans++;
            }
            else {
                cout << -1 << endl;
                return 0;
            }
        }else{
            l++; r--;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();

        if (c - a - b <= 0) {
            System.out.println("No");
            return;
        }
        if (c - a - b > 0 && 4 * a * b < (c - a - b) * (c - a - b)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23892
program papers_please
  implicit none
  integer :: n, a(100) = 0, i
  read(*,*) n
  read(*,*) a(1:n)
  do i = 1, n
    if (mod(a(i),2) /= 0) cycle
    if (mod(a(i),3)*mod(a(i),5) == 0) cycle
    write(*,'(a)') "DENIED"
    stop
  end do
  write(*,'(a)') "APPROVED"
end program papers_please

Measured memory_bytes: 256
s = input().rstrip()

n = [0] * 13
for i in range(13):
    n[i] = (i * 10) % 13

rev = [0] * 13
for i, ni in enumerate(n):
    rev[ni] = i

dp = [[0] * 13 for _ in range(len(s))]

if s[0] == '?':
    for i in range(10):
        dp[0][i] = 1
else:
    dp[0][int(s[0])] = 1

mod = 10**9 + 7
for i in range(1, len(s)):
    for j in range(13):
        if s[i] == '?':
            for k in range(10):
                dp[i][j] += dp[i-1][rev[(j-k) % 13]]
                dp[i][j] %= mod
        else:
            dp[i][j] = dp[i-1][rev[(j-int(s[i])) % 13]]

print(dp[-1][5])

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

int main() {
  int N;
  cin >>N;
   
  vector<double> A(N);
   for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  } 
 sort(A.begin(), A.end()); 
  
  double TES = (A.at(0) + A.at(1)) / 2;
  
   for (int i = 2; i < N; i++) {
 TES = (TES + A.at(i)) / 2 ;
  } 
   cout << TES << endl;
}

Measured memory_bytes: 256
import Control.Monad
import Data.List

main = do
  s <- getContents
  mapM_ print $ map (log10 . sum) $ map ((map (read :: (String -> Int))) . words) $ lines s



log10 n
  | n >= 10 = 1 + log10 ( div n 10 )
  | n < 10 = 1

Measured memory_bytes: 4008
#include <iostream>

typedef struct _Data {
    int leftVal;
    int rightVal;
} Data;

typedef struct _DataList {
    int effectCount;
    Data dataList[200];
    int digitNumber[200];
} DataList;

class DigitNumber {
public:
    DigitNumber();
    // DigitNumber(const DigitNumber& other);
    // ~DigitNumber();

    bool Run();

private:
    bool ReadLine();
    bool Calc();
    void Show() const;

private:
    DataList m_DataList;
};

DigitNumber::DigitNumber()
{
    m_DataList = { 0 };
}

bool DigitNumber::Run()
{
    // Ignore return value
    (void)ReadLine();
    (void)Calc();
    Show();

    return true;
}

bool DigitNumber::ReadLine()
{
    int l = 0, r = 0;
    while (std::cin >> l >> r) {
        m_DataList.dataList[m_DataList.effectCount].leftVal = l;
        m_DataList.dataList[m_DataList.effectCount].rightVal = r;
        ++m_DataList.effectCount;
    }

    return true;
}

bool DigitNumber::Calc()
{
    unsigned int digitNumber = 0;
    unsigned int num = 0;

    for (int i = 0; i < m_DataList.effectCount; ++i) {
        digitNumber = 0;
        num = m_DataList.dataList[i].leftVal + m_DataList.dataList[i].rightVal;
        while (num != 0) {
            num /= 10;
            ++digitNumber;
        }
        m_DataList.digitNumber[i] = digitNumber;
    }
    return true;
}

void DigitNumber::Show() const
{
    for (int i = 0; i < m_DataList.effectCount; ++i) {
        std::cout << m_DataList.digitNumber[i] << std::endl;
    }
}

int main()
{
    DigitNumber digitNumber;
    digitNumber.Run();
}

Measured memory_bytes: 3028
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  cin>>h>>w;
  vector<string> a(h);
  for(int i=0;i<h;i++)
    cin>>a.at(i);
  vector<bool> r(h,0);
  vector<bool> c(w,0);
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(a.at(i).at(j)=='#'){
        r.at(i)=1;
        c.at(j)=1;
      }
    }
  }
  for(int i=0;i<h;i++){
    if(r.at(i)){
      for(int j=0;j<w;j++)
        if(c.at(j))
          cout<<a.at(i).at(j);
      cout<<endl;
    }
  }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        Set<Integer> set = new HashSet<>();

        set.add(a);
        set.add(b);
        set.add(c);

        if (set.size() == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

}


Measured memory_bytes: 23636
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <cmath>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
const int INF=1e9;
ll n,p;
vector<ll> divis;
string s;
int main(int argc,char const* argv[])
{
  cin >> n >> p;
  if(p==1)
    {
      cout << 1 << endl;
      return 0;
    }
  if(n==1)
    {
      cout << p << endl;
      return 0;
    }
  ll power=1;
  ll origin=2;
  ll preorigin=1;
  while(1)
    {
      power=1;
      if(p%origin==0)
	{
	  for(int i=0;i<n;i++)
	    {
	      power*=origin;
	      if(power>p)
		{
		  cout << preorigin << endl;
		  return 0;
		}
	    }
	  if(p%power==0)
	    {
	      preorigin=origin;
	    }
	}
      origin++;
    }
  return 0; 
}


Measured memory_bytes: 256
#include<stdio.h>

typedef struct{
  int x;
  char c;
  int num;
}card;

card A[100001];

int Partition(card* ,int,int);
void Quicksort(card* ,int,int);

int main(){
  int i,k,n,f=0;
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
 
    scanf(" %c %d",&A[i].c,&A[i].x);
    A[i].num=i;
}
  Quicksort(A,0,n-1);
  for(i=1;i<n;i++){
    if(A[i].x==A[i-1].x){
      if(A[i].num<A[i-1].num)f=-1;
    }
 
  }
  if(f==0)printf("Stable\n");
  else printf("Not stable\n");
  for(i=0;i<n;i++){
    printf("%c %d\n",A[i].c,A[i].x);
  }
  return 0;
}

int Partition(card* A,int p,int r){
  card k=A[r],tmp;
  int i=p-1,j;
  
  for(j=p;j<r;j++){
    if(A[j].x <= k.x){
      i++;
      tmp=A[i];
      A[i]=A[j];
      A[j]=tmp;
    }
  }
    tmp=A[i+1];
    A[i+1]=A[r];
    A[r]=tmp;
    return i+1;
}
 
void Quicksort(card* A,int p,int r){  
  int q;

  if(p<r){
  q=Partition(A,p,r);
  Quicksort(A,p,q-1);
  Quicksort(A,q+1,r);
 }
}
 

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

#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define rev(v) reverse(v.begin(), v.end());
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin());
#define io() ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);srand(time(NULL));
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

signed main(){
	io();
	int n; cin >> n;
	bool ok = 1;
	for(int i = 0, x; i < n; ++i){
		cin >> x;
		if(x&1^1){
			ok &= (!(x%3) || !(x%5));
		}
	}
	cout << (ok ? "APPROVED" : "DENIED") << '\n';
	return 0;
}

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


int main() {
  int N,M;
  cin >> N>>M;
  vector<int>id(N);
  vector<int>l(M);
  vector<int>r(M);
  int lmax = 1;
  int rmin = 1E6;
  for (int i = 0; i < M; i++)
  {
    cin >> l[i] >> r[i];
    lmax = max(lmax,l[i]);
    rmin = min(rmin,r[i]);
  }

  if((rmin-lmax) <0 ){cout << 0 << endl;}
  if((rmin-lmax) >= 0 ){cout << rmin-lmax+1 << endl;}

  
}

Measured memory_bytes: 1408
import java.util.Scanner;
public class Main{
    
    public void solve(){
        Scanner sc = new Scanner(System.in);
        int S=sc.nextInt();
        int h=S/3600;
        int m=S%3600/60;
        int s=S-(h*3600+m*60);
        
        System.out.print(h+":"+m+":"+s);
        
        System.out.println();
    }
    
    public static void main(String[] args){
        Main obj = new Main();
        obj.solve();
    }
}

Measured memory_bytes: 17356
<?php

$chars = str_split(file_get_contents('php://stdin'));

$alphabet = array_fill_keys(range('a', 'z'), 0);
foreach ($chars as $c) {
    if (! ctype_alpha($c)) { continue; }

    $alphabet[strtolower($c)]++;
}

foreach ($alphabet as $char => $count) {
    printf('%s : %d%s', $char, $count, PHP_EOL);
}

Measured memory_bytes: 6796
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;


struct edge
{
	int to;
	long long cost;
	edge(int to_, long long cost_) :
		to(to_), cost(cost_) {}
};
const long long INF = 123456789012345;
using P = pair<long long, int>;//first:cost,second:vertice
void dijkstra(vector<edge>graph_[],long long dist[], int n_, int s_)
{
	priority_queue<P, vector<P>, greater<P>>que;
	que.push({ 0,s_ });
	fill(dist, dist + n_, INF);
	dist[s_] = 0ll;
	while (!que.empty())
	{
		auto q = que.top();
		que.pop();
		long long thd = q.first;
		int thv = q.second;
		if (thd > dist[thv])
		{
			continue;
		}
		for (auto ed : graph_[thv])
		{
			if (dist[ed.to] > ed.cost + thd)
			{
				dist[ed.to] = ed.cost + thd;
				que.push({ dist[ed.to],ed.to });
			}
		}
	}
}

vector<edge>graph[123456];
long long dist[123456];

int main(void)
{
	int vn, en, r;
	scanf("%d %d %d", &vn, &en, &r);
	for (int i = 0; i < en; ++i)
	{
		int s, t; long long d;
		scanf("%d %d %lld", &s, &t, &d);
		graph[s].push_back(edge(t, d));
	}
	dijkstra(graph, dist, vn, r);
	for (int j = 0; j < vn; ++j)
	{
		if (dist[j] >= INF)printf("INF\n");
		else printf("%lld\n", dist[j]);
	}
	return 0;
}

Measured memory_bytes: 19932
#include<iostream>
using namespace std;
int main(void)
{
    string s;
    cin >> s;
    if(s[0]==s[1] && s[1]==s[2] && s[2]==s[3])
    {
        cout << "No";
        return 0;
    }
    else if(s[0]==s[1] && s[2]==s[3])
    {
        cout << "Yes";
        return 0;
    }
    else if(s[0]==s[2] && s[1]==s[3])
    {
        cout << "Yes";
        return 0;
    }
    else if(s[0]==s[3] && s[1]==s[2])
    {
        cout << "Yes";
        return 0;
    }
    else
    {
        cout << "No";
        return 0;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>
#include<queue>

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; }

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;
typedef pair<int, int> P;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    vector<double> ex(n);
    double ans = 0, sum = 0;
    for(int i = 0; i < n; i++) cin >> p[i];
    for(int i = 0; i < n; i++) ex[i] = (double)(p[i]+1)/2;
    queue<double> q;
    for(int i = 0; i < n; i++){
        sum += ex[i];
        q.push(ex[i]);
        if(q.size() > k){
            sum -= q.front(); q.pop();
        }
        if(q.size() == k){
            ans = max(ans, sum);
        }
    }
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}


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

int main(){
	stack<int> st;
	int n;
	while( cin >> n ){
		if( n == 0 ){
			if( !st.empty() ){
				cout << st.top() << endl;
				st.pop();
			}else{
				return 0;
			}
		}else{
			st.push(n);
		}
	}
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for(int i=0; i<N; i++){
    cin >> A.at(i);
  }
  for(int i=0; i<N-K; i++){
    if(A.at(K+i)>A.at(i))
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 4024
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;

int main(){
    int k,s;
    cin >> k >> s;

    int count=0;
    int x=0,y=0,z=0;
    for(x=0;x<=k;x++){
        for(y=0;y<=k;y++){
            z=s-x-y;
            if(0<=z && z<=k){
                count++;
            }
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#![allow(non_snake_case, unused)]
use proconio::{input};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::cmp::{max, min};
use std::cmp::Ordering::{self, Greater, Less};

fn main() {
    input![
	n: i32,
    ];

    let mut ans = n / 2;
    if n % 2 == 0 {
	ans -= 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 2140
#include <iostream>

using namespace std;

void print(int a,int b,int c,int d){
    if((a + b + c + d) == 7) {
        printf("%d+%d+%d+%d=7\n",a,b,c,d);
    }
    else if ((a + b + c - d) == 7){
        printf("%d+%d+%d-%d=7\n",a,b,c,d);
    }
    else if((a + b - c + d) == 7){
        printf("%d+%d-%d+%d=7\n",a,b,c,d);
    }
    else if((a + b - c - d) == 7){
        printf("%d+%d-%d-%d=7\n",a,b,c,d);
    }
    else if((a - b + c + d) == 7){
        printf("%d-%d+%d+%d=7\n",a,b,c,d);
    }
    else if((a - b + c - d) == 7){
        printf("%d-%d+%d-%d=7\n",a,b,c,d);
    }
    else if((a - b - c + d) == 7){
        printf("%d-%d-%d+%d=7\n",a,b,c,d);
    }
    else if((a - b- c - d) == 7){
        printf("%d-%d-%d-%d=7\n",a,b,c,d);   
    }
    else if ((-a +b + c + d) == 7){
        printf("-%d+%d+%d+%d=7\n",a,b,c,d);
        
    }
    else if ((-a + b + c -d) == 7)
    {
        printf("-%d+%d+%d-%d=7\n",a,b,c,d);   
    }
    else if ((-a + b -c + d) == 7){
        printf("-%d+%d-%d*%d=7\n",a,b,c,d);
        
    }
    else if ((-a + b -c -d) == 7){
        printf("-%d+%d-%d-%d=7\n",a,b,c,d);
        
    }
    else if((-a -b +c +d) == 7){
        printf("-%d-%d+%d+%d=7\n",a,b,c,d);
        
    }
    else if((-a -b +c -d) == 7){
        printf("-%d-%d+%d-%d=7\n",a,b,c,d);
        
    }
    else if ((-a -b -c +d )== 7){
        printf("-%d-%d-%d+%d=7\n",a,b,c,d);
    }
    else if((-a -b -c -d) == 7){
        printf("-%d-%d-%d-%d=7\n",a,b,c,d);
        
    }
}
int ctoi(char c){
    switch(c){
        case '0': return 0;
        case '1': return 1;
        case '2': return 2;
        case '3': return 3;
        case '4': return 4;
        case '5': return 5;
        case '6': return 6;
        case '7': return 7;
        case '8': return 8;
        case '9': return 9;
        default : return -1;
    }
}

int main(){
    char x[4];
    int a,b,c,d;
    cin >> x;
    a = ctoi(x[0]);
    b = ctoi(x[1]);
    c = ctoi(x[2]);
    d = ctoi(x[3]);
    print(a,b,c,d);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <list>
#include <sys/timeb.h>
#include <fstream>
#include <set>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int n;
	cin >> n;
	vi a(n);
	rep(i, n) cin >> a[i];

	int ans = -1;
	rep(i, n) {
		repr(j, i + 1, n) {
			int t = abs(a[i] - a[j]);
			ans = max(t, ans);
		}
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include<functional>
#include<ios>
#include<iomanip>
//#include <boost/multiprecision/cpp_int.hpp>

//namespace mp = boost::multiprecision;
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
//using Bint = mp::cpp_int;

int main()
{
	int N;
	cin>>N;
	priority_queue<P,vector<P>,greater<P>>M;
	for(int i=0;i<N;i++)
	{
		int a,b;
		cin>>a>>b;
		M.push(make_pair(b,a));
	}
	ll ct=0;
	while(!M.empty())
	{
		P tp=M.top();M.pop();
		ct+=tp.second;
		if(ct>tp.first)
		{
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;

}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define int long long
using P = pair<int, int>;
constexpr array<int, 4> dx = {1, 0, -1, 0};
constexpr array<int, 4> dy = {0, 1, 0, -1};
constexpr int INF = 1234567890;
constexpr int MOD = 1000000000 + 7;
// constexpr int MOD = 998244353;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int fact(int n) { return n > 1 ? n * fact(n - 1) % MOD : 1; }
int modinv(int a)
{
    int b = MOD, u = 1, v = 0;
    while (b)
    {
        int t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= MOD;
    if (u < 0)
        u += MOD;
    return u;
}
constexpr int modpow(int a, int n)
{
    int rtn = 1;
    while (n > 0)
    {
        if (n & 1)
            rtn = rtn * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return rtn;
}

const vector<string> m = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

signed
main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << setprecision(10);

    string s;
    cin >> s;
    int i;
    for (i = 0; i < m.size(); i++)
    {
        if (s == m[i])
            break;
    }
    cout << (7 - i > 0 ? 7 - i : 0) << endl;
}


Measured memory_bytes: 256