akhauriyash/Code-Regression huggingface dataset:
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	s1, s2, s3 := sc.nextStr(), sc.nextStr(), sc.nextStr()
	ans := []rune{}
	ans = append(ans, rune('A'+s1[0]-'a'))
	ans = append(ans, rune('A'+s2[0]-'a'))
	ans = append(ans, rune('A'+s3[0]-'a'))

	fmt.Fprintln(wtr, string(ans))
	wtr.Flush()
}


Measured memory_bytes: 640
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.nextInt()
    val b = sc.nextInt()
    val c = sc.nextInt()
    println(problem120a(a, b, c))
}

fun problem120a(a: Int, b: Int, c: Int): Int {
    return if (c * a <= b) c else b / a
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int x, y;
  cin >> x >> y;
  if (y < x * 2 || x * 4 < y || y % 2) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define ll long long
#define mod pow(10,9)+7

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int s[2]={0};
	int x;
	for(int i=0;i<3;i++)
	{
		cin>>x;
		if(x==5)
			s[0]++;
		else if(x==7)
			s[1]++;
	}
	if(s[0]==2&&s[1]==1)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;

using i64 = long long;
using pii = pair<int, int>;

const int N = 505, NN = N * N;

int f[N], p[N], v[NN];

vector<pii> srt;
int n;

static void check(bool p) {
	if (!p) {
		cout << "No" << endl;
		exit(0); } }

int main() {
#ifdef HOME
	freopen("agc8d.in", "r", stdin);
	freopen("agc8d.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int dr, st(1);

	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> p[i];
		v[p[i]] = i;
		srt.emplace_back(p[i], i); }

	sort(begin(srt), end(srt));
	for (auto i: srt) {
		for (f[i.y] = 1; f[i.y] < i.y; ++f[i.y]) {
			while (v[st]) ++st;
			check(st <= i.x);
			v[st] = i.y; } }

	dr = n * n;
	reverse(begin(srt), end(srt));
	for (auto i: srt) {
		for (; f[i.y] < n; ++f[i.y]) {
			while (v[dr]) --dr;
			check(dr >= i.x);
			v[dr] = i.y; } }

	cout << "Yes\n";
	for (int i = 1; i <= n * n; ++i)
		cout << v[i] << " \n"[i == n * n];

	return 0; }


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

int main(){
    int N;
    int a[200];

    cin >> N;
    for(int i=0; i<N; i++){
        cin >> a[i];
    }

    int ans = 1000000000;

    
    for(int i=0; i<N; i++){
        int count =0;
        
        while(a[i]%2 == 0){
            a[i]/=2;
            count++;
        }

        if(ans > count){
            ans = count;
        }

        
        

            
    }


     cout << ans << endl;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if ((A + B) > (C + D)) {
    cout << "Left" << endl;
  }
  else if ((A + B) < (C + D)) {
    cout << "Right" << endl;
  }
  else
  {
    cout << "Balanced" << endl;
  }
}

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



int main(){
  string s;
  cin >> s;
  int n = s.size();
  int ans =0;
  vector<int> a,z;
  rep(i,n) {
    if (s[i] == 'A') a.push_back(i);
    if (s[i] == 'Z') z.push_back(i);
  }
  sort(a.begin(),a.end());
  sort(z.begin(),z.end(), greater<int>());

  ans = z[0] - a[0]+1;
  cout << ans << endl;

}


Measured memory_bytes: 1364
#include <stdio.h>

#define MAX_LEN 4

int
main(void)
{
	char S[MAX_LEN];
	scanf("%s", S);

	int res = 700;
	int i;

	for (i = 0; i < 3; i++)
		if (S[i] == 'o')
			res += 100;

	printf("%d\n", res);
	return (0);
}


Measured memory_bytes: 128
n = int(input())
s = [(input()) for _ in range(n)]
m = int(input())
t = [(input()) for _ in range(m)]

dic = {}
for i in range(n):
    if s[i] in dic:
        dic[s[i]] += 1
    else:
        dic[s[i]] = 1

for i in range(m):
    if t[i] in dic:
        dic[t[i]] -= 1


ma = max(dic.values())
if ma > 0:
    print(ma)
else:
    print(0)





Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	long long int n,a,b;
	scanf("%lld%lld%lld",&n,&a,&b);
	if(a>b) {
		printf("0\n");
		return 0;
	}
	if(n==1) {
		if(a==b) {
			printf("1\n");
			return 0;

		} else {
			printf("0\n");
			return 0;
		}
	}
	printf("%lld",((b-a)*(n-2)+1));
	return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
c_list = list(map(int, input().split()))


def get_coin_number(coin_list, n, m):
    t = [float("inf") for i in range(n + 1)]
    t[0] = 0

    for i in range(1, m + 1):
        for j in range(coin_list[i-1], n + 1):
            t[j] = min(t[j], t[j - coin_list[i-1]] + 1)
    return t[n]


print(get_coin_number(c_list, n, m))



Measured memory_bytes: 7640
import sys
import itertools
import math

def first(i,a,b):
    if i%2==0: return [a,b,i]
    else: return [b,a,i]

def chk(a,b):
    if m==l:
        for i in range(m-1):
            if a[i][0]>b[i][0] or b[i][0]>a[i+1][0]:
                return 0
        if a[m-1][0]>b[m-1][0]: return 0
            
    else:
        for i in range(l):
            if a[i][0]>b[i][0] or b[i][0]>a[i+1][0]:
                return 0

    return 1

def cal(a,b):
    w=[]
    if m==l:
        for i in range(l):
            w+=[a[i][1],b[i][1]]
    else:
        for i in range(l):
            w+=[a[i][1],b[i][1]]
        w.append(a[m-1][1])
    return w
        


n=int(input())
m,l=n-n//2,n//2
a=list(map(int,input().split()))
b=list(map(int,input().split()))
if n==1:
    print(0)
    sys.exit()

x=[first(i,a[i],b[i]) for i in range(n)]

p=[i for i in range(n)]
ans=1000000

for q in itertools.combinations(p,m):
    tmpa,tmpb=[],[]
    for i in range(n):
        if i in q: tmpa.append([ x[i][0],x[i][2] ])
        else: tmpb.append([x[i][1],x[i][2]])
    tmpa.sort()
    tmpb.sort()


    if chk(tmpa,tmpb)==1:
        t=cal(tmpa,tmpb)
        tans=0
        for i in range(n):
            for j in range(i):
                if t[j]>t[i]: tans+=1
        ans=min(ans,tans)

print(ans if ans<=n*(n-1)/2 else -1)

Measured memory_bytes: 3192
#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#include<iomanip>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
#include<tuple>
#include<typeinfo>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
#define rrep(i,n)for(int i=n-1;i>=0;i--)
#define REP(i,n) for (int i = 1; i <= (int)n; i++)//i=1からi=nまで
#define RREP(i,n)for(int i=n;i>=1;i--) 
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;
const ll mod = pow(10, 9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;
const double pi = 3.14159265358979323846;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main() {
	ll A, B, V, W; cin >> A >> V >> B >> W;
	ll T; cin >> T;
	if (W >=V) {
		cout << "NO" << endl;
	}
	else {
		if (abs(A - B) <= T * (V-W)) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}

}




Measured memory_bytes: 3624
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) for(ll i=0;i<(n);++i)
#define REPR(i,n) for(ll i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    string s; cin>>s;

    int ans = 0;
    vector<vector<int>> dp(n+1, vector<int>(n+1, 0));
    for (int i = n-1; i >= 0; --i) {
        for (int j = n-1; j >= 0; --j) {
            if (s[i]==s[j]) dp[i][j] = min(dp[i+1][j+1]+1,abs(j-i));
            chmax(ans, dp[i][j]);
        }
    }
    
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 98176
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N; cin >> N;
    ll A[N]; F0R(i, N) cin >> A[i];
    F0R(i, N) {
        if (A[i] == 0) {
            cout << 0 << nl; return 0;
        }
    }
    ld L = 0;
    F0R(i, N) {
        L += log10(A[i]);
    }
    if (L > 18.1) {
        cout << -1 << nl; return 0;
    }
    ll ans = 1; F0R(i, N) ans *= A[i];
    if (ans > 1000000000000000000) {
        cout << -1 << nl; return 0;
    }
    cout << ans << nl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 4628
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]){
	int num;
	char x[10];
	int i, j, a, b, A, B;
	
	while(1){
		fgets(x, 10, stdin);
		num = atoi(x);
		if(num == 0)
			break;
		for(i = 0, A = 0, B = 0; i < num; i++){
			fgets(x, 10, stdin);
			x[1] = '\0';
			a = atoi(x);
			b = atoi(x + 2);
			if(a > b){
				A = A + a + b;
			}
			else if(b > a){
				B = B + a + b;
			}
			else{
				A = A + a;
				B = B + b;
			}
		}
		printf("%d %d\n", A, B);
	}

	return 0;
}

