akhauriyash/Code-Regression huggingface dataset:
from collections import deque

H, W = map(int, input().split())
start = [1, 1]
goal  = [H, W]

maps = [[-1]*(W+2)] + [([-1] + list(input()) + [-1]) for _ in range(H)] + [[-1]*(W+2)]
seen = [[-1]*(W+2) for _ in range(H+2)]
dxy = ((-1, 0), (1, 0), (0, -1), (0, 1))
todo = deque()

blacknum = 0
for i in maps:
    blacknum += i.count('#')


def bfs(x, y):
    for i in dxy:
        new_x = x+i[0]
        new_y = y+i[1]
        if seen[new_x][new_y] == -1:
            if maps[new_x][new_y] == '.':
                seen[new_x][new_y] = seen[x][y] + 1
                todo.append([new_x, new_y])
            else:
                seen[new_x][new_y] = -2


todo.append([start[0], start[1]])
seen[start[0]][start[1]] = 1

while len(todo) > 0:
    tmp = todo.popleft()
    bfs(tmp[0], tmp[1])

if seen[H][W] < 0:
    print(-1)
else:
    print(H*W-blacknum-seen[H][W])

Measured memory_bytes: 3316
def enc(k,m)
   code_a = 97
   kosu = 26
   leng = m.length
   a = m.unpack("C*")
   b = Array.new(leng)
   for i in 0..leng-1
      code = a[i]
      sa = code - code_a
      if sa <=26 and 0<=sa
         sa = (sa - k)% 26
      end
      b[i] = sa + code_a
   end
   c = b.pack("C*")
   return(c)
end
while sent = STDIN.gets
bre = 0
cha = sent.split(" ")
num = cha.count
size3 = []
size4 = []
for i in 0..num-1
    if cha[i].length == 3
	size3.push(cha[i])
    elsif cha[i].length == 4
	size4.push(cha[i])
    end
end
for i in 0..25
    for j in 0..size3.count - 1
	if enc(i,size3[j]) == "the"
	    k = i
	    bre = 1
	    break
	end
    end
    for j in 0..size4.count - 1
	if enc(i,size4[j]) == "that" or enc(i,size4[j]) == "this"
            k = i
	    bre = 1
	    break
        end
    end
    if bre == 1
	break
    end
end
print(enc(k,sent))
end

Measured memory_bytes: 8856
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define digit(x) floor(log10(x))+1
#define mod 1000000007
#define endl "\n"
#define int long long
typedef long double ld;
typedef vector<vector<int> > matrix;
typedef vector<int> arr;
typedef vector<string> vs;
typedef vector<pair<int,int> > pv;
#define test() int t;cin>>t;while(t--)
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define ROF(i,a,b) for(int i=a;i>=b;--i)
#define all(x) x.begin(),x.end()
#define debug(x) cerr << #x << " is " << x << endl;
int bx[]={0,0,1,-1,1,-1,-1,1};
int by[]={1,-1,0,0,1,-1,1,-1};
//=================================================================//

