akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fr first
#define se second
#define r_0 return 0;
#define ll long long
#define pb push_back
#define TIME ios_base::sync_with_stdio(0)
using namespace std;
vector<ll>V,L,L1;
vector<pair<char,ll>>B;
vector<string>Ans;
map<int,int>M;
set<ll>S;
set<char>:: iterator it;
ll n,m,a,b,c,d,e,f,x,y,z,t,l,r,ans,cnt,score;
string   s,winner,temp,p;
ll arr[1001];
bool xy=0;
char bd;
float ans1;
int main()
{
    TIME;
    cin>>bd;
    if (bd<97)
        cout<<"A";
    else
        cout<<"a";

}


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

int main(){
  string _S;
  cin >> _S;
  const char *S=_S.c_str();
  int min=1000;
  for(int i=0;i<_S.size()-2;i++){
	int t=abs(753-(((int)S[i]-'0')*100+((int)S[i+1]-'0')*10+(int)S[i+2]-'0'));
	if(min>t){
	  min=t;
	}
  }
  cout << min << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		String a = sc.next();
		String b = sc.next();

		int num = Integer.parseInt(a + b);

		System.out.println(Math.pow((int)Math.sqrt(num), 2) == num ? "Yes" : "No");

	}
}


Measured memory_bytes: 22996
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}*/


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

	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;

	int ans = 0;

	// 愚直でいんじゃね？
	// しゃくとり法で行ける

	ll cnt = 0;

	int right = 0;

	for (int left = 0; left < n; left++) {

		while (right < n && (cnt < k || s[right] == '1')) {
			if (right == 0 && right != n - 1) {
				if (s[right] == '0' && s[right + 1] == '1') {
					cnt++;
					right++;
				}
				else {
					right++;
				}
			}
			else if (right == n - 1) {
				if (s[right] == '0') {
					cnt++;
					right++;
				}
				else {
					right++;
				}
			}
			else if (s[right] == '0' && s[right + 1] == '1') {
				cnt++;
				right++;
			}
			else {
				right++;
			}
		}

		ans = max(ans, right - left);
		if (right == left) right++;
		else if (left != n - 1) {
			if (s[left] == '0' && s[left + 1] == '1') {
				cnt--;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
n = int(input())
hxy = []

for i in range(n):
    x, y, h = map(int, input().split())
    hxy.append([h, x, y])

hxy.sort(reverse=True)

for i in range(101):
    for j in range(101):
        h, x, y = hxy[0]
        H = h + abs(x - i) + abs(y - j)
        if all(h == max(H - abs(x - i) - abs(y - j), 0) for h, x, y in hxy):
            print(i, j, H)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
/*---------------------Define--------------------*/
#define int long long
#define next nextt
#define pii pair<int,int>
#define fi first
#define se second
#define rd random
#define ll long long
#define taskname ""
#define pb push_back
#define mp make_pair
#define pb push_back
#define popb pop_back
#define popf pop_front
#define pf push_front
#define res(a,z,n) for(int i = 1 ; i<=n ; i ++) a[i] = z;
/*-------------------necesary---------------------*/
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
/*------------------limit-------------------------*/
const int base  = 998244353 ;
const int oo = 1e6 + 10;
const int gh = 1e3 + 3 ;
const int inf = 1e15 + 5 ;
double pi=2*asin(1);
/*-----------------globalvari-----------------------*/
int n,m,k,q;
int a[oo];
int b[oo];
int sum[oo];
string s;
char c[oo];
//int sum[oo];
/*-----------------code-----------------------*/


void input()
{
    cin>>n>>k;
    int x;
    int ans = n;
    for(int i = 1;  i <= k ; i ++)
    {
        cin>>x;
        int y;
        for(int j = 1;  j<= x ; j ++)
            {
                cin>>y;
                if(b[y] == 0) ans --;
                b[y] = 1;
            }
    }
    cout<<ans;
    //read

}

void cre()
{

}

void solve()
{
    cre();
    //main code here :))
}

void ouput()
{

    //write
}

int32_t main()
{

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //#ifndef ONLINE_JUDGES
    if (ifstream("test.txt"))
    {
        freopen("test.txt", "r", stdin);
        #ifdef CHECKING
            freopen(taskname".out", "w", stdout);
        #else
            //\freopen("test.out", "w", stdout);
        #endif //CHECKING
    }
    else if (ifstream(taskname".inp"))
    {
        freopen(taskname".inp", "r", stdin);
        freopen(taskname".out", "w", stdout);
    }
    //#endif // ONLINE_JUDGES
    int t=1;
   // cin>>t;

    while(t--)
    {
    input();
    solve();
    ouput();
    }
}

//ilove??<3


Measured memory_bytes: 3632
#include<iostream>
using namespace std;
#define ll long long
#include <bits/stdc++.h>
using namespace std;

// function to print the divisors
vector<ll> printDivisors(ll n)
{
    // Vector to store half of the divisors
    vector<ll> v;
    for (ll i=1; i<=sqrtl(n); i++)
    {
        if (n%i==0)
        {
            if (n/i == i) // check if divisors are equal
                v.push_back(i);
            else
            {
                            v.push_back(i);


                // push the second divisor in the vector
                v.push_back(n/i);
            }
        }
    }

    return v;
}
int main()
{
    ll n;
    cin>>n;
    ll sum=0;
    vector<ll> div=printDivisors(n);
    for(auto i:div)
    {
        if(n/i-1==0)
            continue;
        if(n%(n/i-1)!=0&&n/i-1>i)
            sum+=n/i-1;
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 384
a,b = map(int,input().split())
ten = []
ei = []
for i in range(1,1010):
    if a <= i*0.08 < a+1:
        ei.append(i)
for j in range(1,1010):
    if b <= j*0.1 < b+1:
        ten.append(j)
case = set(ei) & set(ten)
if not case:
    print(-1)
else:
    print(min(case))

Measured memory_bytes: 9200
#include <iostream>

using namespace std;

int main()
{
	int a,b,c,temp;
	
	cin >> a >> b >> c;
	if(a > b)
	{
		temp = b;
		b = a;
		a = temp;
	}
	if(b > c)
	{
		temp = c;
		c = b;
		b = temp;
	}
	if(a > b)
	{
		temp = b;
		b = a;
		a = temp;
	}
	cout << a << " " << b << " " << c << endl;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#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 SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<int>())S
#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 pb push_back
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);}
typedef long long ll;
typedef pair<int, int> pii;

int main(void)
{
    int n;
    cin >> n;
    vector<string> wi(n);
    for (int i = 0; i < n; i++) {
        cin >> wi[i];
    }  

    int flag=0;
    Rep(i,1,n){
        // if(wi[i-1][wi[i-1].size()-1] != wi[i][0]){
        if(wi[i-1].back() != wi[i].front()){
            flag = 1;
        }

        REP(j, i){
            if(wi[i] == wi[j]){
                flag = 1;
            }
        }
    }

    Yes(flag==0);

    return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main()
{
	auto N = to!int(split(readln())[0]);
	auto input = split(readln());
	auto D = to!int(input[0]), X = to!int(input[1]);
	
	int[] A;
	
	int n = X;
	
	foreach (i; 0..N) {
		n += (D-1) / ( to!int(split(readln())[0]) ) + 1;
	}
	
	writeln(n);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MAX 1000010

long long modpow(int n, int r) {
    long long ret = 1; long long tmp = (long long) n;
    while (r != 0) {
        if (r % 2) ret *= tmp;
        tmp *= tmp; tmp %= mod; ret %= mod;
        r /= 2;
    }
    return ret;
}

long long inv(int n) {
    return modpow(n, mod-2);
}

vector<int> divisor[MAX];
vector<long long> invgcd(MAX, 0);
vector<long long> single(MAX, 0), square(MAX, 0);

int main() {
    int n; cin >> n;
    vector<long long> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int div = 1; div < MAX; div++) {
        for (int x = div; x < MAX; x += div) {
            divisor[x].emplace_back(div);
        }
    }
    for (int i = 1; i < MAX; i++) {
        invgcd[i] = inv(i);
        for (auto &div: divisor[i]) {
            if (div == i) continue;
            invgcd[i] += mod - invgcd[div];
            if (invgcd[i] >= mod) invgcd[i] -= mod;
        }
    }
    for (int i = 0; i < n; i++) {
        for (auto &div: divisor[a[i]]) {
            single[div] += a[i];
            if (single[div] >= mod) single[div] -= mod;
            square[div] += a[i] * a[i] % mod;
            if (square[div] >= mod) square[div] -= mod;
        }
    }
    long long ans = 0; long long inv2 = inv(2);
    for (int i = 0; i < MAX; i++) {
        ans += (single[i] * single[i] % mod - square[i] + mod) % mod * inv2 % mod * invgcd[i] % mod;
        if (ans >= mod) ans -= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 139776
// Created by Bingoo on 7/8/2020.
#include"bits/stdc++.h"
using namespace std ;
#define ll  long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

template <class ...Args>
auto &see(const Args &...args) {return ((cerr << " " << args), ...) << '\n';}
#define bug(...)  cerr << "[ "#__VA_ARGS__" ] = "; see(__VA_ARGS__) << '\n';
//C++17
template<typename... Args>
void read(Args&... args){((cin >> args), ...);}
template<typename... Args>
void write(Args... args){((cout << args << " "), ...);}

ll mod = 1e6 +3 ;
ll power(ll a, ll b)	//a is base, b is exponent
{
    if (b == 0)
        return 1;
    if (b == 1)
        return a;
    if (b % 2 == 1)
        return (power(a, b - 1) * a) % mod;
    ll q = power(a, b / 2);
    return (q * q) % mod;
}

bool comp(pair<int,int>&a ,pair<int,int>&b)
{
    return a.second > b.second ;
}

string s;

int k ,n ;

int main(){
    cin >> n ;
    int m = n % 100;
    int y = n / 100 ;
    //bug(y,m)

   if(m>=1 && m <=12){
       if(y>=1 && y <=12)cout<<"AMBIGUOUS\n";
       else cout << "YYMM\n";
   }
   else if(y >=1 && y <=12){
       if(m>=1 && m <=12)cout<<"AMBIGUOUS\n";
       else cout << "MMYY\n";
   }
   else cout << "NA\n";



}

Measured memory_bytes: 3588
import scala.io.StdIn._
import scala.collection._

object Main {

  class Sieve(val n: Int){
    private[this] val top = (n - 3) / 2 + 1
    private[this] val (cmpsts, sqrtLmtNdx) = (new Array[Int]((top >>> 5) + 1), (Math.sqrt(n).toInt - 3) / 2)

    def isCmpst(ci: Int): Boolean = (cmpsts(ci >>> 5) & (1 << (ci & 31))) != 0
    def setCmpst(ci: Int): Unit = cmpsts(ci >>> 5) |= 1 << (ci & 31)

    private def cull(cmpstId: Int, p: Int): Unit = {
      if(cmpstId <= top){
        setCmpst(cmpstId)
        cull(cmpstId + p, p)
      }
    }

    private def get(cndId: Int): Unit = {
      if(cndId <= sqrtLmtNdx){
        if(!isCmpst(cndId)){
          val p = 2 * cndId + 3
          cull((p * p - 3) >>> 1, p)
        }
        get(cndId + 1)
      }
    }

    private def next(cndId: Int): Int =
      if ((cndId > top) || !isCmpst(cndId)) 2 * cndId + 3 else next(cndId + 1)

    def exec: Iterator[Int] = {
      get(0)
      Iterator.single(2) ++ Iterator.iterate(3)(p => next((p - 1) >>> 1)).takeWhile(_ <= n)
    }
  }

  def loop(s: String){
    if(s != null){
       val Array(n,_*) = s.split(" ").map(_.toInt)
       if(n<2) println(0)
       else println(new Sieve(n).exec.size)
       loop(readLine)
    }
  }

  def main(args: Array[String]): Unit = loop(readLine)
}

Measured memory_bytes: 65724
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VVI vector<VI>
#define VL vector<LL>
#define VVL vector<VL>
#define VPII vector<PII>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define all(x) x.begin(),x.end()
#define watch(x) cout<<(#x)<<" = "<<(x)<<'\n'
#define mset(a,v) memset(a,v,sizeof(a))
#define setp(x) cout<<fixed<<setprecision(x)
#define EPS 0.00000000001
#define PI acos(-1)
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

const int MOD = 1e9 + 7;
const LL MX = 1e9;
const LL INF = 1e9;

int main()
{
    //ofstream out("output.txt");
    //ifstream in("input.txt");
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    string s;
    cin>>s;
    int n = s.length();
    if(s[n-1] == 's') s += "es";
    else s += "s";

    cout<<s<<'\n';

    return 0;
}


Measured memory_bytes: 3660
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <fstream>
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(), v.end()
using namespace std;

const int N = 500005;

LL n,used[N],a[N],ans;
vector<int> g[N],t;

void topsort(int v)
{
	used[v] = 1;
	for (int i = 0; i < g[v].size(); i++)
	{
		int to = g[v][i];
		if (used[to])
			continue;
		topsort(to);
	}
	t.PB(v);
}

string s;

int main()
{
	cin >> s;
	s = "#" + s;
	n = s.length();
	for (int i = 1; i < s.length(); i++)
	{
		if (s[i] == '<')
			g[i].PB(i + 1);
		else
			g[i + 1].PB(i);
	}
	for (int i = 1; i <= n; i++)
		if (!used[i])
			topsort(i);
	reverse(all(t));
	for (int i = 0; i < t.size(); i++)
	{
		for (int j = 0; j < g[t[i]].size(); j++)
		{
			int to = g[t[i]][j];
			a[to] = max(a[to], a[t[i]] + 1);
		}
		ans += a[t[i]];
	}

	cout << ans << endl;
	return 0;
}

/*



*/

Measured memory_bytes: 54032
import std.stdio;
import std.conv;
import std.algorithm;
import std.range;
import std.string;
import std.math;
import std.format;

void main() {
  foreach (string line; stdin.lines) {
    int n = line.chomp.to!int;

    int cnt = 0;
    for (int a = 0; a <= 9; a++) {
      for (int b = 0; b <= 9; b++) {
        for (int c = 0; c <= 9; c++) {
          for (int d = 0; d <= 9; d++) {
            if (a + b + c + d == n) {
              cnt++;
            }
          }
        }
      }
    }

    cnt.writeln;
  }
}

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

typedef long double ld;
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

const ll inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;

#define FOR(i, b, e) for (ll i = b; i <= e; i++)
#define FORD(i, b, e) for (ll i = b; i >= e; i--)
#define SIZE(x) ((ll)(x).size())
#define pb push_back
#define st first
#define nd second
#define all(a) begin(a), end(a)
#define watch(x) cerr << (#x) << " is " << (x) << '\n';

struct vec {
    ll x, y, id;
    vec(ll _x, ll _y, ll _id) {
        x = _x;
        y = _y;
        id = _id;
    }
};

vector<vec> V, V1, V2;

bool comp(vec a, vec b) {
    if (a.x * b.y - a.y * b.x == 0) {
        if (a.x == b.x)
            return a.id < b.id;
        else {
            return a.x < b.x;
        }
    } else
        return a.x * b.y - a.y * b.x < 0;
}

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

    ll n;
    cin >> n;
    ll a, b;

    int cnt = 0;

    V1.pb(vec(-1, 0, 200001));
    V1.pb(vec(0, 1, 200002));
    V2.pb(vec(1, 0, 200003));
    V2.pb(vec(0, -1, 200004));

    FOR(i, 1, n) {
        cin >> a >> b;
        if (a == 0 && b == 0) {
            cnt++;
            continue;
        }

        if ((a <= 0 && b >= 0) || (a > 0 && b > 0))
            V1.pb(vec(a, b, i));
        else
            V2.pb(vec(a, b, i));
    }

    n -= cnt;

    sort(all(V1), comp);
    sort(all(V2), comp);

    V.reserve(V1.size() + V2.size());
    V.insert(V.end(), V2.begin(), V2.end());
    V.insert(V.end(), V1.begin(), V1.end());

    // for (auto v : V) cout << v.x << " " << v.y << endl;

    ld mx = 0;
    ll x, y;

    n += 4;

    FOR(i, 0, n - 1) {
        x = y = 0;
        FOR(j, 0, n - 1) {
            if (V[(i + j) % n].id >= 1000) continue;
            x += V[(i + j) % n].x;
            y += V[(i + j) % n].y;
            mx = max(mx, hypotl((ld)x, (ld)y));
        }
    }

    cout << fixed << setprecision(30) << mx;

    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  string s,t;
  cin>>s;
  t=s;
  reverse(t.begin(),t.end());
  for(int i=0;i<(int)t.size();i++){
    if(s[i]=='b') s[i]='d';
    else if(s[i]=='d') s[i]='b';
    else if(s[i]=='p') s[i]='q';
    else if(s[i]=='q') s[i]='p';
  }
  cout<<(s==t?"Yes":"No")<<endl;
  return 0;
}


Measured memory_bytes: 512
/* 문제
2015.

*/


#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <functional>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <iostream>
#include <ctime>

#define enp 	printf("**Entry Point**\n")
#define A		first
#define B		second
#define MP		make_pair

using namespace std;

typedef long long ll;

const int INF = 0x6fffffff;
const int MINF = 0x80000000;
const int mod = 1000000007;
const int cons = 100001;
const double pi = 3.141592653589793;

int a[100001];
bool chk[100001];

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

	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i]);
	}

	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		if (chk[i])continue;
		if (i == a[a[i]])
		{
			ans++;
			chk[i] = true;
			chk[a[i]] = true;
		}
	}

	printf("%d\n", ans);


	return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <string>

using namespace std;

void A()
{
    string S;
    cin >> S;
    
    if( S[0] == S[1] && S[1] == S[2] ){
        cout << "No" << endl;
        return;
    }
    
    cout << "Yes" << endl;
}

void B()
{
    long long int N, A, B;
    cin >> N >> A >> B;
    
    cout << N / (A + B) * A + min(A, N % (A + B)) << endl;
}


int main()
{
    //A();
    B();
    
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String a = in.next();
            String b = in.next();
            String c = in.next();
            out.printf("%C%C%C\n", a.charAt(0), b.charAt(0), c.charAt(0));
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return c >= 33 && c <= 126;
        }

        public String next() {
            StringBuilder sb = new StringBuilder();

            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();

            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }

            return sb.toString();
        }

    }
}



