akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
typedef long long ll;
typedef long double ld;
#define res register
const int INF=0x3f3f3f3f;
template<typename T> inline T read(){
	char ch=getchar();T s=0;int f=1;
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){s=(s<<1)+(s<<3)+(ch^48);ch=getchar();}
	return s*f;
}
const int dx[]={0,0,-1,1};
const int dy[]={1,-1,0,0};
int h,w;
char m[30][30];
int bfs(int x,int y){
	int dist[h][w];
	for(res int i=0;i<h;++i)for(res int j=0;j<w;++j)dist[i][j]=INF;
	dist[x][y]=0;
	queue<pair<int,int> >q;
	q.push(make_pair(x,y));
	while(!q.empty()){
		pair<int,int> p=q.front();
		q.pop();
		for(res int i=0;i<4;++i){
			int x2=p.first+dx[i],y2=p.second+dy[i];
			if(x2>=0&&x2<h&&y2>=0&&y2<w&&m[x2][y2]=='.'&&dist[x2][y2]==INF){
				dist[x2][y2]=dist[p.first][p.second]+1;
				q.push(make_pair(x2,y2));
			}
		}
	}
	int maxd=0;
	for(res int i=0;i<h;++i)for(res int j=0;j<w;++j){
		if(dist[i][j]!=INF)maxd=max(maxd,dist[i][j]);
	}
	return maxd;
}
int main(){
	h=read<int>(),w=read<int>();
	for(res int i=0;i<h;++i)for(res int j=0;j<w;++j)cin>>m[i][j];
	int ans=0;
	for(res int i=0;i<h;++i)for(res int j=0;j<w;++j){
		if(m[i][j]=='.')ans=max(ans,bfs(i,j));
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
int A,B,C,D;
int area1=0,area2=0;

scanf("%d%d%d%d",&A,&B,&C,&D);
if (A>=1&&B>=1&&C>=1&&D>=1&&A<=pow(10,4)&&B<=pow(10,4)&&C<=pow(10,4)&&D<=pow(10,4)){
area1=A*B;
area2=C*D;
if (area1>area2){
    printf("%d",area1);
} else if(area2>area1){
    printf("%d",area2);
}else{
    printf("%d",area1);
}
}
    return 0;
}

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

using namespace std;

string s;
int rmax, r;

int main() {
    cin >> s;
    for (int i = 0; i < (int)s.size(); ++i)
        if (s[i] == 'S') {
            rmax = max(rmax, r);
            r = 0;
        } else
            ++r;

    rmax = max(r, rmax);
    cout << rmax;
    return 0;
}

Measured memory_bytes: 3608
#include<stdio.h>

int main(void){
	int N, N2, fx = 0, x = 100000000;
	do{
		scanf("%d", &N);
	}while(N < 1 || N > 100000000);
	N2 = N;

	while(N / x == 0)
		x /= 10;

	while(x >= 1){
		fx += N2 / x;
		N2 %= x;
		x /= 10;
	}

	if(N % fx == 0)	printf("Yes\n");
	else	printf("No\n");

	return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn._
object Main{
  def main(args: Array[String]): Unit = {
    val one = () => println("Hello World")
    val two = (A: Int,B: Int) => println(A+B)
    readInt match {
      case 1 => one()
      case 2 => val A = readInt
                val B = readInt
                two(A,B)
      case _ =>
    }
  }
}



Measured memory_bytes: 27196
n=int(input())
l=list(map(int,input().split()))
l.sort()
m=l[-1]
work=[0]*(m+1)
for i in l:
    if work[i]<=1:
        for j in range(i,m+1,i):
            work[j]+=1
sm=0
for s in l:
    if work[s]==1: sm+=1
print(sm)


Measured memory_bytes: 32216
// execute g++ main.cpp -std=c++14 -I C:\Users\naoya\Desktop\code\Atcoder
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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;}

template<class T>inline bool chmax(T &a, T b) {if(a < b) {a = b;return true;}return false;}
template<class T>inline bool chmin(T &a, T b) {if(a > b) {a = b;return true;}return false;}


char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    vector<ll> x(2), y(2);
    ll ans = -2 * 1e18 - 1000;
    cin >> x[0] >> x[1] >> y[0] >> y[1];
    REP(i, 0, 2){
        REP(l, 0, 2){
            chmax(ans, x[i] * y[l]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define gc getchar
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define x1 uvuvwevwevwe
#define y1 onyetenyevwe
#define x2 ugwemubwem
#define y2 ossas
typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
template <typename T> void scan(T &angka){
	angka=0;char input=gc();T kali=1;
	while(!(48<=input&&input<=57)){	if(input=='-')	kali=-1;input=gc();}
	while(48<=input&&input<=57)	angka=(angka<<3)+(angka<<1)+input-48,input=gc();angka*=kali;
}
template <typename T1,typename T2> void scan(T1 &angka1,T2 &angka2){
	scan(angka1);scan(angka2);
}
int n,matriks[305][305];
bool mungkin=true,tandai[305][305];
LL ans=0;
bool symmetry(){
	for(int i=1;i<=n;i++)
	{
		for(int j=i;j<=n;j++)
		{
			if(matriks[i][j]!=matriks[j][i])
				return false;
		}
	}
	return true;
}
bool cek0(){
	for(int i=1;i<=n;i++)
		if(matriks[i][i]!=0)
			return false;
	return true;
}
void floyd(){
	for(int k=1;k<=n;k++)
	{
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=n;j++)
			{
				if(matriks[i][k]+matriks[k][j]<matriks[i][j])
					mungkin=false;
				else if(matriks[i][k]+matriks[k][j]==matriks[i][j])
				{
					if(k!=i&&k!=j)
						tandai[i][j]=true;
				}
			}
		}
	}
}
int main()
{
	memset(tandai,false,sizeof(tandai));
	scan(n);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			scan(matriks[i][j]);
	mungkin=(symmetry()&&cek0());
	floyd();
	if(!mungkin)
		printf("-1\n");
	else
	{
		for(int i=1;i<=n;i++)
		{
			for(int j=i;j<=n;j++)
			{
				if(!tandai[i][j])
					ans+=matriks[i][j];
			}
		}
		printf("%lld\n",ans);
	}
}

Measured memory_bytes: 640
import java.util.*;

public class Main {

    static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] a = new long[N];
        long allXOR = 0;
        for(int i=0;i<N;i++){
            a[i] = sc.nextLong();
            allXOR ^= a[i];
        }

        for(int i=0;i<N;i++) {
            System.out.println(allXOR ^ a[i]);
        }


    }

}


