akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main(){
	fastio();
	string s,t;
	cin >> s >> t;
	int a, b;
	cin >> a >> b;
	string p;
	cin >> p;
	cout << a - (s==p) << " " << b -(t==p) ;	
}

Measured memory_bytes: 3656
#include <stdio.h>


int main() {

	
	int i;
	char S[4];

	scanf("%s", S);

	if (S[0] == S[1]) {
		if (S[2] == S[3] && S[0] != S[2]) {
			printf("Yes\n");
			return 0;
		}
		else {
			printf("No\n");
			return 0;
		}
	}
	else if (S[0] == S[2]) {
		if (S[1] == S[3] && S[0] != S[1]) {
			printf("Yes\n");
			return 0;
		}
		else {
			printf("No\n");
			return 0;
		}
	}
	else if (S[0] == S[3]) {
		if (S[1] == S[2] && S[0] != S[1]) {
			printf("Yes\n");
			return 0;
		}
		else {
			printf("No\n");
			return 0;
		}
	}
	else {
		printf("No\n");
		return 0;
	}

	return 0;
}

Measured memory_bytes: 128
N, K = gets.split.map(&:to_i)
S = gets.chomp
t = S.chars.chunk(&:to_i).map do |a, b|
  [a, b.size]
end
t.unshift([1, 0]) if t[0][0] != 1
t.push([1, 0]) if t[-1][0] != 1
x = 0
u = [0]
t.each { |_a, b| u << x += b }
if K >= u.size / 2
  p u[-1]
else
  bucket = (u.size / 2 - K).times.map do |i|
    u[i * 2 + K * 2 + 1] - u[i * 2]
  end
  p bucket.max
end


Measured memory_bytes: 17532
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    string s;
    cin >> s;
    if (s == "ABC"){
        cout << "ARC" << endl;
    } else {
        cout << "ABC" << endl;
    }

}



Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
#include <limits>
using namespace std;
// 素因数分解
typedef pair<long long, long long> P;
vector<P> prime_factorize(long long n)
{
	vector<P> res;
	for (long long p = 2; p * p <= n; ++p)
	{
		if (n % p != 0)
			continue;
		int num = 0;
		while (n % p == 0)
		{
			++num;
			n /= p;
		}
		res.push_back(make_pair(p, num));
	}
	if (n != 1)
		res.push_back(make_pair(n, 1));
	return res;
}
// 因数分解
long long gcd(long long x, long long y)
{
	if (y == 0)
	{
		return x;
	}
	else
	{
		return gcd(y, x % y);
	}
}
const int MOD = 1000000007;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)

int main()
{
	string s;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5])
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3580
#include <iostream>

static const int MAX = 1000;

int main(){
    int itr;
    std::cin >> itr;
    int A[MAX];
    for(int i = 0; i < itr; i++){
        std::cin >> A[i];
    }
    for(int i = 0; i < itr; i++){
        if(i > 0) std::cout << " ";
        std::cout << A[i];
    }
    std::cout << std::endl;
    for(int i = 1; i < itr; i++){
        int v = A[i];
        int j = i - 1;
        while(j >= 0 && A[j] > v){
            A[j+1] = A[j];
            --j;
        }
        A[j+1] = v;
        for(int k = 0; k < itr - 1; k++){
            std::cout << A[k] << " ";
        }
        std::cout << A[itr - 1] << std::endl;
    }
    return 0;
}


Measured memory_bytes: 3096
import java.util.*;

public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        if(a==5 && b==5 &&c==7)System.out.println("YES");
        else if(a==5 && b==7 && c==5)System.out.println("YES");
        else if(a==7 && b==5 && c==5)System.out.println("YES");
        else System.out.println("NO");
    }
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main() {
  ll N,T;
  scanf("%lld%lld", &N,&T);
  ll a[N];
  for (int i = 0; i < N; ++i) {
    scanf("%lld", &a[i]);
  }

  ll ans = 0;

  FOR(i,0,N-2){
    if(a[i+1]-a[i]<T) ans += a[i+1]-a[i];
    else ans += T;
  }

  ans += T;

  cout << ans << endl;

}



Measured memory_bytes: 1920
#include "bits/stdc++.h"

#define rep(i,n) for(int i = 0;i<n;i++)
#define cint(a) int a; cin >> a;
#define cstr(str) string str; cin >> str;


using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;

int main(void) {

	ios::sync_with_stdio(false);
	cin.tie(0);

	int a[3][3];
	bool f[3][3] = {};

	rep(i, 3)rep(j, 3) cin >> a[i][j];

	int n; cin >> n;
	int b;
	while (n--) {
		cin >> b;
		rep(i, 3)rep(j, 3) if (a[i][j] == b) f[i][j] = true;
	}

	if (f[0][0] && f[0][1] && f[0][2]) { cout << "Yes" << endl; return 0; }
	if (f[1][0] && f[1][1] && f[1][2]) { cout << "Yes" << endl; return 0; }
	if (f[2][0] && f[2][1] && f[2][2]) { cout << "Yes" << endl; return 0; }
	if (f[0][0] && f[1][0] && f[2][0]) { cout << "Yes" << endl; return 0; }
	if (f[0][1] && f[1][1] && f[2][1]) { cout << "Yes" << endl; return 0; }
	if (f[0][2] && f[1][2] && f[2][2]) { cout << "Yes" << endl; return 0; }
	if (f[0][0] && f[1][1] && f[2][2]) { cout << "Yes" << endl; return 0; }
	if (f[0][2] && f[1][1] && f[2][0]) { cout << "Yes" << endl; return 0; }

	cout << "No" << endl;



	return 0;
}