Measured memory_bytes: 21332
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ll MOD2   = 998244353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)      for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

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

/*--------additional--------*/

int dp[100005];

/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int n, k; cin >> n >> k;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    for(auto &x : dp) x = INF9;

    dp[0] = 0;
    for(int i = 1; i < n; ++i){
        for(int j = 1; j <= k; ++j){
            if(i - j >= 0)
                chmin(dp[i],
                      dp[i - j] + abs(h[i - j] - h[i]));
        }
    }

    cout << dp[n - 1] << endl;

return 0;
}

Measured memory_bytes: 4044
#include<iostream>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<vector>

using namespace std;
int GCD(int x, int y){
    if(x % y == 0) return y;
    GCD(y, x % y);
}

int main(){
    int x, y; cin >> x >> y;
    cout << GCD(x, y)<< endl;
    return 0;
}
   

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

    for(long long i=2;i*i<=n;++i){
        long long e=0,z=0;
        while(n%i==0){
            ++e;
            if(e>z){
                ++ans;
                z=e;
                e=0;
            }
            n/=i;
        }
    }

    if(n!=1) ++ans;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define eps 1e-10
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int n,m,vis[maxn],pre[maxn];
vector <int> mp[maxn],ans,tmp;
queue <int> q;

inline void bfs(int nw)
{
	for(int i=1;i<=n;i++) vis[i]=0; ans.clear();
	while(!q.empty()) q.pop(); q.push(nw),vis[nw]=1;
	while(!q.empty())
	{
		int u=q.front(); q.pop(); //cout<<nw<<" "<<u<<endl;
		for(int i=0;i<mp[u].size();i++)
		{
			int v=mp[u][i];
			if(v==nw)
			{
				int x=u; ans.push_back(nw);
				while(x!=nw) ans.push_back(x),x=pre[x];
				if(ans.size()<tmp.size()||tmp.size()==0) tmp=ans;
				return;
			}
			if(!vis[v]) q.push(v),pre[v]=u,vis[v]=1;
		}
	}
}