int dp[3001][3001];
void longestCommonSubsequence(string A, string B) {
    
    memset(dp, -1, sizeof dp);
    for(int i=0;i<=A.length();i++) dp[i][0] = 0;
    for(int i=0;i<=B.length();i++) dp[0][i] = 0;
    for(int i=1;i<=A.length();i++) {
        for(int j=1;j<=B.length();j++) {
            if(A[i-1]==B[j-1]) {
                dp[i][j] = 1 + dp[i-1][j-1];
            } else {
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
        }
    }    
}

#undef int
int main(){
#define int long long 
    fast;
    string s1, s2;
    cin>>s1>>s2;
    longestCommonSubsequence(s1,s2);
    int i = s1.length(), j = s2.length();
    string res = "";
    while(i!=0 and j!=0) {
        if(s1[i-1]==s2[j-1]) {
            res+=s1[i-1];
            i--;j--;
        } else {
            if(dp[i][j-1]>dp[i-1][j]) {
                j--;
            } else i--;
        }
    }
    reverse(res.begin(),res.end());
    cout<<res;
    return 0;
}

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

int main(){
	vector<double> mts;
	double in;
	string str;
	while( getline(cin, str), str.size() ){
		sscanf( str.c_str(), "%lf", &in );
		mts.push_back(in);
	}
	sort( mts.begin(), mts.end() );
	double out = mts[mts.size()-1] - mts[0];
	cout << out << endl;
	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
using namespace std;
const long long NR=110;
char s[NR];
long long l;
int main()
{
	scanf("%s",s);
	while(s[l])
	{
		l++;
	}
	for(long long i=0;i<l;i++)
	{
		printf("x");
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> ans(n, 0);
    rep(i, 0, n-1){
        cin >> a[i];
        ans[a[i]-1]++;
    }
    rep(i, 0, n){
        cout << ans[i] << endl;
    }
    return 0;
}


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

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

int main(){
    vector<P> ans;
    ll N;
    cin >> N;
    vector<ll> v(N);
    for(int i=0;i<N;i++) cin >> v[i];
    sort(v.begin(),v.end());
    for(int i=1;i<N-1;i++){
        if(v[i] > 0){
            ans.push_back({v[0],v[i]});
            v[0] -= v[i];
        }else{
            ans.push_back({v[N-1],v[i]});
            v[N-1] -= v[i];
        }
    }
    ans.push_back({v[N-1],v[0]});
    cout << v[N-1] - v[0] << endl;
    for(auto &e : ans){
        cout << e.first << " " << e.second << endl;
    }
    return 0;
}

Measured memory_bytes: 6128
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset

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


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

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

//INT_MAX	2,147,483,647 = 2*1.0e9

int main(){
  string S, T;
  cin >> S;
  cin >> T;
  map<char, vector<int>> mpS;
  map<char, vector<int>> mpT;
  int len = S.length();

  set<int> cS;
  set<int> cT;

  bool ans = true;
  for(int i = 0; i < len; i++){
    mpS[S[i]].push_back(i);
    cS.insert(S[i]);
    mpT[T[i]].push_back(i);
    cT.insert(T[i]);
  }

  for(auto i : cS){
    bool exist = false;
    for(auto j : cT){
      if(mpS[i] == mpT[j]){
        exist = true;
        break;
      }
    }
    if(!exist){
      ans = false;
      break;
    }
  }

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

  return 0;
}


Measured memory_bytes: 2824
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
#define INF 1e9
char v[31][31][4];
int map[31][31];
int dp[31][31][4];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int w,h,c[4];

class State{
public:
	int cost;
	int x,y,d;
	
	State(){}
	State(int c, int a, int b, int e)
	:cost(c),x(a),y(b),d(e)
	{}
	bool operator < (const State &opp) const{
		return cost > opp.cost;
	}
};

main(){
	int i,j,k;
	char *p,*q;
	while(cin>>w>>h,w){
		for(i=1;i<=h;i++) 
			for(j=1;j<=w;j++){
				cin>>map[i][j];
				for(k=0;k<4;k++){
					dp[j][i][k] = INF;
					v[j][i][k] = 0;
				}
			}
		for(i=0;i<4;i++) cin>>c[i];
		
		priority_queue<State> S;
		State t;
		S.push(State(0,1,1,0));
		dp[1][1][0] = 0;
		while(!S.empty()){
			t = S.top();S.pop();
			if(t.x==w&&t.y==h) break;
			if(v[t.x][t.y][t.d]) continue;
			v[t.x][t.y][t.d] = 1;

			for(i=0;i<4;i++){
				int td = (t.d+i)%4;
				int tx=t.x+dx[td];
				int ty=t.y+dy[td];
				if(tx<1 || ty<1 || w<tx || h<ty) continue;
				int tc=(map[t.y][t.x]==i)?0:c[i];
				if(t.cost+tc < dp[tx][ty][td]){
					dp[tx][ty][td] = t.cost+tc;
					S.push(State(dp[tx][ty][td], tx, ty, td));
				}
			}
		}
		cout << dp[w][h][t.d] << endl;
	}
	return 0;
}

Measured memory_bytes: 1032
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define ll long long 
#define pb(a) push_back(a)
#define fi first
#define se second
#define rep(a,b,c) for(int a = b ;a<=c;a++)
#define repn(a,b,c) for(int a = b ; a>=c ; a--)
#define FOR(a,b,c) for(int a = b ; a<c ;a++)
#define mem(a,b) memset(a,b , sizeof(a))
#define ll long long
#define mp make_pair
#define fi first
#define se second
#define size(a) ((int)a.size())
#define ii int
#define umap unordered_map
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a * b / gcd(a,b)
const int INF=0x3f3f3f3f;
const int maxn=5e5+10;
#define  max(a,b) (a > b) ? a : b;
#define  min(a,b) (a > b) ? b : a;
#define  st(a) setprecision(a)
#define fix_ std::fixed

// void input(){
// 	freopen("in.txt", "r",stdin);
// 	freopen("out.txt", "w",stdout);
// }
void fast(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	 cout.tie(NULL);
}


void solve(){

	vector< queue<int> >v(3);

	FOR(i,0,3){
		string s;
		cin>>s;

		FOR(j , 0 , size(s)){
			v[i].push(s[j]);
		}

	}

	int turn = 0;

	while(1){
		if(v[turn].empty()) break;
			char s = v[turn].front();
			v[turn].pop();

			if(s == 'a') turn = 0;
			if(s == 'b') turn = 1;
			if(s == 'c') turn = 2;
	}

	if(turn == 0) cout << "A" << endl;
    else if(turn == 1) cout << "B" << endl;
    else cout << "C" << endl;

}


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



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

int main() {
	int N;
	cin >> N;
	int count = 0;
	int data[N];
	for(int i =0;i<N;i++){
		cin >> data[i];
	}
	for(int i=0;i<N;i++){
		if(i%2 == 0){
			if(data[i]%2==1){
				count++;
			}
		}
	}
	cout << count << endl;
}


Measured memory_bytes: 3616
def ascan; gets.split.map(&:to_i); end

@memo = {}

def guchoku(arr)
    arr = arr.select{|e| e > 0}.sort
    if arr.empty?
        return false # second
    end
    
    return @memo[arr] if @memo[arr]
    
    [0,1].repeated_permutation(arr.size) do |pm|
        next unless pm.include?(1)
        new_arr = arr.zip(pm).map{|a,b| a-b}
        return @memo[arr] = true if guchoku(new_arr) == false
    end
    return @memo[arr] = false
end


rng = gets.to_i.times.map{gets.to_i}.sort

#puts guchoku(rng) ? "first" : "second"


no = rng.select{|r|r.odd?}.size
ne = rng.select{|r|r.even?}.size

if no >= 1
    puts "first"
else
    puts "second"
end


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

int main()
{
	char a;
	cin >> a;
	if( a == 'A'){
		cout << 'T' << endl;
	}else if( a == 'T'){
		cout << 'A' << endl;
	}else if( a == 'G'){
		cout << 'C' << endl;
	}else if( a == 'C'){
		cout << 'G' << endl;
	}
	return 0;
}


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

#define ipr pair<int, int>
#define pb push_back
#define ff first
#define ss second
#define fr(i, j, k) for (int i = j; i < k; i++)
#define rf(i, j, k) for (int i = j; i >= k; i--)
#define ll unsigned long long
#define int long long
#define ld long double
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mp make_pair
#define cnt_ones(x) __builtin_popcountll(x)

#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

const int Maxn = (int)1e6;
const ld pi = acos(-1);
const int mod = (int)1e9 + 7;
const int inf = (int)1e18;

template <class T>
ostream &operator<<(ostream &out, vector<T> &A) {
    fr(i, 0, (int)A.size()) out << A[i] << " ";
    return out;
}


int32_t main() {
    IOS int n, m, k, res = 0;
    cin >> n >> m >> k;
    vector<int> A(n+1), B(m+1);
    A[0] = B[0] = 0;
    fr(i,1,n+1) cin >> A[i];
    fr(i,1,m+1) cin >> B[i];
    fr(i,1,n+1)   A[i] += A[i-1];
    fr(j,1,m+1)   B[j] += B[j-1];
    int j=m;
    for(int i=0;i<=n;i++){
        if(A[i] > k)    break;
        while(j>0 and A[i]+B[j] > k){
            j--;
        }
        res = max(res, i+j);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 6320
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
#include <algorithm>

using namespace std;

int dp[3001][3001];

int main() {
    ios::sync_with_stdio(0);

    int N, T, S;
    cin >> N >> T >> S;

    vector<pair<int,int> > xs(N);
    for(int i = 0; i < N; ++i) {
        int x, y;
        cin >> x >> y;
        xs[i] = make_pair(x, y);
    }

    for(int i = 0; i < 3001; ++i)
        for(int j = 0; j < 3001; ++j)
            dp[i][j] = 0;

    int ans = 0;
    dp[0][0] = 0;
    for(int t = 0; t <= T; ++t) {
        dp[t][0] = (t>=xs[0].second) ? xs[0].first : 0;
        ans = max(ans, dp[t][0]);
    }

    for(int t = 0; t <= T; ++t) {
        for(int i = 1; i <= N; ++i) {
            if(t > 0) dp[t][i] = dp[t-1][i]; 
            if(i > 0) {
                dp[t][i] = max(dp[t][i], dp[t][i-1]);
                if(t >= xs[i].second) {
                    int prevt = t - xs[i].second;
                    if(!(prevt < S && t > S)) {
                        dp[t][i] = max(dp[t][i], dp[prevt][i-1] + xs[i].first);
                    }
                }
            }
            //cout << t << ' ' << i << ' ' << dp[t][i] << endl;
            ans = max(ans, dp[t][i]);
        }
    }

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

Measured memory_bytes: 35000
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 200005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9') {
        res = res * 10 +c - '0';
        c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
        out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,K,tr[MAXN];
int64 a[MAXN],sum[MAXN],val[MAXN];
int lowbit(int x) {return x & (-x);}
void Insert(int x,int v) {
    while(x <= N + 1) {
        tr[x] += v;
        x += lowbit(x);
    }
}
int Query(int x) {
    int res = 0;
    while(x > 0) {
        res += tr[x];
        x -= lowbit(x);
    }
    return res;
}
void Solve() {
    read(N);read(K);
    for(int i = 1 ; i <= N ; ++i) {
        read(a[i]);
        sum[i] = sum[i - 1] + a[i] - K;
        val[i] = sum[i];
    }
    val[N + 1] = 0;
    sort(val + 1,val + N + 2);
    int t = lower_bound(val + 1,val + N + 2,sum[0]) - val;
    Insert(t,1);
    int64 res = 0;
    for(int i = 1 ; i <= N ; ++i) {
        t = lower_bound(val + 1,val + N + 2,sum[i]) - val;
        res += Query(t);
        Insert(t,1);
    }
    out(res);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 5760
N = int(input())
t = [0] * N
x = [0] * N
y = [0] * N

hantei="Yes"


for i in range(N):
    t[i], x[i], y[i] = map(int, input().split())
    if t[i]-x[i]-y[i]>=0 and t[i]%2==(x[i]+y[i])%2:
        continue
    else:
        hantei="No"
        break

print(hantei)


Measured memory_bytes: 11668
#pragma region

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;
using vvb = vector<vector<bool>>;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &pair) {
  cin >> pair.first >> pair.second;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

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

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

void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

ll N, M, Q;

void dfs(vi &A, ll &ans, vl &a, vl &b, vl &c, vl &d) {
  if (A.size() == N + 1) {
    ll p = 0;
    rep(j, Q) {
      if (A[b[j]] - A[a[j]] == c[j]) p += d[j];
    }
    chmax(ans, p);
    return;
  }
  rep(i, A.back(), M + 1) {
    A.push_back(i);
    dfs(A, ans, a, b, c, d);
    A.pop_back();
  }
}

int main() {
  init();

  cin >> N >> M >> Q;
  vl a(Q), b(Q), c(Q), d(Q);
  rep(i, Q) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }

  ll ans = 0;
  vi A(1, 1);
  dfs(A, ans, a, b, c, d);

  out(ans);
}

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

int main()
{
    int H, W;
    cin >> H >> W;
    vector<string> a(H);
    for (int i = 0; i < H; i++)
    {
        cin >> a.at(i);
    }

    vector<bool> skip_h(H, true);
    vector<bool> skip_w(W, true);
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if (a.at(i).at(j) == '#')
            {
                skip_h.at(i) = false;
                skip_w.at(j) = false;
            }
        }
    }
    for (int i = 0; i < H; i++)
    {
        if (skip_h.at(i))
        {
            continue;
        }
        for (int j = 0; j < W; j++)
        {
            if (skip_w.at(j))
            {
                continue;
            }
            cout << a.at(i).at(j);
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int a[N];
    for(int i=0;i<N;i++)cin>>a[i];
    int t=1;
    int ans=0;
    for(int i=0;i<N;i++){
        if(a[i] == t){
            t++;
        }
        else{
            ans++;
        }
    }
    if(ans == N)ans=-1;
    cout << ans << endl;
}


Measured memory_bytes: 3924
<?php

fscanf(STDIN, "%d %d", $n, $k);

if ($k % 2 === 1) {
    $x = floor($n / $k);

    // NOTE: intにキャストしないとなぜか指数表現になる
    echo (int) pow($x, 3);
} else {
    $count1 = 0;
    $count2 = 0;
    for ($i = 1; $i <= $n; ++$i) {
        $mod = $i % $k;
        if ($mod === 0) {
            ++$count1;
        } elseif ($mod === ($k / 2)) {
            ++$count2;
        }
    }

    echo (int) pow($count1, 3) + (int) pow($count2, 3);
}


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

int main() {
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i,n) cin >> l[i];
  
  sort(l.begin(),l.end());
  
  int ans = 0;
  
  for (int i = 0; i < n; i++) {
    for (int j = i+1; j < n; j++) {
      for (int k = j+1; k < n; k++) {
        if (l[i] + l[j] > l[k]) ans++;
      }
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
def main():

    from bisect import bisect_left as bl, bisect_right as br, insort
    import sys,heapq,math
    from collections import defaultdict as dd, deque
    def data(): return sys.stdin.readline().strip()
    def mdata(): return list(map(int, data().split()))
    out = sys.stdout.write
    # sys.setrecursionlimit(100000)
    INF = int(1e9)
    mod = int(1e9)+7

    a,b,n=mdata()
    print(math.floor(a*min(n,b-1)/b))



if __name__ == '__main__':
    main()


Measured memory_bytes: 65452
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

constexpr ll LNF = 1LL<<60;

constexpr int INF = 1e9+7;

const double PI=3.14159265358979323846;


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

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    graph g(n);
    rep(i,0,m){
        int a,b; cin >> a >> b;
        a--; b--;
        g[a].emplace_back(b);
        g[b].emplace_back(a);
    }
    vector<int> d(n,INF);
    vector<int> ans(n,-1);
    queue<int> que;
    que.push(0);
    d[0] = 0;
    while(!que.empty()){
        int x = que.front();
        que.pop();
        for(auto &nx: g[x]){
            if(d[x]+1<d[nx]){
                que.push(nx);
                d[nx] = d[x]+1;
                ans[nx] = x+1;
            }
        }
    }
    rep(i,1,n){
        if(ans[i]<0){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    rep(i,1,n){
        cout << ans[i] << endl;
    }
} 

Measured memory_bytes: 10688
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define all(x) (x).begin() , (x).end()
#define f first
#define s second
#define pr(x) cout<<x<<endl;
#define pr2(x,y) cout<<x<<" "<<y<<endl;
#define pr3(x,y,z) cout<<x<<" "<<y<<endl;
#define prv(v) for(auto x:v) cout<<x<<" ";
#define ffs fflush(stdout);
#define int ll
using namespace std;
 
const ll MOD = 1e9+7;
const ll INF = 1e12;
const ll LOG = 29;
#define PI 3.141592653589793238 


long long binpow(long long a, long long b) {
    a%=MOD;    
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a)%MOD;
        a = (a * a)%MOD;
 
        
        b >>= 1;
    }
    res%=MOD;
    return res;
}
const ll N =(3e5+5);

void solve(){
	ll a,b,c,k;
	cin>>a>>b>>c>>k;
	ll ans =0;
	ll x = min(a,k);
	ans += x * 1;
	k-=x;
	x = min(b,k);
	ans += x * 0;
	k-=x;
	x = min(c,k);
	ans += x * -1;
	cout<<ans<<endl;
}
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
     
    ll t=1;
 //   cin>>t;
    while(t--){
        solve();
    }    
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

int main() {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s == "abc")
        cout << "Yes\n";
    else
        cout << "No\n";

    return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P2;
const int inf=1000000000;
ll ca[100001]={};
ll cb[100001]={};
ll d[100001]={};
ll c2[100001]={};
int main() {
	int n;
	cin>>n;
	ll s;
	for(ll i=1;i<n+1;++i){
		int a1;
		cin>>a1;
		if(d[a1]>0){
			s=n-(i-d[a1]);
		}else{
			d[a1]=i;
		}
	}

	ca[0]=1;
	cb[0]=1;
	for(ll i=1;i<n+2;++i)ca[i]=(ca[i-1]*i)%1000000007;
	for(ll i=1;i<n+2;++i){
		int k=1000000005;
		ll x=ca[i];
		ll ans=1;
		while(k>0){
			if(k%2==1)ans*=x;
			ans%=1000000007;
			x=(x*x)%1000000007;
			k=k/2;
		}
		cb[i]=ans;
	}

	cout<<n<<endl;
	for(ll k=2;k<=n+1;++k){
		ll t=(((ca[n+1]*cb[k])%1000000007)*cb[n+1-k])%1000000007;
		if(k-1<=s)t-=((((ca[s]*cb[k-1])%1000000007)*cb[s-k+1])%1000000007);
		cout<<(t+1000000007)%1000000007<<endl;
	}
	return 0;
}


Measured memory_bytes: 3584
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int x = -1;
    vector<int> v;
    while(x != 0)
    {
        cin >> x;
        v.push_back(x);
    }
    for(int i = 0;i < v.size() - 1;i++)
    {
        cout << "Case " << i + 1 << ": " << v[i] << "\n";
    }

    return 0;
}


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

using namespace std;

#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define nl "\n"
#define sp " "
#define int long long
#define PI 3.141592653589793
#define scanstr(s) cin>>ws; getline(cin,s);

void solve()
{
	int n;
	cin>>n;
	vector<int> a(100000+2);
	int sum=0;
	for(int i=0;i<n;i++)
	{
		int x;
		cin>>x;
		sum+=x;
		a[x]++;
	}
	int q;
	cin>>q;
	for(int i=0;i<q;i++)
	{
		int pos, d;
		cin>>pos>>d;
		if(a[pos]==0)
		{
			cout<<sum<<nl;
			continue;
		}
		sum-= a[pos]*pos;
		sum+=(d*a[pos]);
		cout<<sum<<nl;
		a[d]+=a[pos];
		a[pos]=0;
	}
}

int32_t main()
{
	FastIO;
	solve();
	return 0;
}


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

using namespace std;

int main(void)
{
    int N;
    int Hi;
    int Max = 0;

    scanf("%d", &N);

    for (int i = 0; i < N; i++)
    {
        cin >> Hi;
        if (Max < Hi)
        {
            Max = Hi;
            continue;
        }
        if (Max - Hi >= 2)
        {
            cout << "No" << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 256
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
    s = input()
    if s == 'AC':
        ac += 1
    if s == 'WA':
        wa += 1
    if s == 'TLE':
        tle += 1
    if s == 'RE':
        re += 1

print('AC x', ac)
print('WA x', wa)
print('TLE x', tle)
print('RE x', re)

Measured memory_bytes: 69788
import java.util.*;
public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        StringBuilder OPT = new StringBuilder();
        OPT.append(S.charAt(0));
        int num =0;
        for(int i=1;i<S.length();i++) {
            if(OPT.charAt(num)!=S.charAt(i)){
                OPT.append(S.charAt(i));
                num++;
            }
        }
        System.out.println(OPT.length());
    }
}


Measured memory_bytes: 26596
#include<cstdio>
#include<string>
#include<cstring>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<algorithm>
#include<vector>
#include<iostream>
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll a[100],b[100];
ll dfs(ll x,int y)
{
	if(x<=0)
	{
		return 0;
	}
	if(y==0)
	{
		return 1;
	}
	if(a[y]==x)
	{
		return b[y];
	}
	ll ans=0;//a[y]>x
	int i;
	if(x>=a[y-1]+1)//b ***** p ***** b
	{
		ans+=b[y-1];
		if(x>=a[y-1]+2)
		{
			ans++;
			if(x>a[y-1]+2)
			{
				x-=a[y-1]+2;
				for(i=0;i<y;i++)
				{
					if(a[i]+(y-i-1)>=x)
					{
						break;
					}
				}
				ans+=dfs(x-(y-i-1),i);
			}
		}
		return ans;
	}
	else
	{
		for(i=0;i<y;i++)
		{
			if(a[i]+(y-i)>=x)
			{
				break;
			}
		}
		return dfs(x-(y-i),i);
	}
}
int main()
{
	int i,j,k,n,x,y;
	ll m,an=1,aa=1;
	scanf("%d%lld",&n,&m);
	for(i=0;i<=n;i++)
	{
		a[i]=an;
		b[i]=aa;
		if(a[i]>=m)
		{
			break;
		}
		an=an*2+3;
		aa=aa*2+1;
	}
//	printf("%d",m-n+i);
	cout<<dfs(m-(n-i),i);
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

int main()
{
	set<char> r;
	r.insert('y');
	r.insert('u');
	r.insert('i');
	r.insert('o');
	r.insert('p');
	r.insert('h');
	r.insert('j');
	r.insert('k');
	r.insert('l');
	r.insert('n');
	r.insert('m');

	while(1) {
		string s;
		cin >> s;
		if (s.size() == 1 && s[0] == '#') break;
		bool f;
		auto it = r.find(s[0]);
		if (it == r.end()) f = false;
		else f = true;
		int cnt = 0;

		rep(i,0,s.size()) {
			auto it = r.find(s[i]);
			if (f) {
				if (it == r.end()) {
					f = false;
					cnt++;
				}
			}
			else {
				if (it != r.end()) {
					f = true;
					cnt++;
				}
			}
		}
		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 3088
using System;


class Program {
    static void Main (string[] args) {
        
        int a = int.Parse(Console.ReadLine ());
        string[] a1 = Console.ReadLine ().Split (' ');
        int[] b1 = new int[a];
        int[] b2 = new int[a];
        int[] b3 = new int[a];

        int c =0;
        int d =0;
        int e =0;


        int rtn = 99999999;

        for(int i = 0;i < a;i++){
            b1[i] = int.Parse(a1[i]);
            c = int.Parse(a1[i]) + c;
            b2[i] = c; 
            
        }

        int temp = 0;
        for(int j = a;j > 1;j--){
            d = int.Parse(a1[j -1]) + d;
            e = b2[j -2];
            if(d > e){
                temp = d - e ;
            }else{
                temp = e - d;
            }
            if(temp < rtn){
                rtn = temp;
            }             

        }

        Console.WriteLine(rtn);
    }
}

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

int a[110], n;

int main() {
	scanf("%d", &n); n*=2;
	for (int i=1; i<=n; i++) scanf("%d", a+i);
	std::sort(a+1,a+n+1);
	int ans=0;
	for (int i=n-1; i>0; i-=2) ans+=a[i];
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;


void main() {
    auto s = iota(3).map!(i => readln.chomp.map!(ch => ch - 'a').array).array;

    int p = 0;

    while (!s[p].empty) {
        int np = s[p].front;
        s[p].popFront();
        p = np;
    }

    writeln((p + 'A').to!char);
}



void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


Measured memory_bytes: 256
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif

string a[3] = { "3", "5", "7" };
vi num;

void dfs(int n, string ret) {
    if (n <= 0) {
        bool three = false, five = false, seven = false;
        REP(i, ret.size()) {
            if (ret[i] == '3') three = true;
            else if (ret[i] == '5') five = true;
            else if (ret[i] == '7') seven = true;
        }
        if (three && five && seven) {
            num.push_back(stoi(ret));
        }
        return;
    }

    REP(i,3) {        
        dfs(n - 1, ret + a[i]);
    }
}


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

    int N; cin >> N;
    int n = N;
    int d = 0;
    while(n > 0) {
        n /= 10;
        d++;
    }    

    FOR(i,3, d+1) {
        dfs(i, "");
    }

    int ans = 0;
    for (int i : num) {
        if (i <= N) ans++;
    }
    cout << ans << endl;
    num.clear();

    return 0;
}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    string s; cin >> s;
    int n = s.length();
    cout << s.front();
    cout << n - 2;
    cout << s.back();
    cout << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n,mod;
  cin>>n>>mod;

  vector<Int> a(n*2);
  for(Int i=0;i<n*2;i++) cin>>a[i];
  sort(a.begin(),a.end());

  Int ans=mod;
  {
    Int res=0;
    for(Int i=0;i<n;i++)
      chmax(res,(a[i]+a[n*2+~i])%mod);
    chmin(ans,res);
  }
  
  vector<Int> b(n*2);
  for(Int i=n;i<n*2;i++){
    if(a[i-1]+a[i]<mod){
      b[i]=n*2;
      continue;
    }
    Int l=0,r=i;
    while(l+1<r){
      Int m=(l+r)>>1;
      if(m*2+~i<0||a[m*2+~i]+a[i]<mod) l=m;
      else r=m;
    }
    b[i]=r;
  }

  vector<Int> c(n*2);
  for(Int i=0;i<n;i++){
    if(a[i]+a[i+1]>=mod){
      c[i]=0;
      continue;
    }
    Int l=i+1,r=n*2;
    while(l+1<r){
      Int m=(l+r)>>1;
      if(m*2+~i>=n*2||a[m*2+~i]+a[i]>=mod) r=m;
      else l=m;
    }
    c[i]=l;
  }


  vector<Int> ng(n*2,0);
  {
    Int tmp=0;
    for(Int i=n*2-1;i>n;i--){
      chmax(tmp,b[i]);
      ng[i*2-n*2]|=i<tmp;
    }
  }
  {
    Int tmp=n*2;
    for(Int i=0;i<n;i++){
      chmin(tmp,c[i]);
      ng[i*2]|=tmp<=i;
    }
  }  
  
  Int pos=2;
  while(pos<n*2&&ng[pos]) pos+=2;
  
  {
    Int res=0;
    for(Int i=0;i*2<pos;i++)
      chmax(res,(a[i]+a[pos+~i])%mod);
    
    for(Int i=0;pos+i*2<n*2;i++)
      chmax(res,(a[pos+i]+a[n*2+~i])%mod);
    
    chmin(ans,res);
  }
  
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                    \
  ifstream in("abc148/abc148_b.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;

  string s, t;
  cin >> s >> t;

  string ans = "";
  rep(i, N) {
    ans += s[i];
    ans += t[i];
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
//
//  main.cpp
//  AtCoderABC176
//
//  Created by Glen Cahilly on 9/2/20.
//  Copyright © 2020 Glen Cahilly. All rights reserved.
//

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

/*

Problem A

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long double n, x, t;
    cin >> n >> x >> t;
    if (x==0) {
        cout << 0 << "\n";
    } else {
        long k = ceil(n/x)*t;
        cout << k << "\n";
        
    }
}
*/

//Problem B

/*
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s; cin >> s;
    long count=0;
    for (int k=0; k<s.size(); k++) {
        count+=s[k]-48;
    }
    if (count%9==0) {
        cout << "Yes" << "\n";
    } else {
        cout << "No" << "\n";
    }
}
*/

//Problem C

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n; cin >> n;
    long long prev; cin >> prev;
    long long count=0;
    for (int k=0; k<n-1; k++) {
        long long in; cin >> in;
        if (in-prev<0) {
            count+=prev-in;
        } else {
            prev=in;
        }
        
    }
    cout << count << "\n";
}

Measured memory_bytes: 3620
<?php
  fscanf(STDIN, "%d%d", $n, $m);
  $yp=[];
  $py=[];
  for($i=0; $i<$m; $i++){
      fscanf(STDIN, "%d%d", $p,$y);
      $yp[$y] = $p;
      $py[$p][] = $y;
    //   echo sprintf("%06d",$p);
    //   echo "\n";
  }
  
  $memo = [];
  foreach($py as $k => $d){
      sort($py[$k]);
      foreach($py[$k] as $num => $year){
          $memo[$year] = $num+1;
      }
  }
//   print_r($py);
//   print_r($memo);
  
  foreach($yp as $yy => $pp){
      echo sprintf("%06d",$pp);
      echo sprintf("%06d",$memo[$yy]);
      echo "\n";
  }

Measured memory_bytes: 109120
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cmath>


using namespace std;


int main(){
    int n;
    cin>>n;
    int num;
    int count=0;
    
    for(int i=0;i!=n;++i){
        cin>>num;
        int j=2;
        while(j<=std::sqrt(num)){
            if(num%j==0){
                //cout<<num<<endl;
                ++count;
                break;
            }
            ++j;
        }
       
    }
    cout<<(n-count)<<endl;
}



Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <queue>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a>8||b>8){
        cout<<":("<<endl;
    }
    else{
        cout<<"Yay!"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#define pb push_back
#define mp make_pair
using namespace std;
const int N=1e2+5;

int n;
int a,b;



int main()
{
   int dist;

   cin>>n;
   cin>>a>>b;

   dist=b-a-1;


   if(dist % 2 == 0)
   {
       cout<<"Borys"<<endl;
       return 0;
   }
   else
   {
       cout<<"Alice"<<endl;
       return 0;
   }



   return 0;
}

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

int main(){
  long long int N, A, B, ans = 0;
  long long int X[110000] = {}, temp[110000] = {}, tempx=0, bb=1;

  cin>>N>>A>>B;

  for(int i = 1; i <= N; i++){
    cin>>X[i];
    //cin>>tempx;
    //X[i]+=tempx;
    //X[i+1]=X[i];    
  }
  for(int i = 2; i <= N; i++){
    ans += min((X[i]-X[i-1])*A, B);
    }
  //temp[2] = min((X[2]-X[1])*A, B);
  /* for(int i = 2; i <= N; i++){
    if((X[i]-X[bb])*A*2 <= B){
    }else {
      if(i-1-B >=1){
	ans += (X[i-1]-X[bb])*A*2;
	ans += B;
	bb = i;
      }else ans += X[i] 
    }
    //temp[i] = min((X[2]-X[1])*A, B);
    
    }*/
  
  cout<<ans<<endl;


  return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;

typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<n+1;i++)

struct UnionFind{
    vector<int> par;
    vector<int> rank;

    UnionFind(int N){
        for(int i=0;i<N;i++){
            par.push_back(i);
            rank.push_back(0);
        }
    }

    int find(int x){
        if(par[x]==x) return x;
        return par[x]=find(par[x]);
    }

    void unite(int x,int y){
        x=find(x);
        y=find(y);
        if(x==y) return;
        if(rank[x]<rank[y]) par[x]=y;
        else {
            par[y]=x;
            if(rank[x]==rank[y]) rank[x]++;
        }
    }
    bool same(int x,int y){
        return find(x)==find(y);
    }
};

int main(){
    int N,M,X,Y,Z;
    cin>>N>>M;
    UnionFind T(N);
    rep(i,M){
        cin>>X>>Y>>Z;
        T.unite(X-1,Y-1);
    }
    int num=0;
    rep(i,N){
        if(T.par[i]==i) num++;
    }
    cout<<num<<endl;
    return 0;
}

Measured memory_bytes: 1276
#pragma region Library

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

using ll = long long int; // int_fast64_t;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;
using vi = vt<int>;
using vvi = vvt<int>;
using vl = vt<ll>;
using vvl = vvt<ll>;

constexpr int INF = 1 << 30;  // 1073741824 2倍すると-2147483648
constexpr ll INFL = 1l << 62; // 4611686018427387904 2倍すると-0.9*10^18
constexpr int dx4[] = {0, 1, 0, -1};
constexpr int dy4[] = {1, 0, -1, 0};
constexpr int dx8[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy8[] = {0, -1, 0, 1, -1, -1, 1, 1};
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define RANGE(i, a, b) for (int i = (a); i <= (b); i++)
#define RANGER(i, a, b) for (int i = (b); i >= (a); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, 0, (n))

#pragma endregion

int main() {
  int n, bits[50];
  ll k, a[100000];
  cin >> n >> k;
  REP(j, 50) bits[j] = 0;
  REP(i, n) {
    ll aa;
    cin >> aa;
    a[i] = aa;
    REP(j, 50) { bits[j] += (aa >> j) & 1; }
  }
  // REP(j, 50) cout << bits[j] << " ";
  // cout << endl;
  int isFreeNum = 0;
  ll x = 0;
  REPR(j, 50) {
    if (bits[j] < (n + 1) / 2) {
      if (isFreeNum || ((k >> j) & 1)) {
        x += 1;
      }
    } else {
      x += 0;
      if ((k >> j) & 1) {
        isFreeNum = 1;
      }
    }
    x *= 2;
  }
  x /= 2;
  ll ans = 0;
  REP(i, n) ans += x xor a[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
n=int(input())
if n%2==1:
    print(0)
    exit()
ans=0
tmp=n
if (n//2)%2==1:
    x=n//2
    tmp-=2
else:
    x=0
tmp//=2
x+=(tmp+1)*tmp//2
#"""
for i in range(1,30):
    #print(2*(5**i))
    ans+=n//(2*(5**i))
    #print(n//(2*(5**i)))
#print(x)
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll n, m;
    cin >> n >> m;
    vector<ll> s(n, 0);
    for (ll i = 0; i < m; i++)
    {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        s[a]++;
        s[b]++;
    }

    for (ll i = 0; i < n; i++)
    {
        cout << s[i] << endl;
    }
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;

//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _KTy, typename _Ty> istream& operator >> (istream& istr, pair<_KTy, _Ty>& m) { cin >> m.first >> m.second; return istr; }
template <typename _Ty> istream& operator >> (istream& istr, vector<_Ty>& v) { for (size_t i = 0; i < v.size(); i++) cin >> v[i]; return istr; }
ll modpow(ll n, ll p, ll m) { ll result = 1; while (p > 0) { if (p & 1) result = (result * n) % m; p >>= 1; n = (n * n) % m; } return result; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
#define fake false



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

	vint l(N);
	cin >> l;
	sort(all(l), greater<int>());
	cout << accumulate(l.begin(), l.begin() + K, 0) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	char S [5];
	scanf("%s", &S);
	switch (S[1]) {
		case 'R':
			printf("ABC\n", S);
			break;
		case 'B':
			printf("ARC\n", S);
			break;
	}
	
	return 0;
}



Measured memory_bytes: 1732