akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; 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 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 sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<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 set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N;
  cin >> N;
  vi w(N);
  rep(i,N) {
    cin >> w[i];
  }
  vi rw(N);
  int a = 0;
  rep(i,N) {
    a += w[i];
    rw[i] = a;
  }
  int k = rw[N-1] / 2;
  int minN = INF;
  int ind = 0;
  rep(i,N) {
    if(minN > abs(rw[i]-k)) {
      minN = abs(rw[i] - k);
      ind = i;
    }
  }
  cout << abs(rw[N-1] - 2 * rw[ind])<< endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lli=long long int;
using vi=vector<int>;  using vs=vector<string>; using gi=greater<int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define soao(c) sort((c).begin(),(c).end()) //昇順
#define sodo(c) sort((c).begin(),(c).end(),gi()) //降順
#define rev(c) reverse((c).begin(), (c).end())


int main(){
    int n; cin>>n;
    set<string> S;
    
    rep(i,n){
        string a; cin>>a;
        S.insert(a);
    }

    cout<<S.size()<<endl;
}

Measured memory_bytes: 19276
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>

ll powmod(ll a, ll b) {
	a %= MOD;
	ll res = 1;
	while (b > 0) {
		if (b % 2 == 1)res = res * a % MOD;
		a = a * a % MOD;
		b /= 2;
	}
	return res;
}

ll f[210000];
void cominit() {
	f[0] = 1;
	REP(i, 200000)f[i + 1] = f[i] * (i + 1) % MOD;
}

ll com(ll n, ll r) {
	return f[n] * powmod(f[r] * f[n - r], MOD - 2) % MOD;
}

ll perm(ll n, ll r) {
	return f[n] * powmod(f[n - r], MOD - 2) % MOD;
}

ll n, m, k, nans, mans, cnt;
int main() {
	cin >> n >> m >> k;
	cominit();
	cnt = com(n * m - 2, k - 2);
	REPO(i, n - 1) {
		nans += i * cnt % MOD * m * m % MOD * (n - i) % MOD;
		nans %= MOD;
	}
	REPO(i, m - 1) {
		mans += i * cnt * n * n % MOD * (m - i) % MOD;
		mans %= MOD;
	}
	cout << (nans + mans) % MOD << endl;
}

Measured memory_bytes: 1792
def insertionSort(A, N):
    print(" ".join(list(map(str, A))))
    for i in range(1, N):
        v = A[i]
        j = i - 1

        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1

        A[j + 1] = v

        print(" ".join(list(map(str, A))))

def main():
    N = int(input())
    A = [int(i) for i in input().split()]

    insertionSort(A, N)

main()



Measured memory_bytes: 5608
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#define ll long long
#define for(i,n) for(int i=0;i<n;i++)

using namespace std;

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


Measured memory_bytes: 256
char s[100][101];h;r[100],R,c[100],C,i,j;
main(w){scanf("%d%d",&h,&w);for(i=h;i;)scanf("%s",s[--i]);
for(i=h;i--;){int x=0;for(j=w;j--;)if(s[i][j]=='#')x=1;if(x)r[R++]=i;}
for(j=w;j--;){int x=0;for(i=h;i--;)if(s[i][j]=='#')x=1;if(x)c[C++]=j;}
for(i=0;i<R;i++){for(j=C;j--;)putchar(s[r[i]][c[j]]);puts("");}
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define t_times int t; cin >> t; while(t--)
#define parr(a, n) for(int __i = 0; __i < (int )n; __i++) cout << a[__i] << ' '; cout << '\n'
#define fr(i, p, n) for(int i = (int )p; i < (int )n; i++)
#define frn(i, p, n) for(int i = (int )p; i <= (int )n; i++)
#define rev(i, n, p) for(int i = (int )n; i >= (int )p; i--)
#define all(c) (c).begin(), (c).end()
#define sci(n) scanf("%d", &n)
#define scl(n) scanf("%lld", &n)
#define prin(n) printf("%d\n", n)
#define prln(n) printf("%lld\n", n)
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define bp __builtin_popcount
typedef long long int LL;
typedef unsigned long long ULL;
typedef unsigned int uint;
typedef pair< int, int> ii;
typedef vector< int> vi;

const int mod = 1e9 + 7;
const LL INF = 9e18 + 2e17;
const int inf = 2e9;
const int N = 1e5 + 22;
const double eps = 1e-10;
const double PI = 3.14159265;

int n, k, a[N], dp[N];

void _solve() {
    cin >> n >> k;
    fr(i, 0, n) cin >> a[i];
    fill(dp, dp + n, inf);
    dp[0] = 0;
    fr(i, 0, n)
        frn(j, 1, min(n - 1, k))
            dp[i + j] = min(dp[i] + abs(a[i + j] - a[i]), dp[i + j]);
    cout << dp[n - 1];
}
int main() {
    fastio;
    //t_times
    _solve();
    return 0;
}




Measured memory_bytes: 1024
package main

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

func solve() {
	a := scanInt()
	b, _ := strconv.Atoi(strings.Join(strings.Split(scanString(), "."), ""))
	fmt.Println(a * b / 100)
	return
}

var sc = bufio.NewScanner(os.Stdin)

func scanString() string {
	sc.Scan()
	return sc.Text()
}
func scanInt() int {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}
func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanString(), 64)
	return f
}
func Permute(nums []int) [][]int {
	n := factorial(len(nums))
	ret := make([][]int, 0, n)
	permute(nums, &ret)
	return ret
}
func permute(nums []int, ret *[][]int) {
	*ret = append(*ret, makeCopy(nums))

	n := len(nums)
	var i, j int
	for {
		for i = n - 2; i >= 0; i-- {
			if nums[i] < nums[i+1] {
				break
			}
		}
		if i < 0 {
			return
		}
		for j = n - 1; ; j-- {
			if nums[j] > nums[i] {
				break
			}
		}
		nums[i], nums[j] = nums[j], nums[i]
		for k, l := i+1, n-1; k < l; {
			nums[k], nums[l] = nums[l], nums[k]
			k++
			l--
		}
		*ret = append(*ret, makeCopy(nums))
	}
}

