akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long N, long long K, std::vector<long long> p){
  vector<long double> pp(N);
  REP(N){
    pp[i]=(p[i]+1)/2.0;
  }
  long double ans=0.0;
  long double sum=0.0;
  REP(K){
    sum+=pp[i];
  }
  ans=sum;
  REP(N-K){
    sum+=pp[i+K]-pp[i];
    ans=max(ans,sum);
  }
  cout<<ans<<endl;
}

int main(){
  cout<<setprecision(1000);
  cin.tie(0);
  ios::sync_with_stdio(false);
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> p(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&p[i]);
    }
    solve(N, K, std::move(p));
    return 0;
}


Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        while (true){
            int x = sc.nextInt();
            int y = sc.nextInt();
            if (x == 0 && y == 0)
                break;
            if (x > y)
                System.out.println(y + " " + x);
            else
                System.out.println(x + " " + y);
        }
    }
}



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


int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a.at(i);
  
  ll mindiff = 100000000000000;

  for(ll i=-100;i<=100;++i){
    ll diff = 0;
    rep(j,n){
      ll num = a.at(j)-i;
      diff += num*num;
    }
    mindiff = min(mindiff,diff);
  }
  
  cout << mindiff << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <cstdio>
using namespace std;
int a[200007];
int fastin(){
	register int i; register char ch;
	while (ch = getchar(), ch < '0' || ch > '9');
	i = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9') i = i * 10 + ch - '0';
	return i;
}
int main(){
	register int n, i, lastzero;
	register long long ans;
	n = fastin();
	for (i = 1; i <= n; ++i) a[i] = fastin();
	if (a[1]) {
		puts("-1");
		return 0;
	}
	ans = 0;
	lastzero = 1;
	for (i = 2; i <= n; ++i) {
		if (a[i] > i - lastzero || a[i] - a[i - 1] > 1) {
			puts("-1");
			return 0;
		}
		if (a[i] == 0) lastzero = i;
		if (a[i] == a[i - 1] + 1) ++ans;
		else ans += a[i];
	}
	printf("%lld", ans);
	return 0;
}

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

using namespace std;

int main(){
    int n, m , c, x = 0; cin>>n>>m>>c;
    vector<int> b(m);
    for(int i=0; i<m; ++i) cin>>b[i];
    for (int i=0; i<n; ++i){
        int y = 0;
        for (int j=0; j<m; ++j){
           int d; cin>>d;
            y+=(d*b[j]);
        }
        if (y + c> 0) x++;
    }
    cout<<x;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, a, b, c;
    cin >> n >> a >> b >> c;
    vector<string> s(n);
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
    }
    vector<string> ret;
    bool ok = true;
    for (int i = 0; i < n; ++i) {
        if (s[i] == "AB") {
            if (a == 0 && b == 0) {
                ok = false;
                break;
            } else if (a > b) {
                ret.push_back("B");
                a--, b++;
            } else if (a < b) {
                ret.push_back("A");
                a++, b--;
            } else {
                if (i != n - 1 && s[i + 1] == "AC") {
                    ret.push_back("A");
                    a++, b--;
                } else {
                    ret.push_back("B");
                    a--, b++;
                }
            }
        } else if (s[i] == "BC") {
            if (b == 0 && c == 0) {
                ok = false;
                break;
            } else if (b > c) {
                ret.push_back("C");
                b--, c++;
            } else if (b < c) {
                ret.push_back("B");
                b++, c--;
            } else {
                if (i != n - 1 && s[i + 1] == "AB") {
                    ret.push_back("B");
                    b++, c--;
                } else {
                    ret.push_back("C");
                    b--, c++;
                }
            }

        } else if (s[i] == "AC") {
            if (a == 0 && c == 0) {
                ok = false;
                break;
            } else if (a > c) {
                ret.push_back("C");
                a--, c++;
            } else if (a < c) {
                ret.push_back("A");
                a++, c--;
            } else {
                if (i != n - 1 && s[i + 1] == "AB") {
                    ret.push_back("A");
                    a++, c--;
                } else {
                    ret.push_back("C");
                    a--, c++;
                }
            }
        }
    }
    if (ok) {
        cout << "Yes"
             << "\n";
        for (auto &r : ret) {
            cout << r << "\n";
        }
    } else {
        cout << "No"
             << "\n";
    }
    return 0;
}

Measured memory_bytes: 10560
#include <bits/stdc++.h>
#include <ctime>
#include <cstdlib>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define swap(a, b) (a += b, b = a - b, a -= b)
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N)
    {
        cin >> A[i];
    }
    double sum = 0;
    rep(i, N)
    {
        sum += 1.0 / A[i];
    }
    cout << 1 / sum << endl;
}

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

int main(){
    using namespace std;
    size_t N;
    cin >> N;
    vector<size_t> A(N);
    for(auto& i : A)cin >> i;
    vector<size_t> B{0}, C{0};
    partial_sum(A.cbegin(), A.cend() - 1, back_inserter(B), __gcd<size_t>);
    partial_sum(A.crbegin(), A.crend() - 1, back_inserter(C), __gcd<size_t>);
    vector<size_t> ans;
    transform(B.cbegin(), B.cend(), C.crbegin(), back_inserter(ans), __gcd<size_t>);
    cout << *max_element(ans.begin(), ans.end()) << endl;
    return 0;
}

