akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl '\n'
#define int long long int
using namespace std;
#define pii pair <int, int>
#define mii map<int, int>
#define pb push_back
#define deb(x) cout << #x << " " << x << endl
#define deb2(x, y) cout << #x << " " << x << " " << #y << " " << y << endl
#define Loop(s, e, itr) for (int itr = s; itr < e; itr++)
#define loop(n) for(int i = 0; i < n; i++)
#define vin vector<int>
#define w(t) int tc; cin >> tc; for(int t = 1; t <= tc; t++)
#define vec vector
#define mod 1000000007
#define all(x) x.begin(), x.end()


int N, k; // N == 100, k == 1e5
int dp[105][100005] = {0};


int32_t main(){
    cin >> N >> k;
    int arr[105];
    Loop(1, N+1, i) cin >> arr[i];
    loop(103) dp[0][i] = 0;
    dp[0][0] = 1;
    Loop(1, N+1, i){
        int sums[100005] = {0};
        sums[0] = dp[i-1][0]%mod;
        dp[i][0] = sums[0];
        Loop(1, k+1, j){
            sums[j] = (sums[j-1] + dp[i-1][j])%mod;
            dp[i][j] = sums[j];

            int ur = j - arr[i] - 1;
            if(ur >= 0)    dp[i][j] = (dp[i][j] - sums[ur] + mod)%mod;
        } 
    }
    cout << dp[N][k] << endl;
}


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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
    string field[10];
    while(cin >> field[0]){
        rep(i, 7) cin >> field[i+1];
        rep(i, 10) field[i] += "00000000000000000000000";

        rep(i, 8){
            rep(j, 8){
                if(field[i][j] == '1' && field[i][j+1] == '1' && field[i+1][j] == '1' && field[i+1][j+1] == '1') cout << "A" << endl;
                else if(field[i][j] == '1' && field[i+1][j] == '1' && field[i+2][j] == '1' && field[i+3][j] == '1') cout << "B" << endl;
                else if(field[i][j] == '1' && field[i][j+1] == '1' && field[i][j+2] == '1' && field[i][j+3] == '1') cout << "C" << endl;
                else if(field[i][j+1] == '1' && field[i+1][j+1] == '1' && field[i+1][j] == '1' && field[i+2][j] == '1') cout << "D" << endl;
                else if(field[i][j] == '1' && field[i][j+1] == '1' && field[i+1][j+1] == '1' && field[i+1][j+2] == '1') cout << "E" << endl;
                else if(field[i][j] == '1' && field[i+1][j] == '1' && field[i+1][j+1] == '1' && field[i+2][j+1] == '1') cout << "F" << endl;
                else if(field[i+1][j] == '1' && field[i+1][j+1] == '1' && field[i][j+1] == '1' && field[i][j+2] == '1') cout << "G" << endl;
            }
        }
    }
}

Measured memory_bytes: 1184
#include<iostream>
#include<cmath>

using namespace std;

int main() {
  double side_a, side_b;
  double angle;
  double area;
  double circumference;
  double height;
  cin >> side_a >> side_b >> angle;

  height = sin(angle / 180 * M_PI) * side_b;
  double side_c = sqrt(side_a * side_a + side_b * side_b - 2 * side_a * side_b * cos(angle / 180 * M_PI));
  circumference = side_a + side_b + side_c;
  area = side_a * height * 0.5;

  printf("%f\n", area);
  printf("%f\n", circumference);
  printf("%f\n", height);
}



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

#define rep(i,n) for(int i = 0; i<n ; i++)


int main(){

	int n;
	vector<double> v(100,0);	
	vector<int> h(7,0);
	cin >> n;
	rep(i,n)
	{	
		cin >> v[i];
		if(v[i] <165.0)
			h[0]++;
		else if(v[i]<170.0)
			h[1]++;
		else if(v[i] < 175.0)
			h[2]++;
		else if(v[i] < 180.0)
			h[3]++;
		else if(v[i] < 185.0)
			h[4]++;
		else 
			h[5]++;
	}
	rep(j,6)
		rep(k,h[j]+1)
			{
			 if(k == 0)cout << j+1 << ":";
			 if(h[j] != 0&& k != 0)cout << "*";
			 if(k == h[j])
				cout << endl;
			}




}

Measured memory_bytes: 1232
H=int(input())
at=0

if H==1:
    print(1)
    
else:
    while H!=0:
        H=H//2
        at+=1
    ans=1
    preans=1
    for i in range(2,at+1):
        ans+=preans*2
        preans=preans*2
    print(ans)

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

using namespace std;

#define IOS ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);

#define endl "\n";

#define loop(i,s,n)  for(ll i=s;i<n;i++)
#define test  ll t; cin>>t; while(t--)
#define p push_back
typedef long long ll;
int main()
{IOS
ll n;
cin>>n;
ll x;
map <ll ,ll > mp;
while(n--)
{cin>>x;
mp[x]++;}
map<ll ,ll>::iterator it;
ll count=0;
for(it=mp.begin();it!=mp.end();it++)
{if(it->first!=it->second)
{if((it->first)<(it->second))
	{count+=(it->second)-(it->first);}
	else{count+=(it->second);}
}}


cout<<count;

return 0;

}