int main()
{
	n=read(); m=read();
	for(int i=1;i<=m;i++)
	{
		int u=read(),v=read();
		mp[u].push_back(v);
	}
	for(int i=1;i<=n;i++) bfs(i);
	if(tmp.size()==0) puts("-1");
	else
	{
		cout<<tmp.size()<<endl;
		for(int i=0;i<tmp.size();i++) printf("%d\n",tmp[i]);
	}
	
	return 0;
}

Measured memory_bytes: 26880
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()

struct mint{
    static const long long MOD = 998244353;

    long long v;

    mint() : v(0) {}
    mint(long long x){
        x = x % MOD;
        if(x < 0){ x += MOD; }
        v = x;
    }
    mint& operator+=(mint a){
        v += a.v;
        if(v >= MOD){ v -= MOD; }
        return *this;
    }
    mint& operator*=(mint a){
        v *= a.v;
        v %= MOD;
        return *this;
    }
    mint& operator-=(mint a){
        v -= a.v;
        if(v < 0){ v += MOD; }
        return *this;
    }
    mint& operator/=(mint a){
        return (*this) *= a.inv();
    }

    mint operator*(mint a) const{
        return mint(v) *= a;
    }

    mint operator+(mint a) const {
        return mint(v) += a;
    }

    mint operator-(mint a) const {
        return mint(v) -= a;
    }

