akhauriyash/Code-Regression huggingface dataset:
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define i_inf int(1e9)
#define i_half_inf int(1e5)
#define ll_inf ll(1e9)*ll(1e9)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};


ll N;

vector<ll> each_digit(ll S) {
    ll n_len = 0, n_dig[9];
    while (S > 0) {
        n_dig[n_len++] = S % 10;
        S /= 10;
    }
    vector<ll> ret(n_dig, n_dig + n_len);
    return ret;
}

ll ans = 0;

void dfs(int s_len, string now, string next, bool three, bool five, bool seven) {
    string s_next = now + next;

    if (three && five && seven && s_next.size() == s_len && stoi(s_next) <= N) {
        ans++;
        return;
    } else if (s_next.size() == s_len) return;

    dfs(s_len, s_next, "3", true, five, seven);
    dfs(s_len, s_next, "5", three, true, seven);
    dfs(s_len, s_next, "7", three, five, true);
}

void solve() {
    ll rank = each_digit(N).size();
    repone(i, rank) {
        dfs(i, "", "3", true, false, false);
        dfs(i, "", "5", false, true, false);
        dfs(i, "", "7", false, false, true);
    }
    cout << ans << endl;
}

int main() {
    cin >> N;
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff first
#define ss second
#define int long long
#define all(x) (x).begin(), (x).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define eb emplace_back
#define pii pair<int, int>
#define inf 1e9

using namespace std;

const int mxn = 1e6 + 6;
vector<int> primes(mxn, 1), mpf(mxn);

void ini()
{
    primes[0] = primes[1] = 0;
    for (int i = 1; i < mxn; i++)
        mpf[i] = i;
    for (int i = 4; i < mxn; i += 2)
        primes[i] = 0, mpf[i] = 2;
    for (int i = 3; i < mxn; i += 2)
    {
        if (primes[i])
            for (int j = i * i; j < mxn; j += i)
                primes[j] = 0, mpf[j] = i;
    }
}

int n;
vector<int> v;
unordered_set<int> us;
unordered_map<int, int> pfc;
void solve()
{
    cin >> n;
    v.resize(n);
    int one = 0, res;
    for (int i = 0; i < n; i++)
    {
        cin >> v[i], one += (v[i] == 1);
        if (v[i] != 1)
            us.insert(v[i]);
        if (i == 0)
            res = v[i];
        else
            res = __gcd(res, v[i]);
    }
    bool pw = true, sw = (res == 1);
    if (one == n)
    {
        cout << "pairwise coprime";
        return;
    }
    if ((int)us.size() != n - one)
        pw = false;
    for (int i = 0; i < n; i++)
    {
        if (!pw)
            break;
        if (v[i] != 1)
        {
            pfc[v[i]]++;
            if (pfc[v[i]] > 1)
            {
                pw = false;
                break;
            }
        }
        if (v[i] != 1 and !primes[v[i]])
        {
            int t = v[i];
            unordered_set<int> s;
            while (mpf[t] != t)
            {
                s.insert(mpf[t]);
                t /= mpf[t];
            }
            s.insert(mpf[t]);
            for (auto &j : s)
            {
                pfc[j]++;
                if (pfc[j] > 1)
                {
                    pw = false;
                    break;
                }
            }
        }
    }
    if (pw)
    {
        cout << "pairwise coprime";
        return;
    }
    if (sw)
    {
        cout << "setwise coprime";
        return;
    }
    cout << "not coprime";
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    // int t;
    // cin >> t;
    // while (t--)
    ini();
    solve();
    return 0;
}

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

typedef long long ll;
typedef int64_t i6;
typedef std::vector<std::vector<int64_t> > Graph;

#define rep(i, n) for (int64_t i = 0; i < n; ++i)
#define rep2(i, n) for (int64_t i = 1; i <= n; ++i)
#define repb(i, l, n) for (int64_t i = l; i < n; ++i)
#define repb2(i, l, n) for (int64_t i = l; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))
#define Push_back(p, a, b) (p).push_back( make_pair( (a), (b) ) )

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;  } return 0;  }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;  } return 0;  }
template<typename V,typename T> bool find_num(V v, T num) { if ( find(ALL(v), num) == v.end() ) { return false; } return true; }