Measured memory_bytes: 3608
def gcd(a, b):
    if a == b: return a
    while b > 0: a, b = b, a % b
    return a

n,x=(int(i) for i in input().strip().split(" "))
from functools import reduce
ar=[int(i) for i in input().strip().split(" ")]
ar.sort()
from bisect import insort
insort(ar,x)
temp=[]
for i in range(1,len(ar)):
    temp.append(abs(ar[i]-ar[i-1]))

k=reduce(gcd,temp)
print(k)

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

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX

#define f first
#define s second

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N, M;
	vector<pair<pair<double,double>,double>> c;
	vector<double> dp;
	double ans = 0;
	
	cin>>N>>M;
	
	c.resize(N);
	dp.resize(1<<N);
	
	for(int i = 0; i < N; i++){
		cin>>c[i].f.f>>c[i].f.s>>c[i].s;
	}
	
	for(int i = 1; i < (1<<N); i++){
		int con = 0, j = -1;
		for(int x = i; x; x>>=1) j++;
		dp[i] += dp[i&~(1<<j)];
		for(int k = 0; k < N; k++){
			if((i>>k)&1){
				con++;
				dp[i] += (c[k].f.f - c[j].f.f)*(c[k].f.f - c[j].f.f) + (c[k].f.s - c[j].f.s)*(c[k].f.s - c[j].f.s) + (c[k].s - c[j].s)*(c[k].s - c[j].s);
			}
		}
		if(con == M) ans = max(ans, dp[i]);
	}
	
	cout<<ans<<endl;
	
	return 0;
}


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

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

  int A = N / 100, B = N % 100;

  string ans;

  if (A != 0 && A < 13) {
    if (B != 0 && B < 13) ans = "AMBIGUOUS";
    else ans = "MMYY";
  }
  else if (B != 0 && B < 13) {
    if (A != 0 && A < 13) ans = "AMBIGUOUS";
    else ans = "YYMM";
  }
  else ans = "NA";

  cout << ans << "\n";
}

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

#define MODULO 1000000007

int main() {
	int n;
	cin >> n;
	long int* v = (long int*) malloc (n * sizeof(long int));
	long int* sumP = (long int*) malloc ((n - 1) * sizeof(long int));

	for (int i = 0; i < n; i++) {
		long int aux;
		cin >> aux;
		v[i] = aux;
	}

	sumP[n - 2] = v[n - 1];
	for (int i = n - 3; i >= 0; i--) {
		long int aux = ((sumP[i + 1] % MODULO) + (v[i + 1] % MODULO)) % MODULO;
		sumP[i] = aux;
	}


	long int sum = 0;
	for (int i = 0; i < n - 1; i++) {
		long int prod = ((v[i] % (MODULO)) * (sumP[i] % (MODULO))) % MODULO;
		sum = ((prod % MODULO) + (sum % MODULO)) % MODULO;
	}

	cout << sum;
}

Measured memory_bytes: 6756
package main

import "fmt"

func main() {
	var a, b, c, k int
	fmt.Scan(&a, &b, &c, &k)

	if k <= a {
		fmt.Println(k)
	} else if k <= a+b {
		fmt.Println(a)
	} else {
		m := k - a - b
		fmt.Println(a - m)
	}
}


Measured memory_bytes: 1752
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;

#define D 10 
#define MAXN (1 << 18)
#define MAXW (100010)

int dp[(1 << D)][MAXW];
int v[MAXN];
int w[MAXN];