Measured memory_bytes: 62848
#include<bits/stdc++.h>
#define int long long 
using namespace std;
signed  main(){
	int n,a[100000],sum=0,sum2=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a,a+n,greater<int>());
  for(int i=0;i<n;i+=2){
    sum+=a[i];
  }
  for(int i=1;i<n;i+=2){
    sum2+=a[i];
  }
  cout<<sum-sum2<<"\n";
}	

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


using namespace std;

#define MAXN 100010

int n;
int a[MAXN];
vector<int> neg;
vector<int> pos;

vector< pair<int, int> > v;

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

    for (i=2; i<=n-1; i++) {
        if (a[i]<0) {
            neg.push_back(a[i]);
        }
        else {
            pos.push_back(a[i]);
        }
    }

    int actual;
    actual = a[1];
    for (i=0; i<pos.size(); i++) {
        v.push_back(make_pair(actual, pos[i]));
        actual -= pos[i];
    }
    v.push_back(make_pair(a[n], actual));
    actual = a[n]-actual;
    for (i=0; i<neg.size(); i++) {
        v.push_back(make_pair(actual, neg[i]));
        actual -= neg[i];
    }

    printf("%d\n", actual);
    for (i=0; i<v.size(); i++) {
        printf("%d %d\n", v[i].first, v[i].second);
    }

    return 0;
}








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

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

    int count = 0;
    for(int i = 1; i <= n; i++) {
        string s = to_string(i);
        int len = s.length();
        if(len % 2 == 1) count++;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
K,N=map(int, input().split())
A=list(map(int,input().split()))

# K, N = 20, 3
# A = [0,5,15]

sa=[A[i+1]-A[i] if (i!=N-1) else (K-A[-1]+A[0]) for i in range(N) ]
answer=sum(sa) - max(sa)
print(answer)




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

#define cc(x) cout << (x) << endl
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); ++i)
typedef long long ll;

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

const ll inf = 1LL<<58;
const int iinf = 1<<30;

int main(){
    string s;
    cin >> s;
    int ki[2];
    int gu[2];
    ki[0]=0;ki[1]=0;
    gu[0]=0;gu[1]=0;
    rep(i,s.length()){
        if(i%2==0){
            if(s[i]=='0'){
                gu[0]++;
            }else{
                gu[1]++;
            }
        }else{
            if(s[i]=='0'){
                ki[0]++;
            }else{
                ki[1]++;
            }
        }
    }
    if(gu[0]+ki[1]>gu[1]+ki[0]){
        cc(gu[1]+ki[0]);
    }else{
        cc(gu[0]+ki[1]);
    }
}

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

int main() {
  int X , N ; 
  cin >> X >> N ; 
  vector<int> p(N) ; 

  
  for(int i = 0 ; i < N ; i++){
    cin >> p.at(i) ; 
  }
  
    
  if(N==0){
    cout << X << endl ;
  }
  
  
  for(int i = 1 ; i <= N ; i++){
  
  int T1 = X - i ; 
  int T2 = X + i ; 
  int cnt1=0 ;
  int cnt2=0 ;  
  int cnt =0 ; 
    
    for(int j = 0 ; j < N ; j++){
      if(T1 == p.at(j)){
        cnt1++ ; 
      }
      else if(T2 == p.at(j)){
        cnt2++ ; 
      }
      else if(X == p.at(j)){
        cnt++ ; 
      }
    }
    
    if(cnt == 0 ){
      cout << X << endl;
      return 0;
    }

    else if(cnt1 == 0 ){
      cout << T1 << endl ; 
      return 0 ; 
    }
    else if(cnt2 == 0 ){
      cout << T2 << endl;
      return 0 ; 
    }
    
  }
  
}

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

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

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

    cout << a[n-1] - a[0] << endl;
}