Measured memory_bytes: 4084
#include<stdio.h>
#include<algorithm>
using namespace std;
char str[100005];
int main()
{
    int n;
    scanf("%d",&n);
    scanf("%s",str);
    char ch;
    int ans=1;
    ch=str[0];
    for(int i=1;i<n;i++)
    {
        if(str[i]==ch)
        {
            continue;
        }
        else
        {
            ch=str[i];
            ans++;
        }
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include<cstdint>
#include<unordered_map>
#include<boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second

namespace mp = boost::multiprecision;

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

bool pairsort1(const P& element1, const P& element2)
{//first昇順
	return element1.F < element2.F;
}
bool pairsort2(const P& element1, const P& element2)
{//first降順
	return element1.F > element2.F;
}
bool pairsort3(const P& element1, const P& element2)
{//second昇順
	return element1.S < element2.S;
}
bool pairsort4(const P& element1, const P& element2)
{//second降順
	return element1.S > element2.S;
}

int main() {
	int N;
	scanf("%d",& N);
	vector<int>A(N);
	ll max = 0;
	int now = 0;
	rep(i, N) {
		cin >> A[i];
		max += abs(A[i] - now);
		now = A[i];
		if (i == N - 1) {
			max += abs(now);
		}
	}

	rep(i, N) {
		ll tmp = max;
		if (i == 0) {
			tmp -= (abs(A[0]) + abs(A[0] - A[1]));
			tmp += abs(A[1]);
		}
		else if (i == N - 1) {
			tmp -= abs(A[N-1]-A[N-2])+abs(A[N-1]);
			tmp += abs(A[N - 2]);
		}
		else {
			tmp -= (abs(A[i] - A[i + 1]) + abs(A[i] - A[i - 1]));
			tmp += abs(A[i - 1] - A[i + 1]);
		}
		cout << tmp << endl;

	}

}



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

int main() {
    ll a,b,k; cin >> a >> b >> k;
    ll res_a = a-k;
    if(res_a < 0)b = b + res_a;
    cout << max(res_a,0LL) << " " << max(b,0LL) << endl;
}

Measured memory_bytes: 256
import glob


# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = 'ABC\\158\\B'

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class Solver(Common):

    def resolve(self):

        q = [int(i) for i in self.input_data().split()]
        N = q[0]
        A = q[1]
        B = q[2]

        shou = int(N / (A + B))
        amari = N % (A + B)

        if amari <= A:
            result = shou * A + amari
        else:
            result = (shou+1) * A


        print(str(result))


solver = Solver(REL_PATH)
solver.exec_resolve()


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

int main(){
  int n;
  cin >> n;
  vector<int>b(n-1);
  for(int i=0;i<n-1;i++)
    cin >> b.at(i);
  reverse(b.begin(),b.end());
  int a=1e5,ans=0;
  for(int i=0;i<n-1;i++){
    ans+=min(a,b.at(i));
    a=b.at(i);
  }
  ans+=a;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3656
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const ll MOD = 1000000007;
using namespace std;

int main(){
    int n; cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    cout << a[n-1] - a[0] << endl;
    return 0;
}


Measured memory_bytes: 256
N=int(input())
p=list(map(int,input().split()))
shadow=p[:]
shadow.sort()
cnt=0
if p==shadow:
  print("YES")
  exit()
for i in range(N):
  if p[i]!=shadow[i]:cnt+=1

if cnt==2:
  print("YES")
else:
  print("NO")


Measured memory_bytes: 3060
if __name__ == "__main__":
    s = input()

    i1 = int(s[0:2])
    i2 = int(s[2:4])

    ans = ""
    if i1 == 0 or i2 == 0:
        if i1 == 0 and i2 == 0:
            ans = "NA"
        elif i1 == 0 and i2 < 13:
            ans = "YYMM"
        elif i2 == 0 and i1 < 13:
            ans = "MMYY"
        else:
            ans = "NA"
    else:
        if i1 < 13:
            if i2 < 13:
                ans = "AMBIGUOUS"
            else:
                ans = "MMYY"
        else:
            if i2 < 13:
                ans = "YYMM"
            else:
                ans = "NA"
    print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
//constexpr int MOD = 1000000007;
constexpr int MOD = 998244353;
using Graph = vector<vector<int>>;



signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N,M;
    cin>>N>>M;
    vector<int> a(N),b(M);
    rep(i,N){
        cin>>a[i];
    }
    rep(i,M){
        cin>>b[i];
    }

    vector<int> c=convolution(a,b);

    rep(i,N+M-1){
        cout<<c[i]<<" ";
    }
    cout<<endl;




}


Measured memory_bytes: 27284
#include<bits/stdc++.h>
using namespace std;
#define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

typedef unsigned long long ull;
typedef long long ll;
typedef double db;

#define mem(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define mk make_pair
#define pi pair<int,int>
#define vi vector<int>
#define pL pair<ll,ll>
#define vL vector<ll>
#define vp vector<pi>
#define vpL vector<pL>

const int MX=1000000;
const ll inf=1e9;
const ll mod=1e9+7;

int main()
{
    FasterIO;
    int n, m;
    cin>>n>>m;
    if(m==n) cout<<"Yes"<<endl;
    else     cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
from sys import stdin

def main():

    input = stdin.readline

    A,B,N = map(int,input().split())

    ans = 0

    if N >= B:
        ans = (A * (B-1))//B - A * ((B-1) // B)
    else:
        ans = (A * N)//B - A * (N // B)

    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 61920
import java.util.*;

public class Main {
    private static final String VOWEL = "aeiou";

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

        int n;
        while((n = scn.nextInt()) > 0) {
            int max = 0;
            List<String> list = new ArrayList<>();
            for(int i = 0; i < n; i++) {
                String str = scn.next();
                max = Math.max(max, str.length());
                list.add(str);
            }

            int ans = 0;
            Set<String> set;
            while(++ans <= max) {
                set = new HashSet<>();
                for(String str : list) {
                    set.add(encode(str, ans));
                }
                if(set.size() == n) {
                    break;
                }
            }

            System.out.println(ans > max ? -1 : ans);
        }
    }

    private static String encode(String str, int len) {
        StringBuilder sb = new StringBuilder();
        boolean flg = true;
        for(char elm : str.toCharArray()) {
            if(flg) {
                sb.append(elm);
                flg = false;
            }
            if(VOWEL.indexOf(elm) >= 0) {
                flg = true;
            }
        }
        return sb.toString().substring(0, Math.min(len, sb.length()));
    }
}

Measured memory_bytes: 52276
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)

	ids := make(Ids, m)
	num := make([]int, n)
	dict := map[Id]int{}
	for i := range ids {
		fmt.Scan(&ids[i].p, &ids[i].y)
		a := &Id{ids[i].p, ids[i].y}
		dict[*a] = 0
	}
	ids2 := make(Ids, m)
	copy(ids2, ids)
	sort.Sort(ids)

	for i:=0;i<m;i++{
		num[ids[i].p-1]++
		a := &Id{ids[i].p, ids[i].y}
		dict[*a] = num[ids[i].p-1]
	}
	for i:=0;i<m;i++ {
		a := &Id{ids2[i].p, ids2[i].y}
		fmt.Printf("%06d%06d\n", ids2[i].p, dict[*a])
	}
}