Measured memory_bytes: 528
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let n: usize = sc.read();
    let mut ans = vec![' '; 2 * n];

    print_n(1, n);
    let first = sc.chars()[0];
    print_n(n + 1, n);
    let last = sc.chars()[0];

    let mut prefix = 1;
    let mut suffix = n + 1;
    while suffix - prefix > 1 {
        let m = (suffix + prefix) / 2;
        print_n(m, n);
        let c = sc.chars()[0];
        if c == first {
            prefix = m;
        } else {
            suffix = m;
        }
    }
    ans[prefix - 1] = first;
    ans[suffix + n - 1 - 1] = last;
    // [suffix, ... , suffix+n-2].len() = n-1
    for i in 1..prefix {
        print_1(i, suffix, n);
        let c = sc.chars()[0];
        ans[i - 1] = c;
    }
    for i in (suffix + n)..(2 * n + 1) {
        print_1(i, suffix, n);
        let c = sc.chars()[0];
        ans[i - 1] = c;
    }

    let mut primer = vec![];
    for i in 0..(2 * n) {
        if ans[i] == first && primer.len() < (n - 1) / 2 {
            primer.push(i + 1);
        }
    }
    for i in 0..(2 * n) {
        if ans[i] == last && primer.len() < (n - 1) {
            primer.push(i + 1);
        }
    }

    for i in 0..(2 * n) {
        if ans[i] != last && ans[i] != first {
            print_v(i + 1, &primer);
            ans[i] = sc.chars()[0];
        }
    }

    print!("! ");
    for i in 0..(2 * n) {
        print!("{}", ans[i]);
    }
    println!();
}