Measured memory_bytes: 9532
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
  int n;
  cin >> n;
  getchar();
  for(int i = 0; i < n; i++){
    string s,ss;
    getline(cin,s);
    bool f = true;
    for(int a = 0; f; a++){
      for(int b = 0; b < 26; b++){
	ss = s;
	for(int j = 0; j < (int)s.size(); j++){
	  if(s[j] != ' '){
	    ss[j] = ((s[j]-'a') * a + b) % 26 + 'a';
	  }
	}
	if((int)ss.find("this") != -1 || (int)ss.find("that") != -1){
	  f = false;
	  break;
	}
      }
    }
    cout << ss << endl;
  }
}

Measured memory_bytes: 1212
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int a_norihoudai=sc.nextInt();
		int b=sc.nextInt();
		int b_norihoudai=sc.nextInt();

		int kei=Math.min(a,a_norihoudai)+Math.min(b,b_norihoudai);
		System.out.println(kei);
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define debug1 cout<<"?"<<endl;
#define debug2 cout<<"?"<<i<<endl;
typedef long long ll;
#define PII pair<ll,ll>
const int maxn=2e5+9;
const double pi=acos(-1);
const int mod=998244353;
const int INF=0x3f3f3f3f;
const double ep=1e-10;
using namespace std;
int main()
{
	ll n,s,i,j,a[maxn]={0};
	ll dp[maxn]={0},ans=0;
	//dp[i]表示和为的个数 
	scanf("%lld%lld",&n,&s);
	for(i=1;i<=n;i++)scanf("%lld",&a[i]);
	for(i=1;i<=n;i++)
	{
		dp[0]++;
		for(j=s;j>=a[i];j--)
		{
			dp[j]=(dp[j]+dp[j-a[i]])%mod;
		}
		ans=(ans+dp[s])%mod;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 3328
import java.util.Scanner;
import java.util.Arrays;

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 (b - a == c - b ) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 23380
#include "bits/stdc++.h"
using namespace std;

int main() {
	string S, T;
	bool check1 = false;
	cin >> S >> T;
	for (int i = S.size() - T.size(); i >= 0; i--) {
		bool check2 = true;
		for (int j = i; j < i + T.size(); j++) {
			if (S[j] != '?' && S[j] != T[j - i]) {
				check2 = false;
			}
		}
		if (check2) {
			check1 = true;
			for (int j = i; j < i + T.size(); j++) {
				S[j] = T[j - i];
			}
			break;
		}
	}
	if (check1) {
		for (int i = 0; i < S.size(); i++) {
			if (S[i] == '?') {
				cout << 'a';
			}
			else {
				cout << S[i];
			}
		}
	}
	else {
		cout << "UNRESTORABLE";
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

int main(){
  ll n,m;
  cin >> n >> m;
  vl x(n), y(m);
  ll X = 0, Y = 0;
  rep(i,n){
    cin >> x[i];
    if(i>0){
      ll d = x[i] - x[i-1];
      (X += d * (i * (n-i)) % MOD) %= MOD;
    }
  }
  rep(j,m){
    cin >> y[j];
    if(j>0){
      ll d = y[j] - y[j-1];
      (Y += d * (j * (m-j)) % MOD) %= MOD;
    }
  }
  
  cout << X * Y % MOD << endl;
}


Measured memory_bytes: 1920
N = int(input())

cnt = 1
a = ord("a")
while True:
    if N <= 26**cnt:
        N -= 1
        ans = []
        while 0 < N:
            ans.append(N%26)
            N //= 26
        print("a"*(cnt-len(ans)),end="")
        for i in range(len(ans)-1,-1,-1):
            print(chr(a+ans[i]),end="")
        print()
        break
    else:
        N -= 26**cnt
        cnt += 1

Measured memory_bytes: 9208
#include <stdio.h>

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

  if (a+b >= a-b && a+b >= a*b) {
    printf("%d\n", a+b);
  }
  else if (a-b >= a+b && a-b >= a*b) {
    printf("%d\n", a-b);
  }
  else if (a*b >= a-b && a*b >= a+b) {
    printf("%d\n", a*b);
  }
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////
const ll inf = 1LL<<60;

int main()
{
  ll sx,sy,tx,ty; cin>>sx>>sy>>tx>>ty;

  rep(i, tx-sx) cout << 'R';
  rep(i, ty-sy) cout << 'U';
  rep(i, tx-sx) cout << 'L';
  rep(i, ty-sy) cout << 'D';

  cout << 'D';
  rep(i, tx-sx+1) cout << 'R';
  rep(i, ty-sy+1) cout << 'U';
  cout << 'L';
  cout << 'U';
  rep(i, tx-sx+1) cout << 'L';
  rep(i, ty-sy+1) cout << 'D';
  cout << 'R' << endl;;

  return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <bits/stdc++.h>
//#include<cstdio.h>
#include<stdlib.h>
using namespace std;

int main() 
{
    int i;
    char ch;
    for(i=0;i<3;i++)
    {
        ch=getchar();
        if(ch=='7')
        {
            cout<<"Yes";
            return 0;;
        }
    }
    cout<<"No";
	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define maxn 200000
#define FLASH cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define FILEIO freopen("/home/aman/Desktop/Kachda/input.txt", "r", stdin); //freopen("/home/aman/Desktop/Kachda/output.txt", "w", stdout);
using namespace std;

int n, a[maxn + 1], cnt[maxn + 1];

signed main()
{
    FLASH
	
	cin>>n;
	for(int i = 1; i <= n; i++){
		cin>>a[i];
		cnt[a[i]]++;
	}
	int sum = 0;
	for(int i = 1; i <= n; i++)
		sum += cnt[i]*(cnt[i] - 1)/2;
	for(int i = 1; i <= n; i++){
		int ans = sum -  cnt[a[i]]*(cnt[a[i]] - 1)/2 + (cnt[a[i]] - 1)*(cnt[a[i]] - 2)/2;
		cout<<ans<<'\n';
	}

}

Measured memory_bytes: 4736
n, m = map(int, input().split())
switches = [list(map(int, input().split())) for _ in range(m)]
correct = list(map(int, input().split()))

ans = 0
for i in range(2 ** n):
    # pattern
    flg = True
    for p in range(m):
        cnt = 0
        for j in range(n):
            # 右シフト
            if (i >> j) & 1:
                if (j + 1) in switches[p][1:]:
                    cnt += 1
        if cnt % 2 != correct[p]:
            flg = False
            break
    if flg:
        ans += 1

print(ans)


Measured memory_bytes: 9128
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
#define int ll
signed main(){
    int n,k;cin>>n>>k;
    vector<pii>ujimatu;
    rep(i,n){
        pii tiya; cin>>tiya.first>>tiya.second;
        ujimatu.push_back(tiya);
    }
    int ans=0;
    sort(all(ujimatu));
    for(int i=0; i<ujimatu.size();i++){
        k-=ujimatu[i].second;
        if(k<=0){ans=ujimatu[i].first;break;}
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1400
N, M = map(int, input().split())
G = [[] for i in range(N)]
E = []
for i in range(M):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    G[a].append(b)
    G[b].append(a)
    E.append((a, b))
used = [-1] * N


def dfs(u, a, b):
    used[u] = 1
    for w in G[u]:
        if (u == a and w == b) or (u == b and w == a):
            continue
        if (w, u) in s:
            continue
        s.add((w, u))
        dfs(w, a, b)


num = 0
for a, b in E:
    used = [-1] * N
    s = set()
    dfs(0, a, b)
    if sum(used) != N:
        num += 1

print(num)


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

using namespace std;

int main() {
    string S;
    cin >> S;
    int i, j;
    for (i = 0; i < 'z' - 'a' + 1; i++){
        bool flag = true;
        for (j = 0; j < S.length(); j++) {
            if (S[j] == 'a' + i) flag = false;
        }
        if (flag) {
            cout << (char)('a' + i) << endl;
            return 0;
        }
    }
    cout << "None" <<endl;
}


Measured memory_bytes: 512
import sys
readline=sys.stdin.readline

# 1:a 2:b ... 26:z
# 26 + 1:aa
# 27 = 26 * 1 + 1 : aa
# 52 = 26 * 2 + 0 : az
# 53 = 26 * 2 + 1 : ba
# 26で割ったあまりの1-25をa-yに変換する
# 26で割り切れるときはzに変換して、繰り上げを一つ減らす

N = int(readline())

anum = ord("a")
def num_to_alpha(num):
  return chr(anum + num - 1)

ans = ""
while N:
  num = N % 26
  if num != 0:
    ans += num_to_alpha(num)
  else:
    ans += "z"
    N -= 1
  N //= 26
  
print(ans[::-1])
  




Measured memory_bytes: 9176
import java.util.Scanner;

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

		int d = sc.nextInt();

		for (int i = 0; i < 25 - d; i++) {
			sb.append(" Eve");
		}

		System.out.println(sb);

		sc.close();
	}
}



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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

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

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列 -92
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}



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

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int l,s,cnt=0,n,sort[5],i,j;
	while(scanf("%d",&n),n!=0000){
		if(n%1111==0){
			printf("NA\n");
			continue;
		}
		cnt=0;
		while(n!=6174){
			sort[0]=n/1000;
			sort[1]=n/100-sort[0]*10;
			sort[2]=n/10-(sort[0]*100+sort[1]*10);
			sort[3]=n%10;
			for(i=0;i<4;i++){
				for(j=i+1;j<4;j++){
					if(sort[i]<sort[j]){
					 	sort[4]=sort[i];
					 	sort[i]=sort[j];
					 	sort[j]=sort[4];
					}
				}
			}
			l=sort[0]*1000+sort[1]*100+sort[2]*10+sort[3];
			s=sort[3]*1000+sort[2]*100+sort[1]*10+sort[0];
			n=l-s;
			cnt++;
		}
		printf("%d\n",cnt);
	}
	return 0;
}

Measured memory_bytes: 608
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        double N = scanner.nextInt();
        double K = scanner.nextInt();
//        int[] as = new int[N];
//        int index1 = 0;
//        for (int i = 0; i < N; i++) {
//            as[i] = scanner.nextInt();
//            if (as[i] == 1) {
//                index1 = i;
//            }
//        }

        int ans = 0;
        ans = (int) Math.ceil((N - K) / (K - 1)) + 1;
//        if (K > N / 2) {
//            ans = 2;
//            System.out.println(ans);
//            return;
//        }
//        if (N % 2 != 0) {
//            N -= 1;
//        }
//        if (N % 2 == 0) {
//            ans = N / 2 - K + 3;
//        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cstdlib>
#define mem(i,a) memset(i,a,sizeof(i))
#define PI acos(-1.0)
#define DMAX 100000+5
#define MOD 20190823
#define eps 1e-8
#define mp make_pair
#define INF 1000000000+9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
inline void read(ll &f){
	f=0;
    ll x=1;
    char ch=getchar();
    while(ch<48 || ch>57) {
        if(ch=='-') {
            x=-1;
        }
        ch=getchar();
    }
    while(ch<=57 && ch>=48) {
        f=f*10+ch-'0';
        ch=getchar();
    }
    f*=x;
}
ll h,w,n;
int main(){
	read(h),read(w),read(n);
	ll p=max(h,w);
	if(n%p==0){
		cout<<n/p<<endl;
	}
	else{
		cout<<n/p+1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  	char a,b;
  	cin >> a >> b;
  	if (a>b){
      cout << ">";
    }
  	if (a==b){
      cout << "=";
    }
  	if (a<b){
      cout << "<";
    }
}


Measured memory_bytes: 256
while True:  
  a, op, b = input().split() 
  a = int(a)                   
  b = int(b)
  if op == "?":
    break
  elif op == "+":
    print(a + b)
  elif op == "-":
    print(a - b)
  elif op == "*":
    print(a * b)
  elif op == "/":
    print(a // b)
  else:
    true


Measured memory_bytes: 5596
import numpy as np
S = input()
N = len(S)
if N // 2 == 0:
  even = np.array([int(S[2*k]) for k in range(N // 2)])
  odd = np.array([int(S[2*k + 1]) for k in range(N // 2)])
  even_1 = even.sum()
  odd_1 = odd.sum()
  if even_1 > odd_1:
    print(int(N//2 - even_1 + odd_1))
  else:
    print(int(N//2 + even_1 - odd_1))
else:
  even = np.array([int(S[2*k]) for k in range( (N+1) // 2)])
  odd = np.array([int(S[2*k + 1]) for k in range(N // 2)])
  even_1 = even.sum()
  odd_1 = odd.sum()
  if even_1 <= odd_1:
    print(int(even_1 + N//2 - odd_1))
  else:
    print(int(odd_1 + (N+1)//2 - even_1))

Measured memory_bytes: 13884
n,x,y=map(int,input().split())

ans=[0]*n
for i in range(1,n):
    for j in range(i+1,n+1):
        k=min(abs(i-j),abs(x-i)+abs(y-j)+1,abs(y-i)+abs(x-j)+1)
        ans[k]+=1
for i in range(1,n):
    print(ans[i])


Measured memory_bytes: 3444
import java.util.Scanner;
public class Main {

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


        int a=scan.nextInt();
        int b=scan.nextInt();
        int ans=a+b;
        if(a+b>=24)
            ans-=24;

        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
a = input("").split(" ")
a = [int(aa) for aa in a]
b = input("").split(" ")
b = [int(bb) for bb in b]
Al = []
N = a[0]
C = a[2]
ans = 0
for aaa in range(N):
    al = input("").split(" ")
    al = [int(aal) for aal in al]
    Al.append(al)
for c in Al:
    n = 0
    i = 0
    for d in c:
        n += d*b[i]
        i += 1
    if n+C > 0:
        ans += 1
print(ans)

Measured memory_bytes: 9144
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <map>
#include <string>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) reep((i),0,(n))
#define PB push_back
#define mkp make_pair
#define MOD 1000000007
#define F first
#define S second

typedef long long ll;
typedef vector<long long> vll;
typedef vector<int> vint;
typedef vector<vector<long long> > vvll;
typedef vector<vector<int> > vvint;


void dfs(int x, int y, int c, vint& d, vvint &vv) {
	d[x] = c;
	rep(i, 210) {
		if(i == y) continue;
		if(vv[x][i] && d[i] < 0) {
			dfs(i, x, 1 - c, d, vv);
		}
		if(vv[i][x] && d[i] < 0) {
			dfs(i, x, 1 - c, d, vv);
		}
	}
}

bool dfs2(int x, int y, vint &used, vvint &vv, vvint &same) {
	if(used[x]) return false;
	// cout<<x<<" "<<y<<endl;
	if(x == y) return true;
	used[x] = 1;
	rep(i, 210) {
		if(vv[x][i] || same[x][i]) {
			// cout<<"next "<<i<<endl;
			if(dfs2(i, y, used, vv, same)) return true;
		}
	}
	return false;
}

int main() {
	int n;
	while(cin >> n, n) {
		map<string, int> ma;
		vector<pair<string, string>> v(n);
		rep(i, n) {
			string s;
			cin >> s;
			rep(j, s.size()) {
				if(s[j] == '-') {
					string a = s.substr(0, j);
					string b = s.substr(j + 1);
					if(ma.count(a) == 0) {
						ma[a] = ma.size();
					}
					if(ma.count(b) == 0) {
						ma[b] = ma.size();
					}
					v[i] = mkp(a, b);
				}
			}
		}
		vvint vv;
		int MX = 210;
		vv.assign(MX, vint(MX, 0));
		vvint same = vv;
		for(auto x : v) {
			vv[ma[x.F]][ma[x.S]] = 1;
		}
		rep(i, MX) {
			rep(j, MX) {
				bool f1 = false;
				bool f2 = true;
				rep(k, MX) {
					if(vv[i][k] && vv[j][k]) f1 = true;
					if(vv[k][i] && vv[k][j]) f1 = true;
					if(vv[i][k] && vv[k][j]) f2 = false;
					if(vv[k][i] && vv[j][k]) f2 = false;
				}
				if(f1 && f2) {
					same[i][j] = 1;
				}
			}
		}
		vint d(MX, -1);
		rep(i, MX) {
			if(d[i] == -1) dfs(i, -1, 0, d, vv);
		}
		int q;
		cin >> q;
		cout << ma.size() << endl;
		rep(i, q) {
			string s;
			cin >> s;
			rep(j, s.size()) {
				if(s[j] == '-') {
					string a = s.substr(0, j);
					string b = s.substr(j + 1);
					int aa, bb;
					bool ok = true;
					if(ma.count(a) == 0 || ma.count(b) == 0) {
						ok = false;
					}
					else {
						aa = ma[a];
						bb = ma[b];
						if(min(d[aa], d[bb]) == -1 || d[aa] == d[bb]) {
							ok = false;
						}
						else {
							vint used(MX, 0);
							ok = dfs2(aa, bb, used, vv, same);
						}
					}
					if(ok) {
						cout << "YES" << endl;
					}
					else {
						cout << "NO" << endl;
					}
				}
			}
		}
	}
}

Measured memory_bytes: 3416
while True:
    H, W = map(int, input().split())
    if H==0 and W==0:
        break
    for x in range(H):
        for y in range(W):
            if x == 0 or x == H-1 or y == 0 or y == W-1:
                print('#', end='')
            else:
                print('.', end='')
        print()
    print()



Measured memory_bytes: 7004
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
#define sort(s) sort(s.begin(), s.end());
#define reverse(s) reverse(s.begin(), s.end());
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }

unsigned int randxor()
{
	static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	unsigned int t;
	t = (x ^ (x << 11)); x = y; y = z; z = w; return(w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

//10進数を2進数に変換_63個の要素を持つ配列
vector<int> Convert10to2(ll n) {
	vector<int> ans(63);
	rep(i, 63) {
		ans[i] = n % 2;
		n -= n % 2;
		n /= 2;
	}
	return ans;
}
//2進数を10進数に変換_63個の要素を持つ配列
ll Convert2to10(vector<int> a) {
	ll ans=0;
	ll j = 1;
	rep(i, a.size()) {
		ans += a[i] * j;
		if (i != a.size() - 1) {
			j *= 2;
		}
	}
	return ans;
}
//XORを計算
vector<int> CalcXOR2to2(vector<int> a, vector<int> b) {
	rep(i, 63) {
		if (a[i] != b[i]) {
			a[i] = 1;
		}
		else {
			a[i] = 0;
		}
	}
	return a;
}

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

int sum(vector<int> x) {
	int ans = 0;
	rep(i, x.size()) {
		ans += x[i];
	}
	return ans;
}


int f(int a, int b, int c, vector<vector<int>> k) {
	if (k[0].size() == 0 || k[1].size() == 0 || k[2].size() == 0) {
		return INF;
	}
	int ans = 0;
	ans += abs(a - sum(k[0]));
	ans += abs(b - sum(k[1]));
	ans += abs(c - sum(k[2]));
	ans += (k[0].size() - 1) * 10;
	ans += (k[1].size() - 1) * 10;
	ans += (k[2].size() - 1) * 10;
	return ans;

}


int main() {
	int n, a, b, c;
	cin >> n >> a >> b >> c;
	vector<int> l(n);
	rep(i, n) {
		cin >> l[i];
	}
	int ans = INF;
	rep(i, 262144) {
		vector<vector<int>> k(4);
		int i2 = i;
		rep(j, n) {
			k[i2 % 4].push_back(l[j]);
			i2 = (i2 - i2 % 4) / 4;
		}
		ans = min(ans, f(a, b, c, k));
	}
	cout << ans << endl;

}



Measured memory_bytes: 256
// AOJ 2191: A Book Shop With a Frequent Greetings
// 2017.12.10

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

#define QSIZE 1000000
typedef struct { int n, t; } Q;
Q q[QSIZE]; int top, end;

int xp[1001], yp[1001];
int rel[1001][1001];
int len[1001];
int prev[1001];

char buf[30], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	p++;
	return n;
}

int main()
{
	int cno, n, X, Y, x0, y0, i, j, t, ans;

	fgets(p=buf, 10, stdin), cno = getint();
	while (cno--) {
		fgets(p=buf, 30, stdin);
		n = getint(), X = getint(), Y = getint();
		fgets(p=buf, 30, stdin);
		x0 = getint(), y0 = getint();
		for (i = 0; i < n; i++) {
			fgets(p=buf, 30, stdin);
			xp[i] = getint(), yp[i] = getint();
		}

		ans = 0, top = end = 0;
		memset(prev, 0x81, sizeof(prev));
		memset(len, 0, sizeof(len));
		for (i = 0; i < n; i++) {
			if (hypot(xp[i]-x0, yp[i]-y0) <= 10) q[end].n = i, q[end++].t = 0;
			for (j = i+1; j < n; j++) {
				if (hypot(xp[i]-xp[j], yp[i]-yp[j]) <= 50)
					rel[i][len[i]++] = j, rel[j][len[j]++] = i;
			}
		}

		while (top < end) {
			i = q[top].n, t = q[top++].t;
			if (X > Y && t > X) { ans = -1; break; }
			if (prev[i] < t-Y) {
				t += X;
				prev[i] = t;
				if (t > ans) ans = t;
				for (j = 0; j < len[i]; j++) q[end].n = rel[i][j], q[end++].t = t;
			}
		}
		if (ans < 0) puts("You're always welcome!");
		else printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 13476
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<numeric>
#include<set>

using namespace std;

int main(){
	int n;
	cin>>n;
	vector<int> d(n);
	for(int i=0;i<n;++i) cin>>d[i];
	set<int> anko;
	for(int i=0;i<n;++i) anko.insert(d[i]);
	cout << anko.size() << endl;
	return 0;		
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a)  (a).rbegin(),(a).rend()
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; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll f(ll x)
{
    switch (x % 4)
    {
        case 0:
            return x;
        case 1:
            return 1;
        case 2:
            return x + 1;
        case 3:
            return 0;
        default:
            return 0;
    }
    //return 0;
}

int main()
{
    ll a, b; cin >> a >> b;
    if (a != 0) a--;

    ll ans = f(a) ^ f(b);
    cout << ans << endl;
}

Measured memory_bytes: 256
import math

def ncr(n, r):
    r = min(r, n - r)
    if r == 0: return 1;
    if r == 1: return n;
    numerator = [n - r + i + 1 for i in range(r)]
    denominator  = [i + 1 for i in range(r)]
    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] //= pivot
                denominator[k] //= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1: 
            result *= numerator[k]
    return result

def combi(i,j,mod):
    out = ncr(i+j,j)
    return out % mod

x, y = map(int,input().split())

if (2*x-y)%3 == 0 and (2*y-x)%3 == 0 and (2*x-y) >= 0 and (2*y-x) >= 0:
    i = (2*x-y)//3
    j = (2*y-x)//3
    print(combi(i,j,10**9+7))
else:
    print(0)

Measured memory_bytes: 31500
/*--------------------------------
    Anshul Gangwar
  Chandigarh University
--------------------------------*/
#include<bits/stdc++.h>

using namespace std;
using ll = long long;

#define For(i,n)        for(int i = 0;i < n;i++)
#define fr(i,a,b)       for(int i = a;i <= b;i++)
#define Rfor(i,n)       for(int i = n-1;i >= 0;i--)
#define endl            '\n'
#define pb              push_back
#define mp              make_pair


int main()
{
  #ifdef ANSHUL
  freopen("input.txt", "r", stdin);
  #endif
  int n,k;
  cin>>n>>k;
  string s;
  cin>>s;
  s[k-1] = s[k-1] + 32;
  cout<<s<<endl;
  return 0;
}


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

using namespace std;

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

    vector<bool> isAC(N, false);
    for(int i=0; i<N-1; i++){
        if(S.at(i) == 'A' && S.at(i+1) == 'C')isAC.at(i) = true;
    }

    // cout << "isAC:" << endl;
    // for(bool b : isAC)cout << ((b) ? 1 : 0) << " ";
    // cout << endl;

    vector<int> cs(N+1, 0);
    for(int i=0; i<N; i++)cs.at(i+1) = cs.at(i) + ((isAC.at(i)) ? 1 : 0);

    // cout << "cs: " << endl;
    // for(int i : cs)cout << i << " ";
    // cout << endl;

    for(int i=0; i<Q; i++){
        int l,r;
        cin >> l >> r;
        l--; r--;
        cout << cs.at(r) - cs.at(l) << endl;
    }
}

Measured memory_bytes: 1408
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) # n=1
def inpm(): return map(int,input().split()) # x=1,y=2
def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n]
def inpls(): return list(input().split())  # a=['1','2','3',...,'n']
def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 
def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a = inp()
        a -= 1
        g[i].append(a)
        g[a].append(i)
    return n,g

def main():
    n = inp()
    dic = defaultdict(int)
    for _ in range(n):
        s = input()
        dic[s] += 1
    ans = []
    M = 0
    for e in dic:
        if M < dic[e]:
            M = dic[e]
            ans = [e]
        elif M == dic[e]:
            ans.append(e)
    ans.sort()
    for i in range(len(ans)):
        print(ans[i])           
    
if __name__ == "__main__":
    main()




Measured memory_bytes: 100184
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int math_number = 0;
  cin >> math_number;
  
  int total_math_number = math_number * math_number;
  
  int white_math;
  cin >> white_math;
  
  int black_math = total_math_number - white_math;
  
  cout << black_math << endl;
}

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

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    string str;
    cin >> str;
    if(str == "keyence"){
        cout << "YES" << endl;
        return 0;
    }
    // cout << str.length()-8 << endl;
    rep(i,8){//左端
        if(str.substr(0,i-1) + str.substr(str.length()-8+i) == "keyence"){
            cout << "YES" << endl;
            return 0;
        }
        // cout << str.substr(0,i-1) << str.substr(str.length()-8+i) << endl;
        // cout << str.substr(i,str.length()-7) << endl;
        
    } 
    cout << "NO" << endl;


    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


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

    public static void main(String[] args) {
        int N=0,M=0,P=0;
        int[] voteNum;

        while(true){
            N=s.nextInt();
            M=s.nextInt();
            P=s.nextInt();

            if(N==0) break;

            voteNum = new int[N+1];
            int totalNum=0;

            for(int i=1;i<N+1;i++){
                voteNum[i]=s.nextInt();
                totalNum+=voteNum[i];
            }

            int money=totalNum*100;
            money= money*(100-P);
            int dividend;
            if(voteNum[M]!=0) {
                dividend = money / (voteNum[M]*100);
            } else{
                dividend=0;
            }

            System.out.println(dividend);

        }
    }
}

Measured memory_bytes: 25952
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
	string s;
	cin >> s;
	int n = s.size();
	int ans = 0;
	rep(i,n-1) {
		if (s[i] != s[i+1]) ans++;
	}
	cout << ans << endl;
}

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

Measured memory_bytes: 3760
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <set>
#include <algorithm>
#include <map>
using namespace std;



int main(){
    int n;
    cin >> n;
    int a[n + 1];

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

    long dp[n + 1][3];

    dp[2][0] = abs(a[2] - a[1]);
    dp[2][1] = 10000000000;
    dp[2][2] = min(dp[2][0], dp[2][1]);
    dp[0][2] = 0;
    dp[1][2] = 0;
    for (int i = 3; i <= n; ++i) {

        dp[i][0] = dp[i - 1][2] + abs(a[i] - a[i - 1]);
        if(i - 2 > 0) dp[i][1] = dp[i - 2][2] + abs(a[i] - a[i - 2]);
        else dp[i][1] = 10000000000;
        dp[i][2] = min(dp[i][0], dp[i][1]);
    }

    cout << dp[n][2] << endl;
    return 0;
}

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

int main(){
	int width, height;
	int x, y, r;

	cin >> width >> height >> x >> y >> r;

	if(x >= r && x <= width - r && y >= r && y <= height - r){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
const long double PI = 3.14159265358979323846;  /* pi */

int main() {
    long long a;
    long double b;
    cin >> a >> b;
    b += 0.0000001;
    int b100 = b * 100;
    cout << a * b100/100;
    return 0;
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1010;
map<int,int> cnt,tmp;
vector<int> gt[100001];
struct req {long long x; long long d;};
deque<req> q;
int n,a,b,i,j,m,c,d,k;
int fac[8]={1,1,2,6,24,120,720,5040};
vector<string> prim; string cur;
vector<int> fin={2,3,5,7};
int p(int x)
{
	int a=sqrt(x);
	for (int i=2;i<=a;i++) if (x%i); else return 0;
	return 1;
}
int cmp (string a, string b)
{
	if (a.length()-b.length()) return (a.length()<b.length());
	return (a<b);
}
int expect(string a)
{
	int n=a.length(),cnt1=0,cnt3=0,cnt7=0,cnt9=0;
	for (int i=0;i<n;i++)
	{
		if (a[i]=='1') cnt1++;
		if (a[i]=='3') cnt3++;
		if (a[i]=='7') cnt7++;
		if (a[i]=='9') cnt9++;
	}
	return fac[n]/fac[cnt1]/fac[cnt3]/fac[cnt7]/fac[cnt9];
}
int conv (string a)
{
	int n=a.length(),res=0;
	for (int i=0;i<n;i++)
	{
		res*=10;
		res+=a[i]-48;
	}
	return res;
}
void build(int i)
{
	if ((i>=2)and(p(c))) {sort(cur.begin(),cur.end()); prim.push_back(cur);}
	if (i<7)
	{
		cur.push_back('1');
		c*=10;
		c+=1;
		build(i+1);
		cur.pop_back();
		cur.push_back('3');
		c-=1;
		c+=3;
		build(i+1);
		cur.pop_back();
		cur.push_back('7');
		c-=3;
		c+=7;
		build(i+1);
		cur.pop_back();
		cur.push_back('9');
		c-=7;
		c+=9;
		build(i+1);
		cur.pop_back();
		c-=9;
		c/=10;
	}
}
int main()
{
	#define endl "\n"
//	freopen("janitorin.txt","r",stdin);
//	freopen("janitorout.txt","w",stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n,k,s;
	cin>>n>>k>>s;
	
	{
		
	for (i=0;i<n;i++) if (i<k) cout<<s<<' '; else if (s<1e9) cout<<s+1<<' '; else cout<<s-1<<' ';
	}
}

Measured memory_bytes: 3712
#!/usr/bin/env python3
import sys
import math
import decimal
import itertools
from itertools import product
from functools import reduce
def input():
    return sys.stdin.readline()[:-1]
def gcd(*numbers):
    return reduce(math.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
def sort_zip(a:list, b:list):
    z = zip(a, b)
    z = sorted(z)
    a, b = zip(*z)
    a = list(a)
    b = list(b)
    return a, b
def ceil(x):
    return math.ceil(x)
def floor(x):
    return math.floor(x)

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    ans = ceil((N - 1) / (K - 1))
    print(ans)


if __name__ == '__main__':
    main()


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

struct RS {
	using type = ll;
	static type id() { return 0; }
	static type op(const type& l, const type& r) {
		return l + r;
	}
};

class seg_node {
public:
	using M = RS;
	using T = typename M::type;
	using U = ll;

	T val;

private:
	int size;
	U lazy;

public:
	seg_node() : val(M::id()), size(1), lazy(0) {}
	void init(const T& v) {
		val = v;
	}
	void init(const seg_node& l, const seg_node& r) {
		size = l.size + r.size;
	}
	void update(U v) {
		val += v * size;
		lazy += v;
	}
	void push(seg_node& l, seg_node& r) {
		if (lazy == 0) return;
		l.update(lazy);
		r.update(lazy);
		lazy = 0;
	}
	bool is_updated() const {
		return lazy;
	}

};

class segment_tree {
	using M = typename seg_node::M;
	using T = typename seg_node::T;
	using U = typename seg_node::U;
	const int h, n;
	vector<seg_node> data;
	void init() {
		for (int i = n - 1; i >= 1; i--) {
			data[i].init(data[i << 1], data[(i << 1) | 1]);
		}
	}
	void push(int node) {
		data[node].push(data[node << 1], data[(node << 1) | 1]);
	}
	void update(int node) {
		data[node].val = M::op(data[node << 1].val, data[(node << 1) | 1].val);
	}
public:
	segment_tree(int n_)
		: h(ceil(log2(n_))), n(1 << h), data(n * 2) {
		init();
	}
	segment_tree(int n_, T v1)
		: h(ceil(log2(n_))), n(1 << h), data(n * 2) {
		for (int i = 0; i < n_; i++) {
			data[i + n].init(v1);
		}
		init();
	}
	segment_tree(const vector<T>& data_)
		: h(ceil(log2(data_.size()))), n(1 << h), data(n * 2) {
		for (int i = 0; i < (int)data_.size(); i++) {
			data[i + n].init(data_[i]);
		}
		init();
	}
	void update(int l, int r, U val) {
		l += n, r += n;
		for (int i = h; i > 0; i--) push(l >> i), push(r >> i);
		int tl = l, tr = r;
		r++;
		while (l < r) {
			if (l & 1) data[l++].update(val);
			if (r & 1) data[--r].update(val);
			l >>= 1; r >>= 1;
		}
		while (tl >>= 1, tr >>= 1, tl) {
			if (!data[tl].is_updated()) update(tl);
			if (!data[tr].is_updated()) update(tr);
		}
	}
	T find(int l, int r) {
		l += n, r += n;
		for (int i = h; i > 0; i--) push(l >> i), push(r >> i);
		r++;
		T res1 = M::id(), res2 = M::id();
		while (l < r) {
			if (l & 1) res1 = M::op(res1, data[l++].val);
			if (r & 1) res2 = M::op(data[--r].val, res2);
			l >>= 1; r >>= 1;
		}
		return M::op(res1, res2);
	}
};

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int n, q;
	cin >> n >> q;
	segment_tree st(n);
	while (q--) {
		int type, s, t;
		cin >> type >> s >> t; s--; t--;
		if (type) {
			printf("%lld\n", st.find(s, t));
		}
		else {
			int x;
			cin >> x;
			st.update(s, t, x);
		}
	}
	return 0;
}



Measured memory_bytes: 9104
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.io.InputStream;

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

    static class DFlippingSigns {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = in.nextIntArray(n);
            int numNeg = 0;
            int min = Integer.MAX_VALUE;
            long sum = 0;
            for (int i : a) {
                min = Math.min(min, Math.abs(i));
                sum += Math.abs(i);
                if (i < 0) {
                    numNeg++;
                }
            }
            if (numNeg % 2 == 0) {
                out.println(sum);
            } else {
                out.println(sum - 2 * min);
            }
        }

    }

    static class Scanner {
        private StringTokenizer st;
        private BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

    }
}



Measured memory_bytes: 42708
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  vvi v(m);
  rep(i, m){
    int k;
    cin >> k;
    rep(j, k){
      int s;
      cin >> s;
      s--;
      v[i].push_back(s);
    }
  }
  vi p(m);
  int ans = 0;
  rep(i, m) cin >> p[i];
  for(int i = 0; i < (1 << n); i++){
    int cnt = 0;
    rep(j, m){
      int num = 0;
      for(int k : v[j]){
        if(i & (1 << k)) num++;
      }
      if(num % 2 == p[j]) cnt++;
    }
    if(cnt == m) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define ALL(x) (x).begin(),(x).end()
int ctoi(const char c){
    if('0' <= c && c <= '9') return (c-'0');
    return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8


int main() {
    int n;
    cin >> n;
    
    ll T = 1, A = 1;
    
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        ll k = max((T + a - 1) / a, (A + b - 1) / b);
        T = k * a;
        A = k * b;
    }
    cout << T + A << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define M 998244353

ll factorials[200005];

void do_fact(){
	factorials[0] = 1;
	for(ll i = 1; i < 200005; i++){
		factorials[i] = (factorials[i-1]%M * i%M)%M; 
	}
}

ll modexp(ll x, ll y){
	ll res = 1;
	x =  x % M;

	while(y > 0){
		if(y % 2 != 0){
			res = (res%M * x%M)%M;
		}

		x = (x%M * x%M)%M;
		y /= 2;
	}

	return res;
}

ll invmod(ll a){
	return modexp(a, M-2);
}

ll func(ll n, ll m, ll k){
	ll temp = (factorials[n-1]%M * invmod(factorials[k]))%M;
	temp = (temp * invmod(factorials[n-1-k]))%M;
	temp = (temp * m%M)%M;
	temp = (temp * modexp(m-1, n-1-k))%M;
	return temp;
}	

int main(){

	ll n, m, k, ans=0;
	cin >> n >> m >> k;
	do_fact();
	for(ll i = 0; i <= k; i++){
		ans = (ans%M + func(n, m, i))%M;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5204