type Id struct {
	p int
	y int
}

type Ids []Id

func (a Ids) Len() int {
	return len(a)
}

func (a Ids) Swap(i, j int)  {
	a[i], a[j] = a[j], a[i]
}

func (a Ids) Less(i, j int) bool {
	if a[i].p < a[j].p {
		return true
	} else if a[i].p == a[j].p {
		if a[i].y < a[j].y {
			return true
		}
	}
	return false
}

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

int main( void ) {
  int n, m;
  int a, b;
  cin >> n >> m;
  int minn = 0x3f3f3f3f, maxn = 0;
  for( int i = 0; i < m; ++i ) {
    cin >> a >> b;
    minn = min( minn, b );
    maxn = max( maxn, a );
  }
  if( minn < maxn ) cout << 0 << '\n';
  else cout << minn - maxn + 1 << '\n';
  return 0;
}


Measured memory_bytes: 256
if __name__ == '__main__':
    n = int(input())
    s = input()
    b = s.count('#')
    w = s.count('.')
    bb = 0
    ans = w
    for i in range(n):
        if s[i] == '#':
            bb += 1
        ww = n - (i + 1) - (b - bb)
        ans = min(ans, bb + ww)
    print(ans)


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

int mod2(int n){
  return n%2;
}

int main() {
  int a,b,ans;
  cin >> a >> b;
  if(mod2(a)==mod2(b)){
    ans = (a+b)/2;
  } else {
    ans = 1+(a+b)/2;
  }
  cout << ans << endl;
}

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

using namespace std;

typedef vector<int> vi;

#define PB push_back
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define all(a) a.begin(),a.end()

int P[1001];

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

	int N, M;
	while (cin >> N >> M, N || M) {
		rep1(i, N) cin >> P[i];

		vi A;

		rep(i, N + 1) rep(j, i + 1) if (P[i] + P[j] <= M) A.PB(P[i] + P[j]);

		sort(all(A));

		int ma = 0;

		int l = 0, r = A.size() - 1;

		while (l <= r) {
			while (A[l] + A[r] > M) r--;
			ma = max(ma, A[l] + A[r]);
			l++;
		}

		cout << ma << endl;
	}
}

Measured memory_bytes: 5052
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

int n,a[100010],b[100010],c[200010];
long long t1=0,t2=0,ans,sum[200010];

int main()
{
	scanf("%d",&n);
	for(int i=1; i<=n; i++)
	{
		scanf("%d %d",&a[i],&b[i]);
		c[i]=a[i];
		c[n+i]=b[i];
		t1+=a[i];
		t2+=b[i];
	}
	sort(c+1,c+2*n+1);
	ans=min(t1,t2);
	for(int i=1; i<=2*n; i++)
		sum[i]=sum[i-1]+c[i];
	for(int i=1; i<=n; i++)
	{
		long long x=a[i],y=b[i];
		if(x>y)
			swap(x,y);
		if(lower_bound(c+1,c+2*n+1,x)-c<=n-2)
		{
			if(lower_bound(c+1,c+2*n+1,y)-c<=n-1)
				ans=min(ans,sum[n]);             
			else
				ans=min(ans,sum[n-1]+y);
		}
		else
			ans=min(ans,sum[n-2]+x+y);
	}
	printf("%lld",ans);
}


Measured memory_bytes: 3328
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
#include <unordered_set>
// #include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
// using namespace boost::multiprecision;

const double EPS = 1e-10;
long long const MOD = 1000000007;

typedef vector<int> vec;
typedef vector<vec> mat;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

long long my_mod_pow(long long x, long long n) {
	long long ret = 1;
	for (; n > 0; n >>= 1, x = x * x % MOD) {
		if (n & 1) {
			ret = ret * x % MOD;
		}
	}
	return ret;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

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

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

int main(void) {
    long long H;
    int N; cin >> H >> N;
    long long sum = 0;
    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        sum += a;
    }
    if (sum >= H) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    int flag = 0;

    for (int i = 0; i < n; i++)
    {
        cin >> h.at(i);
    }

    for(int i = 0; i < n;i++)
    {
        if(h.at(i)%2 ==0)
        {
            if(h.at(i)%3==0||h.at(i)%5==0)
            {

            }
            else
            {
                cout << "DENIED" << endl;
                return 0;
            }
            
        }
    }

    cout << "APPROVED" << endl;
    return 0;
}