fn print_v(i: usize, v: &Vec<usize>) {
    print!("? {}", i);
    for &i in v.iter() {
        print!(" {}", i);
    }
    println!()
}

fn print_1(i: usize, head: usize, n: usize) {
    print!("? {}", i);
    for i in 0..(n - 1) {
        print!(" {}", i + head);
    }
    println!();
}

fn print_n(head: usize, n: usize) {
    print!("?");
    for i in 0..n {
        print!(" {}", head + i);
    }
    println!();
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4816
import java.util.*;

public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        String[][] S = new String[H][W];
        for (int i = 0; i < H; ++i) {
            String s = sc.next();
            S[i] = s.split("");
        }
        sc.close();
        // 時計回り
        int dy[] = { -1, -1, 0, 1, 1, 1, 0, -1 };
        int dx[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
        for (int i = 0; i < H; ++i) {
            for (int j = 0; j < W; ++j) {
                if (S[i][j].equals("#")) {
                    continue;
                } else {
                    int cnt = 0;
                    for (int k = 0; k < 8; ++k) {
                        int ny = i + dy[k];
                        int nx = j + dx[k];
                        if (ny < 0 || nx < 0 || ny >= H || nx >= W) {
                            continue;
                        }
                        if (S[ny][nx].equals("#")) {
                            ++cnt;
                        }
                    }
                    S[i][j] = String.valueOf(cnt);
                }
            }
        }
        for (int i = 0; i < H; ++i) {
            String ans = "";
            for (int j = 0; j < W; ++j) {
                ans += S[i][j];
            }
            System.out.println(ans);
        }
    }
}