int main() {
    int64_t n, d;
    cin >> n >> d;
    std::vector<int64_t> x(n), y(n);
    int64_t ans = 0;
    std::vector<int64_t> v;
    rep(i, n) {
        cin >> x[i] >> y[i];
        if (x[i]*x[i]+y[i]*y[i] <= d*d) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6336
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:

*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 110;
const int MAXM = 200010;
const int MAXK = 110;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    string s;
    cin >> s;
    if (s[0] == 'S') cout << "Cloudy";
    else if (s[0] == 'C') cout << "Rainy";
    else cout << "Sunny";
    return 0;
}


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

#define REP(i,a,b) for(int64_t i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
char c[5] = {'M', 'A', 'R', 'C', 'H'};
int64_t a[5];

int main(){
rep(i,5) a[i] = 0;

int64_t n;
cin >> n;

rep(i,n){
	char tmp[15];
	cin >> tmp;
	rep(j,5){
		if(tmp[0] == c[j]){ a[j]++;}
	}
}

int64_t out = 0;
rep(i,5){ REP(j,i+1,5){ REP(k,j+1,5){
	out += a[i] * a[j] * a[k];
}}}

cout << out <<endl;

return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]B - Can you solve this?
            var line = ReadLine();
            int n = line[0];
            int m = line[1];
            int c = line[2];
            var b = ReadLine();

            int count = 0;

            for(int i = 0; i < n; i++)
            {
                var a = ReadLine();
                int result = c;

                for(int j = 0; j < m; j++)
                {
                    result += a[j] * b[j];
                }

                if (result > 0)
                {
                    count++;
                }
            }

            Console.WriteLine(count);
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine().TrimEnd();
            var array = line.Split(' ');
            var numbers = new List<int>();

            foreach (var s in array)
            {
                int num = int.Parse(s);
                numbers.Add(num);
            }

            return numbers;
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;

int main() {
	int N;
	cin >> N;
	ll asum[210000] = { };

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

	ll mi = 2100000000;
	for(int i = 1; i <= N - 1; i++) {
		mi = min(mi, abs(asum[i] - (asum[N] - asum[i])));
	}
	cout << mi << endl;

	return 0;
}



Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, H, M;
  cin >> A >> B >> H >> M;
  
  cout << fixed << setprecision(30);
  
  long double C, D, E, F, L, pi;
  
  C = H*30.0 + M/2.0;
  D = M*6.0;
  pi = 2.0*asin(1.0);
  E = C/180.0*pi;
  F = D/180.0*pi;
  
  L = sqrt( A*A + B*B - 2.0*A*B*(cos(E)*cos(F) + sin(E)*sin(F)));
  
  cout << L << endl;
  
}
  

Measured memory_bytes: 4164
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace lean
{
    class Program
    {
        static void Main()
        {
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int K = a[0];
            int N = a[1];

            int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int ok = A[N - 1] - A[0];

            for (int i = 0; i < N-1; i++)
            {
                if (true)
                {
                    if(ok> (K - A[i + 1] + A[i]))
                    {
                        ok = (K - A[i + 1] + A[i]);
                    }                    
                }
            }

                Console.WriteLine(ok);
        }
    }
}


Measured memory_bytes: 34780
import math

n,d = map(int,input().split(' '))
x,y = [0]*n,[0]*n
for i in range(n):
  x[i],y[i] = map(int,input().split(' '))
  
ans = 0  
  
for i in range(n):
  distane = math.sqrt(x[i]*x[i] + y[i]*y[i])
  if distane <= d:
      ans += 1
print(ans)

Measured memory_bytes: 24568
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VL vector<long long>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVL vector<vector<ll>>
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define PAIR pair<ll,ll>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;
constexpr int MOD = 1000000007;
using namespace std;

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

VL prime_decomposition(ll n) {
	ll i = 2;
	VL table{};
	while (i * i <= n) {
		while (n % i == 0) {
			n /= i;
			table.emplace_back(i);
		}
		++i;
	}
	if (n > 1) {
		table.emplace_back(n);
		return table;
	}
	return table;
}

double nd(ll w, ll s) {
	return (double)(100.0 * s) / (double)(w + s);
}