Measured memory_bytes: 256
// ITP1_5_A:   Print a Rectangle
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

int main()
{
	int H, W;
	int h, w;

	while (1) {
		scanf("%d%d", &H, &W);
		if (H == 0 && W == 0) break;
		for (h = 0; h < H; h++) {
			for (w = 0; w < W; w++) putchar('#');
			putchar('\n');
		}
		putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 2048
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    b = list(map(int, rl().split()))
    
    ans = []
    for _ in range(N):
        j = -1
        for i in range(len(b)):
            if b[i] == i + 1:
                j = i
        if j == -1:
            print(-1)
            exit()
        del b[j]
        ans.append(j + 1)
    ans.reverse()
    print(*ans, sep='\n')


if __name__ == '__main__':
    solve()


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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

constexpr int INF = 1e9;
constexpr int M = 1e9 + 7;

using weight = int;

struct edge {
    int from, to;
    weight d, cap;
    int rev;
};

using edges = std::vector<edge>;
using graph = std::vector<edges>;

void add_edge(graph& g, int from, int to, weight d, weight cap) {
    g[from].push_back(edge{from, to, d, cap, static_cast<int>(g[to].size())});
    g[to].push_back(edge{to, from, d, 0, static_cast<int>(g[from].size()-1)});
}

void bfs(graph& g, std::vector<int>& level, int s) {
    for(int i = 0; i < (int)level.size(); ++i) {
        level[i] = -1;
    }
    level[s] = 0;
    std::queue<int> que;
    que.push(s);
    while(!que.empty()) {
        int v = que.front(); que.pop();
        for(int i = 0; i < (int)g[v].size(); ++i) {
            edge& e = g[v][i];
            if(e.cap > 0 && level[e.to] < 0) {
                level[e.to] = level[v] + 1;
                que.push(e.to);
            }
        }
    }
}

weight dfs(graph& g, std::vector<int>& level, std::vector<int>& iter, int v, int t, weight f) {
    if(v == t) {
        return f;
    }
    for(int& i = iter[v]; i < (int)g[v].size(); ++i) {
        edge& e = g[v][i];
        if(e.cap > 0 && level[v] < level[e.to]) {
            weight d = dfs(g, level, iter, e.to, t, std::min(f, e.cap));
            if(d > 0) {
                e.cap -= d;
                g[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

weight max_flow(graph& g, int s, int t) {
    weight flow = 0;
    std::vector<int> level(g.size(), -1);
    std::vector<int> iter(g.size(), 0);
    weight INF = 1e9;
    while(true) {
        bfs(g, level, s);
        if(level[t] < 0) {
            return flow;
        }
        for(int i = 0; i < (int)iter.size(); ++i) {
            iter[i] = 0;
        }
        weight f;
        while((f = dfs(g, level, iter, s, t, INF)) > 0) {
            flow += f;
        }
    }
}


int main() {
    int N, M, s, t;
    cin >> N >> M >> s >> t;
    s--; t--;
    graph g(N);
    edges es;
    for(int i = 0; i < M; ++i) {
        int u, v, d, c;
        cin >> u >> v >> d >> c;
        g[u - 1].push_back(edge{u - 1, v - 1, d, c, -1});
        es.push_back(edge{u - 1, v - 1, d, c, -1});
    }
    vector<int> dist(N, INF);
    priority_queue<pii, vector<pii>, greater<>> que;
    que.emplace(0, s);
    dist[s] = 0;
    while(!que.empty()) {
        auto now = que.top();
        const int v = now.second;
        que.pop();
        if(dist[v] < now.first) continue;
        for(auto& e : g[v]) {
            if(now.first + e.d < dist[e.to]) {
                dist[e.to] = now.first + e.d;
                que.emplace(dist[e.to], e.to);
            }
        }
    }

    graph g_flow(N);
    for(int i = 0; i < M; ++i) {
        if(dist[es[i].from] + es[i].d == dist[es[i].to]) {
            add_edge(g_flow, es[i].from, es[i].to, es[i].d, es[i].cap);
        }
    }
    
    cout << max_flow(g_flow, s, t) << endl;
}



Measured memory_bytes: 3272
#include<stdio.h>

void swap (long int *x, long int *y) {
  long int temp;    // 値を一時保存する変数

  temp = *x;
  *x = *y;
  *y = temp;
}


int partition (long int array[], long int left, long int right) {
  long int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (long int array[], long int left, long int right) {
  long int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}

long int keck(long int H, long int m, long int n){
  //mが分身、nが回数
  if(H<=0){
    return n;
  }
  
  n = n+m;
  H = H/2;
  m = m*2;
  
  keck(H, m, n);
}
    

int main(void){
 long int H, count=0;
  scanf("%ld", &H);
  
  count = keck(H, 1, 0);
  
  printf("%ld\n", count);
  
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String n = scanner.next();
        int a = Integer.parseInt(n.substring(0, 2));
        int b = Integer.parseInt(n.substring(2, 4));
        if ((a > 12 || a < 1) && (b > 12 || b < 1)) {
            System.out.println("NA");
        } else if (a > 12 || a < 1) {
            System.out.println("YYMM");
        } else if (b > 12 || b < 1) {
            System.out.println("MMYY");
        } else {
            System.out.println("AMBIGUOUS");
        }
    }

}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int K;
    cin >> K;
    ll ans = 0;
    for(int a=1;a<=K;a++){
        for(int b=1;b<=K;b++){
            for(int c=1;c<=K;c++){
                ans+= __gcd(a,__gcd(b,c));
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                             \
  cerr << __LINE__ << ": " << #x << " = {";          \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) { \
    cerr << ((hoge) ? "," : "") << x[hoge];          \
  }                                                  \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A, B;
  cin >> A >> B;
  int ans;
  for (ans = 1; ans <= 10000; ans++)
    if (ans * 8 / 100 == A && ans * 10 / 100 == B) break;
  if (ans > 10000) ans = -1;
  cout << ans << endl;
  return 0;
}


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

int main() {
	uint32_t N;
	cin >> N;

	vector<long double> p(N);
	for(uint32_t i=0; i<N; i++) cin >> p[i];
	
	vector<vector<long double>> dp(N+1, vector<long double>(N+1, 1));
	
	for(uint32_t i=1; i<=N; i++) dp[i][0] = dp[i-1][0] * (1 - p[i-1]);
	for(uint32_t i=1; i<=N; i++) dp[i][i] = dp[i-1][i-1] * p[i-1];
	
	for(uint32_t i=2; i<=N; i++) {
		for(uint32_t j=1; j<i; j++) {
			dp[i][j] = dp[i-1][j-1] * p[i-1] + dp[i-1][j] * (1 - p[i-1]);
		}
	}

	long double ans = accumulate(dp[N].begin() + N/2 + 1, dp[N].end(), (long double)0);
	cout << setprecision(10) << ans << endl;
	
	return 0;

}

Measured memory_bytes: 141056
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <fstream>
#include <queue>
#include <deque>
#include <numeric>
#include <iomanip>
#include <math.h>
using namespace std;

typedef long long LL;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector< LL > vl;
typedef vector< vl > vvl;
typedef vector< bool > vb;
typedef pair <int, int> ii;
#define tr(c,it) for(decltype(c.begin()) it = c.begin(); it != c.end(); it++)
#define rep(i,n) for(int i=0, _##i=(n); i<_##i; ++i)
#define repr(i,l,r) for(int i=(l), _##i=(r); i<_##i; ++i)
#define pb push_back
#define mp make_pair
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define in(a,b) ( (b).find(a) != (b).end())


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

	int n, mw;
	cin >> n >> mw;

	vl w(n), v(n);
	rep(i, n) cin >> w[i] >> v[i];

	vl val(mw+1, -1);
	val[0] = 0;

	auto valid = [mw](int x) -> bool {return x <= mw;};
	rep(oi, n) {
		for (int i = mw-1; i >= 0; --i) {
			if (val[i] > -1) {
				if (valid(i+w[oi])) {
					val[i+w[oi]] = max(val[i+w[oi]], val[i] + v[oi]);
				}
			}
		}
	}

	cout << *max_element(all(val));
}


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

using namespace std;
const int maxn=2e5+100;
int a[2*maxn];
int main()
{
    int n,i,j,t;
    while (scanf("%d",&n)!=-1){
       t=n;i=maxn;j=maxn;
       for (t=1;t<=n;t++){
         if (t%2==1) scanf("%d",&a[j++]);
         else scanf("%d",&a[--i]);
       }
       if(n%2==0) {
        for (int k=i;k<j-1;k++) printf("%d ",a[k]);
        printf("%d\n",a[j-1]);
       } else {
         for (int k=j-1;k>i;k--) printf("%d ",a[k]);
         printf("%d\n",a[i]);
       }
    }
    return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define filein(t) freopen(t, "r", stdin)
#define fileout(t) freopen(t, "w", stdout)
#define f first
#define s second
#define cs 137
#define ll long long
#define mp make_pair
#define N 200025
#define ln 1e9
#define oo 111539786
#define Pa pair < int, int >
#define Pi pair < int, Pa >

using namespace std;

Pa D[N], X[N];
vector < Pa > a[N];
priority_queue < Pa > Que;
int n, m, k, q;
int root[N], S[N], T[N], ok[N], L[N], R[N];

void IJK()
{
    while(!Que.empty())
    {
        Pa P = Que.top();   Que.pop();
        int u = P.s;
        if(D[u].f != -P.f)    continue;
        for(int i=0; i<a[u].size(); i++)
        {
            int v = a[u][i].f;
            int w = a[u][i].s;
            if(D[v].f > D[u].f + w)
            {
                D[v].f = D[u].f + w;
                Que.push(mp(-D[v].f, v));
            }
        }
    }
}

int Get_root(int x)
{
    if(x == root[x])    return x;
    return root[x] = Get_root(root[x]);
}

void Up(int u)
{
    root[u] = u;
    for(int i=0; i<a[u].size(); i++)
    {
        int v = a[u][i].f;
        int p = Get_root(v);
        if(root[p])
            root[p] = u;
    }
}

void Solve()
{
    int pos = n;
    for(int i=q; i>=1; i--)
    {
        while(D[pos].f >= X[i].f && pos)
            Up(D[pos].s), pos--;
        int p = Get_root(S[X[i].s]);
        int q = Get_root(T[X[i].s]);
        if(p == q && p != 0 && q != 0)    ok[i] = 1;
        else    ok[i] = 0;
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    //filein("FESTIVALS.inp");    fileout("FESTIVALS.out");
    int u, v, w;
    cin >> n >> m >> k >> q;
    for(int i=1; i<=m; i++)
    {
        cin >> u >> v >> w;
        a[u].push_back(mp(v, w));
        a[v].push_back(mp(u, w));
    }
    for(int i=1; i<=n; i++)
        D[i].f = ln, D[i].s = i;
    for(int i=1; i<=k; i++)
    {
        cin >> u;
        D[u].f = 0;
        Que.push(mp(0, u));
    }
    IJK();
    sort(D+1, D+n+1);
    for(int i=1; i<=q; i++)
        cin >> S[i] >> T[i];
    for(int i=1; i<=q; i++)
        L[i] = 0, R[i] = ln;
    int step = 30;
    while(step--)
    {
        for(int i=1; i<=q; i++)
            X[i].f = (L[i] + R[i]) / 2, ok[i] = 0, X[i].s = i;
        for(int i=1; i<=n; i++)
            root[i] = 0;
        sort(X+1, X+q+1);
        Solve();
        for(int i=1; i<=q; i++)
        {
            if(ok[i])
                L[X[i].s] = X[i].f;
            else
                R[X[i].s] = X[i].f;
        }
    }
    for(int i=1; i<=q; i++)
        cout << L[i] << endl;
}

Measured memory_bytes: 19404
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll

int t, n, m, k, a[300010], q, l, r;


int32_t main(){
INIT
cin>>n>>k;
for(int i=1; i<=n; i++){cin>>a[i];}
for(int i=(k+1); i<=n; i++){
    if(a[i]<=a[i-k]){
        cout<<"No\n"; //return 0;
    }
    else{
        cout<<"Yes\n";
    }
}

return 0;
}



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

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 25;
const ll INFL = 1223372036854775807;
const ll mod = 1000000007;



int main() {

	int n, m;
	cin >> n >> m;

	VLL x(n), y(m);
	REP(i, n)cin >> x[i];
	REP(i, m)cin >> y[i];

	ll a = 0, b = 0;

	REP(i, n - 1) {
		a += (x[i + 1] - x[i]) % mod*(i + 1) % mod*(n - i - 1) % mod;
		a %= mod;
	}
	REP(i, m - 1) {
		b += (y[i + 1] - y[i]) % mod*(i + 1) % mod*(m - i - 1) % mod;
		b %= mod;
	}

	cout << a*b%mod << endl;




	return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pii pair<int,int>
#define pll pair<lli,lli>
#define vi  vector<int>
#define vii vector<pair<int,int>>
#define vll vector<lli>
#define pb  push_back
#define mpr  make_pair
#define ff  first
#define ss  second
#define mod 1000000007
#define pie 3.14159265358979323846264338327950L
#define all(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define testcase() int t;cin>>t;while(t--)
#define clean(x) memset(x,0,sizeof(x))
#define FOR(x,y) for(int i=x;i<=y;i++)
const lli maxn = 2e5+9;
vector<lli> catlan(int n) {
    vector<lli> dp(n + 1, 0);
    dp[0] = 1;
    dp[1] = 1;
    for (int i = 2; i <= n; i ++) {
        for (int j = 0; j < i; ++ j) {
            dp[i] += dp[j] * dp[i - j - 1];
        }
    }
    return dp;
}
lli b_ex(lli n,lli a){lli res=1;while(n){if(n%2==1)res*=a;n>>=1;a=a*a;}return res;}
lli ncr(lli n,lli k){lli ans=1;if(k>n-k)k=n-k;for(lli i=1;i<=k;i++){ans*=(n-i+1),ans=ans/i;}return ans;}
lli power(lli a , lli n){lli ans = 1;while(n){if(n % 2)ans = (ans * a) % mod;n /= 2;a = (a * a) % mod;}return ans;}
lli lcm(lli a,lli b){lli ans=(a*b)/(__gcd(a,b));return ans;}
lli set_bits(lli n)
{
    int c=0;
    if(n==0)return 0;
    while(n)
    {
        if((n&1)==1)
        {
           cout<<c<<" ";
        }
        c++;
        n=n>>1;
    }
    return c;
}

string X="IF THE CONSTRAINTS ARE LOW JUST BRUTE FORCE IT!!!!!!!!!!!!!!!!!!!!!";
///------------------ALWAYS lli-----TEMP TSF99--------------------------------------------------------------------------------------///


void solve()
{
    int n,s;cin>>n>>s;
    int ans=0;
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        {
            int x=s-i-j;

            if(x>=0 and x<=n)ans++;
            //cout<<i<<" + "<<j<<" + "<<x<<endl;
        }
    }
    cout<<ans<<endl;
}
int main()
{
    solve();
}


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

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

	for (int i = 1; i*i <= n ; i++){
		s = i*i;
	}
	
	printf("%d\n",s);
	return 0;
}

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

void _main() {
    string S;
    cin >> S;
    sort(S.begin(), S.end());
    cout << (S[0] == S[1] && S[2] == S[3] && S[0] != S[2] ? "Yes" : "No") << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,n) for(int i=1;i<(int)(n);i++)

typedef long long ll;
using namespace std;
int main()
{
  string s[3];
  rep(i,3)cin>>s[i];

  int start=0;
  int now[3]={0};

  while(1){
    int tmp=now[start];
    now[start]++;
    if(s[start][tmp]=='a'){
      start=0;
    }else  if(s[start][tmp]=='b'){
      start=1;
    }else   if(s[start][tmp]=='c'){
      start=2;
    }
    // cout<<start<<endl;
    rep(i,3){
      if(now[i]==s[i].length()+1){
        switch(i){
          case 0:
          puts("A");
          break;

          case 1:
          puts("B");
          break;

          case 2:
          puts("C");
          break;
        }
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define RG register
#define maxn 1000005
#define maxm 205
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
inline ll read(){
    ll x = 0, f = 1;
    char ch = getchar();
    while(ch > '9' || ch < '0') {if(ch == '-') f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = x *10 + ch -'0';ch = getchar();}
    return x * f;
}
 
int n, m, k,sum;
char s[1005][1005];
int vis[1005][1005], cnt, X[4] = {0, 0, 1, -1}, Y[4] = {1, -1, 0, 0};
bool isb[1005][1005];
queue<pair<int,int> >Q;
void dfs(int x,int y){
	int i,xx,yy;
	vis[x][y] = cnt;
	for(i = 0;i <4;i++){
		xx = x +X[i], yy = y + Y[i];
		if(xx > n || xx < 1) continue;
		if(yy > m || yy < 1) continue;
		if(s[xx][yy]=='#') continue;
		if(vis[xx][yy]) continue;
		dfs(xx,yy);
	}
}
int inde[2000005], tot;
struct p{
	int u,v,w,nxt;
}e[20000005];
map<pair<int,int>, int> mp;
void add(int u,int v,int w){e[++tot]=(p){u,v,w,inde[u]},inde[u] = tot;}
void ins(int x,int y){
	int u,v;
	for(int i = 0;i <= 2;i++){
		for(int j = -2;j <= 2;j++){
			int xx = x + i, yy = y + j;
			if(xx > n || xx < 1) continue;
			if(yy > m || yy < 1) continue;
			if(s[xx][yy]=='#') continue;
			if(vis[x][y] == vis[xx][yy]) continue;
			u = vis[x][y], v= vis[xx][yy];
			add(u,v,1),add(v,u,1);
		}
	}
}
bool inst[2000005];
int dis[2000005],cx,cy,dx,dy;
struct node
{
    int w,now;
    inline bool operator <(const node &x)const
    {
        return w>x.w;
    }
};
priority_queue<node>que;
void dij(int u){
	for(int i = 1;i <=cnt;i++)dis[i] = 0x3f3f3f3f;
	dis[u] = 0;
	int i,v;
	que.push(node{0,u});
	while(!que.empty()){
		node x = que.top();
		que.pop();
		u = x.now;
		if(inst[u]) continue;
		if(u == vis[dx][dy]) break;
		inst[u] = 1;
		for(i=inde[u];i;i=e[i].nxt){
			v = e[i].v;
			if(dis[v] > dis[u] + e[i].w){
				dis[v] = dis[u] + e[i].w;
				que.push(node{dis[v],v});
			}
		}
	}
}
int main(){
	int i, j, x;
	n =read(), m = read();
	cx=read(),cy=read(),dx=read(),dy=read();
	for(i = 1;i <= n;i++) scanf("%s", s[i] + 1);
	for(i = 1;i <= n;i++){
		for(j = 1;j <= m;j++){
			if(s[i][j] == '#') continue;
			if(i == 1 || i == n || j == 1 || j == m || s[i -1][j] == '#'|| s[i][j - 1] == '#'|| s[i][j + 1] == '#'|| s[i+1][j] == '#')
				isb[i][j] = 1;
			if(vis[i][j]) continue;
			cnt ++;
			dfs(i,j);
		}
	}
	for(i = 1;i <= n;i++){
		for(j = 1;j <= m;j++){
			if(s[i][j]=='#') continue;
			if(isb[i][j]) ins(i,j);
		}
	}
	dij(vis[cx][cy]);
	if(dis[vis[dx][dy]] == 0x3f3f3f3f) puts("-1");
	else printf("%d\n",dis[vis[dx][dy]]);
	return 0;
}


Measured memory_bytes: 41560
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = Console.ReadLine().Trim().Split(' ');
            int ia = int.Parse(sS[0]);
            int ib = int.Parse(sS[1]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iOut = ib - ia;
            iOut = ((1 + iOut) * iOut / 2) - ib;

            // 出力
            Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


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

int main(){
	int N, i, j, k, l, ans = 0;
	scanf("%d", &N);
	string S;
	cin >> S;
	vector<vector<vector<vector<int>>>> dp(N + 1, vector<vector<vector<int>>>(11, vector<vector<int>>(11, vector<int>(11, 0))));
	dp[0][10][10][10] = 1;
	for(i = 0; i < N; i++){
		int n = (int)S[i] - (int)'0';
		for(j = 0; j <= 10; j++){
			for(k = 0; k <= 10; k++){
				for(l = 0; l <= 10; l++){
					dp[i + 1][j][k][l] |= dp[i][j][k][l];
					dp[i + 1][k][l][n] |= dp[i][j][k][l];
				}
			}
		}
	}
	for(j = 0; j < 10; j++){
		for(k = 0; k < 10; k++){
			for(l = 0; l < 10; l++){
				ans += dp[N][j][k][l];
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

using namespace std;


int main(){

int num,ans;
char mark;


cin>>ans;

while(1){

cin>>mark>>num;

if(mark == '=')break;

if(mark == '+')ans=ans+num;

if(mark == '-')ans=ans-num;

if(mark == '*')ans=ans*num;

if(mark == '/')ans=ans/num;

}

cout<<ans<<endl;

return 0;
}


Measured memory_bytes: 3100
#include <iostream>

using namespace std;
int main()
{
	long long int N, A, B;
	cin >> N;
	int count = 0;
	char C[100];
	while (N>0)
	{
		if (N % 26 == 0)
		{
			C[count] = 'z';
			count = count + 1;
		}
		else
		{
			C[count] = N % 26 + 96;
			count = count + 1;
		}
		if (count > 0 && N %26==0)
		{
			N = N / 26 -1;
		}
		else
		{
			N = N / 26;
		}
	}
	for (int i = count - 1; i >= 0; i--)
	{
		cout << C[i];
	}
	cout << "\n";
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int a[106][106];
const int N=100;
int main()
{
	//freopen("093d.out","w",stdout);
	int A,B;scanf("%d%d",&A,&B);
	A--;B--;
	int cnt =1,cntp=1;
	while(A){
		if(cntp>=N) cntp=1,cnt+=2;
		a[cnt][cntp]=1;A--;
		cntp+=2;
	}
	for(int i=cnt+2;i<=N;i++)
		memset(a[i],1,sizeof(a[i]));
	int ncnt=1;cnt+=10,cntp=1;
	
	while(B){
		a[cnt][cntp]=0;cntp+=2;
		B--;
		if(cntp>=N) cntp=1,cnt+=2;
	}
	printf("%d %d\n",N,N);
	for(int i=1;i<=N;i++){
		for(int j=1;j<=N;j++)
			if(a[i][j]) printf(".");
			else printf("#");
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1e+18
#define MOD 1000000007
using namespace std;



int main(){
    int N;
    cin >> N;
    cout<< (N+110)/111*111 << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
s = [input() for i in range(n)]

ab = 0
a = 0
b = 0

d = 0
for i in s:
	d += i.count('AB')
	if i[0] == 'B' and i[-1] == 'A':
		ab += 1
	elif i[-1] == 'A':
		a += 1
	elif i[0] == 'B':
		b += 1

if ab == 0:
	d += min(a,b)
elif a+b == 0:
	d += ab-1
else:
	d += ab+min(a,b)
print (d)

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

using namespace std;

int main()
{
    int N;
    double s;

    cin >> N;
    vector<int> v(N);
    for(int i=0; i<N; ++i) cin >> v[i];

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

    s = (double)v[0];
    for(int i=1; i<N; ++i){
        s = ((double)v[i] + s) / 2.0;
    }

    cout << setprecision(12) << s << endl;

    return 0;
}

Measured memory_bytes: 256
import heapq
n, q = map(int, input().split())
A = [ [] for i in range(n)]
for i in range(q):
    tmp = list(map(int, input().split()))
    if tmp[0] == 0:
        heapq.heappush(A[tmp[1]], -tmp[2])
    elif tmp[0] == 1 and A[tmp[1]]:
        print(-A[tmp[1]][0])
    elif tmp[0] == 2 and A[tmp[1]]:
        heapq.heappop(A[tmp[1]])


Measured memory_bytes: 13184
#include<bits/stdc++.h>
#include<limits>
#define ll long long
#define F first
#define S second
#define pb push_back
#define oo (1LL<<63-1)
#define endl '\n'
#define si size()
#define all(v) v.begin(),v.end()
#define FASTIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define Matrix vector< vector < long long > >


using namespace std;

int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};

const long double Pi=acos(-1),e=2.718;
const int N=2e5+10,mod=1e9+7;

int main ()
{
    FASTIO
    ll k , a , b;
    cin >> k >> a >> b ;
    for(int i=a;i<=b;i++){
        if(i%k==0){
            return cout << "OK" << endl,0;
        }
    }
    cout << "NG" << endl;
    return 0;
}
/**

*/


Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define debug(x) (cout << "#x = " << (x) << '\n')

using namespace std;
typedef long long ll;

inline char gc() {
	static char buf[100000], *p1 = buf, *p2 = buf;
	return (p1 == p2) && (p2 = (p1 = buf) +
		fread(buf, 1, 100000, stdin), p1 == p2)? EOF: *p1++;
}

#define dd ch = getchar()
template <class T>
inline void read(T &x) {
	x = 0;
	int f = 0; char dd;
	for (; !isdigit(ch); dd) f ^= (ch == '-');
	for (; isdigit(ch); dd)  x = (x << 1) + (x << 3) + (ch ^ 48);
	x = f? -x: x;
}
#undef dd

template <class T>
inline void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 | 48);
}

template <class T>
inline void wrn(T x) {
	write(x), putchar(' ');
}

template <class T>
inline void wln(T x) {
	write(x), putchar('\n');
}

template <class T>
inline void wlnn(T x, T y) {
	wrn(x), wln(y);
}

const ll N = 2e5 + 5;
const ll P = 1e9 + 7;

ll n, k, Ans = 0, fac[N], inv[N];

inline ll power(ll a, ll b, ll res = 1) {
	for (; b; b >>= 1, a = a * a % P) 
		res = (b & 1)? res * a % P: res;
	return res;
}

inline ll C(ll n, ll m) {
	if (n < m) return 0;
	if (n == m || !m) return 1;
	return fac[n] * inv[n - m] % P * inv[m] % P;
}

int main()
{
	fac[0] = 1;
	read(n), read(k);
	for (int i = 1; i <= n; ++i) fac[i] = fac[i - 1] * i % P;
	for (int i = 0; i <= n; ++i) inv[i] = power(fac[i], P - 2);
	for (int i = 0; i < min(n, k + 1); ++i) 
		Ans = (Ans + C(n, i) * C(n - 1, n - i - 1) % P) % P;
	return wln(Ans), 0;
}

/*

*/




Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define ll long long
#define pb push_back
#define fi first
#define se second
#define ii pair<int,int>
const int MOD = 1e9 + 7;

int main() {
   ios_base::sync_with_stdio(0); cin.tie(0);
   int n; vector<int> l;
   cin>>n;
   for(int i =0;i<n;i++) {
   		int x;
   		cin>>x;
   		l.pb(x);
   }
   sort(l.begin(),l.end());
   int ans = 0;
   for(int i =0;i<n;i++) {
   	for(int j = i+1;j<n;j++) {
   		for(int k = j+1;k<n;k++) {
   			if(l[i] + l[j] > l[k])
   				ans++;
   		}
   	}
   }
   cout<<ans<<"\n";
  
   return 0;   
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
      	int n = Integer.parseInt(sc.next());
      	int ans = 0;
      	
      	for (int i = 0; i < n; i++) {
        	if (n < (int)Math.round(Math.pow(2, i))) break;
          	ans = (int)Math.round(Math.pow(2, i));
        }
      	
      	System.out.println(ans);
    }
}

Measured memory_bytes: 23636