akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;



public class Test
{
	public static void Main( )
	{
		var n = int.Parse( Console.ReadLine() );
		var A = Console.ReadLine().Trim().Split().Select( x => int.Parse(x)).ToArray();
		
		int cnt = 0;
		for( var i=0; i<=n-1; i++ ) {
			for( var j=n-1; i+1 <= j; j-- ) {
				if( A[j] < A[j-1] ) {
					swap<int>( ref A[j], ref A[j-1] );
					cnt++;
				}
			}
		}
		
		Console.WriteLine( String.Join( " ", A ) );
		Console.WriteLine( cnt );
		
		return;
	}
	public static void swap<T>( ref T a, ref T b )
	{
		var t = a;
		a = b;
		b = t;
		return;
	}
}



Measured memory_bytes: 20312
#include"bits/stdc++.h"
using namespace std;
int a,b;

int main(){
	cin>>a>>b;
	if(a>0)cout<<"Positive";
	else if(a==0||(a<0&&b>0))cout<<"Zero";
	else if((abs(b)-abs(a))%2!=0)cout<<"Positive";
	else cout<<"Negative";
	return 0;
}

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

int main() {
  int64_t N;
  cin >> N;
  vector<int64_t> A(N+1), B(N);
  for (int64_t i=0; i<N+1; i++) {
    cin >> A[i];
  }
  for (int64_t i=0; i<N; i++) {
    cin >> B[i];
  }
  int64_t m=0;
  for (int64_t i=0; i<N; i++) {
    if (A[i]>=B[i]) {
      A[i]-=B[i];
      m+=B[i];
    }
    else {
      m+=A[i];
      B[i]-=A[i];
      A[i]=0;
      if (A[i+1]>=B[i]) {
        A[i+1]-=B[i];
        m+=B[i];
      }
      else {
        m+=A[i+1];
        B[i]-=A[i+1];
        A[i+1]=0;
      }
    }
  }
  cout << m << endl;
}


Measured memory_bytes: 4764
#include <iostream>
#include <vector>


int main(void){
    std::cin.tie(nullptr); std::cin.sync_with_stdio(false);
    
    int n, m; std::cin >> n >> m;
    long long int K; std::cin >> K;
    std::vector<long long int> A(n + 1), B(m + 1);
    A[0] = 0; for(int i = 0; i < n; ++i){ std::cin >> A[i + 1]; A[i + 1] += A[i]; }
    B[0] = 0; for(int i = 0; i < m; ++i){ std::cin >> B[i + 1]; B[i + 1] += B[i]; }
    int res = 0;
    for(int i = 0; i <= n; ++i){
        if(A[i] > K) break;
        long long int OK = K - A[i];
        int ok = 0, ng = m + 1;
        while(ng - ok > 1){
            const int mid = (ok + ng) / 2;
            if(B[mid] <= OK) ok = mid;
            else ng = mid;
        }
        const int ans = i + ok;
        if(ans > res) res = ans;
    }
    std::cout << res << '\n';
    return 0;
}


Measured memory_bytes: 6364
A, B, C, D, E, F = gets.split.map(&:to_i)

waters = []
amax = F / (A * 100)
bmax = F / (B * 100)
(0..amax).each do |a|
    (0..bmax).each do |b|
        water = (a * A + b * B) * 100
        if water < F
            waters.push(water)
        end
    end
end

waters.uniq!
waters.sort!
waters.delete(0)

sugars = []
cmax = F / C
dmax = F / D
(0..cmax).each do |c|
    (0..dmax).each do |d|
        sugar = c * C + d * D
        if sugar < F
            sugars.push(sugar)
        end
    end
end

sugars.uniq!
sugars.sort!

#water, suger, density
max = [0, 0, -1]

waters.each do |water|
    sugars.each do |sugar|
        break if water + sugar > F
        break if water * E < sugar * 100
        density = sugar.to_f / (water + sugar)
        max = [water, sugar, density] if density > max[2]
    end
end

puts "#{max[0]+max[1]} #{max[1]}"

Measured memory_bytes: 3836
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<sstream>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; ++i)
#define per(i, a, n)  for(int i=n-1; i>=a; --i)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 1000000007
using namespace std;
typedef long long ll;