Measured memory_bytes: 3508
using System;
using System.Linq;
using System.Collections.Generic;

class MyClass
{
    public static void Main(string[] args)
    {
        var x = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var N = x[0];
        var C = x[1];
        var p = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Console.WriteLine((p.Sum() + N) / (N + 1));
    }
}


Measured memory_bytes: 20512
#include <iostream>
#include <vector>
#include <boost/dynamic_bitset.hpp>
using namespace std;
using uint = unsigned int;
using ull = unsigned long long;
 
int main() {
	uint H, W;
	cin >> H >> W;
	
	vector<vector<uint>> AB(H, vector<uint>(W));

	for(uint i=0; i<H; i++) {
		for(uint j=0; j<W; j++) {
			cin >> AB[i][j];
		}
	}
	
	for(uint i=0; i<H; i++) {
		for(uint j=0; j<W; j++) {
			int B;
			cin >> B;
			AB[i][j] = abs((int)AB[i][j] - B);
		}
	}
	
	uint nbit = 80 * (H + W) * 2 + 1;
	uint p0 = 80 * (H + W);
	vector<vector<boost::dynamic_bitset<>>> dp(2, vector<boost::dynamic_bitset<>>(W, boost::dynamic_bitset<>(nbit)));
	
	dp[1][0].set(p0);
	
	for(uint i=0; i<H; i++) {
		uint i0 = i % 2;
		uint i1 = (i + 1) % 2;
			
		for(uint j=0; j<W; j++) {
			dp[i0][j] = (dp[i1][j] << AB[i][j]) | (dp[i1][j] >> AB[i][j]);
			//cout << i << " " << j << " " << dp[i0][j] << endl;
		}
		
		for(uint j=1; j<W; j++) {
			dp[i0][j] = dp[i0][j] | (dp[i0][j-1] << AB[i][j]) | (dp[i0][j-1] >> AB[i][j]);
			//cout << i << " " << j << " " << dp[i0][j] << endl;
		}
	}
	
	for(uint i=0; i<p0; i++) {
		if(dp[(H-1)%2][W-1][p0+i]) {
			cout << i;
			break;
		}
	}
	
	return 0;
}


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

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

  ll X; cin >> X;
  string ans = "No";
  if (X >= 30) ans = "Yes";
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
#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 all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
#define Yes "Yes"
#define No "No"
#define YES "YES"
#define NO "NO"
typedef long long ll;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int N;
//下からi桁目まで決めていて、上に繰り上がりを要求するかどうか
ll dp[1001005][2];
void debug(){
    rep(i,N+1){
        rep(j,2){
            cerr<<dp[i][j]<<" ";
        }
        cerr<<endl;
    }
    cerr<<endl;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    string S;
    cin >> S;
    reverse(all(S));
    S += "0";
    N = S.size();
    rep(i,N+1)rep(j,2)dp[i][j] = INF;
    dp[0][0] = 0;
    rep(i,N+1){
        int d = S[i] - '0';
        rep(j,2){
            if(j)d++;
            for(int k = 0; k < 10; k++){

                if(k >= d){
                    chmin(dp[i+1][0], dp[i][j] + k + (k - d));
                }
                else{
                    chmin(dp[i+1][1], dp[i][j] + k + 10 + k - d);
                }
            }
        }
    }
    //debug();
    cout << min(dp[N][0], dp[N][1])<<endl;
}

Measured memory_bytes: 17180
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
#define INF 1<<30

int main()
{
    int P[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int N;
    cin >> N;
    cout << P[N-1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int S, h, m, s;
	scanf("%d",&S);
	h = S/3600;
	S = S % 3600;
	m = S/60;
	s = S % 60;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 592
n = int(input())
ans = 0
if n < 10:
  ans += n
else:
  ans += 9
  if n < 1000:
    ans += max(0, n-99)
  else:
    ans += 900
    if n < 100000:
      ans += max(0, n-9999)
    else:
      ans += 90000
print(ans)


Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<string>
#include<sstream>
#include<algorithm>
using namespace std;
bool Fbcheck(string str, int i){
	bool flg = false;
	stringstream ss;
	string strans;
	ss << i;
	strans = ss.str();
	if(i%3 == 0 && i%5 == 0){
		if(str == "FizzBuzz") flg = true;
	}else if(i%3==0){
		if(str == "Fizz") flg = true;
	}else if(i%5==0){
		if(str == "Buzz") flg = true;
	}else{
		if(str == strans) flg = true;
	}
	return flg;
}
int main(){
	int i, n, m;
	string str;
	while(true){
		cin>>m>>n; if(m==0 && n==0) break;
		vector<int> players;
		for(i=0;i<m;i++){
			players.push_back(i+1);
		}
		for(i=1;i<=n;i++){
			cin>>str;
			if(players.size() > 1){
				if(Fbcheck(str, i)){
					//cout<<"o\n";
					players.push_back(players.front());
					players.erase(players.begin());
				}else{
					//cout<<"x\n";
					players.erase(players.begin());
					
				}
			}
		}
		//cout<<"players.size()="<<players.size()<<endl;
		//cout<<"result\n";
		sort(players.begin(), players.end());
		cout<<players.front();
		players.erase(players.begin());
		while(players.empty() != true){
			cout<<" "<<players.front();
			players.erase(players.begin());
		}
		cout<<endl;
	}
	return 0;
}

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

int main() {
  string S;
  int K;
  cin >> K >> S;
  if( S.size() <= K ){
   cout << S << endl;
  }
  else{
  string T = S.erase(K);
  cout << T + "..." << endl;
  }
}


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

ll MOD = 1000000007;

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);

    ll sum = 0;
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        sum += a[i];
        sum %= MOD;
    }

    ll ans = 0;
    for (ll i = 0; i < n; i++)
    {
        ans += a[i]*((sum-a[i]+MOD)%MOD)%MOD;
        ans %= MOD;
    }
    cout << ans*modinv(2,MOD)%MOD << endl;
    

    
}

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

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b)a=b;};
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b)a=b;};