    mint operator/(mint a) const {
        return mint(v) /= a;
    }

    mint pow(long long k) const {
        mint res(1),tmp(v);
        while(k){
            if(k&1) res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    mint inv(){return pow(MOD - 2); }

    static mint comb(long long n, int k){
        mint res(1);
        for(int i = 0; i < k; ++i){
            res *= mint(n - i);
            res /= mint(i + 1);
        }
        return res;
    }

    static mint factorial(long long n){
        mint res(1);
        for(int i = n; i > 1; --i){
            res *= mint(i);
        }
        return res;
    }

    bool operator<(const mint &a) const {
        return v < a.v;
    };
};

mint operator*(long long l, mint r){ return r * l; }

std::ostream& operator<<(std::ostream& stream, const mint& m){
    stream << m.v;
    return stream;
}

struct mintcomb{
    vector<mint> fact;
    vector<mint> ifact;
    mintcomb(ll n) : fact(n + 1, 1), ifact(n + 1, 1) {
        for(ll i = 2; i <= n; ++i){
            fact.at(i) = fact.at(i - 1) * i;
            ifact.at(i) = fact.at(i).inv();
        }
    }

    mint factorial(ll k) const { return fact.at(k); }
    mint combination(ll k, ll l) const {
        return fact.at(k) * ifact.at(l) * ifact.at(k - l);
    }
};


int main(){
    ll n, m, k;
    cin >> n >> m >> k;

    vector<mint> pow(n + 1);
    pow.at(0) = 1;
    for(ll i = 1; i <= n; ++i){
        pow.at(i) = pow.at(i - 1) * (m - 1);
    }

    mintcomb mc(n);

    mint ans = 0;
    REP(s, k + 1){
        mint tmp = m * pow.at(n - 1 - s) * mc.combination(n - 1, s);
        ans += tmp;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8016
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

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

#define REP(i, n) for(ll i = 0; i < n; i++)











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

int bfs(vector<string> &s, int sy, int sx, int gy, int gx){
    int h = s.size(), w = s[0].size();
    vector<vector<bool>> flag(h, vector<bool>(w));
    queue<pair<pair<int, int>, int>> que;
    que.push({{sy, sx}, 0});
    while(!que.empty()){
        auto tmp = que.front(); que.pop();
        int y = tmp.first.first, x = tmp.first.second, d = tmp.second;
        if(flag[y][x]) continue;
        flag[y][x] = true;
        if(gy == y && gx == x){
            return d;
        }
        for(int i = 0; i < 4; i++){
            int yy = y + dy[i], xx = x + dx[i];
            if(yy < 0 || yy >= h || xx < 0 || xx >= w || s[yy][xx] == '#') continue;
            que.push({{yy, xx}, d + 1});
        }
    }
    return -1;
}

int main(){
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for(int i = 0; i < h; i++){
        cin >> s[i];
    }
    int ans = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(s[i][j] == '#') continue;
            for(int k = 0; k < h; k++){
                for(int l = 0; l < w; l++){
                    if(s[k][l] == '#') continue;
                    ans = max(ans, bfs(s, i, j, k, l));
                }
            }
        }
    }
    cout << ans << endl;
}

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

int main() {
    optimizar_io
 	string s, t;

 	cin >> s >> t;
 	int cnt = 0;
 	for (int i = 0; i < s.size(); i++) {
 		if (s[i] != t[i])
 			cnt++;
 	}
 	cout << cnt << "\n";
 	return 0;
}

Measured memory_bytes: 3728
#include<iostream>
#include<string>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	int c=b-a,
	    d=c*(c-1)/2,
	    ans=d-a;
	printf("%d",ans);
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int heights[N];
  for (int i = 0; i < N; i++)
    cin >> heights[i];
  int dp[N];
  dp[0] = 0;
  for (int i = 1; i < N; i++) {
    int op1 = INT_MAX;
    int op2 = INT_MAX;
  	if (i - 1 >= 0)
      op1 = abs(heights[i] - heights[i-1]) + dp[i-1];
    if (i - 2 >= 0)
      op2 = abs(heights[i] - heights[i-2]) + dp[i-2];
    dp[i] = min(op1, op2);
  }
  cout << dp[N-1];
  return 0;
}


Measured memory_bytes: 4372
import java.util.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;
public class Main {