int main(){
  int N, K; cin >> N >> K;
  string S; cin >> S;

  vector<int> Nums;
  int now = 1;
  int cnt = 0;
  rep(i, 0, N){
    if(S[i] == (char)('0'+now)) cnt++;
    else{
      Nums.push_back(cnt);
      now = 1-now;
      cnt = 1;
    }
  }
  if(cnt != 0)  Nums.push_back(cnt);
  if(Nums.size()%2 == 0)  Nums.push_back(0);

  int add = 2 * K + 1;
  vector<int> Sums(Nums.size()+1);
  rep(i, 0, Nums.size()){
    Sums[i+1] = Sums[i] + Nums[i];
  }

  int ans = 0;
  for(int i=0; i<Nums.size(); i+=2){
    int left = i;
    int right = min(i+add, (int)Nums.size());
    int tmp = Sums[right] - Sums[left];

    ans = max(tmp, ans);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1272
#include <stdio.h>
#include <string.h>
#define N 20
#define T 1000
void Sum(int n);
int S[T*5]={0};
int main(void){
	int n,i;
	char str[N];

	for(i=0;i<=T;i++)
		S[i]+=1;
	for(n=T;n<=T*3;n+=T)
		Sum(n);
	for( ;fgets(str,sizeof(str),stdin)!=NULL; ){
		sscanf(str,"%d",&n);
		printf("%d\n",S[n]);
	}
	return 0;
}

void Sum(int n){
	int i,j,y[T*5]={0};
	for(i=0;i<=n;i++){
		for(j=0;j<=T;j++)
			y[i+j]+=S[i];	
	}
	for(i=0;i<=T+n;i++)
		S[i]=y[i];
}

Measured memory_bytes: 648
#include<bits/stdc++.h>
using namespace std;
using namespace std::chrono; 
#define ll long long
#define fo(i,v,e) for(v=i;v<e;v++)
#define rfo(i,v,e) for(v=i;v>e;v--)
#define pb(x) push_back(x)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fi first 
#define se second
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vl vector<ll>
#define sz(x) (int)x.size()
#define ull unsigned long long
#define vvi vector<vi>
#define vvl vector<vl>
#define vpi vector<pii>
#define vpl vector<pll>
ll mod = 1000000007;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x);
#else
#define deb(x...)
#endif
void init()
{
}

void solve()
{
    ll n,i,j;cin>>n;
   string s;cin>>s;
   if(sz(s)>n)
   {
       s = s.substr(0,n);
       s+="...";
   }
   cout<<s<<endl;
}
int main()
{
    init();
    #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    #endif
    auto start = high_resolution_clock::now(); 
    int T = 1;
    // cin>>T;
    while(T--)
    {
        solve();
    }
    auto stop = high_resolution_clock::now(); 
    auto duration = duration_cast<milliseconds>(stop - start); 
    #ifndef ONLINE_JUDGE
    // cout << "time taken : "<<duration.count()<<" ms" << endl;
     #endif
}


Measured memory_bytes: 3616
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;
use std::ops::Bound::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (n, q) = (v[0], v[1]);
    let a = read_vec::<i64>();

    let mut bit = BinaryIndexTree::new(n);
    for i in 0..n {
        bit.add(i + 1, a[i]);
    }
    for i in 0..q {
        let query = read_vec::<i64>();
        if query[0] == 0 {
            let (p, x) = (query[1] as usize, query[2]);
            bit.add(p + 1, x);
        } else {
            let (l, r) = (query[1] as usize, query[2] as usize);
            let ans = bit.sum(r) - bit.sum(l);
            println!("{}", ans);
        }
    }
}
struct BinaryIndexTree {
    bit: Vec<i64>,
    n: usize,
}

impl BinaryIndexTree {
    fn new(n: usize) -> BinaryIndexTree {
        BinaryIndexTree {
            bit: vec![0; n + 1],
            n: n,
        }
    }

    fn sum(&self, i: usize) -> i64 {
        let mut i = i;
        let mut s = 0i64;
        while i > 0 {
            s += self.bit[i];
            i -= (i as i64 & -(i as i64)) as usize;
        }
        s
    }

    fn add(&mut self, i: usize, x: i64) {
        assert!(i > 0);
        let mut i = i;
        while i <= self.n {
            self.bit[i as usize] += x;
            i += (i as i64 & -(i as i64)) as usize;
        }
    }
}
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 12084
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
using namespace std;
using ll = long long;

typedef pair <int, int> pii;

int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll n;
	ll x[100005] = {};
	ll y[100005] = {};
	ll z[100005] = {};
	cin >> a;
	cin >> b;
	cin >> c;
	for (int i = 0; i < a; i++)
	{
		cin >> x[i];
		if (b>=x[i])
		{
			d++;
		}
		else if (c<x[i])
		{
			f++;
		}
		else
		{
			e++;
		}
	}

	


	cout << min(min(d,f),e) << endl;
	//cout << ans << endl;

	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}

