akhauriyash/Code-Regression huggingface dataset:
/* Headers */

#include <bits/stdc++.h>

using namespace std;

const long long MOD = 1e9 + 7;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,pii> iii;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef priority_queue<pii, vector<pii>, greater<pii>> fila_prioridade;
typedef priority_queue<iii, vector<iii>, greater<iii>> fila_prioridade_grids;


#define INF 1000000000
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)


/* -------------- */

//NAME: Power Socket
//Source: Atcoder Beginner Contest 139
//URL: https://atcoder.jp/contests/abc139
//TYPE: Ad-hoc
/* Knowledge required:

*/

//O único detalhe que deve ser lembrado é de subtrair a quantidade de tomadas
//totais em 1 para cada extensor.


int A,B;
int extensores = 0;
int tomadas = 1;

int main() {
        std::ios_base::sync_with_stdio(false);
        cin.tie(NULL);

        cin >> A >> B;


        while (tomadas < B) {
                tomadas += A - 1;
                extensores++;

        }

        cout << extensores << endl;

        return 0;
}



Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define MODULO 1000000007 
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> ii;
 
#define fori(n) for (int i = 0; i < (n); i++)
#define forj(n) for (int j = 0; j < (n); j++)
#define speed_io ios_base::sync_with_stdio(false); cin.tie(NULL)

int power(int x, int y, int mod) {
    int res = 1;
    while (y > 0) {
        if ((y & 1) == 1) {
            res = ((ll) res * x) % mod;
        }
        y >>= 1;
        x = ((ll) x * x) % mod;
    }
    return res;
}

int mod_inverse(int n, int p) {
    return power(n, p - 2, p);
}

int modulo_divide(int a, int b, int mod) {
    return ((ll) a * mod_inverse(b, mod)) % mod; 
}