Measured memory_bytes: 22712
import java.util.Scanner;
public class Main{
    public static void main(String args[]){
        Scanner scan=new Scanner(System.in);
        int N=scan.nextInt();
        int copy=N;
        int sum_order=0;
        int i=1,j=10;
        while(N%i!=N){
            i*=10;
            sum_order+=copy%j;
            copy/=10;
            //System.out.println(sum_order);
        }
        if(N%sum_order==0){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23252
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
using namespace std;
int n,m,t[200001];
vector<int> d;
const int inf=1000000001;
int main(){
  map<int,int> ma;
  cin >> n;
  for(int i=0;i<n;i++){
    int x;
    cin >> x;
    ma[x]++;
  }
  cin >> m;
  if(n<m){
    printf("NO\n");
    return 0;
  }
  for(int i=0;i<m;i++){
    int x;
    cin >> x;
    if(ma[x]==0){
      printf("NO\n");
      return 0;
    }
    ma[x]--;
  }
  printf("YES\n");
  return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char x;
  cin >> x;

  if(x=='A'){
    cout << 'T' << endl;
  }
  
    if(x=='T'){
    cout << 'A' << endl;
  }
  
    if(x=='C'){
    cout << 'G' << endl;
  }
  
    if(x=='G'){
    cout << 'C' << endl;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int x=n;
	cout<<n<<":";
	for(int i=2;i*i<=x;i++){
		while(n%i==0){
			cout<<" "<<i;
			n/=i;
		}
	}
	if(n!=1){
		cout<<" "<<n;
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 3120
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    w, h, x, y = map(int, input().split())
    if x == w / 2 and y == h / 2:
        print(w * h / 2, 1)
    else:
        print(w * h / 2, 0)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9160
#include<stdio.h>

int num_a, num_b;

Comparison_num() {
	if (num_a < num_b) return printf("a < b\n");
	if (num_a > num_b) return printf("a > b\n");
	if (num_a = num_b) return printf("a == b\n");
}

int main() {
	scanf("%d %d", &num_a, &num_b);
	Comparison_num();
	return 0;
}


Measured memory_bytes: 2124
M=998244353
n,s,*l=map(int,open(0).read().split())
dp=[[0]*(s+1) for _ in '01']
dp[0][0]=1
b=0
for i in range(n):
  b^=1
  for j in range(s+1):
    dp[b][j]=dp[b^1][j]*2%M
    if j>=l[i]: dp[b][j]+=dp[b^1][j-l[i]]
print(dp[n%2][s]%M)

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



main()
{
	char b[5];
	cin >> b;
	int a[4];
	for(int i=0;i<4;i++)
	{
		a[i]=b[i]-'0';
	}
	if(a[0]+a[1]+a[2]+a[3]==7)
	{
		cout << a[0] << '+' << a[1] << '+' << a[2] <<'+' << a[3] <<"=7"; 
	}
	else if(a[0]+a[1]+a[2]-a[3]==7)
	{
		cout << a[0] << '+' << a[1] << '+' << a[2] <<'-' << a[3] <<"=7"; 
	}
	else if(a[0]+a[1]-a[2]+a[3]==7)
	{
		cout << a[0] << '+' << a[1] << '-' << a[2] <<'+' << a[3] <<"=7"; 
	}
	else if(a[0]-a[1]+a[2]+a[3]==7)
	{
		cout << a[0] << '-' << a[1] << '+' << a[2] <<'+' << a[3] <<"=7"; 
	}
	else if(a[0]+a[1]-a[2]-a[3]==7)
	{
		cout << a[0] << '+' << a[1] << '-' << a[2] <<'-' << a[3] <<"=7"; 
	}
	else if(a[0]-a[1]-a[2]+a[3]==7)
	{
		cout << a[0] << '-' << a[1] << '-' << a[2] <<'+' << a[3] <<"=7"; 
	}
	else if(a[0]-a[1]+a[2]-a[3]==7)
	{
		cout << a[0] << '-' << a[1] << '+' << a[2] <<'-' << a[3] <<"=7"; 
	}
	else if(a[0]-a[1]-a[2]-a[3]==7)
	{
		cout << a[0] << '-' << a[1] << '-' << a[2] <<'-' << a[3] <<"=7"; 
	}
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e5 + 5, mod = 1e9 + 7;

int dp[N];

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	memset(dp, -1, sizeof dp);
	int n, pile_size;
	cin >> n >> pile_size;

	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	dp[0] = 0;

	for (int i = 1; i <= pile_size; i++) {
		bool canTakeToLoosingState = 0;
		for (int j = 0; j < n; j++) {
			if (i - a[j] >= 0 and dp[i - a[j]] == 0)
				canTakeToLoosingState = 1;
		}
		dp[i] = canTakeToLoosingState;
	}

	if (dp[pile_size])
		cout << "First" << endl;
	else
		cout << "Second" << endl;
	return 0;
}

Measured memory_bytes: 4388
#include <iostream>
#include <cstdio>
#include <cmath>
#define eps 0.0000001
using namespace std;
struct po{int x,y,z,r; long long l;};
struct popo{int x,y,z;};

double mk_dis(popo a,popo b){
  return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)+(a.z-b.z)*(a.z-b.z));
}

int main(){
  int n,q;
  cin >>n>>q;
  po ball[51];
  for(int i=0;i<n;i++)cin>>ball[i].x>>ball[i].y>>ball[i].z>>ball[i].r>>ball[i].l;
  
  for(int i=0;i<q;i++){
    int a1,a2,b1,b2,c1,c2;
    double dis[3];
    cin >>a1>>b1>>c1>>a2>>b2>>c2;
    dis[0] = mk_dis((popo){a1,b1,c1},(popo){a2,b2,c2});
    long long ans=0;
    for(int j=0;j<n;j++){
      dis[1] = mk_dis((popo){a1,b1,c1},(popo){ball[j].x,ball[j].y,ball[j].z});
      dis[2] = mk_dis((popo){a2,b2,c2},(popo){ball[j].x,ball[j].y,ball[j].z});
      double s = (dis[0]+dis[1]+dis[2])/2.0;
      double S = sqrt(s*(s-dis[0])*(s-dis[1])*(s-dis[2]));
      double h = (2*S)/dis[0];
      
      if(dis[1]-ball[j].r<=eps ||dis[2]-ball[j].r<=eps) {
	ans+=ball[j].l;
	continue;
      }

      if(abs(sqrt(dis[1]*dis[1]-h*h)+sqrt(dis[2]*dis[2]-h*h)-dis[0]) > eps)continue;
      if(h-ball[j].r<=eps) ans+=ball[j].l;
    }
    cout << ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1172
while 1:
    n, i, j = map(int, input().split())
    if n+i+j == 0:
        break
    i = 2**n - i
    up = [0]*n
    for k in range(n):
        if 2**(n-1-k) <= i:
            up[k] = 1
            i = 2**(n-k)-1 - i
    up.reverse()
    ans = ""
    j -= 1
    for k in range(n):
        if up[k]:
            if j < 2**(n-1-k):
                j = 2**(n-1-k)-1 - j
                ans += "L"
            else:
                j = 2**(n-k)-1 - j
                ans += "R"
        else:
            if j < 2**(n-1-k):
                ans += "R"
            else:
                j -= 2**(n-1-k)
                ans += "L"
    print(ans)

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

const int MAX = 510000;
const int MOD = 1000000007;
const int MAX_N = 200000;


int main(int argc, const char * argv[]) {
   int N,M;cin >> N >> M;
   if(N==M){
     cout << "Yes" << endl;
   }else{
     cout << "No" << endl;
   }


   return 0;
}


Measured memory_bytes: 256
import sys
sys.stdin.readline

MOD=10**9+7
class Fp(int):
    def __new__(self,x=0):return super().__new__(self,x%MOD)
    def inv(self):return self.__class__(super().__pow__(MOD-2,MOD))
    def __add__(self,value):return self.__class__(super().__add__(value))
    def __sub__(self,value):return self.__class__(super().__sub__(value))
    def __mul__(self,value):return self.__class__(super().__mul__(value))
    def __floordiv__(self,value):return self.__class__(self*self.__class__(value).inv())
    def __pow__(self,value):return self.__class__(super().__pow__(value%(MOD-1), MOD))
    __radd__=__add__
    __rmul__=__mul__
    def __rsub__(self,value):return self.__class__(-super().__sub__(value))
    def __rfloordiv__(self,value):return self.__class__(self.inv()*value)
    def __iadd__(self,value):self=self+value;return self
    def __isub__(self,value):self=self-value;return self
    def __imul__(self,value):self=self*value;return self
    def __ifloordiv__(self,value):self=self//value;return self
    def __ipow__(self,value):self=self**value;return self
    def __neg__(self):return self.__class__(super().__neg__())

class Combination:
    def __init__(self,max_n):
        self.max_n=0
        self.fact=[Fp(1)]
        self.ifact=[Fp(1)]
        self.make_fact_list(max_n)
    def C(self,n,k):return self.fact[n]*self.ifact[k]*self.ifact[n-k] if 0<=k<=n else 0
    def H(self,n,k):return self.C(n+k-1,k) if n or k else 1
    def P(self,n,k):return self.fact[n]*self.ifact[n-k] if 0<=k<=n else 0
    def make_fact_list(self,max_n):
        if max_n<=self.max_n: return
        self.fact+=[Fp(0)]*(max_n-self.max_n)
        self.ifact+=[Fp(0)]*(max_n-self.max_n)
        for i in range(self.max_n+1,max_n+1):
            self.fact[i]=self.fact[i-1]*i
            self.ifact[i]=self.ifact[i-1]//i
        self.max_n=max_n

def main():
    H, W, A, B = map(int, input().split())
    C = Combination(H+W)
    ans = C.C(H+W-2, H-1)
    for b in range(B):
        ans -= C.C(H-A-1+b, b) * C.C(A-1+W-b-1, A-1)
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 71732
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define PB push_back
#define MP make_pair
#define FST first
#define SND second
#define SZ(a) (signed)((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())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;

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

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int a,b,x;
    cin >> a >> b >> x;

    cout << (b>=0?(b)/x+1:0) - (a-1>=0?(a-1)/x+1:0) << endl;
    
    return 0;
}

Measured memory_bytes: 384
/******
	~site:    atcoder.jp
	~user:    Turkhuu
	~problem: AtCoder Beginner Contest 177 - C (abc177_c)
** **/

#include<bits/stdc++.h>

#define FFOR(i,s,e,k) for(int i=s;(k==1?i<=e:i>=e);i+=k)
#define FOR(i,n) FFOR(i,0,n-1,1)
#define FORR(i,s,e) FFOR(i,s,e,1)
#define ll long long
#define PQ priority_queue
#define pb push_back
#define ppb pop_back()
#define pp push
#define MIN(v) *min_element(v.begin(),v.end())
#define MAX(v) *max_element(v.begin(),v.end())
#define SORT(v) sort(v.begin(),v.end())
#define TROS(v) sort(v.rbegin(),v.rend())
#define CNT(v,x) count(v.begin(),v.end(),x)

using namespace std;

const ll MOD=1000000007;

ll a[200001],s[200001];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n;
	cin>>n;
	s[0]=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		s[i]=s[i-1]+a[i];
	}
	ll sum=0;
	for(int i=1;i<n;i++){
		sum+=(a[i]*((s[n]-s[i])%MOD))%MOD;
		sum%=MOD;
	}
	cout<<sum;
}

Measured memory_bytes: 6760
#include<iostream>

using namespace std;
            
int main(){

    int n = 0;

    
    while(cin >> n){

        int count = 0;

        for(int a = 0; a < 10; ++a){
            for(int b = 0; b < 10; ++b){
		        for(int c = 0; c < 10; ++c){
		            for(int d = 0; d < 10; ++d){
	        	        if(a + b + c + d == n){
                            count++;
                            break;
                        }
                        
    	            }	
                }	
    	    }	
    	}
        cout << count << endl;
    }
    
	return 0;
}

Measured memory_bytes: 1160
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const W = input.slice(1, -1).map((line) => line[0]);

  const first = W[0];
  const used = new Set([first]);
  let tail = first[first.length - 1];

  for (let i = 1; i < W.length; i++) {
    const current = W[i];
    const top = current[0];

    if (top !== tail || used.has(current)) {
      return "No";
    }

    used.add(current);
    tail = current[current.length - 1];
  }

  return "Yes";
};

console.log(main(read()));


Measured memory_bytes: 29672
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define scan(n) scanf("%d",&n)
#define ls(n) scanf("%lld",&n)
#define print(n) printf("%d",n)
#define pln(n) printf("%d\n",n)
#define lpln(n) printf("%lld\n",n)
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rev(i,a,n) for(int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define tc           ll t1; cin>>t1; while(t1--)
#define inp         ll n; cin>>n; ll arr[n]; rep(i,0,n) cin>>arr[i];
#define vect vector<ll>
#define sortv(v)       sort(v.begin(),v.end())
#define lower(v,n)    lower_bound(v.begin(),v.end(),n)-v.begin()
#define upper(v,n)    upper_bound(v.begin(),v.end(),n)-v.begin()
#define all(v)        v.begin(),v.end()
#define bitcount(n) __builtin_popcount(n)
#define ln <<endl
#define inf          1e12+5
#define ninf         LONG_MIN
#define fast()         ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
const   ll mod=1e9+7;
const ll N=1e5+5;




int main() 
{ 
          fast();
          #ifndef ONLINE_JUDGE
          freopen("input.txt" , "r" , stdin);
          freopen("output.txt" , "w" , stdout);
          #endif

          ll x,k,d;
          cin >> x  >> k >>d;
          ll temp=abs(x)/d;
          ll temp1=temp+1;
          if(k>=temp1){
            int p=k%2;
            if(temp%2==p){
            cout<<(abs(abs(x)-temp*d));
            
          }
           else if(temp1%2==p){
            cout<<(abs(abs(x)-temp1*d));
           
          }
          }
          else cout<<abs(x)-k*d;
          
 
           return 0; 

} 

Measured memory_bytes: 3612
#include<iostream>
#include<stdlib.h>
 
using namespace std;
 
struct Node{
  int key;
  Node* next;
  Node* prev;
};
 
struct List{
  Node* nil;
 
  void init(){
    nil=(Node*)malloc(sizeof(Node));
    nil->next=nil;
    nil->prev=nil;
    nil->key=0;
  }
 
  Node* find(int key){
    for(Node* i=nil->next;i!=nil;i=i->next){
      if(i->key==key)return i;
    }
    return nil;
  }
 
  void insert(Node *x){
    x->next=nil->next;
    nil->next->prev=x;
    nil->next=x;
    x->prev=nil;
  }
  
  void add(int x){
    Node* p = (Node*)malloc(sizeof(Node));
    p->key=x;
    insert(p);
  }
   
  void delete_x(int key){
    Node* x=find(key);
    if(x==nil)return;
    x->prev->next=x->next;
    x->next->prev=x->prev;
    free(x);
  }
   
  void deleteFirst(){
    Node* x = nil->next;
    x->prev->next=x->next;
    x->next->prev=x->prev;
    free(x);
  }
   
  void deleteLast(){
    Node* x = nil->prev;
    x->prev->next=x->next;
    x->next->prev=x->prev;
    free(x);   
  }
 
  void output(){
    int flg=0;
    for(Node* i=nil->next;i!=nil;i=i->next){
      if(flg)cout<<' ';
      cout<<i->key;
      flg=1;
    }
    cout<<endl;
  }
};
 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
 
  List list;
  list.init();
  int n,x;
  string str;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>str;
    if(str=="insert"){
      cin>>x;
      list.add(x);
    }else if(str=="delete"){
      cin>>x;
      list.delete_x(x);
    }else if(str=="deleteFirst"){
      list.deleteFirst();
    }else {
      list.deleteLast();
    }
  }
  //cout<<'-'<<endl;
  list.output();
}

Measured memory_bytes: 32472
# 2020/08/02
# AtCoder Beginner Contest 174 - D

# Input
n = int(input())
c = input()

# Count R
rcnt = 0
for i in range(n):
    if c[i] == 'R':
        rcnt = rcnt + 1

ans = 0
for i in range(rcnt):
    if c[i] == 'W':
        ans = ans + 1

# Output
print(ans)


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


int main(){
    int n,t;
    cin >> n >>t;
    vector<int> ta(n);
    for(int i = 0; i < n; i++){
        cin >> ta.at(i);
    }
    
    long long answer = 0;
    for(int i = 0; i < n - 1; i++){
        if(ta.at(i + 1) - ta.at(i) > t)answer += t;
        else answer += ta.at(i + 1) - ta.at(i);
    }
    
    answer += t;
    
    cout << answer <<endl;
}

Measured memory_bytes: 1024
import java.math.*;
import java.util.*;
import java.lang.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        String ans = "DENIED";
        outloop:for(int i = 0;i<a.length;i++){
            a[i] = sc.nextInt();
            if(a[i]%2==0){
                if(a[i]%3==0||a[i]%5==0){
                    ans = "APPROVED";
                } else {
                    ans = "DENIED";
                    break outloop;
                }
            } else {
                ans = "APPROVED";
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 25172
#include<bits/stdc++.h>
using namespace std;
int n,a,b;
int main(){
       cin>>n>>a>>b;
       if(n==1&&a!=b)printf("0");
       else if(a>b)printf("0");
       else{
                long long sm=1LL*a*(n-1)+b;
                long long bi=1LL*b*(n-1)+a;
               printf("%lld",bi-sm+1);
              return 0;
    }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000)
 
nVertices = int(input())
edges = [[] for _ in range(nVertices + 1)]
length = {}
for _ in range(nVertices - 1):
    u, v, l = map(int, input().split())
    edges[u].append(v)
    edges[v].append(u)
    if u > v:
        u, v = v, u
    length[(u, v)] = l
color = [None] * (nVertices + 1)
color[1] = 0
 
def dfs(par, v):
    for child in edges[v]:
        if child != par:
            key = (min(v, child), max(v, child))
            if length[key] & 1 == 0:
                color[child] = color[v]
            else:
                color[child] = color[v] ^ 1
            dfs(v, child)
 
dfs(0, 1)
print('\n'.join(map(str, color[1:])))

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

int main() {
	int n;
	ll c,k;
	cin >> n >> c >> k;
	ll t[n];
	int ans = 1;
	ll start;
	int sum = 1;
	for (int i = 0;i < n;i++) {
		cin >> t[i];
	}
	sort(t,t+n);
	start = 0;
	for (int i = 1;i < n;i++) {
		if (t[i]-t[start] > k || sum == c) {
			ans++;
			start = i;
			sum = 1;
		} else {
			++sum;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
'use strict';
(function(stdin) { 
  var inputs = stdin.toString();
  var params = inputs.split('\n')[0].split(' ').map(Number);
  (function(a,b) {
    //????????????????????????
    if (a < b) {
        console.log('a < b');
    }else if (a > b) {
        console.log('a > b');
    }else {
        console.log('a == b');
    }

  }(params[0],params[1])); 
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

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


bool vector_finder(std::vector<ll> vec, ll number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) {
    return true;
  }
  else {
    return false;
  }
}


int main() {
    ll A, B, K;

    cin >> A >> B >> K;

    vector<ll> div;

    for (ll i = 100; i >= 1; i--) {
      if ((A%i == 0) && (B%i == 0)) div.push_back(i);
    }
    
    cout << div.at(K-1) << endl;
    
    
    return 0;
}

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

using namespace std;

int main() {
	char c;
	cin >> c;
	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
		cout << "vowel" << endl;
	} else {
		cout << "consonant" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
def kaijyo(num):
  ans = 1
  for i in range(num):
    ans = ans * (i + 1)
  return ans

N = int(input())
P = list(map(int,input().rstrip().split(" ")))
Q = list(map(int,input().rstrip().split(" ")))
ap = [(i + 1) for i in range(N)]
aq = [(i + 1) for i in range(N)]
Pa = 0
Qa = 0
for i in range(N):
  Pa += ap.index(P[i]) * kaijyo(N - i - 1)
  ap.pop(ap.index(P[i]))
for i in range(N):
  Qa += aq.index(Q[i]) * kaijyo(N - i - 1)
  aq.pop(aq.index(Q[i]))
print(abs(Pa - Qa))

Measured memory_bytes: 3064
#include <iostream>
#include <cmath> 
#include <vector>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

int main(){
  int H, W;
  string str;
  cin >> H >> W;
  vector<vector<int> > v(H, vector<int>(W, -1));
  queue<pair<int,int> >que;
  //??\???
  for(int i=0;i<H;i++){
    cin >> str;
    for(int j=0;j<W;j++){
      if(str[j] == 'c'){
        v[i][j] = 0;
        if(j < W-1)
          que.push(make_pair(i, j+1));
      }
    }
  }
  while(!que.empty()){
    pair<int,int> q = que.front();
    que.pop();
    if(v[q.first][q.second] == -1)
      v[q.first][q.second] = v[q.first][q.second-1] + 1;
    if(q.second < W-1){
      que.push(make_pair(q.first, q.second + 1));
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cout << v[i][j];
      if(j != W-1)
        cout << " ";
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1328
#include <cstdio>
using namespace std;

inline int read() {
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - 48; ch = getchar(); }
	return x * f;
}

const int MOD = 1e9 + 7;
const int N = 2010;
int C[N][N];

void init() {
	C[0][0] = 1;
	C[1][0] = C[1][1] = 1;
	for (int i = 2; i < N; i++) {
		C[i][0] = 1;
		for (int j = 1; j <= i; j++) 
			C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % MOD;
	}
}

int main() {
	init();
	int n = read(), k = read();
	for (int i = 1; i <= k; i++) {
		printf("%d\n", 1LL * C[k - 1][i - 1] * C[n - k + 1][i] % MOD);
	}
	return 0;
}

Measured memory_bytes: 15104
#include <iostream>
#include <string>
#include <cstring>
using namespace std;

char s[100010];

int main(void){
  int rightFlag;
  int j,i,n;
  int foot[2];
  char before;
  cin>>n;
  while(n--){
    cin>>s;
    for(j = 0 ; j < 2 ; j ++){
      foot[0] = -1;
      foot[1] = 1;
      rightFlag = j;
      before = 0;
      for(i = 0 ; i < strlen(s) ; i ++){
        if(before == s[i])break;
        switch(s[i]){
          case 'U' :
          case 'D' :
            foot[rightFlag] = 0;
            break;
          case 'R' :
            foot[rightFlag] = 1;
            break;
          case 'L' :            
            foot[rightFlag] = -1;
            break;
        }
        if(foot[0] > foot[1]) break;
        before = s[i];
        rightFlag = !rightFlag;
      }
      if(i == strlen(s)) break;
    }
    cout<<(j<2?"Yes":"No")<<endl;
  }
  return 0;
}

Measured memory_bytes: 1252
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	 vector<int>a(3);
	for (int i = 0; i < 3; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	cout << a[1] - a[0] + a[2] - a[1] << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>a>>b>>k;
    rrrep(i,100,1){
        if(a%i==0&&b%i==0){
            cnt++;
        }
        if(cnt==k){
            Cout(i);
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 768
#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];
  long dp[N][2];
  dp[0][0]=0;
  dp[0][1]=-1234567890;
  for(int i=0;i<N;i++){
    dp[i+1][0]=max(dp[i][0]+a[i],dp[i][1]-a[i]);
    dp[i+1][1]=max(dp[i][0]-a[i],dp[i][1]+a[i]);
  }
  cout<<dp[N][0]<<endl;
}


Measured memory_bytes: 2176
import java.io.{BufferedReader, InputStreamReader}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val n = in.readLine().toInt

    System.out.println(
      if (n % 2 == 0) {
        n / 2 - 1
      } else {
        n / 2
      }
    )
  }
}


Measured memory_bytes: 25524
#[allow(unused_imports)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(n: usize, a: [usize; n]);

    let mut money: usize = 1000;

    for i in 0..n - 1 {
        if a[i] < a[i + 1] {
            let kabu = money / a[i];
            money = money % a[i] + kabu * a[i + 1];
        }
    }

    println!("{}", money);
}


Measured memory_bytes: 2196
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(){
    char a[1000000];
    unsigned long long int n,i,j,sum=0;
    scanf("%s",&a);
    n=strlen(a);
    for(i=0;i<n;i++){
        if(a[i]!='0'){
            sum=sum+(a[i]-'0');
        }
    }
    if(sum%9==0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 1832
use itertools::interleave;
use itertools::join;
use proconio::input;
use proconio::marker::Chars;

use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::Write;

pub trait Echo {
    fn echo(&self);
    fn echo_b(&self, out: &mut std::io::Stdout) -> Result<(), std::io::Error>;
}

macro_rules! impl_echo {
    ($($t:ty),*) => {
        $(
            impl Echo for $t {
                fn echo(&self){
                    self.echo_b(&mut std::io::stdout()).unwrap();
                }

                fn echo_b(&self, out: &mut std::io::Stdout) -> Result<(), std::io::Error>{
                    writeln!(out,"{}", &self)?;
                    Ok(())
                }
            }
        )*
    };
}

macro_rules! impl_echo_f {
    ($($t:ty),*) => {
        $(
            impl Echo for $t {
                fn echo(&self){
                    self.echo_b(&mut std::io::stdout()).unwrap();
                }

                fn echo_b(&self, out: &mut std::io::Stdout) -> Result<(), std::io::Error>{
                    writeln!(out,"{:.12}", &self)?;
                    Ok(())
                }
            }
        )*
    };
}

impl_echo!(u8, u16, u32, u64, u128, usize);
impl_echo!(i8, i16, i32, i64, i128, isize);
impl_echo!(&str, String, char);
impl_echo_f!(f32, f64);

impl<T: Echo> Echo for Vec<T> {
    fn echo(&self) {
        self.echo_b(&mut std::io::stdout()).unwrap();
    }
    fn echo_b(&self, out: &mut std::io::Stdout) -> Result<(), std::io::Error> {
        for i in self {
            i.echo_b(out).unwrap();
        }
        Ok(())
    }
}

fn main() {
    input! {
        n: usize
    };
    let res = if n % 1000 == 0 { 0 } else { 1000 - n % 1000 };
    res.echo();
}

#[allow(dead_code)]
fn yn(i: bool) {
    if i {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2192
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define rep3(i, s, n) for (int i = s; i > (int)(n); i--)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define dbvv(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main() {
	string S; cin >> S;
	string f = "", b = "";
	bool fr = true; // Sが元の向きであるか
	int Q; cin >> Q;
	rep(i, Q) {
		int T; cin >> T;
		if (T == 1) fr = !fr;
		else {
			int F; char C; cin >> F >> C;
			if (fr && F == 1 || !fr && F == 2) f = C + f;
			else b = b + C;
		}
	}
	S = f + S + b;
	if (!fr) reverse(all(S));
	cout << S << endl;
}

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

typedef long long ll;
const int N = 300233;
int n;
ll m, x[N], t[N], ans;
bool l[N], r[N];

int main() {
  scanf("%d%lld", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", x + i);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%lld", t + i);
    if (t[i] % (m << 1) == 0) {
      ans += t[i] / (m << 1);
    } else {
      ans += 1 + t[i] / (m << 1);
      t[i] %= m << 1;
      if (t[i] <= x[i] << 1) l[i] = true;
      if (t[i] <= (m - x[i]) << 1) r[i] = true;
    }
  }
  int L = 0, LR = 0;
  for (int i = 1; i < n; i++) {
    if (L && r[i]) {
      if (l[i]) {
        LR++;
      }
      L--;
      ans--;
    } else if (!l[i] && r[i]) {
      if (LR) {
        LR--;
        L++;
      }
    } else if (l[i]) {
      L++;
    }
  }
  if (!r[n]) {
    ans++;
  }
  printf("%lld\n", ans * m << 1);
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
#define zcin(type, a) type a; cin >> a;
#define zcout(a, sep1, b, sep2) cout << a << sep1 << b << sep2;
#define zfor(i, b, n) for (int i = b; i < n; ++i)
#define pb push_back

using namespace std;

int main()
{
	#ifdef ME
		freopen("input.txt", "r", stdin);
		//freopen("output.txt", "w", stdout);
	#endif
	int s, w;
	cin >> s >> w;

	printf((w >= s) ? "unsafe" : "safe");

	return 0;
}


Measured memory_bytes: 3764
import java.util.*;
import java.io.*;

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

        int[][] card = new int[4][13];
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 13; j++) {
                card[i][j] = j + 1;
            }
        }

        String[] piclist = {"S", "H", "C", "D"};
        int n = Integer.parseInt(sc.next());
        for (int i = 0; i < n; i++) {
            String picture = sc.next();
            int rank = Integer.parseInt(sc.next());
            int pic = 0;
            for (int j = 0; j < 4; j++) {
                if (picture.equals(piclist[j])) {
                    card[j][rank-1] = 0;
                    break;
                }
            }
        }

        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 13; j++) {
                if (card[i][j] != 0) {
                    out.printf("%s %d\n", piclist[i], card[i][j]);
                }
            }
        }
        out.flush();
    }
}


Measured memory_bytes: 26300