//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え

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

int main()
{
	double a[3], b[3];
	while (cin >> a[0] >> a[1] >> a[2] >> b[0] >> b[1] >> b[2])
	{
		if (a[0] == 0)
		{
			double c = a[2] / a[1];
			double d = (b[2] - b[1] * c) / b[1];
			a[2] = d;
			b[2] = d;
		}
		else
		{
			double c = 1;
			if (b[0] != 0)
			{
				c = a[0] / b[0];
				b[1] = b[1] * c - a[1];
				b[2] = b[2] * c - a[2];
			}
			b[2] /= b[1];
			b[1] = 1;
			a[2] -= b[2] * a[1];
			a[2] /= a[0];
		}
		if (a[2] < 0.0001 && a[2] > -0.0001)
			a[2] = 0.000;
		if (b[2] < 0.0001 && b[2] > -0.0001)
			b[2] = 0.000;

		cout << fixed << setprecision(3) << a[2]  << " " << b[2] << endl;
	}

	return 0;
}

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

int main()
{
  int n;
  cin >> n;
  map<int, int> a;
  for (int i = 1; i <= n; ++i)
  {
    int t;
    cin >> t;
    a[i] = t;
  }
  int cnt = 0;
  for (int i = 1; i <= n; ++i)
  {
    if (a[a[i]] == i)
      cnt++;
  }
  cout << cnt / 2 << endl;

  return 0;
}

Measured memory_bytes: 4992
function main(input) {
  input = input.trim();
  const a = input.split(" ").map(Number);
	console.log((a[0]+a[1])*(a[0]+a[1]-1) / 2 - a[0] * a[1]);
  
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29556
import java.util.*;
import java.io.*;
class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        String a = sc.next();
        if(a.equals("Sunny")) p("Cloudy");
        else if(a.equals("Cloudy")) p("Rainy");
        else p("Sunny");
    }
    public static String stringCopy(String str) {
        StringBuilder builder = new StringBuilder();
        builder.append(str.toCharArray());
        return builder.toString();
    }
    public static <T> void p(T element) {
	System.out.println(element);
    }
    public static <T> void pp(T element) {
        System.out.print(element);
        }
    public static int min(int a, int b, int c) {
	int min = Math.min(a,b);
	min = Math.min(min,c);
	return min;
    }
    public static int max(int a, int b,int c) {
	int max= Math.max(a,b);
	max = Math.max(max,c);
        return max;
    }
}
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
 
    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }
 
    private boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
 
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }
 
    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
 
    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
 
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
 
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

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

using vi = vector<int>;
using vvi = vector<vi>;
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m, K, sum;
    cin >> n >> m >> K >> sum;
    vvi a(n, vi(m));
    REP(i, n) { REP(j, m) cin >> a[i][j]; }

    auto cnt_min = [&](const vi& p) {
        int n = p.size();
        int mi = 100;
        REP(S, 1 << n) {
            int mi_val = 0, acc = 0;
            bool ok = true;
            REP(i, n) {
                int tmp = p[i];
                if (S >> i & 1) tmp = -abs(tmp);
                acc += tmp;
                if (acc - mi_val > sum) {
                    ok = false;
                    break;
                }
                mi_val = min(mi_val, acc);
            }
            if (ok) mi = min(mi, (int)__builtin_popcount(S));
        }
        return mi;
    };
    vi rows, cols;
    REP(i, n) {
        if (cnt_min(a[i]) > 0) rows.push_back(i);
    }
    REP(j, m) {
        vi tmp;
        REP(i, n) tmp.push_back(a[i][j]);
        if (cnt_min(tmp) > 0) cols.push_back(j);
    }

    int H = rows.size(), W = cols.size();
    if (H > K || W > K) {
        cout << "No" << endl;
        return 0;
    }

    vvi row_tbl(H, vi(1 << W));
    REP(i, H) {
        vi vec;
        REP(j, m) vec.push_back(a[rows[i]][j]);
        REP(S, 1 << W) {
            vi tmp = vec;
            REP(j, W) {
                int j_ = cols[j];
                if (S >> j & 1) tmp[j_] = -abs(tmp[j_]);
            }
            row_tbl[i][S] = cnt_min(tmp);
        }
    }
    vvi col_tbl(W, vi(1 << H));
    REP(j, W) {
        vi vec;
        REP(i, n) vec.push_back(a[i][cols[j]]);
        REP(S, 1 << H) {
            vi tmp = vec;
            REP(i, H) {
                int i_ = rows[i];
                if (S >> i & 1) tmp[i_] = -abs(tmp[i_]);
            }
            col_tbl[j][S] = cnt_min(tmp);
        }
    }

    // if (H == 0 && W == 0)
    for (int num = 0; num <= K; num++) {
        vector<int> perm(H * W);
        REP(i, min(num, H * W)) perm[i] = 1;
        sort(perm.begin(), perm.end());
        do {
            int acc = 0;
            REP(i, H) {
                int S = 0;
                REP(j, W) { S |= perm[i * W + j] << j; }
                acc += row_tbl[i][S];
            }
            REP(j, W) {
                int S = 0;
                REP(i, H) { S |= perm[i * W + j] << j; }
                acc += col_tbl[j][S];
            }
            if (acc + num <= K) {
                cout << "Yes" << endl;
                return 0;
            }
        } while (next_permutation(perm.begin(), perm.end()));
    }
    cout << "No" << endl;
}