	static Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) {
		while (read())
			solve();
	}
	
	static int N, M, R;
	static int[] Z = new int[1001];
	static int[][] WL = new int[201][201], WS = new int[201][201];
	static final int INF = 1 << 25;
	static boolean read() {
		N = sc.nextInt();
		M = sc.nextInt();
		if (N == 0 && M == 0) return false;
		
		for (int i = 0; i < 201; i++) {
			fill(WL[i], INF); 
			fill(WS[i], INF);
			WL[i][i] = WS[i][i] = 0;
		}
		
		for (int i = 0; i < M; i++) {
			int x, y, t;
			char sl;
			x = sc.nextInt();
			y = sc.nextInt();
			t = sc.nextInt();
			sl = sc.next().charAt(0);
			if (sl == 'S') {
				WS[x][y] = WS[y][x] = t;
			} else {
				WL[x][y] = WL[y][x] = t;
			}
		}
		
		R = sc.nextInt();
		for (int i = 0; i < R; i++) Z[i] = sc.nextInt();
		return true;
	}

	static int[][] dist = new int[1010][201];
	static void solve() {
		PriorityQueue<State> que = new PriorityQueue<State>();
		que.offer(new State(0, Z[0], 0));
		int ans = INF;
		for (int k = 1; k < 201; k++) {
			for (int i = 1; i < 201; i++) { 
				for (int j = 1; j < 201; j++) {
					WL[i][j] = min(WL[i][j], WL[i][k] + WL[k][j]);
					WS[i][j] = min(WS[i][j], WS[i][k] + WS[k][j]);
				}
			}
		}			
		
		/*
		for (int i = 0; i < 1000; i++) fill(dist[i], -1);
		while (!que.isEmpty()) {
			State s = que.poll();
			if (dist[s.cur][s.ship] != -1) continue;
			
			dist[s.cur][s.ship] = s.cost;
			
			if (s.cur == R - 1) {
				ans = s.cost;
				break;
			}
			
			int cur = s.cur, from = Z[s.cur], to = Z[s.cur + 1], cost = s.cost, ship = s.ship;
			// ツ猟、ツ路ツづーツ使ツつ、
			
			int ncost = cost + WL[from][to], nship = ship;
			if (dist[s.cur + 1][nship] == -1 && ncost < INF) 
				que.offer(new State(s.cur + 1, ship, cost + WL[from][to]));
			
			// ツ海ツ路ツづーツ使ツつ、
			for (int k = 1; k < 201; k++) {
				ncost = cost + WL[from][ship] + WS[ship][k] + WL[k][to];
				nship = k;
				if (dist[s.cur + 1][nship] == -1 && ncost < INF)
					que.offer(new State(s.cur + 1, nship, ncost));
			}
		}
		System.out.println(ans);
		*/
		
		for (int i = 0; i < 1000; i++) fill(dist[i], INF);
		dist[0][Z[0]] = 0;
		
		for (int i = 1; i <= R; i++) {
			for (int j = 1; j <= N; j++) {
				int from = Z[i - 1], to = Z[i]; 
				dist[i][j] = min(dist[i][j], dist[i - 1][j] + WL[from][to]);
				for (int k = 1; k <= N; k++) {
					dist[i][j] = min(dist[i][j], dist[i - 1][k] + WL[from][k] + WS[k][j] + WL[j][to]); 
				}
				//System.out.print(dist[i][j] + " ");
			}
			//System.out.println();
		}
		
		
		ans = INF;
		for (int i = 1; i < 201; i++) 
			ans = min(ans, dist[R - 1][i]);
		
		System.out.println(ans);
	}	
}