int n, q;

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> v[i] >> w[i];
	}
	for (int i = 1; i < (1 << D); i++) {
		int prevdp[MAXW];
		memcpy(prevdp, dp[i / 2], sizeof(dp[0]));
		for (int j = 0; j + w[i] < MAXW; j++) {
			dp[i][j + w[i]] = prevdp[j] + v[i];
		}
		for (int j = 0; j < MAXW; j++) {
			dp[i][j] = max(prevdp[j], dp[i][j]);
		}
		for (int j = 1; j < MAXW; j++) {
			dp[i][j] = max(dp[i][j], dp[i][j - 1]);
		}
	}
	cin >> q;
	for (int i = 0; i < q; i++) {
		int cur, cap;
		cin >> cur >> cap;
		if (cur < (1 << D)) {
			cout << dp[cur][cap] << endl;
		} else {
			vector<int> items;
			while (cur >= (1 << D)) {
				items.push_back(cur);
				cur >>= 1;
			}
			int m = items.size();
			int bestval = 0;
			for (int mask = 0; mask < (1 << m); mask++) {
				int curv = 0;
				int curw = 0;
				for (int j = 0; j < m; j++) {
					if (mask & (1 << j)) {
						curv += v[items[j]];
						curw += w[items[j]];
					}
				}
				if (curw > cap) {
					continue;
				}
				curv += dp[cur][cap - curw]; 
				bestval = max(curv, bestval);
			}
			cout << bestval << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 405668
io = STDIN
a,b,c,x,y=io.gets.split.map(&:to_i)
if a+b<=2*c
  puts a*x+b*y
else
  min=[x,y].min
  max=[x,y].max
  if x>y
    puts [max*2*c,min*2*c+(x-y)*a].min
  else
    puts [max*2*c,min*2*c+(y-x)*b].min
  end
end


Measured memory_bytes: 1788
#!/usr/bin/env python3
import sys
from math import ceil

def solve(A: int, B: int, C: int):
    l = [A, B, C]
    l.sort()

    t = l[2]-l[1] + l[2] - l[0]

    if(t%2 == 0):
        print(ceil(t/2))
    else:
        print(ceil(t/2)+1)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define forr(i,m,n) for (int i=(m); i<=(n); i++)
#define forv(i,m,n) for (int i=(m); i>=(n); i--)
#define forall(it,p) for (auto it = p.begin(); it != p.end(); ++it)
#define DBG 1
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,ll> pll;

vector<int> c;
vector< vector<int> > s;

struct State {
  vector<int> t;
  int d, score;

  State() {  }

  void set(int _d, vector<int>& _t) {
    d = _d;
    //t = _t;
    t.resize(d);
    forr(i,0,d-1) t[i] = _t[i];
    compscore0();
  }

  void compscore0() {
    vector<int> last(26,-1);
    int sc = 0;
    forr(i,0,d-1) {
      int tt = t[i];
      last[tt] = i;
      forr(j,0,25) sc -= c[j]*(i-last[j]);
      sc += s[i][tt];
    }
    score = sc;
  }

  void add(int day, int con) {
    int bef = day-1;
    while (bef>=0 && t[bef]!=con) bef--;
    int aft = day+1;
    while (aft<d && t[aft]!=con) aft++;
    int inc = s[day][con] + c[con]*(day-bef)*(aft-day);
    //cerr << "add inc " << inc << " s " << s[day][con] << " c " << c[con] << " dy-bf " << day-bef << " af-dy " << aft-day << " sc " << score << endl;
    score += inc;
    t[day] = con;
  }

  void sub(int day) {
    int con = t[day];
    int bef = day-1;
    while (bef>=0 && t[bef]!=con) bef--;
    int aft = day+1;
    while (aft<d && t[aft]!=con) aft++;
    int inc = s[day][con] + c[con]*(day-bef)*(aft-day);
    //cerr << "sub inc " << inc << " s " << s[day][con] << " c " << c[con] << " dy-bf " << day-bef << " af-dy " << aft-day << " sc " << score << endl;
    score -= inc;
    t[day] = -1;
  }

  void chg(int day, int con) {
    //cerr << "chg day " << day << " con " << con << endl;
    sub(day);
    //cerr << "sub done" << endl;
    add(day,con);
    //cerr << "add done score " << score << endl;
  }
};

int main() {
  int d;
  cin >> d;
  //c = vector<int>(26);
  c.resize(26);
  //s = vector< vector<int> >(d, vector<int>(26));
  s.resize(d);
  forr(i,0,d-1) s[i].resize(26);

  forr(i,0,25)
    cin >> c[i];
  forr(i,0,d-1)
    forr(j,0,25)
      cin >> s[i][j];
  vector<int> t;
  t.push_back(0);

  State st;

  forr(i,0,d-1) {
    st.set(i+1,t);
    int sc = st.score;
    //cerr << "i " << i << " presc " << sc << endl;
    int mxj = 0;
    forr(j,1,25) {
      st.chg(i,j);
      if (sc<st.score) {
        sc = st.score;
        mxj = j;
        //cerr << " j " << j << " sc " << sc << endl;
      }
    }
    t.push_back(mxj);
    cout << mxj+1 << endl;
  }
}


Measured memory_bytes: 3692
#include <stdio.h>
#include <string.h>
#include <math.h>

//#define DEBUG 1
#define LENGTH 81

char shift_char(char in);

main()
{
	char input[LENGTH];
	int flag = 1;
	int i, j;
	while(fgets(input,81,stdin) != NULL)
	{
		while(1)
		{
			if(strstr(input, "the") != NULL || strstr(input, "that") != NULL || strstr(input, "this") != NULL)
			{
				break;
			}
			for(i = 0; i < strlen(input); i++)
			{
				if(islower(input[i]) != 0)
				{
					input[i] = shift_char(input[i]);
				}
			}
		}
		printf("%s", input);
	}
	return 0;
}

char shift_char(char in)
{
	in = in + 1;
	if(in == '{') 
	{
		in = in - 26;
	}
	return in;
}

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

const int MAX_N = 206;
const int INF = 1e9 + 7;

int dp[MAX_N][MAX_N];

int aa[MAX_N];
int p[MAX_N];

int main () {
	int n,m,r;
	cin >> n >> m >> r;
	for (int i=0;r>i;i++) {
		cin >>aa[i];
	}
	for (int i=0;n>i;i++) {
		for (int j=0;n>j;j++ ) {
			dp[i][j] = INF;
		}
	}
	for(int i=0;m>i;i++) {
		int a,b,c;
		cin >> a >> b >> c;
		a--;
		b--;
		dp[a][b] = dp[b][a] = min(dp[a][b],c);
	}
	for (int k=0;n>k;k++) {
		for (int i=0;n>i;i++) {
			for (int j=0;n>j;j++) {
				dp[i][j] = min(dp[i][j],dp[i][k] + dp[k][j]);
			}
		}
	}
	for (int i=0;r>i;i++) {
		p[i] = aa[i]-1;
	}
	sort(p,p+r);
	int ans=INF;
	do {
		int tmp=0;
//		tmp += dp[0][p[0]];
		for (int i=0;r-1>i;i++) {
			tmp += dp[p[i]][p[i+1]];
		}
//		tmp += dp[p[r-1]][n-1];
		ans = min(ans,tmp);
//		for (int i=0;r>i;i++) {
//			cout<<p[i]<<' ';
//		}
//		cout<<endl;
	}while (next_permutation(p,p+r));
	cout<<ans<<endl;
}


Measured memory_bytes: 512
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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

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

  int p, q, r;

  cin >> p >> q >> r;

  cout << min(min(p+q, r+q), p+r) << endl;
  
  return 0;
}


Measured memory_bytes: 888
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		char [][] field = new char[H][W];
		for(int i=0;i<H;i++){
				field[i]=sc.next().toCharArray();
		}
		for(int i=0;i<H;i++){
			int Answer = -1;
			for(int j=0;j<W;j++){
				if(field[i][j]=='c'){
					Answer=0;
				}else if(Answer!=-1){
					Answer++;
				}
				System.out.print(Answer);
				if(j!=W-1) System.out.print(" ");
			}
			System.out.println("");
		}
	}
}

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