Measured memory_bytes: 3200
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            String intputString = br.readLine();

            Set<String> vowelSet = new HashSet<>();
            vowelSet.add("a");
            vowelSet.add("e");
            vowelSet.add("i");
            vowelSet.add("o");
            vowelSet.add("u");

            if (vowelSet.contains(intputString)) {
                System.out.println("vowel");
            } else {
                System.out.println("consonant");
            }

        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

Measured memory_bytes: 21204
#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);
  }
  
  for (int i = 0; i < h; i++) {
    a.at(i) = '#' + a.at(i) + '#';
  }
  
  string s(w + 2, '#');
  a.insert(a.begin(), s);
  a.push_back(s);
  
  for(const auto& s: a) {
    cout << s << endl;
  }
}

Measured memory_bytes: 256
// AOJ Volume2 0256

#include <stdio.h>

int main(void)
{
    int s;
    int n;
    int i;
    
    n = 0;
    for (i = 0; i < 10; i++){
        scanf("%d", &s);
        n += s;
    }
    printf("%d\n", n);

    return (0);
}

Measured memory_bytes: 600
#include <iostream>
#include <cstdio>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <vector>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

bool check(string s,int n){
	int a = (s.size()-n)/2;
	for(int i=0;i<a;i++){
		if(s[i]!=s[a+i])
			return false;
	}
	return true;
}

int main(int argc, char const *argv[])
{
	string s;
	cin>>s;
	for (int i = 2; i < s.size(); i+=2)
	{
		if(check(s,i)){
			cout << s.size() - i;
			break;
		}
	}
	cout << "\n";
	return 0;
}	

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



void solve(){
    ll n;
    cin >> n;
    ll a[n+10], b[n+10], c[n+10];
    rep(i,n){
        cin >> a[i];
    }
    rep(i,n){
        cin >> b[i];
    }
    rep(i,n){
        cin >> c[i];
    }
    sort(a,a+n);
    sort(b,b+n);
    sort(c,c+n);

    ll ans = 0;
    rep(i,n){
        ll center = b[i];
        auto IterA = lower_bound(a, a+n, center);
        auto IterC = upper_bound(c, c+n, center);
        ll acount, ccount;
        acount = IterA - a;
        ccount = c+n- IterC;
        ans += acount*ccount;
    }
    cout << ans << endl;
}

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



Measured memory_bytes: 2688
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

#include <bits/stdc++.h>
using namespace std;

int main() {
  int p,q,r;
  cin>>p>>q>>r;
  cout << p+q+r-max(p,max(q,r)) <<endl;
  
  return 0;
}

Measured memory_bytes: 256
import numba
from numba import jit
import numpy as np
  
@jit
def main(r, c):
  dp = np.zeros((c+1, 4), np.int64)
  for i in range(r):
    new_dp = np.zeros((c+1, 4), np.int64)
    for j in range(4):
      new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,j])
    dp = new_dp
    for k in range(c):
      for l in range(2, -1, -1):
        dp[k,l+1] = max(dp[k,l+1], dp[k,l]+item_map[i,k])
      for m in range(1,4):
        dp[k+1,m] = max(dp[k+1,m], dp[k,m])
  return max(dp[c-1,:])


R, C, K = map(int, input().split())
item_lis = list(list(map(int, input().split())) for i in range(K))
item_map = np.zeros((R, C), np.int64)
for i,j,k in item_lis:
  item_map[i-1,j-1] = k