int main() {
	ll a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;

	double max = 0.0;
	ll p = 0, q = 0;
	ll w = 0;
	REP(i, 11) {
		if (w > f) { break; }
		REP(j, 11) {
			ll wt = w + 100 * j*b;
			if (wt > f) { break; }
			ll s = 0;
			REP(k, 3100) {
				if (wt + s > f || wt * e < s * 100) { break; }
				REP(l, 3100) {
					ll st = s + d * l;
					if (wt + st > f || wt * e < st * 100) { break; }
					double tmp = nd(wt, st);
					if (tmp > max) {
						max = tmp;
						p = wt;
						q = st;
					}
				}
				s += c;
			}
		}
		w += 100 * a;
	}
	if (q == 0) {
		cout << 100 * a << " " << q << endl;
	} else {
		cout << p + q << " " << q << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
#include <numeric>
#include <queue>
#include <set>

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

int main(int argc, char const *argv[])
{
  ll n, x;
  cin >> n >> x;
  vector<ll> l(n);
  REP(i, n)
  {
    cin >> l[i];
  }
  ll d = 0;
  ll res = 1;
  REP(i, n)
  {
    d = d + l[i];
    if (d <= x)
    {
      res++;
    }
    else
    {
      break;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
int_list=[]

list1=list(map(int,input().split()))
list2=list(map(int,input().split()))
list3=list(map(int,input().split()))

int_list=[list1,list2,list3]

if(sum(list1)+sum(list2)+sum(list3)==(int_list[0][0]+int_list[1][1]+int_list[2][2])*3):
    print("Yes")
else:
    print("No")

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
template<class T>void dump(T&& t){cerr<<t<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  int h,w,k;
  cin>>h>>w>>k;
  vector<vector<char>> c(h,vector<char>(w));
  cin>>c;

  int ans = 0;
  for(int b1=0;b1<(1<<h);++b1){
    for(int b2=0;b2<(1<<w);++b2){
      auto tmp = c;
      rep(i,h)if((b1>>i)&1)rep(j,w)tmp[i][j]='!';
      rep(j,w)if((b2>>j)&1)rep(i,h)tmp[i][j]='!';
      int cnt = 0;
      rep(i,h)rep(j,w)if(tmp[i][j]=='#')cnt++;
      //cout<<b1<<" "<<b2<<endl;
      if(cnt==k)ans++;
    }
  }
  cout<<(ans)<<endl;

}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 string s;
  cin>>s;
  
  int ans=0;
  int n=s.size();
  bool nine=true;
  for(int i=1;i<n;i++)
    if(s[i]!='9')
      nine=false;
  
  if(nine)
    ans+=int(s[0]-'0');
  else ans+=int(s[0]-'1');
  cerr<<ans;
  for(int i=1;i<n;i++){
    ans+=9;
  }
  cout<<ans;
 
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  vector<double> high;
  double h;
  while(cin >>h) high.push_back(h);
  sort(high.begin(),high.end());
  cout <<high[high.size()-1]-high[0]<<endl;
  return 0;
}

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

const ll mod = 1000000007;
const double eps = 1e-8;

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

int main() {
    string S;
    cin >> S;
    if ((int)S.size() % 2 == 1) {
        cout << "No" << endl;
        return 0;
    }
    for (int i=0; i<(int)S.size(); i+=2) {
        if (S[i] != 'h' || S[i+1] != 'i') {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int i,num;
    scanf("%d",&num);
     
    for(i=1;i<=num;i++){
        if(i%10==3){
            printf(" %d",i);
        }
        else if(i%3==0){
             
            if(i==num){
                printf(" %d",i);
            }
            else
            printf(" %d",i);
        }
        else if(i/10==3){
            printf(" %d",i);
        }
        else if(30<=(i%100)&&(i%100)<=39){
            printf(" %d",i);
        }
        else if(300<=(i%1000)&&(i%1000)<=399){
        printf(" %d",i);
        }
        else if(3000<=(i%10000)&&(i%10000)<=3999){
        printf(" %d",i);
        }
 

    }
    printf("\n");
}


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

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    int mat[10][1000];
    rep(i, h) rep(j, w){
        char ch;
        scanf(" %c", &ch);
        mat[i][j] = (ch == '1');
    }
    const int INF = 10 * 1000;
    int ans = INF;
    int c[10][1000];
    rep(bi, 1 << h){
        vector<int> id(h);
        int g = 0;
        rep(i, h){
            id[i] = g;
            if(bi >> i & 1) g++;
        }
        g++;
        rep(i, h) rep(j, w) c[i][j] = 0;
        rep(i, h) rep(j, w){
            c[id[i]][j] += mat[i][j];
        }
        int cnt = g-1;
        vector<int> now(g);
        auto add = [&](int j){
            rep(i, g) now[i] += c[i][j];
            rep(i, g){
                if(now[i] > k){
                    return false;
                }
            }
            return true;
        };
        rep(j, w){
            if(!add(j)){
                now = vector<int>(g);
                if(!add(j)){
                    cnt = INF;
                    break;
                }
                cnt++;
            }
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

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

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		String s=scan.next();
		char y[]=s.toCharArray();
		Arrays.sort(y);
		if(y[0]=='a' && y[1]=='b' && y[2]=='c') {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}

	}

}

Measured memory_bytes: 35520
import sys
from collections import deque

stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n, m = nm()
    friends = [set() for _ in range(n)]
    for i in range(m):
        a, b = nm()
        friends[a - 1].add(b - 1)
        friends[b - 1].add(a - 1)

    groups = []
    in_group = [False] * n
    for i in range(n):
        if in_group[i]:
            continue
        d = deque(friends[i])
        group = [i]
        in_group[i] = True
        while d:
            c = d.pop()
            if in_group[c]:
                continue
            group.append(c)
            in_group[c] = True
            for friend in friends[c]:
                if not in_group[friend]:
                    d.append(friend)
        groups.append(group)

    ans = 0
    for group in groups:
        ans = max(ans, len(group))
    print(ans)


if __name__ == '__main__':
    main()


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

const int A=0,G=1,C=2,T=3,mod=pow(10,9)+7;
long long dp[100][4][4][4],res;

int n;

int main(){

    std::cin>>n;

    dp[0][T][T][T]=1;

    for(int i=0;i<n;i++){
        for(int j=0;j<4;j++){
            for(int k=0;k<4;k++){
                for(int l=0;l<4;l++){
                    for(int m=0;m<4;m++){
                        if(k==A&&l==G&&m==C)goto f;
                        if(k==A&&l==C&&m==G)goto f;
                        if(k==G&&l==A&&m==C)goto f;
                        if(j==A&&k==G&&m==C)goto f;
                        if(j==A&&l==G&&m==C)goto f;
                        dp[i+1][k][l][m]+=dp[i][j][k][l];
                        dp[i+1][k][l][m]%=mod;
                        f:;
                    }
                }
            }
        }
    }

    for(int i=0;i<4;i++){
        for(int j=0;j<4;j++){
            for(int k=0;k<4;k++){
                res+=dp[n][i][j][k];
            }
        }
    }

    std::cout<<res%mod<<std::endl;

    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector> 
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <cerrno>
#include <cfenv>
#include <math.h>
#include <iomanip>
#include <limits>
#include <queue>
#define ll long long int
#define mp make_pair

using namespace std;

int main(){

    int n;

    while(true){

        cin >> n;

        if(n == 0){
            break;
        }

        int flag;
        int ans = 0;

        for(int i=n+1;i<=2*n;i++){
            flag = 0;
            for(int j=2;j<=sqrt(i);j++){
                if(i%j == 0){
                    flag  = 1;
                    break;
                }
            }
            if(flag == 0){
                ans++;
            }
        }

        cout << ans << endl;

    }

    return 0;
}


Measured memory_bytes: 2996
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vector<int, int> > vvi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int h, w;
    cin >> h >> w;
    vs v;
    for(int i = 0; i < h; i++){
        string s;
        cin >> s;
        v.pb(s);
    }
    for(int i = 0; i < v.size(); i++){
        cout << v[i]<<endl;
        cout << v[i]<<endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstring>

using namespace std;

const int SIZE = 128;
bool A[SIZE],B[SIZE],C[SIZE];

int getPos(const string& s){
  int p = 0;
  for(int i = 0; i < (int)s.length(); i++){
    if(s[i] == '(') p++;
    else if(s[i] == ')') p--;
    if(p == 0 && s[i] == ',') return i;
  }
  return -1;
}

void parse(const string& s, bool isA, int idx){
  if(s == "") return;
  if(idx < 0 || idx >= SIZE) return;
  if(isA) A[idx] = true;
  else B[idx] = true;
  string nex = s.substr(1,s.length()-2);
  int pos = getPos(nex);
  string left = nex.substr(0,pos);
  string right = nex.substr(pos+1);
  parse(left,isA,2*idx+1);
  parse(right,isA,2*idx+2);
}

string makeTree(int idx){
  if(!C[idx]) return "";
  string res = "";
  if(2*idx+1 < SIZE) res += makeTree(2*idx+1);
  res += ",";
  if(2*idx+2 < SIZE) res += makeTree(2*idx+2);
  res = "(" + res + ")";
  return res;
}

int main(){

  char c;
  string a,b;
  while(cin >> c >> a >> b){
    memset(A,false,sizeof(A));
    memset(B,false,sizeof(B));
    memset(C,false,sizeof(C));
    parse(a,true,0);
    parse(b,false,0);
    if(c=='i') for(int i = 0; i < SIZE; i++) C[i] = A[i]&&B[i];
    else for(int i = 0; i < SIZE; i++) C[i] = A[i]||B[i];
    cout << makeTree(0) << endl;
  }
  return 0;
}

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

using namespace std;

typedef long long ll;

ll ceil(ll a, ll b){
  // a を　b　で割って切り上げ
  return ( a + b - 1) / b;}

int main(){
int N; cin >> N;
  vector<ll> T(N); vector<ll> A(N);
  
  for(int i = 0; i < N; i++){
    cin >> T[i] >> A[i];}
  
  vector<ll> t(N); vector<ll> a(N);
  
  t[0] = T[0]; a[0] = A[0];
  
  for(int i = 0; i < N - 1; i++){
    ll n = max( ceil( t[i] , T[i+1]),ceil( a[i], A[i+1]));
    t[i+1] = n * T[i+1]; a[i+1] = n * A[i+1];}
  
  cout << t[N-1] + a[N-1] << endl; return 0;}

Measured memory_bytes: 384
n = int(input())
aa = list(map(int, input().split()))
bb = list(map(int, input().split()))
"""
先頭からなめていって、
A. ai < biなら対処が必要⇒変更確定
B. ai == biなら変更不要で確定
C. ai > biなら他に融通する可能性あり⇒保留
Aのケースの不足数の総和を計算し、Cの差分の大きいものから順に使っていく。
Cのheapqを作成するのかな？いったんリストでやってみるか
"""
if sum(aa) < sum(bb):
    print(-1)
else:
    total_diff = 0
    margin = []
    modified = 0
    for i in range(n):
        if aa[i] < bb[i]:
            modified += 1
            total_diff += bb[i] - aa[i]
        elif aa[i] > bb[i]:
            margin.append(aa[i]-bb[i])
    margin.sort(reverse=True)
    while total_diff > 0:
        modified += 1
        t = margin.pop(0)
        total_diff -= t
    print(modified)


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

class Program
{
    static void Main()
    {
        const int charNum = 26;
        int n = int.Parse(Console.ReadLine());
        int[][] charCNT = new int[charNum][];
        for (int i = 0; i < charNum; i++) charCNT[i] = new int[n];
        for (int i = 0; i < n; i++)
        {
            string S = Console.ReadLine();
            for (int j = 0; j < S.Length; j++)
            {
                //文字は数値で表現されるため、引き算ができちゃう
                charCNT[(int)(S[j] - 'a')][i]++;
            }
        }
        for (int i = 0; i < charNum; i++)
        {
            //charで数値⇒文字に変更
            IEnumerable<char> result = Enumerable.Repeat((char)('a' + i), charCNT[i].Min());
            foreach (char item in result)
            {
                Console.Write(item);
            }
        }
        Console.WriteLine();
    }
}

Measured memory_bytes: 11348
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		HashSet<Integer> contains = new HashSet<>();
		contains.add(0);
		int numBalls[] = new int[n];
		for(int i=0;i<n;i++) {
			numBalls[i] = 1;
		}
		for(int i=0;i<m;i++) {
			int a = sc.nextInt()-1;
			int b = sc.nextInt()-1;
			numBalls[a]--;
			numBalls[b]++;
			if(contains.contains(a)) {
				contains.add(b);
			}
			if(numBalls[a]==0) {
				if(contains.contains(a)) {
					contains.remove(a);
				}
			}
		}
		System.out.println(contains.size());
	}
}


Measured memory_bytes: 64344
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
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; }
ll mod= 1e9 + 7;


int main(){
  string s;
  cin >> s;
  s[3]='8';
  cout << s << endl;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int a[105][2];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i][0]>>a[i][1];
    for(int i=1;i+2<=n;i++)if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1]){cout<<"Yes";return 0;}
    cout<<"No";
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define FILEIN freopen("input.txt", "r", stdin)
#define endl "\n"
#define ll long long

ll INF = 1e9 + 7, h, w;
vector<string> s;
ll dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};

ll bfs(ll i, ll j){
    queue<pair<ll, ll>> q;
    vector<vector<ll>> dist(h, vector<ll>(w, INF));
    q.push({i, j});
    dist[i][j] = 0;
    while(!q.empty()){
        pair<ll, ll> p = q.front();
        q.pop();
        for(ll k = 0; k<4; k++){
            ll nx = p.first + dx[k], ny = p.second + dy[k];
            if(0 <= nx && nx < h && 0 <= ny && ny < w){
                if(s[nx][ny] == '.' && dist[nx][ny] == INF){
                    dist[nx][ny] = dist[p.first][p.second] + 1;
                    q.push({nx, ny});
                }
            }
        }
    }
    ll max1 = 0;
    for(ll k = 0; k<h; k++){
        for(ll z = 0; z<w; z++){
            if(dist[k][z] != INF){
                max1 = max(max1, dist[k][z]);
            }
        }
    }
    return max1;
}

int main(){
    // FILEIN;
    cin>>h>>w;
    s.resize(h);
    ll ans = 0;
    for(auto &i : s) cin>>i;
    for(ll i = 0; i<h; i++){
        for(ll j = 0; j<w; j++){
            if(s[i][j] == '.'){
                ans = max(ans, bfs(i, j));
            }
        }
    }
    cout<<ans<<endl;
}

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

int main()
{
  uint64_t n;
  cin >> n;
  uint64_t ans = 0;
  if (n % 2 == 0) {
    n /= 2;
    while (n > 0) {
      n /= 5;
      ans += n;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    while( n-- ){
        string p, m;
        cin >> p >> m;
        reverse( p.begin(), p.end() );
        for( size_t i = 0; i < p.length(); i++ ){
            switch(p[i]){
                case 'J':{
                    char tmp = m[m.length() - 1];
                    for( size_t j = m.length() - 1; j > 0; j-- ){
                        //if( j == 0 ){
                        //}else{
                            m[j] = m[j-1];
                        //}
                        //cout << m[j] << endl;
                    }
                    m[0] = tmp;
                    break;
                }case 'C':{
                    char tmp = m[0];
                    for( size_t j = 0; j < m.length(); j++ ){
                        if( j == m.length() - 1 ) m[j] = tmp;
                        else m[j] = m[j+1];
                    }
                    break;
                }case 'E':{
                    string tmp = m.substr( 0, (m.length() ) / 2 );
                    m.replace( 0, (m.length() ) / 2, &m[(m.length()+1)/2] );
                    m.replace( (m.length() + 1)/ 2, tmp.length(), tmp );
                    break;
                }case 'A':{
                    reverse( m.begin(), m.end() );
                    break;
                }case 'P':{
                    for( size_t j = 0; j < m.length(); j++ ){
                        if( '1' <= m[j] && m[j] <= '9' ){
                            m[j]--;
                        }else if( '0' == m[j] ){
                            m[j] = '9';
                        }
                    }
                    break;
                }case 'M':{
                    for( size_t j = 0; j < m.length(); j++ ){
                        if( '0' <= m[j] && m[j] <= '8' ){
                            m[j]++;
                        }else if( '9' == m[j] ){
                            m[j] = '0';
                        }
                    }
                    break;
                }
            }
        }
        cout << m << endl;
    }
}

Measured memory_bytes: 1212
s = input()
c = 0
n = len(s)
if n%2 == 0:  
	for i in range(int(n/2)):
		if s[i]!=s[-(i+1)]:
			c = c + 1
else:
    for i in range(int((n+1)/2)):
        if s[i]!=s[-(i+1)]:
            c = c + 1
print(c)

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

int main()
{
    ll n,a,flag=0;
    cin>>n;
    for(ll i=0;i<n;++i)
    {
        cin>>a;
        if(a%2==0 && flag==0)
        {
            if(a%3!=0 && a%5!=0)flag=1;
        }
    }
    if(flag==0)cout<<"APPROVED";
    else cout<<"DENIED";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cmath>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <complex>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <unordered_map>

using namespace std;
typedef long long ll;

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

	vector<int> v((int)n);
	vector<int> c((int)n);
	vector<int> rieki((int)n);
	for (int i = 0; i < n; ++i) cin >> v[i];
	for (int i = 0; i < n; ++i) cin >> c[i];
	int ans = 0;
	

	for (int i = 0; i < n; ++i)
	{
		rieki[i] = v[i] - c[i];
		if (rieki[i] > 0) ans += rieki[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
/*
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll max3(ll a, ll b, ll c){return max(a, max(b, c));};
ll min3(ll a, ll b, ll c){return min(a, min(b, c));};
ll max4(ll a, ll b, ll c, ll d){return max(max(a, b), min(c, d));};
ll min4(ll a, ll b, ll c, ll d){return min(min(a, b), min(c, d));};
ll max5(ll a, ll b, ll c, ll d, ll e){return max(max(a, b), max3(c, d, e));};
ll min5(ll a, ll b, ll c, ll d, ll e){return min(min(a, b), min3(c, d, e));};
*/
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

//デバッグ
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};

ll kai_mod(ll x){
  if(x == 0) return 1;
  return x * kai_mod(x-1) % MOD;
}

/*
//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        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 comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}
*/


int main(){
  ll N, K;
  ll cnt = 0;
  cin >> N >> K;
  vector<ll> h(N);
  rep(i, N) cin >> h[i];
  rep(i, N){
    if(h[i] >= K) cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 1024
def resolve():
    N,M = map(int,input().split())#N軒､M本必要
    AB = []
    for i in range(N):
        a = list(map(int,input().split()))
        AB.append(a)
#    print()
#    print(AB)
    AB.sort()
#    print(AB)

    yen = 0
    sum = 0
    for i in range(N):
#        print(AB[i][0],AB[i][1])
        tmp = min(AB[i][1],M-sum) #購入本数
        yen += tmp*AB[i][0]
        sum += tmp
        if (sum>=M):
            break
    print(yen)
resolve()

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

int main() {
  string S;
  cin >> S;

  int N = S.size();
  bool flag = true;
  for (int i = 0; i < N / 2; ++i)
    if (S[i] != S[N - 1 - i])
      flag = false;
  for (int i = 0; i < (N - 1) / 2 / 2; ++i)
    if (S[i] != S[(N - 1) / 2 - 1 - i])
      flag = false;
  for (int i = N - (N - 1) / 2; i < N / 2; ++i)
    if (S[i] != S[N - 1 - i])
      flag = false;

  if (flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
// 問題の URL を書いておく
// 

#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

//#define ENABLE_PRINT

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

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

using ll = int64_t;

struct Vertex
{
    vector<int> next;
    vector<int> prev;
};

int dp[100005];
bool done[100005];

int calc(int end, vector<Vertex>& vs)
{
    if(done[end])
    {
        return dp[end];
    }

    int maxDist = 0;
    auto& v = vs[end];

    if(v.prev.size() == 0)
    {
        done[end] = true;
        dp[end] = 0;
        return 0;
    }

    for(auto p : v.prev)
    {
        maxDist = max(maxDist, calc(p, vs));
    }
    done[end] = true;
    dp[end] = maxDist + 1;
    return dp[end];
}

int main(int, const char**)
{
    int N, M;
    cin >> N >> M;
    vector<Vertex> vs(N + 1);
    rep(i, M)
    {
        int x, y;
        cin >> x >> y;
        vs[x].next.push_back(y);
        vs[y].prev.push_back(x);
    }

    int ans = 0;
    rep(i, N)
    {
        auto vi = i + 1;
        ans = max(ans, calc(vi, vs));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 19168
#include<cstdio>
#include<algorithm>
using namespace std;
int num[5];
int cnt=0;
int main() {
	for(int i=0;i<=2;i++)
		scanf("%d",&num[i]);
	sort(num,num+3);
	while(num[0]!=num[1]||num[1]!=num[2]) {
		cnt++;
		if(num[2]==num[1]) num[0]+=2;
		else num[0]++,num[1]++;
		sort(num,num+3);
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
struct aa {
	int x;
	int y;
	bitset<5>gets;
	int cost;
};
class Compare {
public:
	bool operator()(const aa&l, const aa&r) {
		return l.cost>r.cost;
	}
};

int main() {
	int H,W;cin>>W>>H;
	vector<vector<int>>field(H,vector<int>(W,1));
	vector<pair<int,int>>makis;
	int sx, sy, gx, gy;
	{
		vector<pair<int, int>>holes;
		for (int i = 0; i < H; ++i) {
			string st; cin >> st;
			for (int j = 0; j < W; ++j) {
				char ch(st[j]);
				if (ch == 'S') {
					sx = j;
					sy = i;
				}
				else if (ch == 'G') {
					gx = j;
					gy = i;
				}
				else if (ch == '#') {
					holes.push_back(make_pair(j, i));
				}
				else if (ch == 'M') {
					makis.push_back(make_pair(j,i));
				}
			}
		}
		for (auto hole : holes) {
			for (int y = 0; y < H; ++y) {
				for (int x = 0; x < W; ++x) {
					int x_dis = abs(x - hole.first);
					int y_dis = abs(y - hole.second);
					int dis = max(x_dis, y_dis);
					if (dis == 0) {
						field[y][x] = max(field[y][x],10000);
					}
					else if (dis <= 3) {
						field[y][x] =max(field[y][x],4-dis);
					}
				}
			}
		}
	}

	priority_queue<aa,vector<aa>,Compare>que;

	que.push(aa{ sx,sy,bitset<5>(),0 });
	vector<vector<vector<int>>>memo(W,vector<vector<int>>(H,vector<int>(32,1e9)));
	memo[sx][sy][0]=0;
	int dx[4] = { -1,0,1,0 };
	int dy[4] = { 0,1,0,-1 };
	int ans=-1;
	while (!que.empty()) {
		auto atop(que.top());
		const int now_x=atop.x;
		const int now_y=atop.y;
		const bitset<5>gets(atop.gets);
		const int now_cost=atop.cost;

		if (now_x == gx&&now_y == gy&&gets.count() == makis.size()) {
			ans=now_cost;
			break;
		}
		que.pop();
		for (int way = 0; way < 4; ++way) {
			const int next_x=now_x+dx[way];
			const int next_y=now_y+dy[way];

			if (0 <= next_x&&next_x < W&&next_y < H && 0 <= next_y) {
				const int next_cost=now_cost+field[now_y][now_x];
				auto next_gets(gets);
				for (int i = 0; i < makis.size(); ++i) {
					if (next_x == makis[i].first&&next_y == makis[i].second) {
						next_gets[i]=true;
					}
				}
				if (memo[next_x][next_y][next_gets.to_ulong()] > next_cost) {
					memo[next_x][next_y][next_gets.to_ulong()]=next_cost;
					que.push(aa{ next_x,next_y,next_gets,next_cost });
				}
			}
		}
	}
	cout<<ans<<endl;
	

	return 0;
}

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

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

    int n, m;
    cin >> n;
    vector<int> as(n);
    for (int i = 0; i < n; i++) cin >> as[i];
    cin >> m;
    vector<int> bs(m);
    for (int i = 0; i < m; i++) cin >> bs[i];
    cout << (as < bs) << endl;
}



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

//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3", "Ofast", "unroll-loops", "fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


#define int long long
#define endl '\n'

using namespace std;

signed main(){
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    int n;
    cin >> n;
    if (n % 10 == 7 || (n / 10) % 10 == 7 || (n / 100) % 10 == 7){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3592
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
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; }
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	ll a, b, n;
	cin >> a >> b >> n;
	if(b == 1){
		cout << 0 << endl;
		return 0;
	}
	double c =  a * min( b - 1, n) / b;
	int e = c;
	cout << e << endl;
	return 0;
}


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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    for(size_t i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    int i = 0;
    int index = 1;
    while(i<=100000){
        i++;
        index = v[index-1];
        if(index==2) break;
    }
    if(i==100001) cout << -1 << endl;
    else cout << i << endl;
    return 0;
}

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

using namespace std;

void solve()
{
    int even=0,n,r,s;

    cin>>n;
    s=n;
    while(n)
    {
        r=n%10;
        even+=r;
        n/=10;
    }

    if(s%even==0)
        cout<<"Yes";
    else
        cout<<"No";

}

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

    solve();

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N=0,A=0,B=0;
  cin>>N>>A>>B;
  string S;
  cin>>S;
  int count=0;
  int countb=0;
  for(int i=0;i<N;i++){
    if(S.at(i)=='a'&&count<(A+B)){
        count+=1;
        cout<<"Yes"<<endl;
    }
    else if(S.at(i)=='b'&&count<(A+B)&&countb<B){
        count+=1;
        countb+=1;
        cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }
  }
}

Measured memory_bytes: 3768
#include <cstdio>
#include <algorithm>

using namespace std;

const int N = 200'009;

int a[N];
int b[N];
int c[N];
int o[N];

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", b + i, c + i);
    o[i] = i;
  }
  sort(o, o + m, [](int i, int j) {
    return c[i] > c[j];
  });
  int sz = n;
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < b[o[i]]; ++j) {
      if (sz == 2 * n) {
        break;
      }
      a[sz++] = c[o[i]];
    }
  }
  sort(a, a + sz);
  reverse(a, a + sz);
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += a[i];
  }
  printf("%lld\n", ans);
}


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

using namespace std;

signed main()
{
	string s;
	cin >> s;
	int n = s.size();
	vector<int> a(26, 0);
	for (int i = 0; i < n; i++)
		a[s[i] - 'a']++;

	bool fl = true;
	for (int i = 0; i < 26 && fl; i++)
		if (a[i] % 2 == 1)
			fl = false;
	if (fl)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    int N; cin >> N;
    vector<int> X(N, 0), L(N, 0);
    vector<pair<int, int>> P(N);
    for (int i = 0; i < N; i++) {
        cin >> X[i] >> L[i];
        P[i].second = (X[i] - L[i]), P[i].first = (X[i] + L[i]);
    }
    sort(P.begin(), P.end());
    long long int cnt = 0, now = -10e9;
    for (int i = 0; i < N; i++) {
        if (now <= P[i].second) {
            cnt++;
            now = P[i].first;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 4816
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>

#define DIV 1000000007
#define TE 2e5
using namespace std;
using ll = long long;
using ldb = long double;

int main() {
	ll N; cin >> N;
	vector<ll> ans;
	for (int i = 1; i < 1e5; i++) {
		if (N <= i * (i + 1) / 2) {
			for (int j = 1; j <= i; j++) {
				if (j == i * (i + 1) / 2 - N)continue;
				cout << j << endl;
			}
			break;
		}
	}
}


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

int main(){
  int N,K,sum,owt;
  cin >>N>>K;
  int A[N];
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  map<int,int> S;
  int a=0;
  for(int i=0;i<N;i++){
    S[A[i]]++;
  }
  int T[S.size()];
  for(int i=0;i<S.size();i++){
    if(S[i]!=0) sum++;
    T[i] = S[i];
  }
  sort(T,T+S.size());
  if(sum<=K){
    a=0;
  }
  else{
    int E=sum-K;
    for(int i=0;owt<E;i++){
      if(T[i]!=0){
        a +=T[i];
        owt ++;
      }
    }
  }
  cout << a << endl;
}
      

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
int main ()
{
  int N,K,a;
  cin >> N >> K;
  a = 1;
  for ( int i=0 ; i < N ; i++ )
  {
    if ( a+K < 2*a )
    {
      a = a+K;
    }
    else
    {
      a = 2*a;
    }
  }
  cout << a << endl;
}

Measured memory_bytes: 256