class State implements Comparable<State> {
	int cur, ship, cost;
	State (int cur, int ship, int cost) {
		this.cur = cur;
		this.ship = ship;
		this.cost = cost;
	}
	
	public int compareTo(State s) {
		return this.cost - s.cost;
	}
}

Measured memory_bytes: 14000
A, B, K = map(int, input().split())

ans = set()

for i in range(A, A+K):
    if i > B:
        break
    ans.add(i)

for i in range(B, B-K, -1):
    if i < A:
        break
    ans.add(i)
for i in sorted(list(ans)):
    print(i)


Measured memory_bytes: 3060
#include <stdio.h>
int main(void){
    int H,W,n,m;
    for(;;){
        scanf("%d %d",&H,&W);
        if(H==0 && W==0){
            break;
        }
        for(m=1;m<=W;m++){
            printf("#");
        }
        printf("\n");
        for(n=1;n<=H-2;n++){
            printf("#");
            for(m=1;m<=W-2;m++){
                printf(".");
            }
            printf("#\n");
        }
        for(m=1;m<=W;m++){
            printf("#");
        }
        printf("\n");
        printf("\n");
  }
  return 0;
}

Measured memory_bytes: 588
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define NMAX 1005
#define MMAX 2005
#define INF (long long )1e18

//コメントアウトするとdebug()を実行しない
#define DEBUG

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

typedef long long ll;
typedef pair<ll ,ll > P;

struct edge{
	ll from,to,cost;
};

ll N,M,ans,d[NMAX];
edge es[MMAX];
string S;
static const ll dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

bool bellman_ford(){
	Fill(d,-INF);
	d[1] = 0;
	bool update = false;
	ll num = 0,nat;
	do{
		update = false;
		for (ll i = 0; i < M; ++i)
		{
			edge e = es[i];
			if(d[e.from] != -INF && d[e.to] < d[e.from] + e.cost){
				d[e.to] = d[e.from] + e.cost;
				update = true;
			}
		}
		if(num == N-2){
			nat = d[N];
		}
		if(num > 2*N && update){
			if(nat != d[N]){
				return true;
			}
			return false;
		}
		num++;
	}while(update);
	return false;
}

void solve(){
	if(bellman_ford()){
		ans = INF;
	}
}

void debug(){

}

void answer(){
	if(ans == INF){
		cout << "inf\n";
	}else{
		cout << d[N] << "\n";
	}
}