print(main(R, C))

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

int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for(int i = 0; i < n; i++) cin >> a.at(i);
  
  long long ans = 0, tall = 0;
  for(int i = 0; i < n; i++){
    long long k = a.at(i);
    if(k > tall) tall = k;
    else ans += tall - k;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 4852
#include <iostream>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)

int main(void){
    // Your code here!
   int n;
   //vector<vector<int>> v(3, vector<int>(3));
   int v[3][3];
   rep(i,3)rep(j,3) cin >> v[i][j];
   
   cin >> n;
   //vector <int> d(n);
   int d[n];
   rep(i,n)cin >> d[i];
   
   rep(i,3){
       rep(j,3){
           for(int x:d){
               if(v[i][j] == x){
                   v[i][j] = 0;
                   break;
               }
           }
       }
   }
   
   int f=0;
   rep(i,3) if(v[i][0]==0 && v[i][1]==0 and v[i][2]==0) f=1;
   rep(j,3) if(v[0][j]==0 && v[1][j]==0 and v[2][j]==0) f=1;
   if(v[0][0]==0 && v[1][1]==0 and v[2][2]==0) f=1;
   if(v[0][2]==0 && v[1][1]==0 and v[2][0]==0) f=1;
   
   if(f==1) cout << "Yes" << endl;
   else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

map<ll, int > prime_factor(ll n) {
  map< ll, int > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main() {
  int n;
  cin >> n;
  int ans = 0;
  rep(i,n+1){
    auto M = prime_factor(i);
    int c = 1;
    for(auto it:M){
      c*=(it.se+1);
    }
    if(c == 8 && i%2)ans++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int N;

int main() {
  cin >> N;

  long long int res = 0;
  for (long long int i = 1; i <= N; i++) {
    long long int x = N / i;
    res += i * x * (x + 1) / 2;
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 3560
#include<iostream>
#include <bitset>
using namespace std;
int main(){
	const int TMAX = 10000;
	std::bitset<TMAX> flg;
	int n;
	int primes=0;
	for(int i=2;i<TMAX;i++){
		if (!flg.test(i)){
			for(int j=2;i*j<TMAX;++j){
				flg.set(i*j);
			}
		}
	}
	cin >> n;
	while(n-->0) {
		int x;
		cin >> x;
		if (x <= TMAX) {
			if (!flg.test(x)) {
				primes++;
			}
		} else {
			bool isnotprime = false;
			if (( x % 2) != 0) {
				for(int i=3;i<TMAX;i+=2) {
					if (!flg.test(i)) {
						if ((x % i) == 0) {
							isnotprime = true;
							break;
						}
					}
				}
				if (!isnotprime){
					primes++;
				}
			}
		}
	}
	cout << primes << endl;
}

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

namespace AtCoder_Project_CSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var k = int.Parse(Console.ReadLine());

            int c = 1;
            for (int i = 0; i < n; i++)
            {
                int a = c * 2;
                int b = c + k;
                c = Math.Min(a, b);
            }
            Console.WriteLine(c);
        }
    }
}


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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

ll N, M;
bool A[111][111];

void f(int y, int x) {
   for (int i = y-1; i <= y+1; i++) {
      for (int j = x-1; j <= x+1; j++) {
         if (i < 0 || i >= N || j < 0 || j >= M) continue;
         A[i][j] = !A[i][j];
      }
   }
}

void print() {
   rep (i, N) {
      rep (j, M) {
         cout << A[i][j];
      }
      puts("");
   }
}

int main() {
   cin >> N >> M;
   cout << abs((N-2)*(M-2)) << endl;
   // fill(A[0], A[111], true);

   // rep (i, N) {
   //    rep (j, M) {
   //       f(i, j);
   //    }
   // }

   // print();

   return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;


const int mod=1000000007;
//const int mod=998244353;


ll pow(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}


int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll t,n,m,k,q,x,a,b,c,d,y,l,r,p;
    cin >> x >> n;
    map<int,int> map;
    for(int i=0; i<n; i++){
        cin >> a;
        map[a]=1;
    }
    b=1e9;
    for(int i=-200; i<200; i++){
        if(!map[i]&&abs(i-x)<b){
            b=abs(i-x);
            c=i;
        }
    }
    cout << c << el;
    return 0;
}
    


Measured memory_bytes: 3672
import java.util.*;

class Main {
        public static void main(String args[]) {
                try (Scanner sc = new Scanner(System.in)) {
                        while (true) {
                                int a, b, c;
                                try {
                                        a = sc.nextInt();
                                        b = sc.nextInt();
                                        c = sc.nextInt();
                                } catch (Exception e) {
                                        break;
                                }
                                a %= b;
                                int ans = 0;
                                for (int i = 0; i < c; i++) {
                                        a *= 10;
                                        ans += a / b;
                                        a %= b;
                                }
                                System.out.println(ans);
                        }
                }
        }
}

Measured memory_bytes: 26272
#include <iostream>
#include<math.h>
#include<list>
#include <algorithm>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
using ll = long long;
using vll = vector<long long>;

#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)


int main() {
	ll a,b,c,ans;

	in(a);
	in(b);
	in(c);
	

	ans = c - a + b;
	if (ans < 0) {
		ans = 0;
	}

	outn(ans);
	return 0;
}



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

using namespace std;

int main(){
  int x1,x2;
  cin >> x1 >> x2;
  int a;
  if(x1>x2) a=x1-x2;
  else a=x2-x1;
  cout << a << endl;
  
  return 0;
}




Measured memory_bytes: 3116
#include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
	int N;
	string s, t;
	cin >> N >> s >> t;
	for(int i = N; i >= 0; i--){
		bool if_ok = true;
		for(int j = 0; j < i; j++){
			if(s[N - i + j] != t[j]){
				if_ok = false;
				break;
			}
		}
		if(if_ok){
			cout << N * 2 - i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
# ABC092
N = int(input())
A = list(map(int, input().split()))
A.insert(0, 0)
A.insert(N+1, 0)
wa = 0
for i in range(N+1):
    wa += abs(A[i+1] - A[i])

for i in range(0, N):
    print(wa - abs(A[i+2] - A[i+1]) - abs(A[i+1] - A[i]) + abs(A[i+2] - A[i]))

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

#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);

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

    vector<int> arr;
    for(int i=0;i<n;i++) {
        int num;
        cin>>num;
        arr.push_back(num);
    }

    sort(arr.begin(),arr.end());

    int ans=0;
    for(int i=0;i<k;i++) {
        ans+=(arr[i]);
    }
    cout<<ans<<endl;

}




Measured memory_bytes: 3652
INT_MAX=10**18+7
x=10**9+7
def INPUT():return list(int(i) for i in input().split())
def LIST_1D_ARRAY(n):return [0 for _ in range(n)]
def LIST_2D_ARRAY(m,n):return [[0 for _ in range(n)]for _ in range(m)]
GETA=123
###############################################################################
import math as M
n,a,b=INPUT()
#ans=2^n-1-(n,a)-(n,b)
def power(a,n):
    if n==0:
        return 1
    else:
        if(n%2==0):
            return ((power(a,n//2))**2)%x
        else:
            return ((a%x)*(((power(a,(n-1)//2)))**2)%x)%x
def bin(n,r):
    num=1
    den=1
    for i in range(1,r+1):
        den=(den*i)%x
        num=(num*(n-i+1))%x
    return (num*power(den,x-2))%x
ans=power(2,n)-1-bin(n,a)-bin(n,b)
if ans>0:
    print(ans)
else:
    print((x+ans)%x)


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

int i;
string text;

void forChar(void){
	if(i != text.length()){
		i++;
	}
}

void forWord(void){
  int len = text.length();

  if(i == text.length()) return;

  if(text.at(i) == ' '){
    for(;i<len && text.at(i)==' ';i++);
    if(i == len) return;
  }
  for(;i<len && text.at(i)!=' ';i++);
}

void backChar(void){
	if(i != 0){
		i--;
	}
}

void backWord(void){
  if(i == 0) return;

  if(text.at(i-1) == ' '){
    for(;i>0 && text.at(i-1)==' ';i--);
    if(i == 0) return;
  }
  for(;i>0 && text.at(i-1)!=' ';i--);
}

void insert(string s){
	text.insert(i,s);
	i += s.length();
}

void delChar(void){
	if(i != text.length()){
		text.erase(text.begin()+i);
	}
}

void delWord(void){
	int len = text.length();
	int gi=i;

	if(i == len) return;

	if(text.at(i) == ' '){
		for(;gi<len && text.at(gi)==' ';gi++);
		if(gi == len) return;
	}
	for(;gi<len && text.at(gi)!=' ';gi++);

	text.erase(text.begin()+i, text.begin()+gi);
}

int main(void){
	int n,m;
	string s,s2;
	char tmp;

	cin>>n;
	cin.get();

	while(n--){
		getline(cin,text);
		cin>>m;

		i=0;

		while(m--){
			cin>>s;
			getline(cin,s2);
			s2.erase(s2.begin(),s2.begin()+1);

			if(s == "forward"){
				if(s2 == "char"){
					forChar();
				}
				else{
					forWord();
				}
			}
			else if(s == "backward"){
				if(s2 == "char"){
					backChar();
				}
				else{
					backWord();
				}
			}
			else if(s == "insert"){
				s2.erase(s2.end()-1,s2.end());
				s2.erase(s2.begin(),s2.begin()+1);
				insert(s2);
			}
			else{
				if(s2 == "char"){
					delChar();
				}
				else{
					delWord();
				}
			}
		}
		text.insert(i,"^");
		cout<<text<<endl;
	}

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	string s;
	cin >> s;
	vector<int> cnt(26);
	rep(i, s.size()) cnt[s[i] - 'a']++;
	rep(i, 26) {
		if (cnt[i] & 1) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

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

using namespace std;

int main() {
	int N;
	char a[11234];
	scanf(" %d", &N);
	scanf(" %[^\n]", a);
	int tam = strlen(a);
	for (int i = 0;i < tam;i++){
		int l = a[i] - 'A';
		if (l+65+N > 90){
			printf("%c", 64+((l+65+N)-90));
		}else{
			printf("%c", l+65+N);
		}
	}
	puts("");
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

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

        char[] chars = s.toCharArray();

        StringBuilder sb = new StringBuilder();

        for (char chars2 : chars) {
            if (chars2 != 'B') {
                sb.append(String.valueOf(chars2));
            } else {
                int index = sb.length();
                if (index != 0) {
                    sb.delete(index - 1, index);
                }
            }
        }

        System.out.println(sb.toString());
    }
}


Measured memory_bytes: 9684
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define BUF 1e5
#define INF 1 << 30
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define bit(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
constexpr ll mod = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

signed main() {
    cin >> A >> B >> C;
    cout << max(C - (A - B), (ll)0) << endl;
}

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

#define ll          long long
#define int            ll
#define pb          push_back
#define ppb         pop_back
#define eb          emplace_back
#define	endl		'\n' 
#define max(a,b)	((a)>(b)?(a):(b))
#define min(a,b)	((a)<(b)?(a):(b))
#define vi          vector<int>
#define vii         vector<pair<int, int> >
#define mp          make_pair
#define mem1(a)     memset((a),-1,sizeof(a))
#define all(a)      (a).begin(),(a).end()
#define vs          vector<string>
#define F           first
#define S           second
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    (a)*((b)/gcd((a),(b)))
#define DECIMAL(n)  cout << fixed ; cout << setprecision(n);
#define FAST        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mi          map<int,int>
#define sz(x)       (ll)(x).size()
#define rep(i,a,b)  for(int i=(a);i<(b);i++)
#define pii         pair<int,int>

int solve()
{
	int n,w;
	cin>>n>>w;
	vii arr(n);
	rep(i,0,n)
	{
		int a,b;
		cin>>a>>b;
		arr[i]=mp(a,b);
	}
	int weight[w+1]={0};
	sort(all(arr));
	rep(i,0,n)
	{
		for(int j=w;j>=arr[i].F;j--)
		{
			weight[j]=max(weight[j],weight[j-arr[i].F]+arr[i].S);
			//cout<<weight[j]<<" "<<weight[j-arr[i].F]+arr[i].S<<" ";
		}
		//cout<<endl;
	}
	cout<<weight[w];
    return 0;
}
signed main()
{
    FAST
    #ifndef ONLINE_JUDGE 
        freopen("input.txt", "r", stdin); 
        freopen("output.txt", "w", stdout); 
    #endif 
    int t=1;
    //cin>>t;
    while(t)
    {
        solve();
        t--;
    }
    cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
    return 0;
}

Measured memory_bytes: 4544
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

int min(vector<int> &vec){
    int ret=vec[0];
    for(int i=1; i<(int) vec.size(); i++){
        ret=min(ret, vec[i]);
    }
    return ret;
}

int main(){
    string s;
    cin >> s;
    vector<int> tmp(26,-1);
    vector<int> max_(26,0);

    for(int i=0; i<(int) s.size(); i++){
        int c=s[i]-'a';
        max_[c]=max(i-tmp[c]-1, max_[c]);
        tmp[c]=i;
    }
    for(int i=0; i<26; i++){
        max_[i]=max(max_[i], (int) s.size()-tmp[i]-1);
    }
    cout << min(max_) << endl;
}

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

int n,d;
string s[222];
unordered_set<string>st[222];
bool used[222][222];
unordered_set<string>::iterator it,it2;

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  while(cin>>n,n){
    memset(used,0,sizeof(used));
    cin>>d;
    r(i,n)cin>>s[i];
    sort(s,s+n);
    r(i,n)st[i].clear();
    r(i,n){
      r(j,s[i].size()){
        string t=s[i];
        t.erase(t.begin()+j);
        st[i].insert(t);
      }
      r(j,s[i].size()+1){
        r(k,26){
          string t=s[i];
          t=t.substr(0,j)+(char)(k+'a')+t.substr(j);
          st[i].insert(t);
        }
      }
      r(j,s[i].size()+1){
        r(k,26){
          string t=s[i];
          t[j]=(char)(k+'a');
          st[i].insert(t);
        }
      }
      r(j,s[i].size()-1){
          string t=s[i];
          swap(t[j],t[j+1]);
          st[i].insert(t);
      }
    }
    int ans=0;
    if(d==1){
      r(i,n)r(j,n)if(i!=j&&!used[i][j]){{
        for(it=st[i].begin();it!=st[i].end();it++){
            if(s[j]==(*it)){
                used[i][j]=used[j][i]=1;
                cout<<s[i]<<','<<s[j]<<endl;
                ans++;
                break;
            }
          }
        }
      }
    }
    else{
      r(i,n)r(j,n)if(i!=j&&!used[i][j]){
        for(it=st[i].begin();it!=st[i].end();it++){
              if(st[j].count(*it)){
                used[i][j]=used[j][i]=1;
                cout<<s[i]<<','<<s[j]<<endl;
                ans++;
                break;
              }
          }
      }
    }
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 16836
#include <stdio.h>
#include <math.h>


int main(void){
  double n;
  double s[1000];
  int i;
  double ave;
  double a;
  double sum;

  while(1) {
    ave = 0;
    a = 0;
    sum = 0;
    scanf("%lf", &n);
    if (n == 0)
      break;
    for (i = 0; i < n; i++) {
      scanf("%lf", &s[i]);
      sum += s[i];
    }

    ave = sum / n;
  
    for(i = 0; i < n; i++) {
      a += (s[i] - ave) * (s[i] - ave);
    }

    printf("%f\n", sqrt(a / n));
  }
  
  
  return 0;
}



Measured memory_bytes: 2048
import numpy as np

N, M = map(int, input().split())
edge = [[] for i in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edge[a].append(b)
    edge[b].append(a)
# print(*edge, sep='\n')

# N, M = 3, 3
# edge = [[1, 2], [0, 2], [0, 1]]


def dfs(v):
    if sum(visited) == N:
        return 1

    res = 0
    for i in edge[v]:
        if visited[i] == 1:
            continue
        visited[i] = 1
        res += dfs(i)
        visited[i] = 0
    return res


visited = [0] * N

visited[0] = 1
ans = dfs(0)

print(ans)


Measured memory_bytes: 14448
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var N, A, B int
var S string

func main() {
	sc.Split(bufio.ScanWords)
	N, A, B = nextInt(), nextInt(), nextInt()
	S = nextStr()

	MAX := A + B
	now := 0
	foreign := 0
	for i := 0; i < N; i++ {
		if now >= MAX {
			fmt.Println("No")
			continue
		} else {
			if string(S[i]) == "a" {
				now++
				fmt.Println("Yes")
			} else if string(S[i]) == "b" && foreign < B {
				foreign++
				now++
				fmt.Println("Yes")
			} else {
				fmt.Println("No")
			}
		}
	}
}


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

int main() {
    int N, M;
    cin >> N >> M;
    int t1, t2;
    int x, y;
    x = -1;
    y = N+1;
    for(int i = 0; i < M; i++){
        cin >> t1 >> t2;
        x = max(x, t1);
        y = min(y, t2);
    }
    int a = y - x + 1;
    cout << max(0, a) << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int n,a,i,t=0,c[8]={},min=0,max;
  scanf("%d",&n);
  for (i=0;i<n;i++){
    scanf("%d",&a);
    if (a>=3200) t++;
    else c[(a-a%400)/400]++;
  }
  for (i=0;i<8;i++){
    if (c[i]) min++;
  }
  max=min+t;
  if (min==0) min=1;
  printf("%d %d\n",min,max);
  return 0;
}

Measured memory_bytes: 128