int main(void) {
	int n;
	int d;
	char suuretu[1024];
	int i;
	char current[16];
	if (scanf("%d", &n) != 1) return 1;
	for (i = 0; i < n; i++) {
		if (scanf("%d", &d) != 1) return 1;
		suuretu[i] = d + '0';
	}
	suuretu[n] = '\0';
	for (i = 0;; i++) {
		sprintf(current, "%d", i);
		if (strstr(suuretu, current) == NULL) {
			printf("%d\n", i);
			return 0;
		}
	}
}

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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

int N;
int S[111111];

signed main(){
    cin>>N;
    rep(i,N){
        int a,b;
        cin>>a>>b;
        b++;
        S[a]++;S[b]--;
    }
    rep(i,100100)S[i+1]+=S[i];

    for(int i=N+1;i>=1;i--){
        if(S[i]>=i-1){
            cout<<i-1<<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3880
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

#define int long long
#define double long double
int N, K;
vector<int> X;
vector<int> Y;
double calc(double x, double y){
    vector<double> v(N);
    for(int i=0;i<N;i++){
        v[i] = hypot(X[i] - x, Y[i] - y);
    }
    sort(v.rbegin(),v.rend());
    double res = 0;
    for(int i=0;i<K;i++){
        res+=v[i];
    }
    return res;
}
signed main(){
    cin >>N>>K;
    X.resize(N);
    Y.resize(N);
    for(int i=0;i<N;i++){
        cin >> X[i] >> Y[i];
    }
    double xu,xd,yu,yd;

    xu=2000;
    xd=-2000;
    for(int i=0;i<100;i++){
        double xm1 = (xu*2+xd)/3;
        double xm2 = (xu+xd*2)/3;
        yu = 2000;
        yd = -2000;
        for(int j=0;j<100;j++){
            double ym1 = (yu*2+yd)/3;
            double ym2 = (yu+yd*2)/3;
            if(calc(xm1, ym1) < calc(xm1, ym2)){
                yd=ym2;
            }else{
                yu=ym1;
            }
        }
        double m1 = calc(xm1, (yu + yd)/2);
        yu = 2000;
        yd = -2000;
        for(int j=0;j<100;j++){
            double ym1 = (yu*2+yd)/3;
            double ym2 = (yu+yd*2)/3;
            if(calc(xm2, ym1) < calc(xm2, ym2)){
                yd=ym2;
            }else{
                yu=ym1;
            }
        }
        double m2 = calc(xm2, (yu + yd)/2);
        if(m1 < m2){
            xd=xm2;
        }else{
            xu=xm1;
        }

    }

    double res = calc((xu + xd)/2, (yu + yd)/2);
    //cerr << xu <<  " " << xd<<endl;
    cout << fixed << setprecision(15) <<  res<<endl;
    return 0;
}


Measured memory_bytes: 3344
#include <iostream>
#include <string>
#include <stdlib.h>

using namespace std;

int main(){
	int N, M;
	cin >> N >> M;

	int items[N];
	int count = 0;
	int ans_count = 0;

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


	for(int i = 0; i < N; i++){
		if(items[i] * (4 * M) >= count){
			ans_count++;
		}
	}

	if(ans_count >= M){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}


	return 0;


}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1<<29;
const ll  longinf = 1LL<<60;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

int main(){
  int l,m,n,x;
  cin>>l>>m>>n>>x;
  int ans=0;
  rep(i,n+1)rep(j,m+1)rep(k,l+1)
    if(50*i+100*j+500*k==x)ans++;
  cout<<ans<<endl;
  return 0;
  }

  

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int a,b,c,d,e,f,g;
    cin>>a>>b>>c>>d;
    e=a-c;
    if(e<0){
        e=-e;
    }
    f=a-b;
    if(f<0){
        f=-f;
    }
    g=b-c;
    if(g<0){
        g=-g;
    }
    if(e<=d){
        cout<<"Yes"<<endl;
    }
    else{
        if(f<=d&&g<=d){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
}


Measured memory_bytes: 3636
#include<algorithm>
#include<cstring>
#include<queue>
#include<cstdio>
using namespace std;
const int MAXN =1e3+5;
int n,m,x_1,y_1,x_2,y_2;
char s[MAXN][MAXN];
int vis[MAXN][MAXN];
int move_1_x[10]={0,1,0,-1,0};
int move_1_y[10]={0,0,1,0,-1};
struct node{
	int x,y,step;
	node(){}
	node(int X,int Y,int STEP){
		x=X;
		y=Y;
		step=STEP;
	}
	bool operator<(node Y)const{return step > Y.step;}
};
priority_queue<node> que;
bool check(int x,int y,int time){
	if(x<1 || y<1 || x>n || y>m || vis[x][y]<=time || s[x][y]=='#'){
		return false;
	}
	return true;
}
int main(){
	scanf("%d %d %d %d %d %d",&n,&m,&x_1,&y_1,&x_2,&y_2);
	for(int i=1;i<=n;i++){
		getchar();
		for(int j=1;j<=m;j++){
			scanf("%c",&s[i][j]);
		}
	}
	int step=0x3f3f3f3f;
	memset(vis,0x3f,sizeof(vis));
	que.push(node(x_1,y_1,0));
	vis[x_1][y_1]=0;
	while(!que.empty()){
		node f=que.top();
		que.pop();
		for(int i=1;i<=4;i++){
			int nx=f.x+move_1_x[i];
			int ny=f.y+move_1_y[i];
			int time=f.step;
			if(check(nx,ny,time)){
				vis[nx][ny]=time;
				if(nx==x_2 && ny==y_2){
					step=min(step,time);
				}
				que.push(node(nx,ny,time));
			}
		}
		for(int i=-2;i<=2;i++){
			for(int j=-2;j<=2;j++){
				if(i==0 && j==0)
				continue;
				int nx=f.x+i;
				int ny=f.y+j;
				int time=f.step+1;
				if(check(nx,ny,time)){
					vis[nx][ny]=time;
					if(nx==x_2 && ny==y_2){
						step=min(step,time);
					}
					que.push(node(nx,ny,time));
				}
			}
		}
	}
	if(step==0x3f3f3f3f){
		printf("-1");
	}
	else{
		printf("%d",step);
	}
	return 0;
}

Measured memory_bytes: 8224
#include<iostream>
#include<vector>
using namespace std;
int main(void){
  char in[10];
  while(cin>>in[0]){
    in[0] -= '0';
    for(int i = 1 ; i < 10 ; i ++){
      cin>>in[i];
      in[i] -= '0';
    }
    for(int i = 0 ; i < 9 ; i ++){
      for(int j = 0 ; j < 10 - i ; j ++){
	//	cout<<int(in[j])<<" ";
	in[j] = (in[j] + in[j+1])%10;
      }
      //     cout<<endl;
    }
    cout << int(in[0]) << endl;
  }
}

Measured memory_bytes: 1140
#include<bits/stdc++.h>
#define int long long
using namespace std;
char s[300000];
int f[300000][27],ans=0,len;
main() {
	scanf("%s",s+1);len=strlen(s+1);
	for(int i=1;i<=len;i++) {
		memcpy(f[i],f[i-1],sizeof(f[i]));
		ans+=i-(++f[i][s[i]-'a']);
	}cout<<ans+1<<"\n";
}

Measured memory_bytes: 45312
#include "bits/stdc++.h"
//#include<iostream>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define fr(i , a , b) for(int  i = a ; i <= b ; i++)
#define all(v) v.begin() , v.end()
#define mod  1000000007
#define N 300005
#define mod1 1000000007
#define mod2 1000000009
#define bitcnt __builtin_popcount
#define PI acos(-1)
//#define endl "\n" 
#define mid  (s+e)/2
#define MAX 10000007
//const int inf = (int)1e18 + 10;;
int dp[100005] , h[100005];
signed main(){
  fast;
  
  //freopen("input.txt" , "r" , stdin);
  //freopen("output.txt" , "w" , stdout);
  

    int n;
    cin >> n;
    for(int i = 0 ; i < n ; i++)
          cin >> h[i];



    dp[0] = 0;
    for(int i = 1 ; i <n ; i++){
           dp[i] = dp[i-1] + abs(h[i] - h[i-1]);

           if(i-2 >= 0)
             dp[i] = min(dp[i] , dp[i-2] + abs(h[i] - h[i-2]));
    }

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

   

 }

Measured memory_bytes: 1792
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 200001; //check the limits, dummy
int N; ll K;
vl datas(MX);

ll divs(ll A, ll B, bool floor) {
    bool neg;
    if (A < 0) {
        neg = !neg; A *= -1;
    } if (B < 0) {
        neg = !neg; B *= -1;
    }
    ll res = (A+B-1) / B;
    if (neg) {
        res = A / B; res *= -1;
    } 

    if (floor) {
        res = A / B;
        if (neg) {
            res = (A+B-1) / B; res *= -1;
        }
    }
    
    return res;
}

bool bigEnough(ll V) { //at least K values with at most V
    ll cnt = 0;
    F0R(i, N) {
        ll cur = datas[i];
        if (cur == 0) {
            if (V >= 0) {
                cnt += N;
            }
        } else if (cur < 0) {
            ll pos = (lb(datas.begin(), datas.begin()+N, divs(V, cur, false))- datas.begin());
            cnt += (ll) N - pos;
        } else {
            ll pos = (ub(datas.begin(), datas.begin()+N, divs((V) , cur, true)) - datas.begin());
            cnt += pos;
        }

        if (cur * cur <= V) cnt--;
    }

    cnt /= 2;

//    cout << cnt << " " << V << endl;

    return cnt >= K;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
    cin >> N >> K; F0R(i, N) cin >> datas[i];
    sort(datas.begin(), datas.begin()+N);
    ll hi = 1e18 + 1;
    ll lo = hi * -1;
    F0R(i, 65) {
        ll mid = (lo+hi)/2;
        if (bigEnough(mid)) {
            hi = mid;
        } else {
            lo = mid+1;
        }
    }

    if (bigEnough(min(lo, hi))) {
        cout << min(lo, hi) << endl;
    } else {
        cout << max(lo, hi) << endl;
    }
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
long long a[100011];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int t=0;
	for(int i=1;i<=n;i++){
		if(a[i-1]>a[i]){
			puts("No");
			return 0;
		} 
		if(a[i]-1>=a[i-1]){
			a[i]-=1;
		}
	}
	puts("Yes");
    return 0;
}


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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second

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

int main ()
{
    fastio

    st s ;
    cin >> s ;
    (s[0] == s[1] && s[1] == s[2] ? Yes : (s[1] == s[2] && s[2] == s[3] ? Yes : No) ) ;


    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



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

int main() {
string s, t;
  cin >> s >> t;
  bool id = true;
 for(int i = 0; i<s.size(); ++i){
   if(s.at(i) != t.at(i)) id = false; 
 }
  if(id) cout << "Yes" << endl;
  else cout << "No" << endl;
   
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    ll X; cin >> X;

    while(1){
        bool f = true;
        for (ll i = 2;i*i <= X && f;i++){
            if(X%i == 0) f = false;
        }
        if(f){
            cout << X << endl;
            break;
        }
        X++;
    }

    return 0;

}

Measured memory_bytes: 256
n, m = map(int, input().split())
if n > 1 and m > 1:
    print((n-2) * (m-2))
elif n > 1 and m == 1:
    print(n-2)
elif m > 1 and n == 1:
    print(m-2)
else:
    print(1) 

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	
	public static void Main(string[] args)
	{
		int n = int.Parse(Console.ReadLine());
		string[] sa = Input();
		int[] a = new int [n];
		int[] b = new int [n];
		int[] c = new int [n-1];
		for(int i = 0; i < n; i++)
		{
			a[i] = int.Parse(sa[i]);
		}
		sa = Input();
		for(int i = 0; i < n; i++)
		{
			b[i] = int.Parse(sa[i]);
		}
		sa = Input();
		for(int i = 0; i < n-1; i++)
		{
			c[i] = int.Parse(sa[i]);
		}
		int m = 0;
		for(int i = 0; i < n; i++)
		{
			m += b[a[i]-1];
			//Console.WriteLine(b[a[i]-1]);
			if(i> 0)
			{
				if(a[i-1]+1 == a[i])
				{
					m += c[a[i-1]-1];
					//Console.WriteLine("add" + c[a[i-1]-1]);
				}
			}
		}
		Console.WriteLine(m);
	}
	
	public static long GCD(long a, long b)
	{
		if(b == 1)
			return a;
		long p = b / a;
		return GCD(a, b - a*p);
	}
	
	public static string[] Input()
	{
		return Console.ReadLine().Split(' ');
	}

	
	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}

}



Measured memory_bytes: 13140
#include<iostream>
using namespace std;
int D;
int c[26];
int S[365][26];
int t[365];
int lst[26];
main()
{
	scanf("%d",&D);
	for(int i=0;i<26;i++)scanf("%d",&c[i]);
	for(int i=0;i<D;i++)for(int j=0;j<26;j++)scanf("%d",&S[i][j]);
	int ans=0;
	for(int i=0;i<D;i++)
	{
		scanf("%d",&t[i]);
		t[i]--;
		ans+=S[i][t[i]];
		lst[t[i]]=i+1;
		for(int j=0;j<26;j++)ans-=c[j]*(i+1-lst[j]);
	}
	int M;scanf("%d",&M);
	for(;M--;)
	{
		int d,q;scanf("%d%d",&d,&q);d--,q--;
		ans-=S[d][t[d]];
		ans+=S[d][q];
		int r=d+1;
		while(r<D&&t[r]!=t[d])r++;
		int l=d-1;
		while(l>=0&&t[l]!=t[d])l--;
		ans-=c[t[d]]*(r-d)*(d-l);
		r=d+1;
		while(r<D&&t[r]!=q)r++;
		l=d-1;
		while(l>=0&&t[l]!=q)l--;
		ans+=c[q]*(r-d)*(d-l);
		t[d]=q;
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 3756
#include <iostream>


int main(){
    int x;
    std::cin >> x;

    if (x<600){
        std::cout << "8" << std::endl;
    }

    else if (x<800){
        std::cout << "7" << std::endl;
    }
    else if (x<1000){
        std::cout << "6" << std::endl;
    }
    else if (x<1200){
        std::cout << "5" << std::endl;
    }
    else if (x<1400){
        std::cout << "4" << std::endl;
    }
    else if (x<1600){
        std::cout << "3" << std::endl;
    }
    else if (x<1800){
        std::cout << "2" << std::endl;
    }
    else{
        std::cout << "1" << std::endl;
    }
    return 0;
}


Measured memory_bytes: 3616
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    // TODO 自動生成されたメソッド・スタブ
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int l = sc.nextInt();

    List<String> strList = new ArrayList<String>();

    for (int i = 0; i < n; i++) {
      String str = sc.next();
      boolean inserted = false;
      for (int j = 0; j < strList.size(); j++) {
        if (str.compareTo(strList.get(j)) < 0) {
          strList.add(j, str);
          inserted = true;
          break;
        }
      }
      if (!inserted) {
        strList.add(str);
      }
    }

    for (String s : strList) {
      System.out.print(s);
    }
  }
}


Measured memory_bytes: 21072
#define scanf_s scanf
#include <string>
#include <stdio.h>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
using namespace std;

#define MAX 450
//#define MAX_ 1000

int main(void)
{
	int H, xk;
	long long int Heaps[MAX + 1];
	scanf_s("%d", &H);
	for (int i = 1; i <= H; ++i) {
		scanf_s("%d", &xk);
		Heaps[i] = xk;
	}
	for (int i = 1; i <= H; ++i) {
		printf("node %d: key = %lld, ", i, Heaps[i]);
		if (i / 2 >= 1) printf("parent key = %lld, ", Heaps[i / 2]);
		if (i * 2 <= H) printf("left key = %lld, ", Heaps[i * 2]);
		if (i * 2 + 1 <= H) printf("right key = %lld, ", Heaps[i * 2 + 1]);
		printf("\n");
	}
}

Measured memory_bytes: 1196
#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;


int main() {
	int n;
	scanf("%d",& n);
	int ans = 1e9;
	rep(i, n + 1) {
		int t = i;
		int cc = 0;
		while (t > 0) {
			cc += t % 6;
			t /= 6;
		}
		t = n - i;
		while (t > 0) {
			cc += t % 9;
			t /= 9;
		}
		ans = min(ans, cc);

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


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
using namespace std;
 
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
	
int32_t main() {
	fast;
	int d, t, s;
	cin>>d>>t>>s;
	if(s*t >= d) cout<<"Yes"<<endl;
	else cout<<"No";
}




Measured memory_bytes: 3652
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n,k] <- getIntList
    print $ (n-2) `div` (k-1) + 1

Measured memory_bytes: 380
import sys
input = sys.stdin.readline
N = int(input())
a = []
for _ in range(N):
  l, r = map(int, input().split())
  a.append((l, r))
a.sort()
X = 0
if N % 2: X = a[N // 2][0]
else: X = (a[N // 2 - 1][0] + a[N // 2][0]) / 2
a.sort(key = lambda x: x[1])
Y = 0
if N % 2: Y = a[N // 2][1]
else: Y = (a[N // 2 - 1][1] + a[N // 2][1]) / 2

if N % 2: print(Y - X + 1)
else: print(int(Y * 2 - X * 2 + 1))

Measured memory_bytes: 95604
#include "bits/stdc++.h"
#include <cmath>
#include <iomanip>
using namespace std;
 
#define f first
#define s second
 
#define pb push_back
#define pp pop_back
#define mp make_pair
 
#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))
 
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)
 
#define nl '\n'
#define ioi exit(0);
 

#define PI 3.14159265

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
//const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;
 
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};

const int mod = 998244353;

struct dsu{
	int parent[N];
	int cont;
	void make_set(int n){
		for(int i = 1; i <= n; i++)
			parent[i] = i;
		cont = n;
	}
	
	int find_set(int v){
		if(v == parent[v])
			return v;
		return find_set(parent[v]);
	}
	
	void union_sets(int a, int b){
		a = find_set(a);
		b = find_set(b);
		if(a != b){
			parent[b] = a;
			cont--;
		}
	}
};

int main(){
	string s; cin>> s;
	int n = (int)s.size();
	int ans = 0;
	for(int i = 0, j = n -1; i < n/2;i++, j--){
		if(s[i] != s[j])
			ans++;
	} 
	cout<<ans;
	return 0;
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  string s, t;
  cin >> s >> t;
  sort(ALL(s));
  sort(t.rbegin(), t.rend());
  if(s < t) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

using namespace std;

vector<int>card;

void cut(int p,int c){
  vector<int>res;
  for(int i=p;i<p+c;i++)res.push_back(card[i]);
  for(int i=0;i<p;i++)res.push_back(card[i]);
  for(int i=p+c;i<card.size();i++)res.push_back(card[i]);
  card=res;
}

int main(void){
  int n,r;

  while(cin >> n >> r, n|r){
    card.resize(n);
    for(int i=0;i<n;i++)card[i]=n-i;
    
    int p,c;
    for(int i=0;i<r;i++){
      cin >> p >> c;
      cut(p-1,c);
    }
    cout << card[0] << endl;
  }
  return 0;
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    if((s[2]==s[3]) && s[4]==s[5])
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.StringJoiner;
import java.util.Scanner;

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

String line2 = sc.nextLine();
String column[] = line2.split("");
String addword = column[line2.length() -1];
String newID = String.join("" , line , addword);

if(line2.equals(newID)){
  System.out.println("Yes");
}else{
  System.out.println("No");
}

  
}
}

Measured memory_bytes: 35704
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int n,a,b;
int main(){
    while (scanf("%d%d%d",&n,&a,&b)==3) {
        if(abs(a-b)%2==0)printf("Alice\n");
        else printf("Borys\n");
    }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ITP1_4D2
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            string[] StringArray = Console.ReadLine().Split(' ');
            long[] NumArray = Array.ConvertAll(StringArray, new Converter<string,
 long>(s => long.Parse(s)));
 
            Console.WriteLine(NumArray.Min() + " "
                + NumArray.Max() + " "
                + NumArray.Sum());
        }
    }
}
 

Measured memory_bytes: 10280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
const int INF = 2000000000;

int a, b;

int main(){
  cin >> a >> b;
  if((a*b)%2 == 0) cout<<"Even"<<endl;
  else cout <<"Odd" <<endl;
}

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

import sys
input = sys.stdin.readline

def io_generator():
	return input()

#+++++++++++++++++++

def isBitOn(value, n):
	return (value & (2 ** n)) > 0
	
def isMake(l,v):
	if len(l)==0 and v ==0:
		return True
		
	for i in range(2 ** len(l)):
		r=sum([v * (1-2*isBitOn(i,j)) for j,v in enumerate(l)])
		if r == v:
			return True
	return False
	
def move_next(v,i):
	rv = (v | 2 ** (i))
	ri = i+1
	return rv, ri
	
def buck(v,i):
	#111,3->101,3
	#101,3->010,2
	for j in range(i-1):
		n=i-1-j
		d=(v & 2** (n - 1))
		if d > 0:
			nv=(v & (2**(n-1) - 1))
			nnv,ni = move_next(nv, n)
			return True,nnv,ni
	return False, -1, -1
	
def isMake3(l,a_target):
	tree=0
	ii=0
	l.sort(reverse = True)
	est=lambda al,av:sum([v * isBitOn(av,j) for j,v in enumerate(l)])
	cc=True
	
	while cc:
		ccv=est(l, tree)
		#print(bin(tree),ii, est(l,tree),a_target)
		while ccv < a_target:
			tree, ii = move_next(tree,ii)
			#print(bin(tree),ii, est(l,tree),a_target)
			if ii > len(l):
				return False, -1
			ccv += l[ii-1]
			
		if ccv == a_target:
			return True, tree
		else:
			cc,tree,ii=buck(tree, ii)
			
	return False, -1
	
def isMake2(l, a_target):
	off=sum(l)
	if abs(a_target) > off:
		return False
	elif abs(a_target) == off:
		return True
	
	ll=[2*i for i in l]
	ret, _ = isMake3(ll, off + a_target)
	return ret
	
def isMakeDp(l, a_target):
	ss=set()
	ss.add(0)
	for v in l:
		next_ss=set()
		for p in list(ss):
			next_ss.add(p+v)
			next_ss.add(p-v)
		ss=next_ss
	return a_target in ss
		

def next(a_xy):
	return (a_xy+1)%2
	
def main(io):
	ft=io()
	goal = list(map(int, io().split()))
	
	isFirstMove=True
	init_pos=[0,0]
	xy=0
	mm=0
	ml=[[],[]]
	for c in ft:
		if isFirstMove and c=='F':
			init_pos[0]+=1
		elif isFirstMove and c=='T':
			isFirstMove=False
			xy = next(xy)
			mm=0
		elif c == 'F':
			mm+=1
		elif c== 'T':
			if mm > 0:
				ml[xy].append(mm)
			xy=next(xy)
			mm=0
	if mm>0:
		ml[xy].append(mm)

	is_debug=False
	if is_debug:
		print(ml)
		print(init_pos)
		print(goal)
	for i in range(2):
		if not isMakeDp(ml[i], goal[i] - init_pos[i]):
			return 'No'
	return 'Yes'

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

Measured memory_bytes: 3768
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
typedef long long ll;
using namespace std;
int main(void){
    int n;ll k;cin>>n>>k;
    vector<ll> a(n);
    vector<int> d(100,0);
    rep(i,n){
        cin>>a[i];
        rep(j,40){
            if((a[i]&((ll)1<<j)))d[j]++;
        }
    }
    
    ll X=0;
    for(int i=40;i>=0;i--){
        if(d[i]<=n/2){
            if(X+((ll)1<<i)>k)continue;
            X+=(ll)1<<i;
        }
    }
    
    ll res=0;
    rep(i,n){
        res+=(a[i]^X);
    }
    cout<<res<<endl;
}


Measured memory_bytes: 4040
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  bool flag=true;
  for(int i=0;i<3;i++){
	  if(s[i]==s[i+1]){
        cout << "Bad" << endl;
        flag=false;
        break;
      }
  }
  if (flag) cout << "Good" << endl;
}

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

int main()
{
    int n, a[100010] = {};
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];

    int sum = 0;
    for (int i = 1; i < n + 2; i++) sum += abs(a[i] - a[i - 1]);

    for (int i = 1; i <= n; i++) {
        int t = sum - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i]) + abs(a[i - 1] - a[i + 1]);
        cout << t << endl;
    }

    return 0;
}


Measured memory_bytes: 1664
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H,W;
        while(sc.hasNextLine()){
            String[] str = sc.nextLine().split(" ");
            H = Integer.parseInt(str[0]);
            W = Integer.parseInt(str[1]);
            if(H == 0 && W == 0) break;
            for(int y = 0; y < H; y++){
                for(int x = 0;x < W; x++){
                    if(y == 0 || y == H-1 ||
                       x == 0 || x == W-1) System.out.print("#");
                    else System.out.print(".");
                }
                System.out.println();
            }
            System.out.println();
        }
    }
 
}

Measured memory_bytes: 32248