int main(){
	cin >> N >> M;
	for (ll i = 0; i < M; ++i)
	{
		ll A,B,C;
		cin >> A >> B >> C;
		es[i] = (edge){A,B,C};
	}
	solve();
	#ifdef DEBUG
	debug();
	#endif
	answer();

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cctype>
#include <cstdio>

using namespace std;

int main()
{
    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;
    transform(s.begin() + k - 1,s.begin() + k, s.begin() + k - 1, ::tolower);
    cout << s << endl;
    return 0;
}

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

using namespace std;
using ll = long long;
static const int LIMIT = 1000000000;

int main(){
	ios_base::sync_with_stdio(false);
	int n, m, h, w;
	cin >> n >> m >> h >> w;
	if(h * w == 1){
		cout << "No" << endl;
		return 0;
	}
	const ll hi = ((LIMIT - 1) / (h * w - 1)) * (h * w - 1) + 1;
	const ll lo = (hi - 1) / (h * w - 1);
	vector<vector<ll>> a(n, vector<ll>(m, lo));
	for(int i = h - 1; i < n; i += h){
		for(int j = w - 1; j < m; j += w){
			a[i][j] = -hi;
		}
	}
	ll sum = 0;
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j){ sum += a[i][j]; }
	}
	if(sum <= 0){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
		for(int i = 0; i < n; ++i){
			for(int j = 0; j < m; ++j){ cout << a[i][j] << " "; }
			cout << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
#define INF LLONG_MAX
#define mod 1000000007
typedef long long ll;
int main(void)
{
	int N, count=0;
	cin >> N;
	vector<string> s(N);
	vector<int> t(N);
	rep(i, N) cin >> s.at(i) >> t.at(i);
	string X;
	cin >> X;
	for(int i=N-1; i>0; i--)
	{
		if(s.at(i)==X) break;
		count += t.at(i);
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
ans = 0
for b in range(K + 1, N + 1):
    p, q = divmod(N, b)
    ans += p * (b - K)
    if K:
        ans += max(0, q - K + 1)
    else:
        ans += q
print(ans)

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

int main(){
	int a, b;
	cin >> a >> b;
	
	if(a<b){
	    
	 cout << "a < b" << endl;
	    
	}
	else if(a>b){
	    
	cout << "a > b" << endl;
	    
	}
	else {
	    cout << "a == b" << endl;
	    
	}
}



Measured memory_bytes: 3060
// AOJ 2009: Area Separation
// 2017.10.30 bal4u@uu

#include <stdio.h>
#include <math.h>

#define EPS 1e-10

typedef struct { int x, y; } PP;
typedef struct { double x, y; } FPP;
typedef struct { PP p1, p2; } SEG;
SEG sg[102]; int n;
FPP pp[102]; int sz;

double dis(FPP p1, FPP p2)
{
	double dx = p1.x - p2.x;
	double dy = p1.y - p2.y;
	return sqrt(dx*dx + dy*dy);
}

int one(FPP p1, PP p2)
{
	return fabs(p1.x-p2.x) <= EPS && fabs(p1.y-p2.y) <= EPS;
}

int intersection(FPP *p, PP p1, PP p2, PP p3, PP p4)
{
   int t1, t2, t3, t4;
   double bo, ua;

   t1 = (p1.y-p3.y)*(p3.x-p4.x)-(p1.x-p3.x)*(p3.y-p4.y);
   t2 = (p2.y-p3.y)*(p3.x-p4.x)-(p2.x-p3.x)*(p3.y-p4.y);
   t3 = (p3.y-p1.y)*(p1.x-p2.x)-(p3.x-p1.x)*(p1.y-p2.y);
   t4 = (p4.y-p1.y)*(p1.x-p2.x)-(p4.x-p1.x)*(p1.y-p2.y);
   if ((t1 < 0 && t2 > 0 || t1 > 0 && t2 < 0) && (t3 < 0 && t4 > 0 || t3 > 0 && t4 < 0)) {
      bo = (p4.y-p3.y)*(p2.x-p1.x)-(p4.x-p3.x)*(p2.y-p1.y);
      ua = (p4.x-p3.x)*(p1.y-p3.y)-(p4.y-p3.y)*(p1.x-p3.x);
      p->x = p1.x + ua/bo * (p2.x-p1.x);
      p->y = p1.y + ua/bo * (p2.y-p1.y);
      return 1;
   } else return 0;
}

int main()
{
	int i, j, k, f, ans;
	FPP p;

	while(scanf("%d", &n) && n > 0) {
		for (i = 0; i < n; i++)
			scanf("%d%d%d%d", &sg[i].p1.x, &sg[i].p1.y, &sg[i].p2.x, &sg[i].p2.y);
		ans = 1;
		for (i = 0; i < n; i++) {
			sz = 0;
			for (j = 0; j < i; j++) {
				if (!intersection(&p, sg[i].p1, sg[i].p2, sg[j].p1, sg[j].p2)) continue;
				if (one(p, sg[i].p1) || one(p, sg[i].p2) ||
					one(p, sg[j].p1) || one(p, sg[j].p2)) continue;
				
				for (f = 1, k = 0; k < sz; k++) {
					if (dis(p, pp[k]) < EPS) { f = 0; break; }
				}
				if (f) pp[sz++] = p;
			}
			ans += sz + 1;
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1740
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = (int)1e9 + 7;
const int MX = (int)1e5 + 10;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}

int main(){

	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);

	int h, w, k;
	cin >> h >> w >> k;
	vector<vector<int>> a(h, vector<int>(w));
	for(auto &rw : a){
		for(auto &x : rw){
			char c;
			cin >> c;
			x = c == '1';
		}
	}

	int res = h + w - 2;

	int mx = 1 << (h - 1);
	for(int msk = 0; msk < mx; ++msk){
		vector<int> row_sep(h), col_sep(w);
		int cnt = 0;
		for(int bit = 0; bit < h - 1; bit++){
			if((msk >> bit & 1) == 0) continue;
			row_sep[bit + 1] = true;
			cnt++;
		}
		assert(cnt == __builtin_popcount(msk));

		bool leave_msk = 0;
		int sz = cnt + 1;
		vector<int> tot(sz);
		for(int j = 0; j < w; ++j){
			vector<int> added;
			int sum = 0;
			for(int i = 0; i < h; ++i){
				if(row_sep[i]){
					added.push_back(sum);
					sum = 0;
				}
				sum += a[i][j];
			}
			added.push_back(sum);
			sum = 0;

			assert(added.size() == tot.size());

			bool repeat = 0;
			for(int i = 0; i < sz; ++i){
				if(added[i] > k) leave_msk = true;
				if(added[i] + tot[i] > k) repeat = true;
			}
			if(leave_msk) break;
			else if(repeat){
				col_sep[j] = true;
				// j--;
				// fill(all(tot), 0);
				tot = added;
				cnt++;
			}
			else {
				for(int i = 0; i < sz; ++i){
					tot[i] += added[i];
				}
			}
		}
		if(not leave_msk){
			res = min(res, cnt);
		}
	}

	cout << res << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  char S[5];
  int flag=1;
  scanf("%s",S);
  char s1,t1,s2,t2;
  s1=t1=s2=t2='\0';
  s1=S[0];
  for(int i=1;i<4;i++){
    if(s1==S[i])
      if(t1=='\0')
        t1=S[i];
      else
        flag=0;
    else if(s2==S[i])
      if(t2=='\0')
        t2=S[i];
      else
        flag=0;
    else
      if(s2=='\0')
        s2=S[i];
      else 
        flag=0;
  }
  if(flag)
  	printf("Yes\n");
  else
    printf("No\n");
  return 0;
}

Measured memory_bytes: 128
a[9999];main(n,i,j,m,s){
	for(;scanf("%d",&n),n;){
		for(i=0;i<n;i++)scanf("%d",a+i);
		for(m=-1000000,i=0;i<n;i++){
			for(s=0,j=i;j<n;j++){
				s+=a[j];
				if(m<s)m=s;
			}
		}
		printf("%d\n",m);
	}
	exit(0);
}

Measured memory_bytes: 612
#include <stdio.h>
#include <string.h>


void bubbleSort( char A[][3], char B[][3], int N )
{
    char tmp[3];

	for ( int i = 0; i < N; i++ ) {
    	memcpy( B[i], A[i], 3 );
	}

    for ( int i = 0; i < N; i++ ) {
        for ( int j = N - 1; j >= i + 1; j-- ) {
            if ( B[j][1] < B[j - 1][1] ) {
               memcpy( tmp, B[j], 3 );
               memcpy( B[j], B[j - 1], 3 );
               memcpy( B[j - 1], tmp, 3);
            }
        }
    }
}

void selectionSort( char A[][3], char C[][3], int N )
{
    int minj;
    char tmp[3];

	for ( int i = 0; i < N; i++ ) {
    	memcpy( C[i], A[i], 3 );
	}

    for ( int i = 0; i < N; i++ ) {
        minj = i;
        for ( int j = i + 1; j < N; j++ ) {
            if ( C[j][1] < C[minj][1] ) {
                minj = j;
            }
        }
        if ( minj != i ) {
            memcpy( tmp, C[i], 3 );
            memcpy( C[i], C[minj], 3 );
            memcpy( C[minj], tmp, 3);
        }
    }
}

int isStable( char in[][3], char out[][3], int N )
{
    for ( int i = 0; i < N; i++ ) {
        for ( int j = i + 1; j < N; j++ ) {
            for ( int a = 0; a < N; a++ ) {
                for ( int b = a + 1; b < N; b++ ) {
                    if ( ( in[i][1] == in[j][1] ) && ( strcmp( in[i], out[b] ) == 0 ) && ( strcmp( in[j], out[a] ) == 0 ) ) {
                        return 0;
                    }
                }
            }
        }
    }
    return 1;
}

int main(void)
{
    int N;
    char A[36][3];
    char B[36][3];
    char C[36][3];

    scanf("%d", &N);
    
    for ( int i = 0; i < N; i++ ) {
        scanf("%s", A[i]);
    }
    
    bubbleSort( A, B, N );
	for ( int i = 0; i < N; i++ ) {
        printf("%s", B[i]);
        if ( i != N - 1 ) {
            printf(" ");
        } else {
            printf("\n");
        }
    }
    if ( isStable( A, B, N ) == 1 ) {
        printf("Stable\n");
    } else {
        printf("Not stable\n");
    }
    
    selectionSort( A, C, N );
    for ( int i = 0; i < N; i++ ) {
        printf("%s", C[i]);
        if ( i != N - 1 ) {
            printf(" ");
        } else {
            printf("\n");
        }
    }
    if ( isStable( A, C, N ) == 1 ) {
        printf("Stable\n");
    } else {
        printf("Not stable\n");
    }
    
    return 0;
}


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

int main() {
  string a,b;
  cin>>a>>b;
  bool flag = 0;//LESS
  
  if(a==b){
    puts("EQUAL");
    return 0;
  }
  else if(a.size()>b.size()) flag=1;
  
  else if(a.size()<b.size()) flag=0;
  
  else{//a.size()==b.size()かつa!=b
    rep(i,a.size()){
      int c = a[i]-'0';
      int d = b[i]-'0';
      if(c>d) {
        flag=1;
        break;
      }
      else if(c<d) {
        flag=0;
        break;
      }
    }
  }
  if(flag)puts("GREATER");
  else puts("LESS");
  return 0;
}

Measured memory_bytes: 256
/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n,k;
  cin >> n >> k;
  vector<int>p(n);
  rep(i,n)cin >> p.at(i);
  vector<double>c(n);
  vector<double>d(n);
  
  double allsum =0;
  rep(i,n){
    double sum =0;
    double count=0;
    for(int j=1;  j<= p.at(i) ;j++){
      sum += j;
      count ++;
    }
    c.at(i) = sum / count;
    allsum += sum / count;
    d.at(i) = allsum;
  }
/*  rep(i,n) cout << c.at(i) <<" | ";
  cout << endl;
  rep(i,n) cout << d.at(i) <<" | ";
  cout << endl;
  */

  double ma =0;
  ma = max(ma, d.at(k-1));
//  cout << d.at(k-1) <<" | ";
  
  int countB = 0;
  for(int i=k; i<n; i++){   
//    cout << d.at(i) -d.at(countB) <<" | ";
    ma = max(ma, d.at(i) - d.at(countB) );
       countB ++;
  }
//  cout << endl;
  printf("%.10f\n", ma);
//  cout << ma << endl;
}

Measured memory_bytes: 4096