func factorial(n int) int {
	ret := 1
	for i := 2; i <= n; i++ {
		ret *= i
	}
	return ret
}
func makeCopy(nums []int) []int {
	return append([]int{}, nums...)
}
func gcd(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}
func main() {
	sc.Split(bufio.ScanWords)
	solve()
}


Measured memory_bytes: 1756
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

Int h, w, k;
vector<string> s;
vector<vector<Int>> ans;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> h >> w >> k;
	s.resize(h);
	for(auto &i:s) cin >> i;
	ans.resize(h, vector<Int>(w, 0));
	Int cnt = 1;
	for(Int i=0; i<h; ++i){
		Int l = -1;
		Int r = -1;
		for(Int j=0; j<w; ++j)
			if(s[i][j] == '#')
				r = j;
		for(Int j=0; j<w; ++j){
			if(s[i][j] == '#'){
				for(Int k=l+1; k<=j; ++k) ans[i][k] = cnt;
				if(j == r)
					for(Int k=j+1; k<w; ++k)
						ans[i][k] = cnt;
				++cnt;
				l = j;
			}
		}
	}
	for(Int i=0; i<h; ++i)
		for(Int j=0; j<w; ++j)
			if(ans[i][j] == 0)
				if(i >= 1 && ans[i-1][j] != 0)
					ans[i][j] = ans[i-1][j];
	for(Int i=h-2; i>=0; --i)
		for(Int j=0; j<w; ++j)
			if(ans[i][j] == 0)
				ans[i][j] = ans[i+1][j];
	for(auto i:ans)
		for(Int j=0; j<w; ++j)
			cout << i[j] << (" \n"[j+1==w]);
}

Measured memory_bytes: 1664
#include<iostream>
#include<algorithm>
#include<vector>
#include<climits>
#include<math.h>
using namespace std;

int N;
static const int MAX=20;
int x[MAX][MAX];
int y[MAX][MAX];
int A[MAX];

int counter(int x){
  if (x==0)return 0;
  return counter(x>>1)+(x&1);
}

void solve(){
  cin>>N;
  for(int i = 1; i <= N; i++) {
    cin >> A[i];
    for(int j = 1; j <= A[i]; j++) {
      cin >> x[i][j] >> y[i][j];
    }
  }
  int ans=0;
  for(int bits=1;bits<(1<<N);bits++){
    bool ok=true;
    for(int i=1;i<=N;i++){
      if (!(bits&(1<<(i-1))))continue;
      for(int j=1;j<=A[i];j++){
        if (((bits >> (x[i][j]-1)) & 1) ^ y[i][j])ok=false;
      }
    }
    if (ok) ans=max(ans,counter(bits));
  }
  cout<<ans<<endl;
  return;
}

int main(){
  solve();
  return 0;
}

Measured memory_bytes: 256
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
diff = float('inf')
for i in range(N):
    if abs(A-(T-0.006*H[i])) < diff:
        diff = abs(A-(T-0.006*H[i]))
        ans = i+1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;


int main() {

	int n, k;

	cin >> n >> k;
	

	
	if (n % k == 0) {
		cout << 0 << endl;
	}
	else {
		cout << 1 << endl;

	}

	

}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut aseq = vec![0 as i64; n];
    let mut bseq = vec![0 as i64; n];
    for i in 0..n {
        aseq[i] = read();
        bseq[i] = read();
    }
    let mut ans = 0;
    if aseq != bseq {
        let mut min_value = 1e+13 as i64;
        for i in 0..n {
            if aseq[i] <= bseq[i] {
                ans += aseq[i];
            } else {
                ans += aseq[i];
                min_value = std::cmp::min(min_value, bseq[i]);
            }
        }
        ans -= min_value;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; 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 sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  cout << (100000-N)%1000 << endl;
  return 0;
}

Measured memory_bytes: 3600
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int m = sc.nextInt();
		LocalDateTime l1 = LocalDateTime.of(2017,12,30,m,0);
		LocalDateTime l2 = LocalDateTime.of(2018,1,1,0,0);
		Duration d1 = Duration.between(l1, l2);
		System.out.println(d1.toHours());
	

	}

}


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