const int MAX = 100;
int dmg[MAX][MAX];
int dst[MAX][MAX];

int in(int y,int x){
  return 0<=y&&y<MAX&&0<=x&&x<MAX;
}

void calc(int sy,int sx){
  const int INF = 1e5;
  for(int i=0;i<MAX;i++)
    for(int j=0;j<MAX;j++)
      dst[i][j]=INF;

  using P = pair<int, int>;
  queue<P> que;
  dst[sy][sx]=0;
  que.emplace(sy,sx);

  int dy[]={0,0,1,-1};
  int dx[]={1,-1,0,0};  
  while(!que.empty()){
    int y,x;
    tie(y,x)=que.front();que.pop();
    for(int k=0;k<4;k++){
      int ny=y+dy[k],nx=x+dx[k];
      if(!in(ny,nx)) continue;
      if(dst[ny][nx]<=dst[y][x]+dmg[ny][nx]) continue;
      dst[ny][nx]=dst[y][x]+dmg[ny][nx];
      que.emplace(ny,nx);
    }
  }
}

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

  int n;
  while(cin>>n,n){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    a--;b--;
    vector<int> xs(n+1),ys(n+1);
    for(int i=0;i<=n;i++) cin>>xs[i]>>ys[i],xs[i]--,ys[i]--;

    for(int i=0;i<MAX;i++)
      for(Int j=0;j<MAX;j++)
        dmg[i][j]=1;
    
    for(int i=b;i<d;i++)
      for(int j=a;j<c;j++)
        dmg[i][j]=0;

    int ans=0;
    for(int i=0;i<n;i++){
      calc(ys[i],xs[i]);
      ans+=dst[ys[i+1]][xs[i+1]];
      //cout<<ans<<endl;
    }
    cout<<ans<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 3256
#include <bits/stdc++.h>
#include<stdlib.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
#define pr pair<ll, ll>
#define prf pair<ld,ld>
#define vct vector<ll>
#define vpt vector<pr>
#define vcf vector<ld>
#define vpf vector<prf>
#define st set<ll>
#define pq priority_queue<ll>
#define mat vector<vector<ll> >
#define all(x) x.begin(),x.end()
#define F(i, n) for(i = 0; i < (1LL*n); i++)
#define Fr(i, n) for(i = n - 1; i >= 0; i--)
 
struct custom_hash{
    static uint64_t splitmix64(uint64_t x){
        x += 0x9e3779b97f4a7c15;x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const{
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umap unordered_map<long long, long long, custom_hash>
 
void prv(vct v){for (ll i=0;i<v.size();i++)cout<<v[i]<<" ";cout << "\n";}
void prn(ll n){cout<<n<<"\n";}
void prs(string n){cout<<n<<"\n";}
void deb(string s, ll n){cout<<s<<" : "<<n<<"\n";}
void prmt(mat m){for(ll i=0;i<(1LL*m.size());i++)prv(m[i]);}
 
mat getRzMat(ll m,ll n, ll ini=0){mat mt;mt.assign(m,vector<ll>(n,ini));return mt;}
 
ll poww(ll x, ll y, ll m){
    ll res = 1;
    while (y){
        if (y%2 == 0){x = (x * x) % m;y = y / 2;}
        else{res = (res * x) % m;y--;}
    }
    return res;
}
 
vct divsors(ll n){
    vct ans;//ans.push_back(1);
    for(ll i=1;i<=sqrt(n);i++){if(n%i==0){ans.push_back(i);if(i!=(n/i))ans.push_back(n/i);}}
    sort(ans.begin(),ans.end());
    return ans;
}
vct sieve(ll n){
    vct ans(n+1,-1);
    for(ll i=2;i<=n;i++){
        if(ans[i]==-1){
            for(ll j=i;j<=n;j+=i)if(ans[j]==-1)ans[j]=i;
        }
    }
    return ans;
}
mat mt;
ll n, k, m, l, r, x, y, z, ans=0;
ll t, t1, t2;
ll q;
ll i, j;
ll a, b, c, d, w;
ll mod = 1000000007;
ld epi = 0.00000001;
ll cas=0;

void solve(){
    ld di,ti,spi;
    cin>>di>>ti>>spi;
    if((di/spi)>ti)prs("No");
    else prs("Yes"); 
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    // cout<<fixed<<setprecision(10);
    // freopen("input.txt", "r", stdin); 
    // freopen("output.txt", "w", stdout);
    ll t = 1;
    // cin >> t;
    cas=1;
    while (t--){
        solve();
        cas++;
    }
    return 0;
}
 

Measured memory_bytes: 3772
#include<cstdio>

int gcd(int x,int y)
{
    if(x%y!=0&&y!=0) gcd(y,x%y);
    else return y;
}

int main()
{
    int a,b;
    while(~scanf("%d%d",&a,&b)) printf("%d\n",gcd(a,b));
    return 0;
}

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

int main() {
  int H,W;
  cin >> H >> W;
  string S;
  
  for(int i = 0; i < W+2; i++){
      cout << "#";
  }
  cout << endl;
  
  for(int i = 0; i < H; i++){
      cin >> S;
      cout << "#" << S << "#" << endl;
  }
  for(int i = 0; i< W + 2; i++){
      cout << "#";
  }
  cout << endl;
    
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int H, W, K; cin >> H >> W >> K;
    vector<string> cake(H);
    REP(i, 0, H) cin >> cake[i];

    vector<vector<int>> numbers(H, vector<int>(W, 0));
    int cakeCount = 0;
    REP(i, 0, H) {
        REP(j, 0, W) {
            if (cake[i][j] == '#') numbers[i][j] = ++cakeCount;
            else {
                if (j > 0 && numbers[i][j - 1] != 0) {
                    numbers[i][j] = numbers[i][j - 1];
                }
            }
        }
    }

    REP(i, 0, H) {
        for (int j = W - 2; j >= 0; j--) {
            if (numbers[i][j] != 0) continue;
            if (numbers[i][j + 1] != 0) {
                numbers[i][j] = numbers[i][j + 1];
            }
        }
    }

    REP(j, 0, W) {
        REP(i, 1, H) {
            if (numbers[i][j] != 0) continue;
            if (numbers[i - 1][j] != 0) {
                numbers[i][j] = numbers[i - 1][j];
            }
        }
    }

    REP(j, 0, W) {
        for (int i = H - 2; i >= 0; i--) {
            if (numbers[i][j] != 0) continue;
            if (numbers[i + 1][j] != 0) {
                numbers[i][j] = numbers[i + 1][j];
            }
        }
    }

    REP(i, 0, H) {
        REP(j, 0, W) {
            if (j != W - 1) cout << numbers[i][j] << " ";
            else cout << numbers[i][j] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1280
# CODE FESTIVAL 2017 Final
# C - Time Gap
# https://atcoder.jp/contests/cf17-final/tasks/cf17_final_c
from collections import Counter
N = int(input())
*A, = map(int, input().split())

INF = 1 << 30
C = Counter(A)
if N >= 24 or 0 in C:
    print(0)
    exit()

dt = []
nt = []
for k, v in C.items():
    if v > 2:
        print(0)
        exit()
    if v == 2:
        dt.append(k)
        dt.append(24-k)
    if v == 1:
        nt.append(k)

tmp = min(A)
for i, t in enumerate(dt):
    for s in dt[i+1:]:
        if abs(t-s) < tmp:
            tmp = abs(t-s)
ans = 0

M = len(nt)
if M:
    for bit in range(1 << M):
        D = [0]*M
        for i in range(M):
            if bit >> i & 1:
                D[i] = nt[i]
            else:
                D[i] = 24-nt[i]

        mn = tmp
        for j, d in enumerate(D):
            for e in D[j+1:]:
                if abs(d-e) < mn:
                    mn = abs(d-e)
            for t in dt:
                if abs(d-t) < mn:
                    mn = abs(d-t)

        if mn != INF and mn > ans:
            ans = mn
else:
    ans = tmp

print(ans)


Measured memory_bytes: 3316
import sys
from heapq import heappop, heappush
from operator import itemgetter
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7
INF = float('inf')

def sol():
    S = input().rstrip()

    for i, s in enumerate(S):
        if i % 2 == 0:
            if s == 'L':
                print('No')
                return
        else:
            if s == 'R':
                print('No')
                return
    print('Yes')


sol()

Measured memory_bytes: 3468
import sys
n=int(input())
w=[input() for i in range(n)]
w_set = set()
for i in range(n):
    w_set.add(w[i])

if len(w)!=len(w_set):
    print("No")
    sys.exit()

for i in range(n-1):
    if w[i][-1]!=w[i+1][0]:
        print("No")
        sys.exit()         
print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
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 double PI = acos(-1.0);
// cout << fixed << setprecision(14);
 
signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, D;
	cin >> N >> D;
	D = D*D;
	int ans = 0;
	rep(i,N){
		int x, y;
		cin >> x >> y;
		if(x*x + y*y <= D) ++ans;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3588
#define _DEBUG 1
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                     \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll A, ll B, ll N) {
  ll x = min(B - 1, N);
  ll f = floor(A * x / B);
  cout << f << endl;
}

int main() {
  ll A, B, N;
  cin >> A >> B >> N;
  solve(A, B, N);
  return 0;
}


Measured memory_bytes: 3548
import math

N = int(input())
a = list(map(int,input().split()))
b = []
for n in range(N):
    b.append(0)

def box_sum(a):
    s = 0
    for i in range(1,a):
        s = s + b[(i+1)*(N-k)-1]
    return s

for k in range(N):
    c = N//(N-k)
    if c==1:
        b[N-1-k] = a[N-1-k]
    else:
        s = box_sum(c)
        if s%2==a[N-1-k]%2:
            b[N-1-k] = 0
        else:
            b[N-1-k] = 1
print(b.count(1))
box_num = [i for i,x in enumerate(b) if x == 1]
for d in range(b.count(1)):
    print(box_num[d]+1)


Measured memory_bytes: 12468
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> P1;
typedef long long int ll;

//define
#define INF 1e9
#define NUM 1000000007
#define all(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

int main () {
	int n,m;
	cin >> n>>m;
	int a;
	map<int, int> mp;
	rep (i, n) {
		cin >> a;
		mp[a]++;
	}

	int cnt = 0;
	vector<pair<int, int>> p;
	for (const auto& x : mp) {
		if (x.second > 0) cnt++;
		p.emplace_back (x.second, x.first);
	}

	sort (all(p));
	int ans = 0;
	if (cnt <= m) {
		cout << 0 << endl;
		return 0;
	} else {
		for (int i = 0; i < cnt - m; i++) {
			ans += p[i].first;
		}
	}

	cout << ans << endl;
	
}



Measured memory_bytes: 11768
#include <stdio.h>

int main(void)
{
    int n, m, ai;
    scanf("%d %d", &n, &m);
    for (int i = 0; i < m; i++)
    {
        scanf("%d", &ai);
        n -= ai;
    }
    if(n<0){
        printf("-1");
    }else{
        printf("%d", n);
    }
    
}


Measured memory_bytes: 1724
#include<iostream>
#include<cstdio>
#include<stack>
#include<string>
using namespace std;
int main()
{
	string in;
	while(getline(cin,in)) 
	{
		stack<double> st;
		double a,b;
		for(int i = 0; i < in.size(); ++i)
		{
			if(in[i]=='+')
			{
				 a=st.top(); st.pop();
				 b=st.top(); st.pop();

				st.push(b+a);
				i++;
			}
			else if(in[i]=='-')
			{
				if(i+1<in.size()&&'0'<=in[i+1]&&in[i+1]<='9')
				{
					i++;
					double tmp=0;
					while(i<in.size()&&in[i]!=' ')
					{
						tmp*=10;
						tmp+=in[i]-'0';
						i++;
					}
					st.push(tmp*(-1.0));
				}
				else
				{
					a=st.top(); st.pop();
				  b=st.top(); st.pop();

					st.push(b-a);
					i++;
				}
			}	
			else if(in[i]=='*')
			{
				 a=st.top(); st.pop();
				 b=st.top(); st.pop();

				st.push(b*a);
				i++;
			}
			else if(in[i]=='/')
			{
				 a=st.top(); st.pop();
				 b=st.top(); st.pop();

				st.push(b/a);
				i++;
			}
			else
			{
				double tmp=0;
				while(i<in.size()&&in[i]!=' ')
				{
					tmp*=10;
					tmp+=in[i]-'0';
					i++;
				}
				st.push(tmp);
			}
		}
		printf("%.9lf\n",st.top());
	}
  return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main(){
    cin>>H>>W;
    vector<string> a(H);
    rep(i,H) cin>>a[i];
    vector<string> ans(H);
    rep(j,W){
        bool push = false;
        rep(i,H){
            if(a[i][j] == '#'){
                if(!push) rep(k,i) ans[k].push_back(a[k][j]);
                push = true;
            }
            if(push){
                ans[i].push_back(a[i][j]);
            }
        }
    }
    for(ll i = H - 1; i >= 0; --i){
        bool remove = true;
        for(char c : ans[i]){
            if(c == '#') remove = false;
        }
        if(remove) ans.erase(ans.begin() + i);
    }
    for(string str : ans){
        for(char c : str) cout<<c;
        cout<<endl;
    }
}


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

int N;

int main(){

    cin >> N;

    int ans;
    for (int i=1; i<10; i++){
        for (int j=1; j<10; j++){
            ans = i*j;

            if (ans == N){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

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

Measured memory_bytes: 256
A,B,C = [ int(it) for it in input().split() ]

if (A==B and B==C and A%2==0):
  print (-1)
else:
  s = 0
  for i in range(1000000):
    if (A%2==0 and B%2==0 and C%2==0):
      A,B,C = (B+C)//2,(A+C)//2,(A+B)//2
    else:
      s = i
      break
  print ( s )

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

const int N=120;
typedef long long ll;

int dp[2][N][N],f[N][N],n,m,K,pw[N][N],C[N][N],mod,T;

int main(){
	cin>>n>>m>>K>>mod;
	for(int i=0;i<N;++i){
		pw[i][0]=1;C[i][0]=1;
		for(int j=1;j<N;++j)pw[i][j]=(ll)pw[i][j-1]*i%mod;
		for(int j=1;j<=i;++j)C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
	}
	dp[0][0][0]=1;
	for(int t=1;t<=K;++t){
		T^=1;memset(dp[T],0,sizeof dp[T]);memset(f,0,sizeof f);
		for(int i=0;i<=n;++i)
			for(int j=0;j<=m;++j)if(dp[!T][i][j]){
				int p=dp[!T][i][j],tmp=(ll)pw[K+1-t][j]*(pw[t][m-j]-pw[t-1][m-j]+mod)%mod;
				for(int k=0;k<=n-i;++k){
					f[i+k][j]=(f[i+k][j]+(ll)p*C[n-i][k])%mod;
					p=(ll)p*tmp%mod;
				}
			}
		for(int i=0;i<=n;++i)
			for(int j=0;j<=m;++j)if(f[i][j]){
				int p=f[i][j],tmp=(ll)pw[t][n-i]*(pw[K+1-t][i]-pw[K-t][i]+mod)%mod;
				for(int k=0;k<=m-j;++k){
					dp[T][i][j+k]=(dp[T][i][j+k]+(ll)p*C[m-j][k])%mod;
					p=(ll)p*tmp%mod;
				}
			}
	}
	cout<<dp[T][n][m]<<endl;
	return 0;
}



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


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	int n; 
  	cin >> n;
  	
  	vi data6;
  	int x = 6;
  	while(x<=n){
      	data6.pb(x);
      	x *= 6;
    }
  	vi data9;
    int y = 9;
	while(y<=n){
    	data9.pb(y);
      	y *= 9;
    }  	
  	
  	/*
  	rep(i,data6.size()) cout << data6[i] << " ";
  	rep(i,data9.size()) cout << data9[i] << " ";
  	cout << endl << endl;
  	//*/
  
  	int dp[n+15];
	dp[0] = 0;
  	dp[1] = 1;
  	int j = 0;
  	int k = 0;
  	x = y = 1;
  	rep3(i,2,n){
      	if(i>=6) {
            x = data6[j];
          	if(i+1 == data6[j+1]) j++;
        }
      	if(i>=9) {
          	y = data9[k];
          	if(i+1 == data9[k+1]) k++;
        }
    	dp[i] = min({dp[i-1], dp[i-x], dp[i-y]}) + 1;
    }
  	// rep(i,37) cout << i << ": " << dp[i] << endl;
  	cout << dp[n] << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int A, B;
  cin >> A >> B;
  string s;
  cin >> s;
  if (s.length() != A + B + 1 || s[A] != '-') {
    cout << "No" << endl;
    return 0;
  }
  for (int i = 0; i < A + B + 1; ++i) {
    if (i == A) continue;
    if (!(s[i] >= '0' && s[i] <= '9')) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int num;
	cin >> num;
	while(1){
		int n = num;
		set<int> s;
		while(n){
			int r = n % 10;
			s.insert(r);
			n = n / 10;
		}
		if(s.size() == 1){
			cout << num;
			return 0;
		}
		num++;
	}
}

Measured memory_bytes: 256
// Aizu Vol0 0084: Search Engine
// 2017.7.30

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#define MAX 1100

char *gets(char *);
char buf[MAX + 5];

int main()
{
	int len, f;
	char *p, *w;

	gets(p = buf); f = 1;
	while (*p) {
		while (*p && (isspace(*p) || *p == '.' || *p == ',')) p++;
		if (*p == 0) break;
		w = p++;
		while (*p && !isspace(*p) && *p != '.' && *p != ',') p++;
		if ((len = p - w) >= 3 && len <= 6) {
			if (f) f = 0;
			else putchar(' ');
			while (len-- > 0) putchar(*w++);
		}
	}
	putchar('\n');
	return 0;
}

Measured memory_bytes: 520
// input! macro is published in the following URLs.
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
// https://github.com/tanakh/competitive-rs.git
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        k: usize,
        a_s: [usize; n],
    }
    let mut count = 0;
    let mut idx = 0;
    while idx < n - 1 {
        idx += k - 1;
        count += 1;
    }
    println!("{}", count);
}


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

using namespace std;

int main(void)
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string a, b;
  cin >> a >> b;
  int length = a.length(), cnt = 0;;
  for (int i = 0; i < length; i++)
    if (a[i] != b[i])
      cnt++;
  cout << cnt << '\n';
  return 0;
}

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

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

int main() {
  int n, r;
  while (cin >> n >> r, n|r) {
    vector<int> deck(n);
    REP(i, n) { deck[i] = n - i; }
    REP(i, r) {
      int p, c; cin >> p >> c;
      reverse(deck.begin(), deck.begin() + p + c - 1);
      reverse(deck.begin(), deck.begin() + c);
      reverse(deck.begin() + c, deck.begin() + p + c - 1);
    }
    cout << deck.front() << endl;
  }
}

Measured memory_bytes: 0
#include <stdio.h>
#include <math.h>

int main()
{
  int n, i, j, k, sum, left;

  while (1) {
    scanf("%d", &n); if (n == 0) break;

    sum = 0;
    for (i = 0; 4 * i*i <= n; i++) {
      for (j = i; i*i + 3 * j*j <= n; j++) {
        for (k = j; i*i + j*j + 2 * k*k <= n; k++) {
          left = n - (i*i + j*j + k*k);
          if (sqrt((double)left) - floor(sqrt((double)left)) < 1e-8) {
            sum++;
          }
        }
      }
    }
    printf("%d\n", sum);
  }
  return 0;
}


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


int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    rep(i, n) {
        cin >> a[i];
        b[i] = a[i];
    }

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

    rep(i, n) {
        if (a[i] != b[n - 1]) cout << b[n - 1] << endl;
        else cout << b[n - 2] << endl;
    }
}


Measured memory_bytes: 3200
#include <stdio.h>

int main(void) {
	int L, R, d;
	int asumi, iguti;
	if (scanf("%d%d%d", &L, &R, &d) != 3) return 1;
	asumi = (L - 1) / d;
	iguti = R / d;
	printf("%d\n", iguti - asumi);
	return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
//typedef pair<int,int> P;
//priority_queue<int> pque;
//priority_queue<int, vector<int>, greater<int>> pque;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2000000000;//10^9
ll MOD  = 1000000007;
int a,b,c,d,e;

vector<int> p(100);

int main(void){
    int N;
    cin >> N;
    vector<int> sosuu = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
    for(int i = 2; i <= N; i++){
        for(int x: sosuu){
            int I = i;
            while(I % x == 0){
                p.at(x)++;
                I /= x;
            }
        }
    }
    
    
    int ans = 0;
    for(int i = 0; i < 100; i++){
        if(p.at(i) >= 2){
            a++;
        }
        if(p.at(i) >= 4){
            b++;
        }
        if(p.at(i) >= 14){
            c++;
        }
        if(p.at(i) >= 24){
            d++;
        }
        if(p.at(i) >= 74){
            e++;
        }
    }
    
    
    ans += d * (d - 1);
    ans += d * (a - d);
    ans += c * (c - 1);
    ans += c * (b - c);
    ans += b * (b - 1) * (b - 2) / 2;
    ans += b * (b - 1) / 2 * (a - b);
    ans += e;
    cout << ans << endl;
    
}


Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


s = S()
t = set(s)
if len(s)==4 and len(t)==2 and s.count(s[0])==2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=l;i<r;i++)
using ll=long long;
const ll MOD=1000000007;
const ll MAX=1100000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    repl(i,2,MAX){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k)return 0;
    if(n<0 or k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll modpow(ll a, ll n) {
    ll res=1;
    while(n>0){
        if(n&1)res=res*a%MOD;
        a=a*a%MOD;
        n>>=1;
    }
    return res;
}
int main(){
    COMinit();
    ll n,a,b;cin>>n>>a>>b;;
    ll ans=modpow(2,n)-1;
    ll now=1;
    rep(i,a){
        now*=(n-i)*inv[i+1]%MOD;
        now%=MOD;
    }
    ans=(ans+MOD-now)%MOD;
    now=1;
    rep(i,b){
        now*=(n-i)*inv[i+1]%MOD;
        now%=MOD;
    }
    ans=(ans+MOD-now)%MOD;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 25984
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) for(ll i=0;i<(n);++i)
#define REPR(i,n) for(ll i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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; }

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

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    vector<int> a(n);
    vector<int> cnt(n);
    rep(i,n-1) cin>>a[i], cnt[a[i]-1]++;
    for (auto &&e: cnt) cout << e << '\n';
    return 0;
}

Measured memory_bytes: 4848
N = int(input())
S = input()
r = 0
g = 0
b = 0
for a in range(N):
    if S[a] == "R":
        r += 1
    elif S[a] == "G":
        g += 1
    elif S[a] == "B":
        b += 1
all = r*g*b
count = 0
for i in range(0, N-2):
    for j in range(i+1, N-1):
        k = 2*j-i
        if k < N:
            if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]:
                count += 1
print(all-count)      

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

int const oo = 1000000000 + 7;

#define endl '\n'

vector<vector<int>> dp;

bool canGoRight(int j, int m) {
    return (j + 1) <= m;
}

bool canGoDown(int i, int n) {
    return (i + 1) <= n;
}

bool isThereWall(vector<vector<char>> &grid, int i, int j) {
    return grid[i][j] == '#';
}

bool isFinished(int i, int j, int n, int m) {
    return i == (n - 1) && j == (m - 1);
}

int startMoving(vector<vector<char>> &grid, int i, int j, int n, int m) {
    
    if(isFinished(i, j, n, m)) return 1;
    
    if(dp[i][j] != -1) return dp[i][j];
    
    int count = 0;
    
    if(canGoRight(j + 1, m)) {
        if(!isThereWall(grid, i, j + 1)) {
            count += (startMoving(grid, i, j + 1, n, m) % oo);
        }
    }
    
    if(canGoDown(i + 1, n)) {
        if(!isThereWall(grid, i + 1, j)) {
            count += (startMoving(grid, i + 1, j, n, m) % oo);
        }
    }
    
    
    dp[i][j] = (count % oo);
    return dp[i][j];
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n, m;
    string line;
    cin>>n>>m;
    
    vector<vector<char>> grid(n, vector<char>(m, ' '));
    dp.resize(n, vector<int>(m, -1));
    
    for(int i = 0; i < n; ++i) {
        cin>>line;
        for(int j = 0; j < m; ++j) {
            grid[i][j] = line[j];
        }
    }
    
    cout<<startMoving(grid, 0, 0, n, m)<<endl;
    
   
    return 0;
}

Measured memory_bytes: 5376