int main() {
    speed_io;

    int x;
    cin >> x;

    int angle = 0;
    int res = 0;
    while (angle != 360) {
        angle += x;
        if (angle > 360) {
            angle -= 360;
        }
        res++;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 3668
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
string st,st1;
int n,m,i,j,cnt,f[100005];
int main()
{
	cin>>st;
	n=st.length();
	for (i=0;i<n;i++)
	{
		if (st[i]=='x')
		{
			cnt++;
			f[st1.size()]++;
		}
		else st1.push_back(st[i]);
	}
	for (i=0;i<=st1.size();i++)
	{
		cnt-=min(f[i],f[st1.size()-i]);
	}
	st=st1;
	reverse(st1.begin(),st1.end());
	if (st==st1) cout<<cnt; else cout<<-1;
	return 0;
}

Measured memory_bytes: 768
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

from collections import Counter


n, k, l = map(int, input().split())

GRAPH = [[] for _ in range(n + 1)]
for _ in range(k):
    p, q = map(int, input().split())
    GRAPH[p].append(q); GRAPH[q].append(p)

def dfs(now):
    A[now] = a
    SEARCHED[now] = True
    for v in GRAPH[now]:
        if SEARCHED[v]:
            continue
        next = v
        dfs(next)

A = [0] * (n + 1)
SEARCHED = [False] * (n + 1)

a = 1
for i in range(1, n + 1):
    if SEARCHED[i]:
        continue
    dfs(i)
    a += 1

GRAPH = [[] for _ in range(n + 1)]
for _ in range(l):
    r, s = map(int, input().split())
    GRAPH[r].append(s); GRAPH[s].append(r)

def dfs(now):
    B[now] = b
    SEARCHED[now] = True
    for v in GRAPH[now]:
        if SEARCHED[v]:
            continue
        next = v
        dfs(next)

B = [0] * (n + 1)
SEARCHED = [False] * (n + 1)

b = 1
for i in range(1, n + 1):
    if SEARCHED[i]:
        continue
    dfs(i)
    b += 1

AB = [ab for ab in zip(A, B)]
COUNTS = Counter(AB)

for i in range(1, n + 1):
    print(COUNTS[AB[i]])


Measured memory_bytes: 77208
def shorten(f):
    #print(f) 
    if len(f) == 1:
        return(f[0])
    else:
        g = []
        v = f[0]
        for i in f[1:]:
            g.append((v + i)%10)
            v = i
        return(shorten(g))

while True:
  try:
      f = list(map(int, list(input().strip())))
      print(shorten(f))
  
  except EOFError:
      break

Measured memory_bytes: 7692
#include<bits/stdc++.h>
using namespace std;
const bool DEBUG = true;
#define coutd if(DEBUG) cout 
#define ff first
#define ss second
#define debug(x) cout << "> x:" << x << endl;
#define len(x) int(x.size())
#define all(x) x.begin(), x.end()
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(){
	ios::sync_with_stdio(0);
	int a, b;
	cin >> a >> b;
	int w = a;
	int ans = 1;
	while(w<b) w+=a-1, ++ans;
	if(b==1) ans=0;
	cout << ans << endl;
}


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

n, m = map(int, input().split())
sc = list(list(map(int, input().split())) for i in range(m))

# 全捜索
for i in range(1000):
    q = i
    # 桁数比較
    if len(str(i)) == n:
        l = []
        # 桁ごとに分ける
        for _ in range(n):
            q, mod = divmod(q, 10)
            l.append(mod)
        l.reverse()
        # 条件比較
        f = True
        for [s, c] in sc:
            if l[s-1] != c:
                f = False
                break
        if f == True:
            print(i)     
            exit()
print(-1)     


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<string>
#include<functional>
using namespace std;
typedef	long long int ll;

int main(){
    string s;
    int x, y;
    cin >> s >> x >> y;
    vector<int> xi;
    vector<int> yi;
    xi.push_back(0);
    yi.push_back(0);
    int restart = s.size();
    for(int i = 0; i < s.size(); i++){
        if(s[i]=='F'){
            x--;
        }
        else{
            restart = i;
            break;
        }
    }
    int length = 0;
    bool dr = 0;//0はx方向
    int xmax = 0;
    int ymax = 0;
    for(int i = restart; i < s.size(); i++){
        if(s[i]=='F'){
            length++;
        }
        else{
            if(dr==0){
                dr = 1;
                xi.push_back(2*length);
                xmax += 2*length;
                x += length;
                length = 0;
            }
            else{
                dr = 0;
                yi.push_back(2*length);
                ymax += 2*length;
                y += length;
                length = 0;
            }
        }
    }
    if(dr==0){
        xi.push_back(2*length);
        xmax += 2*length;
        x += length;
    }
    else{
        yi.push_back(2*length);
        ymax += 2*length;
        y += length;
    }
    if(x > xmax || x < 0){
        cout << "No" << endl;
        return 0;
    }
    if(y > ymax || y < 0){
        cout << "No" << endl;
        return 0;
    }
    bool dpx[xi.size()][xmax+1];
    bool dpy[yi.size()][ymax+1];
    for(int i = 0; i < xi.size(); i++){
        for(int j = 0; j <= xmax; j++){
            if(i==0){
                if(xi[i]==j) dpx[i][j] = 1;
                else if(j==0) dpx[i][j] = 1;
                else dpx[i][j] = 0;
            }
            else{
                if(dpx[i-1][j]==1) dpx[i][j] = 1;
                else if(j-xi[i]>=0 && dpx[i-1][j-xi[i]]==1) dpx[i][j] = 1;
                else dpx[i][j] = 0;
            } 
        }
    }
    for(int i = 0; i < yi.size(); i++){
        for(int j = 0; j <= ymax; j++){
            if(i==0){
                if(yi[i]==j) dpy[i][j] = 1;
                else if(j==0) dpy[i][j] = 1;
                else dpy[i][j] = 0;
            }
            else{
                if(dpy[i-1][j]==1) dpy[i][j] = 1;
                else if(j-yi[i]>=0 && dpy[i-1][j-yi[i]]==1) dpy[i][j] = 1;
                else dpy[i][j] = 0;
            } 
        }
    }
    if(dpx[xi.size()-1][x]==1 && dpy[yi.size()-1][y]==1){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 15872
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin>> N;
    int ans = INF;
    int W[110];
    rep(i, N) cin >> W[i];
    rep(S, N + 1) {
        int L = 0, R = 0;
        rep(i, S) {
            L += W[i];
        }
        REP(i, S, N - 1) {
            R += W[i];
        }
        //cout << L << " " << R << endl;
        ans = min(ans, abs(L - R));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "
int main(){
    int n;cin>>n;
    vector<int> sum(n);
    int tmp=0;
    rep(i,n){int ne;cin>>ne;tmp+=ne;sum[i]=tmp;}
    int ans =1e9;
    rep(i, n-1){
        int dif = abs(2*sum[i]-sum[n-1]);
        if(ans>dif)ans = dif;
    }
    co(ans);
}


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

typedef long long ll;
int main()
{
    int n;
    cin>>n;
    if(!(n%2))
    {
        cout<<n/2<<endl;
    }
    else

    {
        cout<<(n+2)/2<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())

# 一回の思考にかかる時間
total_time = M*1900+(N-M)*100

e = 0
err = 10**(-3)  # 許容誤差(答えが整数だから、いい感じに近くなったら打ち切って、四捨五入)
prev = -1
i = 0

while abs(prev-e) > err:
    prev = e
    e += (1-(1/2)**M)**i*(1/2)**M*total_time*(i+1)
    i += 1


def floor(x, y):
    return ((-x)//y)*(-1)


print(int(floor(e, 1)))



Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> o_set; 

#define     int                 ll
#define     pb                  push_back
#define     mp                  make_pair
#define     xx                  first
#define     yy                  second    
#define     all(a)              a.begin(),a.end()
#define     vi                  vector<int>
#define     vpi                 vector<pii>
#define     pii                 pair<int, int>
#define     present(DT, val)    (DT.find(val) != DT.end()) //for set and map
#define     cpresent(DT, val)   (find(all(DT),val) != DT.end()) //vectors
#define     input               "/home/pollution/Desktop/WorkSpace/C++/Files/input.txt"
#define     output              "/home/pollution/Desktop/WorkSpace/C++/Files/output1.txt"
#define     error               "/home/pollution/Desktop/WorkSpace/C++/Files/error.txt"
#define     IO()                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define     INF                 2e18
#define     MOD                 1000000007
#define     clr(x)              memset(x, 0, sizeof(x))
#define     init(x, a)          memset(x, a, sizeof(x))
#define     out(a)              for (auto i: a) cout<<i<<'\n';
#define     cpy(a,b)            memcpy(a,b,sizeof(b))
#define     is(a)               to_string(a)
#define     ci(a,c)             a-c
#define     debug(i)            cout<<"point :"<<i<<'\n';
#define     setd(val,n)         cout<<fixed<<setprecision(n)<<val<<'\n'

void solve(){
    int n,x,y; cin>>n>>x>>y;
    vi ans(n-1,0);
    for(int i = 1; i <= n; ++i){
    	for(int j = i+1; j <= n; ++j){
    		ans[min(j-i,abs(x-i)+abs(y-j)+1)-1]++;
    	}
    }
    out(ans);
}

signed main() { 
    IO();
    
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0; 
}

Measured memory_bytes: 256
#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(){
    int n;
    cin >> n;
    int h[n];
    int high;
    rep(i,n) cin >> h[i];
    bool ans = true;
    high = h[0]-1;

    for(int i=1;i<n;i++){
        if(high>h[i]){
            ans = false;
            break;
        }else{
            high = max(high,h[i]-1);
        }
    }

    if(ans)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <iomanip>
#include <algorithm>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 xx, yy;
	cin >> xx >> yy;

	if(yy >= xx * 2 && yy <= xx * 4)
	{
		if(yy % 2 == 0)
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3632
#include<iostream>

using namespace std;

int main(){
    int N,X;
    int ans=1,sum=0;

    cin>>N>>X;
    for (int i = 0; i < N; i++)
    {
        int tmp;
        cin>>tmp;
        sum+=tmp;
        if(sum<=X)ans++;
    }
    

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
const ll mod=1e9+7;

int main(){
	int N,i,j;
	cin >> N;
	vs s(N);
	bool isExist;
	ll ans=0;
	for(i=0; i<N; i++){
		cin >> s[i];
		sort(s[i].begin(), s[i].end());
		isExist=false;
	}

	sort(s.begin(), s.end());
/*
	vector< vll > v(N+1);
	for(i=0; i<v.size(); i++){
		vll vv(v.size(),0);
		vv[0]=1;
		vv[i]=1;
		v[i]=vv;
	}

	for(i=1; i<v.size(); i++){
		v[i][1]=(v[i-1][0]+v[i-1][1]);
		v[i][2]=(v[i-1][1]+v[i-1][2]);
	}
*/
	int count=1;
	for(i=1; i<N; i++){
		if(s[i]==s[i-1]){
			count++;
			ans+=count-1;
		}else{
			count=1;
		}
	}

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

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int n, c, b, a, l[8];

int f(int k, int p, int q, int r)
{
    if (k == n)
    {
        if (!p || !q || !r) return 1e9;
        return abs(p - c) + abs(q - b) + abs(r - a);
    }

    int sol = f(k + 1, p, q, r);
    sol = min(sol, f(k + 1, p + l[k], q, r) + 10);
    sol = min(sol, f(k + 1, p, q + l[k], r) + 10);
    sol = min(sol, f(k + 1, p, q, r + l[k]) + 10);
    return sol;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> c >> b >> a;
    for (int i = 0; i < n; ++i)
        cin >> l[i];
    cout << f(0, 0, 0, 0) - 30;
}


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

using namespace std;

int dx[] = {0, 0, 1, -1, 1,-1,1,-1};
int dy[] = {1, -1, 0, 0, 1,-1,-1,1};
int m,n;
bool isSafe(int x, int y){
    if(x<0||y<0||x>=n||y>=m)return false;
    return true;
}

int main()
{

 scanf("%d %d",&n,&m);
 char c[n][m];
 int x[n][m];
 for(int i=0;i<n;i++)
    fill(x[i],x[i]+m,0);

 for(int i=0;i<n;i++)
    scanf("%s",&c[i]);

 for(int i=0;i<n;i++)
 {
     for(int j=0;j<m;j++)
     {
         if(c[i][j]=='.')
         {
             //cout<<" i = "<<i<<" // "<<" j = "<<j<<endl;
             for(int k=0;k<8;k++)
             {
                 if(isSafe(i+dx[k],j+dy[k])&&c[i+dx[k]][j+dy[k]]=='#')
                 {
                     x[i][j]++;
                     //cout<<"x = "<<x[i][j]<<" i = "<<i+dx[k]<<" j ="<<j+dy[k]<<endl;
                 }
             }
         }
     }
 }
for(int i=0;i<n;i++)
{
    for(int j=0;j<m;j++)
    {
        if(c[i][j]=='.')
            printf("%d",x[i][j]);
        else
            printf("%c",c[i][j]);
    }
    printf("\n");
}
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
   int n,d;
   cin>>n>>d;

   int p=2*d+1;

   if(n%p!=0)
     cout<<(n/p)+1<<"\n";
   else
    cout<<n/p<<"\n";
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  cin >> n;
  vector<pair<string,P>> p;
  rep(i,n){
    string s;
    int x;
    cin >> s >> x;
    p.emplace_back(s,P(-x,i));
  }
  sort(rng(p));
  for(auto it : p){
    cout<<it.se.se+1<<endl;
  }
  return 0;
}

Measured memory_bytes: 3552
#include <iostream>
#include <vector>
#include<algorithm>
#include<set>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i =0;i < n;i++)
int main() {
	int n; string s;
	cin >> n >> s;
	vector<int> w(n), e(n);w[0] = 0;e[0] = 0;
	for(int i = 0;i < n;i++) {
		if (i != 0) {
			e[i] = e[i - 1];
			w[i] = w[i - 1];
		}
		if (s[i] == 'W') {
			w[i]++;
		}
		else
			e[i]++;
	}
	int ans = 364364,sum;// E ->   W <-
	rep(i, n) { 
		if (i == 0) {
			sum = e[n - 1] - e[0];
		}
		else if (i == n - 1) {
			sum = w[n - 2];
		}
		else{
			sum = e[n - 1] - e[i] + w[i - 1];
		}
		ans = min(ans, sum);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#define debug(x) cout << #x " => " << (x) << endl
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int k;
  cin >> k;
  vector<int> v{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};
  cout << v[k - 1] << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
					
public class my
{
	public static void Main()
	{
		while(true) {
			var n = my.GetInt();
			if(n==0)	break;
			
			var a = new int[n];
			for(int i = 0; i < n; i++) {
				a[i] = my.GetInt();
			}
			
			var max = int.MinValue;
			for(int i = 0; i < n; i++) {
				var sum = 0;
				for(int j = 0; i+j < n; j++) {
					sum += a[i+j];
					max = Math.Max(sum, max);
				}
			}
			Console.WriteLine(max);
		}
	}
	
	private static int GetInt()
	{
		return int.Parse(Console.ReadLine());
	}
}

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

#define fst first
#define snd second
#define ll long long
#define ld long double
#define pb push_back
#define emp emplace_back
#define pii pair<int, int>
#define usg unsigned
#define sg signed
#define mp make_pair

using namespace std;

void setIO(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
}

const ld PI = 4*atan((ld)1);
const int INF = 1e9+7;
const ll _INF = 1e18+7;

int main(){
	setIO();
	int d, t, s;
	cin >> d >> t >> s;
	if (d <= t*s) cout << "Yes\n";
	else cout << "No\n";
}

Measured memory_bytes: 3648
/*
 *  Created on: 21 / 6 / 2020
 *  Author:     Eslam Waheed
 */

#define _CRT_SECURE_NO_WARNINGS
//#define __USE_MINGW_ANSI_STDIO

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

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

#define ll   long long
#define ull  unsigned ll
#define dd   double
#define ld   long dd
#define ss   string

#define pb      push_back
#define all(c)  c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define stp(n)  cout << fixed << setprecision(n);
#define iq(v)   v.resize(unique(v.begin(),v.end())-v.begin())
#define sz(s)   (ll)(s.size())
#define endl    '\n'

#define loop(i,m,n)  for(ll i=m;i<n;i++)
#define test(t)      while(t--)

//ll gcd(ll a, ll b) { return !b ? abs(a) : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return abs(a / gcd(a, b)) * b; }

//const ld PI = acos(-1);
//const ll mod = 1e9 + 7;
//__int128
/*
 you can ^_^ (•‿•)

( إن الله وملائكته يصلون على النبي يا أيها الذين آمنوا صلوا عليه وسلموا تسليما )
*/
int main()
{
    //stp(0)
    Eslam__Waheed
        ll n, k; cin >> n >> k;
    vector<ll>v(n);
    for (auto& it : v)
    {
        cin >> it;
    }
    sort(all(v));
    ll ans = 0;
    for (int i = 0; i < k; i++)
    {
        ans += v[i];
    }
    cout << ans;
}

Measured memory_bytes: 3664
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;

int main(){
   long long N,A,B;
   cin >> N >> A >> B;
   long long k = N/(A+B);
   long long r = N % (A+B);
   cout << k*A+min(r,A)<<endl;
   return 0;
}


Measured memory_bytes: 256
A, B, C, X = 4.times.map { gets.to_i }

output = 0

(0..A).each do |a|
  break if a > A
  (0..B).each do |b|
    break if b > B
    sum = 0
    sum += 500 * a + 100 * b
    if X == sum
      output += 1
    elsif X > sum
      output += 1 if X <= sum + 50 * C
    end
  end
end

puts output


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
const int MAX_V=100000;
#define int long long
struct edge{int to,cost;};
int V,E;
vector<edge> G[MAX_V];
int d[MAX_V];

signed main(){
  int N,A,B,C;
  cin >> A>>B;
  cout << (A+B+1)/2 << endl;
}


Measured memory_bytes: 3068
n,c = map(int,input().split())

t = [[0 for i in range(100001)] for j in range(c)]

for i in range(n):
    si,ti,ci = map(int,input().split())
    for j in range(si,ti+1):
        t[ci-1][j] = 1
print(max(sum(t[j][i] for j in range(c)) for i in range(100001)))


Measured memory_bytes: 26712
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include <fstream>
using namespace std;
typedef long long ll;
const ll INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int mod = 1e9+7;
const int maxn = 200005;
ll T,n,m;
int main() {
	cin>>n;
	string s;
	cin>>s;
	if(n%2==1){
		cout<<"No\n";
	}
	else {
		for(int i=0;i<n/2;i++){
			if(s[i]!=s[(n/2)+i]){
				cout<<"No\n";
				return 0;
			}
		}
		cout<<"Yes\n";
	}
	
    return 0;
}



Measured memory_bytes: 256
def combination(n,r,mod=10**9+7):
    n1 = n+1
    r = min(r,n-r)
    numer = denom = 1
    for i in range(1,r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom,mod-2,mod) % mod
 
mod = int(1e9+7)
n,a,b= map(int,input().split())
 
S = (pow(2,n,mod) - 1)%mod
A = combination(n,a)
B = combination(n,b)
ans = (S-A-B)%mod
 
print(ans)

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

int main(){
	
	int n;
	cin >> n;
	for(int i=1; i<=25; i++){
		if(4 * i == n){
			cout << "Yes\n";
			return 0;
		}
	}

	for(int i=1; i<=14; i++){
		if(7 * i == n){
			cout << "Yes\n";
			return 0;
		}
	}

	for(int i=1; i<=25; i++){
		for(int j=1; j<=14; j++){
			if(4 * i + 7 * j == n){
				cout << "Yes\n";
				return 0;
			}
		}
	}

	for(int i=1; i<=14; i++){
		for(int j=1; j<=25; j++){
			if(4 * j + 7 * i == n){
				cout << "Yes\n";
				return 0;
			}
		}
	}

	cout << "No\n";

	return 0;
}

Measured memory_bytes: 256
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line: Vec<u32> = read_as_vec();
    let (a, b, c) = (line[0], line[1], line[2]);

    println!("{}", cmp::min(b/a, c ));
}


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

int main() {
  long n,T;
  long long ans;
  cin >> n >> T;
  vector<long>data(n);
  ans = n*T;
  for(long i;i < n;i++){
    cin >> data[i];
    if(i != 0){
      if(data[i]-data[i-1] < T){
        ans -= T-(data[i]-data[i-1]);
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int reverse(char *, int, int);

int main(void){

    char a[100], sum=0, n;

    scanf("%s",a);
    n = strlen(a);

    sum = reverse(a, 0,n) + reverse(a, 0, (n-1)/2) + reverse(a,((n+3)/2-1),n);
    
    if(sum == 0){
        printf("Yes");
    }else{
        printf("No");
    }
}

int reverse(char *p,int a,int n){
    int i;
    for(i=a;i<n;i++){
        if(p[i]!=p[n-1-i]){
            return -1;
        }
    }
    return 0;
}

Measured memory_bytes: 1732
def main():
    import bisect
    x,y,a,b,c = map(int,input().split())
    p = sorted(list(map(int,input().split())))[-1*x:]
    q = sorted(list(map(int,input().split())))[-1*y:]
    r = sorted(list(map(int,input().split())))
    ans = p+q+r
    ans = sorted(ans,reverse=True)[0:x+y]
    print(sum(ans))

    
if __name__ == "__main__":
    main()


Measured memory_bytes: 22064
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000


int main(){

	string s;
	cin>>s;
	
	cout<<s.front()<<s.size()-2<<s.back()<<endl;
	
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#define Max 2000

int n,A[Max];
int q,M[Max],i;

int hantei(int,int);
main(){
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&M[i]);
  }
  
  for(i=0;i<q;i++){
    if(hantei(0,M[i])==1)
      printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

int hantei(int i,int m){
  if(A[i]==m)return 1;
  if(i==n)return 0;
  else{
    if (hantei(i+1,m) || hantei(i+1,m-A[i]))
      return 1;
  }
  return 0;
}

Measured memory_bytes: 588
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<stdlib.h>
using namespace std;
int top,s[1000];

void push(int x){
    s[++top]=x;
}

int pop(){
    top--;
    return s[top+1];
}

int main(){
int a,b;
top=0;
char s[100];
while(scanf("%s",s)!=-1){
if(s[0]=='+'){
    a=pop();
    b=pop();
    push(a+b);
}
else if(s[0]=='-'){
    b=pop();
    a=pop();
    push(a-b);
}
else if(s[0]=='*'){
    a=pop();
    b=pop();
    push(a*b);
}
else {push(atoi(s));}
}
printf("%d\n",pop());
return 0;
}

Measured memory_bytes: 3208
#include <bits/stdc++.h>
#define INF 1e18
#define MOD 1000000007
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;

void solve()
{
    int N, K;
    cin >> N >> K;
    vector<int> h(N);
    REP(i, N) cin >> h[i];

    int ans = 0;
    REP(i, N) {
        if (h[i] >= K) {
            ans += 1;
        }
    }

    print(ans);
}

int main()
{
    solve();

    return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
int l;
//char s[60000][12],c[12];
int g(char a[20]){
  int n=0,i;
  for(i=l;i;i--){
    if(a[i-1]=='r')n=n*3+0;
    if(a[i-1]=='g')n=n*3+1;
    if(a[i-1]=='b')n=n*3+2;
  }
  return n;
}
int main(){
  int t,r,i,j,f,a[60000];
  char s[60000][12],c[12];
  while(scanf("%s",s[0]),s[0][1]){
    l=strlen(s[0]);
    int u[60000]={0};
    u[g(s[0])]=1;
    a[0]=t=0;
    for(r=1;r-t;t++){//printf("%s\n",s[t]);
      for(i=f=1;s[t][i];i++){//printf("%s\n",s[t]);
	if(s[t][i-1]==s[t][i])continue;
	f=0;
	strcpy(c,s[t]);
	if(s[t][i-1]+s[t][i]=='g'+'r')c[i-1]=c[i]='b';
	if(s[t][i-1]+s[t][i]=='g'+'b')c[i-1]=c[i]='r';
	if(s[t][i-1]+s[t][i]=='b'+'r')c[i-1]=c[i]='g';
	if(u[g(c)])continue;//printf("c%s\n",c);
	strcpy(s[r],c);
	a[r++]=a[t]+1;
	u[g(c)]=1;
      }
      if(f)break;
    }//printf("r%d\n",r);
    if(f)printf("%d\n",a[t]);
    else printf("NA\n");
  }
  return 0;
}

Measured memory_bytes: 1016
//04, 11, 2018, 10:07:35 Rafaelcs cpp
#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

const int N = int(1e5 + 10);
vector< pii > cities[N];
pii codes[N];

int get_len(int num){
    int d = 0;

    while(num){
        num /= 10;
        d++;
    }

    return d;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n, m;

    cin >> n >> m;

    for(int i = 0 ; i < m; i++){
        int p, y;

        cin >> p >> y;

        cities[p].push_back({y, i + 1});
    }


    for(int i = 1 ; i <= n ; i++){
        sort(cities[i].begin(), cities[i].end());
    }

    for(int i = 1 ; i <= n ; i++){
        for(int j = 0 ; j < cities[i].size() ; j++){
            pii u = cities[i][j];

            codes[u.second].first = i;
            codes[u.second].second = j + 1;
        }
    }

    for(int i = 1 ; i <= m ; i++){
        int a = 6 - get_len(codes[i].first);

        while(a){
            printf("0");
            a--;
        }

        printf("%d", codes[i].first);

        a = 6 - get_len(codes[i].second);

        while(a){
            printf("0");
            a--;
        }

        printf("%d\n", codes[i].second);
    }

    return 0;
}

Measured memory_bytes: 7808
// #include <bits/stdc++.h>
// #define FOR(i, m, n) for (int i = m; i < (n); i++)
// #define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
// #define REP(i, n) FOR(i, 0, n)
// #define RREP(i, n) RFOR(i, n, 0)
// #define ALL(v) v.begin(), v.end()
// #define RALL(v) v.rbegin(), v.rend()
// using namespace std;
// typedef long long ll;
// const int mod = 1e9 + 7;

// ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

// int main() {
//   int n, d;
//   cin >> n >> d;
//   int x[n][d];
//   REP(i, n) {
//     REP(j, d) { cin >> x[i][j]; }
//   }
//   int anser = 0;
//   REP(i, n) {
//     REP(j, d) {
//       FOR(k, i, n) {
//         int sum = 0;
//         FOR(l, j, d) { sum += pow(x[i][j] - x[k][l], 2); }
//         if (is_int_lround(sqrt(sum))) {
//           anser++;
//         }
//       }
//     }
//   }
//   cout << n << endl;
//   return 0;
// }

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

int main() {
  int n, d;
  cin >> n >> d;
  vector<vector<int>> x(n, vector<int>(d));
  REP(i, n) {
    REP(j, d) { cin >> x[i][j]; }
  }
  int anser = 0;
  REP(i, n) {
    REP(j, i) {
      int sq = 0;
      REP(k, d) {
        int s = x[i][k] - x[j][k];
        sq += s * s;
      }
      int s = sqrt(sq) + 0.5;
      if (s * s == sq) anser++;
    }
  }
  cout << anser << endl;
  return 0;
}

Measured memory_bytes: 256
import math

N = int(input())
A = list(map(int, input().split()))
Asrt = sorted(A, reverse=True)


num = math.ceil(N/2)

a = Asrt[:num]

if N % 2 == 0:#guusuu
    print(sum(a) * 2 - a[0])
else:#kisuu
    print(sum(a) * 2 - a[0] - a[-1])


Measured memory_bytes: 32768
#include <iostream>

using namespace std;

int main(){
  long long n,a,b,c,d;
  cin >> n>> a>> b>> c>> d; 
  bool flag = false;
  for(int m=0;m<n;++m){
    if(c*(n-1-m)-d*m<=b-a&&b-a<=-c*m+(n-1-m)*d){
      flag = true;
      break;
    }
  }
  if(flag){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
ans = float(0)
for i in range(1, n+1):
    cnt = 0
    while True:
        if i >= k:
            break
        i *= 2
        cnt += 1
    ans += 0.5**cnt
    # print(cnt)

ans *= 1 / n
print(ans)

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
def main():
    A, V = map(int, input().split())
    B, W = map(int, input().split())
    T = int(input())

    if (V-W) > 0 and abs(B-A) <= (V-W)*T:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()



Measured memory_bytes: 9124
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define PI 3.14159265358979
typedef long long int ll;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a+b+c>21?"bust":"win");
}


Measured memory_bytes: 256
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('a1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n = read_int()
    p = read_int_list()
    res = 0
    m = p[0]
    for i in range(n):
      if p[i] <= m:
        res += 1
      m = min(m, p[i])


    print(res)


main()


Measured memory_bytes: 25380
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
      if(n<m){
        int po=n;
        n=m;
        m=po;
      }
      for(int i=0;i<n;i++)System.out.print(m);
    }
}


Measured memory_bytes: 21844
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Code author: Saurabh Singhal
Code copy karne vaale tera muh kaala
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

#include<bits/stdc++.h>
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define ppb pop_back

using namespace std;
typedef long long int ll;
typedef vector<int> vi_t;
typedef vector<ll> vll_t;
int t=1;
vll_t a,b;
int  main(){
	// #ifndef ONLINE_JUDGE
 //    // for getting input from input.txt
 //    freopen("input.txt", "r", stdin);
 //    // for writing output to output.txt
 //    freopen("output.txt", "w", stdout);
	// #endif
	string s;
	int k;
	cin>>s>>k;
	set<string>t;
	//cout<<"k="<<k<<endl;
	//cout<<"s="<<s<<endl;
	for(int i=1;i<=k&&i<=s.size();i++){
		for(int j=0;j<=s.size()-i;j++){
			string res="";
			for(int l=j;l<j+i;l++){
				res+=s[l];
			}
			//cout<<"res=:"<<res<<endl;
			t.insert(res);
		}
	}
	int count=0;
	while(!t.empty()&&count<k-1){
		count++;
		//cout<<*t.begin()<<endl;
		t.erase(t.begin());
	}
	cout<<*t.begin()<<endl;
}

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

#include <atcoder/modint.hpp>
#include <atcoder/lazysegtree.hpp>

using mint = atcoder::modint998244353;

vector<mint> ones;

struct S {
    S(mint v, int64_t s) : value(v), size(s) {}
    mint value;
    int64_t size;
};
using F = mint;

// op(12, 34) -> 1234
S op(S l, S r) { return { l.value * mint(10).pow(r.size) + r.value, l.size + r.size }; }

S e() { return { 0, 0 }; }

F id() { return 0; }

S mapping(F f, S x) { return (f == id() ? x : S(ones[x.size] * f, x.size)); }

F composition(F f, F g) { return (f == id() ? g : f); }


int main() {
    int64_t N, Q;
    cin >> N >> Q;

    vector<int64_t> L(Q), R(Q), D(Q);

    for (int64_t i = 0; i < Q; i++) {
        cin >> L[i] >> R[i] >> D[i];
        L[i]--;
    }

    //ones[i] = 1をi個並べたものの数
    ones.resize(N + 1, 1);
    for (int64_t i = 2; i <= N; i++) {
        ones[i] = ones[i - 1] * 10 + 1;
    }

    atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(N);
    for (int64_t i = 0; i < N; i++) {
        seg.set(i, S(mint(1), 1));
    }

    for (int64_t i = 0; i < Q; i++) {
        seg.apply(L[i], R[i], D[i]);
        cout << seg.all_prod().value.val() << endl;
    }
}

Measured memory_bytes: 21192
#include<bits/stdc++.h>
#define int long long
#define Inf 1000000000LL
using namespace std;
signed main(){
  int n,m=1;
  cin>>n;
  for(int i=1;i<=n;i++){
    m = m * i;
    m = m % 1000000007;
  }
  cout<<m<<"\n";
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int n,m,target[100],point[100]={0};
    int i,j;
    int t,count;

    scanf("%d%d",&n,&m);
    for(i=0;i<m;i++){
	scanf("%d",&target[i]);
    }

    for(i=0;i<m;i++){
	for(j=0;j<n;j++){
	    scanf("%d",&t);
	    if(t!=target[i]){
		point[target[i]-1]++;
	    }else{
		point[j]++;
	    }
	}
    }

    for(j=0;j<n;j++) printf("%d\n",point[j]);

    return 0;
} 

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int n , k ; 
  cin >> n >> k ;
  int ans = 1 ;
  int now = k ; 
  
  while(now<n){
    now += k-1 ;
    ans ++ ;
  }
  
  cout << ans ;
  
  }


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

ll n,A,B;

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

int main()
{
	n=rd()+1;A=rd();B=rd();
	if (B-A<=2) { printf("%lld\n",n);return 0; }
	if (!((n-A)&1)) printf("%lld\n",A+(n-A)/2*(B-A));
	else printf("%lld\n",A+1+(n-A)/2*(B-A));
	return 0;
}

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

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

using namespace std;
using lint=long long;
using graph=vector<vector<int>>;

pair<bool,vector<int>> two_coloring(const graph& G){
	int n=G.size();
	vector<int> color(n,-1);
	rep(u,n) if(color[u]==-1) {
		color[u]=0;
		queue<int> Q; Q.emplace(u);
		while(!Q.empty()){
			int v=Q.front(); Q.pop();
			for(int w:G[v]){
				if(color[w]==-1){
					color[w]=1-color[v];
					Q.emplace(w);
				}
				else if(color[w]==color[v]) return {false,vector<int>()};
			}
		}
	}
	return {true,color};
}

int main(){
	int n,m; scanf("%d%d",&n,&m);
	graph G(n);
	rep(i,m){
		int u,v; scanf("%d%d",&u,&v); u--; v--;
		G[u].emplace_back(v);
		G[v].emplace_back(u);
	}

	auto res=two_coloring(G);
	if(res.first){
		lint n1=count(res.second.begin(),res.second.end(),0);
		lint n2=count(res.second.begin(),res.second.end(),1);
		printf("%lld\n",n1*n2-m);
	}
	else{
		printf("%lld\n",n*(n-1LL)/2-m);
	}

	return 0;
}


Measured memory_bytes: 6528
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, math.MaxInt64)
}

func readInt() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func main() {
	n := readInt()
	a := make([]int, n)
	m := make(map[int]int)
	for i := 0; i < n; i++ {
		a[i] = readInt()
		m[a[i]]++
	}
	if len(a) == len(m) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 13312
n = int(input())
s = str(input())

ans = []
cnt = 0
for i in range(1,n):
    s1 = list(set(s[:i]))
    s2 = list(set(s[i:]))

    for j in range(len(s1)):
        for k in range(len(s2)):
            if s1[j] == s2[k]:
                cnt += 1
    ans.append(cnt)
    cnt = 0

print(max(ans))

Measured memory_bytes: 3064
def set(x, y, f)
  f[y] ^= (1 << x)
end

def isset?(x, y, f)
  return (f[y] & (1 << x)) != 0
end

def shoot(x, y, f)
  set(x, y, f)
  set(x - 1, y, f) if x > 0
  set(x + 1, y, f) if x < 9
  set(x, y - 1, f) if y > 0
  set(x, y + 1, f) if y < 9
end

### main

n = gets.strip.to_i

max_bits = 1 << 10

n.times.each do
  flds = []
  10.times.each do
    hl = gets.strip.gsub(/ /, '').reverse.to_i(2)
    flds.push hl
  end

  for bits in (0...max_bits)
    ans = []
    flds0 = flds.clone

    for x in (0..9)
      if (bits & (1 << x)) != 0
        shoot(x, 0, flds0)
      end
    end
    ans.push bits

    for y in (1..9)
      by = 0
      for x in (0..9)
        if isset?(x, y - 1, flds0)
          shoot(x, y, flds0)
          by |= (1 << x)
        end
      end
      ans.push by
    end

    if flds0[9] == 0
      ans.each{|b| puts ("%010b" % b).reverse.split("").join(" ")}
      break
    end
  end
end

Measured memory_bytes: 6816
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
int main(){

  long long k;
int n,a,b,i;

  cin>>n>>k;
  pair<int,int> pairs[n];
  for(i=0;i<n;i++){
    cin>>a>>b;
    pairs[i]=make_pair(a,b);
  }
  sort(pairs,pairs+n);
  for(i=0;k>0&&i<n;i++) k-=pairs[i].second;
  if(i==0) i++;
  cout<<pairs[i-1].first<<endl;
  return 0;
}


















Measured memory_bytes: 1024
package main

import(
      "fmt"
      "bufio"
      "io"
      "os"
      "strconv"
)

func main(){
  defer stdout.Flush()
  n := readInt()
  h := readInt()
  w := readInt()
  ans := 0
  a := make([]int, n)
  b := make([]int, n)
  for i := range a {
    a[i] = readInt()
    b[i] = readInt()
    if a[i]>=h && b[i]>=w {
      ans++
    }
  }
  fmt.Println(ans)
}

//==========================================================

type pair struct{
  first, second int
}

type pairSlice []pair

func (p pairSlice) Len() int{
  return len(p)
}
 
func (p pairSlice) Less(i, j int) bool{
  return p[i].second > p[j].second
}
 
func (p pairSlice) Swap(i, j int){
  p[i], p[j] = p[j], p[i]
}

//====  ↓↓↓ Scanner ↓↓↓  ====================================

var (
  readString func() string
  stdout     *bufio.Writer
)
 
func init() {
  readString = newReadString(os.Stdin)
  stdout = bufio.NewWriter(os.Stdout)
}
 
func newReadString(ior io.Reader) func() string {
  r := bufio.NewScanner(ior)
  r.Buffer(make([]byte, 1024), int(1e+11))
  r.Split(bufio.ScanWords)
 
  return func() string {
    if !r.Scan() {
      panic("Scan failed")
    }
    return r.Text()
  }
}
 
func readInt() int {
  return int(readInt64())
}
 
func readInt64() int64 {
  i, err := strconv.ParseInt(readString(), 0, 64)
  if err != nil {
    panic(err.Error())
  }
  return i
}
 
func readIntSlice(n int) []int {
  b := make([]int, n)
  for i := 0; i < n; i++ {
    b[i] = readInt()
  }
  return b
}
 
func readLengthAndSlice() []int {
  n := readInt()
  return readIntSlice(n)
}

//====  ↓↓↓ template functions ↓↓↓  ===========================

//min max
func minInt(a, b int) int{
  if a < b {
    return a
  }
  return b
}

func minInt64(a, b int64) int64{
  if a < b {
    return a
  }
  return b
}

func minFloat64(a, b float64) float64{
  if a < b {
    return a
  }
  return b
}

func maxInt(a, b int) int{
  if a > b {
    return a
  }
  return b
}

func maxInt64(a, b int64) int64{
  if a > b {
    return a
  }
  return b
}

func maxFloat64(a, b float64) float64{
  if a > b {
    return a
  }
  return b
}

//abs
func absInt(x int) int{
  if x < 0 {
    return -x
  }
  return x
}

func absInt64(x int64) int64{
  if x < 0 {
    return -x
  }
  return x
}

func absFloat64(x float64) float64{
  if x < 0 {
    return -x
  }
  return x
}

//gcd lcm
func gcdInt(a, b int) int{
  if b == 0 {
    return a
  }else{
    return gcdInt(b, a%b)
  }
}

func gcdInt64(a, b int64) int64{
  if b == 0 {
    return a
  }else{
    return gcdInt64(b, a%b)
  }
}

func lcmInt(a, b int) int{
  return a*b/gcdInt(a, b);
}

func lcmInt64(a, b int64) int64{
  return a*b/gcdInt64(a, b);
}

func swapInt(x, y *int){
  *x, *y = *y, *x
}

func swapInt64(x, y *int64){
  *x, *y = *y, *x
}

func swapFloat64(x, y *float64){
  *x, *y = *y, *x
}


Measured memory_bytes: 640
n, k = map(int, input().split())

a = [0]*n

for i in range(k):
  d = int(input())
  okasi = list(map(int, input().split()))
  for o in okasi:
    a[o-1] += 1
    
ans = 0
for i in range(n):
  if a[i] ==0 :
    ans += 1
print(ans)

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

int main() {
  
  int n;
  cin >> n;
  
  vector<int> a(n);
  REP(i,n) {
    cin >> a[i];
  }
  
  vector<int> b(n);
  REP(i,n) {
    cin >> b[i];
  }
  
  vector<int> c(n-1);
  REP(i,n-1) {
    cin >> c[i];
  }
    
  int ans = 0;
  
  REP(i,n) { 
    ans += b[a[i]-1];
    if (i > 0 && a[i]-1 == a[i-1]) ans += c[a[i]-2];
  }
  
  cout << ans << endl;
     
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	//B




	//A
	int money = 0;
	int x, y;
	cin >> x >> y;
	if (x == 1 && y == 1)
		money = 1000000;
	else 
	{
		if (x <= 3) {
			money = (4 - x) * 100000;
		}
		if (y <= 3) {
			money = money + (4 - y) * 100000;
		}
	
	}
	cout << money << endl;
	return 0;
	
}

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

vector<int> Q, seen;
int n, x;
void dfs(vector<int> &G, int i, int a){
    if(seen[a] != -1) {
        x = i - seen[a];
        return;
    }
    Q.push_back(a);
    seen[a] = i;
    dfs(G, i + 1, G[a]);
}

int main(){
    ll k;
    cin >> n >> k;
    vector<int> G(n);
    seen.resize(n, -1);
    rep(i, n){
        int a;
        cin >> a;
        a--;
        G[i] = a;
    }
    dfs(G, 0, 0);
    if(k >= Q.size()){
        k -= Q.size();
        k %= x;
        k = Q.size() - x + k;
    }
    cout << Q[k] + 1 << endl;
    return 0;
}

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

using namespace std;

int main(){
    string str[3]={"Sunny","Cloudy", "Rainy"};
    string s;
    cin>>s;
    for(int i=0;i<3;i++){
        if(s==str[i]){
            i++;
            cout<<str[i%3]<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256