int main(){
  LL c=0, ind=1;
  LL n;
  cin>>n;
  for(int i=0; i<n; i++){
    LL a;
    cin>>a;
    if(a==ind){
      c++;
      ind++;
    }
   
  }
  if(c==0) cout<<-1<<"\n";
  else cout<<n-c<<"\n";
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>


using namespace std;


int main() {
    const string separator = "####################";
    int n;
    cin >> n;

    int house[4][3][10] {};
    
    for (int i = 0, b, f, r, v; i < n; ++i)
    {
        cin >> b >> f >> r >> v;
        house[b - 1][f - 1][r - 1] += v;
    }

    
    for (const auto& b : house)
    {
        for (const auto& f : b)
        {
            for (const auto& r : f)
            {
                cout << " " << r;
            }
            cout << endl;
        }
        if(b != house[3])
            cout << separator << endl;
    }

    return 0;
} 

Measured memory_bytes: 3228
import scala.collection.mutable.ListBuffer
import scala.io.StdIn
object Main extends App {

  val n = StdIn.readLine().trim.toInt
  
  val result = (0 until n).foldLeft(ListBuffer.empty[String], Set.empty[String]){
    case ((acc, dict), _) =>
    val cmd = StdIn.readLine().split(' ')
    if(cmd(0) == "insert"){
      (acc, dict + cmd(1))
    } else {
      if(dict.contains(cmd(1))) {
        (acc += "yes", dict)
      } else {
        (acc += "no", dict)
      }
    }
  }
  println(result._1.mkString(f"%n"))

}


Measured memory_bytes: 484188
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

fn main(){
    let n: usize = read_as_vec()[0];

    let mut a: Vec<Vec<u64>> = vec![];

    for _ in 0..2{
        a.push(read_as_vec::<u64>());
    }

    let mut ans = 0;
    for i in 0..n{
        let mut tmp = 0;
        for j in 0..i+1{
            tmp += a[0][j];
        }

        for j in i..n{
            tmp += a[1][j];
        }

        ans = cmp::max(ans, tmp);
    }

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


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

#define int long long

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, k, s;
    cin >> n >> k >> s;
    for(int i = 0; i < k; i++){
    	cout << s << ' ';
    }
    for(int i = k; i < n; i++){
    	cout << (int)((s == 1e9) ? (1e9 - 1): 1e9) << ' ';
    }
    cout << '\n';
}

Measured memory_bytes: 1280
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
long long mod=(long long)1e09+7;
int inf=1<<30;
long long llinf=1ll<<60;

int in(void){
    int i;scanf("%d",&i);
    return i;
}
long long llin(void){
    long long i;scanf("%lld",&i);
    return i;
}
double din(void){
    double i;scanf("%lf",&i);
    return i;
}
void chin(char s[]){
    scanf("%s",s);
}
void print(int a){
    printf("%d\n",a);
}
void llprint(long long a){
    printf("%lld\n",a);
}
void dprint(double a){
    printf("%.10f\n",a);
}
void print2(int a,int b){
    printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
    return a>b?a:b;
}
long long min(long long a,long long b){
    return a<b?a:b;
}
int cmp(const void *a,const void *b){
    return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
    return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
    return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
    return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
    int t=*a;
    *a=*b;
    *b=t;
}
long long gcd(long long x,long long y){
    return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct
#define LIMIT 7368792
int b[LIMIT];

int main(void){
    int n,m,c,i,j;
    while(1){
        m=in();
        n=in();
        if(!n)break;
        c=0;
        MEMSET(b);
        for(i=m;i<LIMIT;i++){
            if(b[i])continue;
            b[i]=1;
            c++;
            for(j=2*i;j<LIMIT;j+=i)b[j]=1;
            if(c==n)break;
        }
        for(i=m+1;i<LIMIT;i++){
            if(!b[i]){
                print(i);
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 30544
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1001001001;
const ll LONGINF = 1001001001001001LL;
const ll MOD = 1000000007LL;

const double PI = acos(-1);
const double EPS = 1e-9;
int main() {
    int N; cin >> N;
    vector< pair<int, int> > points(N);
    for(int i=0; i<N; i++) {
        int x, y; cin >> x >> y;
        points[i] = make_pair(x, y);
    }

    sort(points.begin(), points.end(), [](auto a, auto b) {
            double ra = atan2(a.second, a.first);
            double rb = atan2(b.second, b.first);
            return ra < rb;
        });

    double ans = 0;
    for(int i=0; i<N; i++) {
        double x = 0, y = 0;
        for(int l=0; l<N; l++) {
            int k = (i + l) % N;
            x += points[k].first, y += points[k].second;
            ans = max(ans, sqrt(x*x + y*y));   
        }
    }
    printf("%.12f\n", ans);
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

class Program
{
	static void Main(string[] args)
	{

		while (true)
		{
			var input = Console.ReadLine().Split().ToArray();
	
			var a = int.Parse(input[0]);
			var op = input[1];
			var b = int.Parse(input[2]);


			if (op == "?") break;

			if (op == "+")
			{
				System.Console.WriteLine(a + b);
			}
			else if (op == "-")
			{
				System.Console.WriteLine(a - b);
			}
			else if (op == "*")
			{
				System.Console.WriteLine(a * b);
			}
			else
			{
				System.Console.WriteLine(a / b);
			}
		}
	}
}


Measured memory_bytes: 18332
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    for(;;){
    int H,W; cin >> H >> W;
    if(H==0 && W==0) break;
    rep(i,W){
        cout << '#';
    }
    cout << endl;
    rep(i,H-2){
    rep(i,W){
        if(!i || i==W-1) cout << '#';
        else cout << '.';
    }
    cout << endl;
    }
    rep(i,W) cout << '#';
    cout << endl;
    cout << endl;
    }

    return 0;
}


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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	int n;
	cin >> n;
	int aCount[(n-1)/2];
	FOR(i,0,(n-1)/2)aCount[i] = 0;
	FOR(i,0,n){
		int a;
		cin >> a;
		aCount[a/2]++;
	}
	bool able = true;
	if(n % 2 == 1)aCount[0]++;
	FOR(i,0,(n-1)/2)
		if(aCount[i] != 2)able = false;
	if(!able){
		ANS(0);
		return 0;
	}
	ll ans = 1;
	FOR(i,0,n/2)
		ans = ans * 2 % MOD;
	ANS(ans);
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#include<queue>
using namespace std;
int main(){
  int h,w;
  cin>>h>>w;
  queue<pair<int,int>> q;
  vector<vector<int>> d(h+2,vector<int>(w+2,0));
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      char block;
      cin>>block;
      if(block=='.'){
        d.at(i).at(j)=1;
      }
      else q.push({i,j});
    }
  }
  int count=0;
  vector<int> dx={1,0,-1,0};
  vector<int> dy={0,1,0,-1};
  while(!q.empty()){
    queue<pair<int,int>> qq;
    while(!q.empty()){
      pair<int,int> p=q.front();
      q.pop();
        for(int l=0;l<4;l++){
          if(d.at(p.first+dx.at(l)).at(p.second+dy.at(l))){
            d.at(p.first+dx.at(l)).at(p.second+dy.at(l))=0;
            qq.push({p.first+dx.at(l),p.second+dy.at(l)});
          }
        }
    }
    count++;
    q=qq;
  }
  cout<<count-1<<endl;
}

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

using namespace std;

int main() {
	int x, y;
	while(cin >> x >> y) {
		if (x == 0 && y == 0) {
			break;
		}
	vector< vector<int> > data(y+1, vector<int>(x, 0));
	vector< vector<long long int> > cc(y+1, vector<long long int>(x, 0));
	for (int i = 0; i < y; i++) {
		for (int j = 0; j < x; j++) {
			cin >> data[i][j];
			if (i == 0 && data[i][j] != 1) {
				cc[i][j] = 1;
			}
		}
	}
	long long int ccc = 0;
	for (int i = 0; i < y-1; i++) {
		for (int j = 0; j < x; j++) {
			if (data[i][j] == 0) {
				if (i+1 < y+1) {
					if (j-1 >= 0) {
						if (data[i+1][j-1] == 0) {
							cc[i+1][j-1] += cc[i][j];
						}
					} 
					if (j+1 < x) {
						if (data[i+1][j+1] == 0) {
							cc[i+1][j+1] += cc[i][j];
						}
					}
					if (data[i+1][j] != 1) {
						cc[i+1][j] += cc[i][j];
					}
				}
			} else if (data[i][j] == 2) {
				if (i+2 < y+1) {
					if (data[i+2][j] != 1) {
						cc[i+2][j] += cc[i][j];
					}
				}
			}
			//cout << i << ' ' << j << endl;
		}
	}
	//cout << 'a' << endl;
	/*
	cout << endl;
	for (int i = 0; i < y+2; i++) {
		for (int j = 0; j < x; j++) {
			cout << cc[i][j] << ' ';
		}
		cout << endl;
	}*/
	for (int i = 0; i < x; i++) {
		ccc += cc[y][i]+cc[y-1][i];
	}
	cout << ccc << endl;
	}
	return 0;
}

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

int main(){
	int a, b;
	cin >> a >> b;
	cout << a - b +1 << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using  namespace std;
#define ll long long
int main()
{
    ll n;
    cin>>n;
   ll  sum=0;
    while(n>5)
    {
        if(n>=500)
        {
            sum+=1000*(n/500);
           // sum*=1000;
            n=n%500;
        }
        else if(n>=5)
        {
            sum+=5*(n/5);

            n=n%5;

        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define max(x,y) ((x) > (y) ? (x) : (y))
#define min(x,y) ((x) < (y) ? (x) : (y))

int neib[101][200];
int used[101];
int onceused[101];
int rings[105];
int dfs(int x){
  int i;
  used[x] = 1;
  onceused[x] = 0;
  int res = 1;
  for(i = 0;i < rings[x];i++){
    if(used[neib[x][i]] == 0){
      int tmp = dfs(neib[x][i]);
      res = max(res, 1 + tmp);
    }
  }
  used[x] = 0;
  return res;
}


int main(){
  int i, j;
  while(1){
    int n, ans = 0;
    memset(rings, 0, sizeof(rings));
    memset(neib, 0, sizeof(neib));
    memset(onceused, 0, sizeof(onceused));
    memset(used, 0, sizeof(used));
    scanf("%d", &n);
    if(n == 0)return 0;
    for(i = 0;i < n;i++){
      int a, b; 
      scanf("%d%d", &a, &b);
      onceused[a] =onceused[b] = 1;
      neib[a][rings[a]++] = b;
      neib[b][rings[b]++] = a;
    }

    for(i = 1;;i++){
      for(j = 1;j < 101 ;j++){
	if(rings[j] == i){
	  int tmp = dfs(j);
	  ans = max(ans,tmp);
	}
      }
      int fin = 1;
      for(j = 1;j < 101;j++){
	if(onceused[i] == 1){
	  fin = 0;
	  break;
	}
      }
      if(fin)break;
    }
    printf("%d\n",ans);
  }
}

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

int main(void){
    int n, i, j;
    scanf("%d",&n);
    if(n==1){
        printf("Yes\n");
    }
    else{
        int h[n];
        for(i=0;i<n;i++){
            scanf("%d",&h[i]);
 //           printf("%d\n",h[i]);
        }
        for(j=n-2;j>=0;j--){
            if(h[j]-h[j+1]>1){
 //               printf("%daaa",j);
                printf("No\n");
                exit(0);
            }
            if(h[j]-h[j+1]==1){
            h[j] = h[j] - 1;
            }
        }   
        printf("Yes\n");
    }
    return 0;
    
}



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

typedef long long ll;
typedef double dd;

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

const int mx=1e6+11;
const long double PI=3.14159265358979;

#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define sqr(a) ((a) * (a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sa(v) sort(v.begin(),v.end())
#define sd(v) sort(v.begin(),v.end(),greater<>())
#define rev(s) reverse(s.begin(),s.end())
#define tt int t; cin>>t; while(t--)
#define lo(i,a,b) for(ll i=a;i<b;i++)
#define be(a) (a).begin(),(a).end()

#define yes cout<<"YES"<<nl;
#define no cout<<"NO"<<nl;

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

int main()
{
   su;
   int n,k,sum=0;
   cin>>n>>k;
   int a[n];
   lo(i,0,n)   cin>>a[i];
   sort(a,a+n);
   lo(i,0,k)
   {
      sum+=a[i];
   }
   cout<<sum<<nl;
   return 0;
}


Measured memory_bytes: 3644
var GET = (function () {function f(s) {return new g(s);}function g(s) {this._s = s.trim().split("\n");}g.prototype.getValue = function (n) {return this._s[n];};g.prototype.getArray = function (n) {return this.stoa(this._s[n]);};g.prototype.slice = function (s, limit) {return this._s.slice(s, +limit + s || undefined).map(v => this.stox(v));};g.prototype.sliceArray = function (s, limit) {return this._s.slice(s, +limit + s || undefined).map(v => this.stoa(v));};g.prototype.stoa = function (s) {return s.split(" ").map(v => this.stox(v));};g.prototype.stox = function (v) {var i = +v;return (i === i) ? i : v;};return f;})();
var o = GET(require("fs").readFileSync("/dev/stdin", "utf8"));

console.log(main());
function main(){
    var weekly = ["SUN","MON","TUE","WED","THU","FRI","SAT"];

    var S = o.getValue(0);

    var index = weekly.findIndex((v) => {
        return v === S
    });

    return 7 - index;
}

Measured memory_bytes: 21192
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace At
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadInts();
            if (input[0] - input[1]<=0)
            {
                WriteLine(0);
            }
            else
            {
                WriteLine(input[0] - input[1]);
            }
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

const string YES = "Yes";
const string NO = "No";

void solve(std::string S, std::string T){
    if(S == T.substr(0, S.size())){
        cout<<YES<<endl;
    }else{
        cout<<NO<<endl;
    }
}

int main(){
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(S, T);
    return 0;
}


Measured memory_bytes: 3648
from heapq import heappop, heappush

n,m,s = map(int,input().split())
e = [[] for _ in range(n)]
for i in range(m):
  u,v,a,b = map(int,input().split())
  u -= 1
  v -= 1
  e[u].append((v,a,b))
  e[v].append((u,a,b))
c = []
d = []
for i in range(n):
  x,y = map(int,input().split())
  c.append(x)
  d.append(y)

INF = float('inf')
def dijkstra(s,n,g): # sからの最短距離 頂点数n g[v]=[(u1,w1),(u2,w2)....]:vからuへの有向辺があり、重みw
  que = []
  d = [INF for _ in range(n)]
  d[s] = 0
  heappush(que,(0,s))
  while len(que) > 0:
    p = heappop(que)
    v = p[1]
    if d[v] < p[0]:
      continue
    for u,w in g[v]:
      if d[u] > d[v]+w:
        d[u] = d[v]+w
        heappush(que,(d[u],u))
  return d

def newv(v,s):
  return v*2500+s

s = min(s,2499)
e2 = [[] for _ in range(n*2500)]
for u in range(n):
  for j in range(2500):
    if j+c[u] < 2500:
      e2[newv(u,j)].append((newv(u,j+c[u]),d[u]))
    #e2[newv(u,j)].append((newv(u,min(j+c[u],2499)),d[u]))
    for v,a,b in e[u]:
      if j >= a:
        e2[newv(u,j)].append((newv(v,j-a),b))

l = dijkstra(newv(0,s),n*2500,e2)
for i in range(1,n):
  ans = INF
  for j in range(2500):
    ans = min(l[newv(i,j)],ans)
  print(ans)


Measured memory_bytes: 116316
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i

output = "Yay!"
antennas = [a, b, c, d, e]
antennas_combi = antennas.combination(2)

antennas_combi.each do |antenna_combi|
    if (antenna_combi[0] - antenna_combi[1]).abs > k
        output = ":("
        break
    end
end

puts output

Measured memory_bytes: 1788
#include<iostream>
#include<vector>
using namespace std;
int n, a[1000], s; vector<int>p;
int main() {
	while (true) {
		cin >> n;
		if (!n) { break; }
		for (int i = 0; i < n + 1; i++) {
			cin >> a[i];
		}
		for (int i = 0; i < n + 1; i++) {
			p.clear();
			for (int j = 0; j < n + 1; j++) {
				if (i != j) {
					p.push_back(a[j]);
				}
			}
			for (int j = 0; j < p.size() - 1; j++) {
				if (j == 0) { 
					s = p[j + 1] - p[j];
				}
				else if (p[j + 1] - p[j] != s) {
					goto E;
				}
			}
			cout << a[i] << endl;
			goto otawa;
		E:;
		}
	otawa:;
	}
}

Measured memory_bytes: 1220
#include<stdio.h>
int main(void)
{
	int a,b,x;
	scanf("%d %d",&a,&b);
	if(a>b){
		printf("%d",2*a-1);
	}
	else if(b>a){
		printf("%d",2*b-1);
	}
	else{
		printf("%d",2*a);
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <cstring>
using namespace std;
int main() {
  char ch;
  int sum[26]={};
  while(cin>>ch){
    ch=tolower(ch);
    if(isalpha(ch)){
    sum[ch-'a']++;
   }
  }
  for(int i=0;i<=25;i++){
    printf("%c : %d\n",i+'a',sum[i]);
  }
  return 0;
}

Measured memory_bytes: 1124
#include<stdio.h>

void swap(int* a,int* b)
{*a+=*b;*b=*a-*b;*a-=*b;}

int main(){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if(b<a)swap(&a,&b);

  if(a<c && c<b)
    printf("Yes\n");
  else printf("No\n");
		
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;

int main() {
	string s;
	bool flag;
	cin >> s;
	REP(i,26){
		flag=false;
		REP(j,s.length())
			if((char)(i+'a')==s[j]) flag = true;
		if(!flag){ cout << (char)(i+'a') << endl; return 0;}
	}
	cout << "None" << endl;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define _h cout<<"here"<<endl;
#define fill(a,v) memset(a,v,sizeof(a));
#define all(v) v.begin(),v.end()
#define rep(i,n) for(int i=0;i<n;i+=1)
#define prd(a,n) rep(i,n) cout<<a[i]<<" \n"[i==n-1];// printf("%s\n"," " );
#define ff first
#define ss second
#define pu push_back
const int inf = 1e9+10;
const ll INF = 2e18+10;
const int Mod = 1e9+7;
const int MAXN = 1000010;
const int N=1e3+10;
const int M=210;
const int M1=1e9+7;
const int M2=1e9+9;
const int base=131;
int main()
{
  ios::sync_with_stdio(0), cin.tie(0); cout.tie(0);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  int d,t,s;
  cin>>d>>t>>s;
  if(d<=(t*s)) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(x, to) for (int x = 0; x < (to); x++)
#define REP(x, a, to) for (int x = (a); x < (to); x++)
#define EPS (1e-14)
#define _PA(x,N) rep(i,N){cout<<x[i]<<" ";}cout<<endl;
#define _PA2(x,H,W) rep(i,(H)){rep(j,(W)){cout<<x[i][j]<<" ";}cout<<endl;}

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef complex<double> Complex;
typedef vector< vector<int> > Mat;

int N;
string s;
char ans[100005];

int ok() {
	for (int i = 1; i < N - 1; i++) {
		int p = (i - 1 + N) % N;
		int q = (i + 1) % N;
		if (s[i] == 'o' && ans[i] == 'S') {
			ans[q] = ans[p];
		} else if (s[i] == 'o' && ans[i] == 'W') {
			ans[q] = ans[p] == 'S' ? 'W' : 'S';
		} else if (s[i] == 'x' && ans[i] == 'S') {
			ans[q] = ans[p] == 'S' ? 'W' : 'S';
		} else if (s[i] == 'x' && ans[i] == 'W') {
			ans[q] = ans[p];
		}
	}

	for (int i = 0; i < N; i++) {
		int p = (i - 1 + N) % N;
		int q = (i + 1) % N;
		if (s[i] == 'o' && ans[i] == 'S') {
			if (ans[p] != ans[q]) return 0;
		} else if (s[i] == 'o' && ans[i] == 'W') {
			if (ans[p] == ans[q]) return 0;
		} else if (s[i] == 'x' && ans[i] == 'S') {
			if (ans[p] == ans[q]) return 0;
		} else if (s[i] == 'x' && ans[i] == 'W') {
			if (ans[p] != ans[q]) return 0;
		}
	}
	return 1;
}

void solve() {
	int res = 0;
	char t[2] = {'S', 'W'};
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < 2; j++) {
			ans[0] = t[i];
			ans[1] = t[j];
			res |= ok();
			if (res) break;
		}
		if (res) break;
	}

	if (res) {
		for (int i = 0; i < N; i++) {
			cout << ans[i];
		}
		cout << endl;
	} else {
		cout << -1 << endl;
	}
}

int main() {
	cin >> N;
	cin >> s;
	solve();
	return 0;
}




Measured memory_bytes: 640
#include <iostream>
#include <cmath>
using namespace std ;
int main()
{
    int a[3] ;
   for (int i=0;i<3;i++)
   {
       cin >>a[i];
   }
    if (a[0]!=a[1] and a[0]!=a[2] and a[1]==a[2])
        cout << "Yes";
    else if (a[1]!=a[0] and a[1]!=a[2] and a[0]==a[2])
        cout<<"Yes";
    else if(a[2]!=a[0] and a[2]!=a[1] and a[0]==a[1])
        cout <<"Yes";
    else cout <<"No";

    return 0 ;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kishan Sairam Adapa
 */

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define ll long long int
#define MOD ((int)(1e9) + 7)

using namespace std;

class BChocolate {
public:
    void solve(istream& cin, ostream& cout) {
        ll n, d, x;
        cin >> n >> d >> x;
        ll ans = 0;
        for(int i=0; i<n; i++) {
            ll tp;
            cin >> tp;
            x += (d-1) / tp + 1;
        }
        cout << x << '\n';
    }
};


int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    BChocolate solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

N = int(input())
string_list = [input() for i in range(N)]

counter = 0
#左端がb and 右端がa の数
ab = 0
#ab以外で右端がaの数
a = 0
#ab以外で左端がbの数
b = 0

for s in string_list:
    #ここで一つの文字列内にABが複数ある場合が抜けてた
    if 'AB' in s:
        counter += s.count('AB')
    if s[0] == 'B' and s[-1] == 'A':
        ab += 1
    elif s[0] == 'B':
        b += 1
    elif s[-1] == 'A':
        a += 1

c = min(a,b)
d = max(a,b)
if d == 0 and ab > 0:
    counter += ab - 1
else:
    counter += c + ab
'''
if ab == 0:
    counter += min(a,b)
elif a + b == 0:
    counter += ab - 1
else:
    counter += min(a,b) + ab
'''
print(counter)

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

int main() {
	int n,m;
	cin >> n >> m;
	vector<vector<int>> s(n,vector<int>(2));
	for (int i=0;i<n;i++) {
		for (int j=0;j<2;j++) {
			cin >> s[i][j];
		}
	}
	sort(s.begin(),s.end());
	long count = 0;
	long yen = 0;
	for (int i=0;i<n;i++){
		for (int j=0;j<s[i][1];j++){
			yen += s[i][0];
			count++;
			if (count >= m)break;
		}
		if (count >= m)break;
	}
	cout << yen << endl;
}


Measured memory_bytes: 5760
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from collections import deque, Counter, defaultdict
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import math
from functools import reduce
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
def lcm_base(a, b):
    return (a * b) // gcd(a, b)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def main():
  N = int(readline())
  L = list(map(int, readline().split()))
  L.sort()
  ans = 0
  
  for i in range(N-2):
    a = L[i]
    for j in range(i+1, N-1):
      b = L[j]
      k = bisect_left(L, a+b)
      ans += (k-(j+1))
  print(ans)
  
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 14700
#include <stdio.h>
int main(void) {
  int a,b,d,r;
  double f;
  scanf("%d %d" ,&a, &b);
  d = a / b;
  r = a % b;
  f = 1.0 * a / b;

  printf("%d %d %f\n",d,r,f );
  return 0 ;



}



Measured memory_bytes: 2104
import java.util.Scanner;

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

		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
		
		if (b%a == 0) {
			System.out.println(a+b);
		} else {
			System.out.println(b-a);
		}
	}
}

Measured memory_bytes: 22612
using static System.Math;
using System;

public class hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var d = int.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        var ans = 0;
        for (int i = 0; i < n; i++) ans += Max(a[i] - d, 0);
        if (ans == 0) Console.WriteLine("kusoge");
        else Console.WriteLine(ans);
    }
}



Measured memory_bytes: 17968
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
 
using namespace std;
using value_t = unsigned long long;
 
int main() {
    value_t A, B;
    cin >> A; // 010
    cin >> B; // 100
 
    if (A == B) {
        cout << A;
        return 0;
    }
 
    bool oddA = A % 2 == 0; // 1
    bool oddB = B % 2 == 0; // 1
 
    value_t result = 0;
    if (oddA == oddB) {
        result = oddA ? 0 : 1;
        result += (B - A) >> 1;
    } else {
        result = 1 + ((B - A - 1) >> 1);
    }
    result %= 2;
    int k = 1;
    value_t pow2K = 2;
 
    while (pow2K <= B) {
        int modA = (A >> k) % 2;
        int modB = (B >> k) % 2;
 
        int resA = (modA == 1 && !oddA) ? 1 : 0;
        int resB = (modB == 1 &&  oddB) ? 1 : 0;
 
        if ((resA + resB) % 2 == 1)
            result += pow2K;
 
        pow2K = pow2K << 1;
        k += 1;
    }
 
    cout << result;
    return 0;
}

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

int main() {
int N,L;
cin >> N >> L;
vector<string>A(N);
for(int i=0;i<N;i++){
    cin >> A.at(i);
}
sort(A.begin(),A.end());
string C;
for(int j=0;j<N;j++){
    C+=A.at(j);
}
cout << C ;
}

Measured memory_bytes: 3640
#include <stdio.h>
#include <limits.h>
#include <math.h>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<bitset<16> >(x) << endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 100000000;
typedef double D;
const double EPS = 1e-8;
const double PI = 3.14159;
//int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
typedef pair<int, int> P;

/** Problem0122 : Sumer of Phyonkichi **/
int dx[12] = {-1, 0, 1, -2, 2, -2, 2, -2, 2, -1, 0, 1},
dy[12] = {-2, -2, -2, -1, -1, 0, 0, 1, 1, 2, 2, 2};
int N;
vector<P> p;


bool dfs(int px, int py, int k)
{
	//printf("(%d, %d)\n", px, py);
	if (k>=N) return true;
	
	bool res = false;
	for (int y=-1; y<=1; y++) {
		for (int x=-1; x<=1; x++) {
			for (int i=0; i<12; i++) {
				int nx = px+dx[i], ny = py+dy[i];
				int sx = p[k].first+x, sy = p[k].second+y;
				
				if_range(nx, ny, 10, 10) {
					if_range(sx, sy, 10, 10) {
						if (nx == sx && ny == sy) {
							res |= dfs(nx, ny, k+1);
						}
					}
				}
			}
		}
	}
	
	return res;
}


int main()
{
	P s;
	
	while (cin>>s.first>>s.second, s.first||s.second) {
		cin>>N;
		p.clear();
		
		rep(i, N) {
			int x, y;
			cin>>x>>y;
			p.push_back(P(x, y));
		}
		
		cout << (dfs(s.first, s.second, 0)?"OK":"NA") << endl;
	}
}

Measured memory_bytes: 1188
#include <stdio.h>

int main(){

  int a,b,c;

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

  if(a+b==c){
    printf("Yes\n");
  }else if(a+c==b){
    printf("Yes\n");
  }else if(c+b==a){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String ans = "Good";
        char[] c = S.toCharArray();

        for(int i = 0; i < 3; i++){
            if(c[i] == c[i + 1]){
                ans = "Bad";
                break;
            }
        }
        System.out.print(ans);
    }
}

Measured memory_bytes: 23252
#include <stdio.h>

int main(void) {
  int n;
  scanf("%d", &n);

  long long int ans = 1;
  for (int i = 0; i < n; i++) {
    long long int num;
    scanf("%lld", &num);
    
    if (num == 0) {
      printf("0");
      return 0;
    }
    
    if (ans >= 0 && ans <= 1000000000000000000 / num)
      ans *= num;
    else
      ans = -1;
  }
  
  printf("%lld", ans);
  
  return 0;
}


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

const int N = 1e5 + 10;
const long long mod = 1e9 + 7;

char s[N];
int cnt[26];

int main(){
	int n;
	long long ans;
	scanf("%d",&n);
	scanf("%s", s + 1);
	memset(cnt, 0, sizeof(cnt));
	ans = 1;
	for (int i = 1; i <= n; i++) cnt[s[i] - 'a']++;
	for (int i = 0; i < 26; i++){
		ans *= cnt[i] + 1;
		ans %= mod;
	}
	ans = (ans - 1 + mod) % mod;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int N,K;
    cin >> N >> K;
    string S;
    cin >> S;
    int c = 0;
    vector<int> B;
    int ans = 0;
    REP(i, N-1){
        if(S[i]==S[i+1]){
            c++;
        }else{
            B.pb(c);
            ans += c;
            c = 0;
        }
    }
    B.pb(c);
    ans += c;

    int n = B.size();
    REP(i, K){
        if(n >= 3){
            ans += 2;
            n -= 2;
        }else if(n >= 2){
            ans += 1;
            n -= 1;
        }else{
            break;
        }
    }

    pr(ans);
}

Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define op_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define fo(i,a,b) for(int i=a; i <b; i++)
#define ff first
#define ss second
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef map<int,int> mpii;
typedef map<ll,ll> mpll;
typedef map<int,ll> mpil;
typedef map<ll,int> mpli;

ll getgcd(ll a, ll b){
  if(a ==0 && b == 0){
    return 0LL;
  }
  if(b == 0){
    return a;
  }
  return getgcd(b, a%b);
}

ll bigmod(ll a, ll m, ll mod){
  ll ret = 1;
  while(m){
    if((m%2)==1){
      ret = (ret*a)%mod;
    }
    a = (a*a)%mod;
    m /= 2;
  }
  return ret%mod;
}

int main(){
  op_io;
  ll n,zero=0;
  cin>>n;
  ll mod = 1000000007LL;
  map <pll,ll> mp;
  for(int i=0;i<n;i++){
    ll a,b;
    cin>>a>>b;
    ll gcd=getgcd(a,b);
    if(gcd==0) zero++;
    else{
      a/=gcd,b/=gcd;
      if(a<0) a=-a,b=-b;
      mp[{a,b}]++;
    }
  }
  ll ans = 1;
  for(auto x: mp){
    if(x.ss == 0){
      continue;
    }
    ll tmp = bigmod(2LL, x.ss, mod);
    ll a = x.ff.ff, b = x.ff.ss;
    b = -b;
    if(b < 0){
      b = -b; a = -a;
    }
    if(mp.count({b,a})){
      tmp = (tmp + bigmod(2LL, mp[{b,a}], mod) + mod - 1)%mod;
      mp[{b,a}] = 0;
    }
    ans = (ans*tmp)%mod;
  }
  ans = (ans +zero+ mod - 1)%mod;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 16092
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    int N, K, X, Y; cin >> N >> K >> X >> Y;
    cout << min(N, K)*X + max(N-K, 0)*Y << endl;
}

Measured memory_bytes: 256