akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <deque>
 
#define ll long long
#define cint const int
#define ld long double
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define add +
#define minus -
#define squer(a) sqrt(a)
#define mod % 
 
using namespace std;

int n;
string s;

int main () {
	cin >> n >> s;
	int c = 0;
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') {
			c++;
			++i;
			++i;
			continue;
		}
	}
	cout << c;
	return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
grid = []

for i in range(0, H):
    temp = list(input())
    grid.append(temp)

yoko = []
tate = []
for i in range(0, H):
    judge = True
    for j in range(0, W):
        if grid[i][j] != '.':
            judge = False
    if judge:
        yoko.append(i)
        
for i in range(0, W):
    judge = True
    for j in range(0, H):
        if grid[j][i] != '.':
            judge = False
    if judge:
        tate.append(i)


for i in range(0, H):
    for j in range(0, W):
        if i in yoko or j in tate:
            pass
        else:
            print(grid[i][j], end='')
    if not i in yoko:
        print('')

Measured memory_bytes: 4596
/*修正*/
#include<bits/stdc++.h>
using namespace std;
void part(){
  int x,n,p;
  cin>>x>>n;
  unordered_map<int,int> unmp;
  while(n--){
    cin>>p;
    ++unmp[p];
  }
  for(int i=0;i<=x;i++){
    for(auto j:{-1,1}){
      int a=x+i*j;
      if(unmp[a]==0){
        cout<<a;
        return;
      }
    }
  }
}
int main(void){
  int num=1;
  while(num--){
    part();
  }
  return 0;
}

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

int main () {
  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;

  if (s[k-1] == 'A') {
    s[k-1] = 'a';
  } else if(s[k-1] == 'B') {
    s[k-1] = 'b';
  } else if(s[k-1] == 'C') {
    s[k-1] = 'c';
  }

  cout << s << endl;
}


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

int main(){
    int N;
    cin >> N;
    vector<pair<int, int> > v;
    int A,B;
    for(int i = 0; i < N; i++){
        cin >> A >> B;
        v.push_back({B,A});
    }
    sort(v.begin(), v.end());
    ll time_now = 0;
    
    for(int i = 0; i < N; i++){
        time_now += v[i].second;
        if(time_now > v[i].first){
            cout << "No" << "\n";
            return 0;
        }
    }
    
    cout << "Yes" << "\n";
    return 0;
} 


Measured memory_bytes: 2420
class Segment_Tree():
    def __init__(self,N,calc,unit,L=[]):
        """calcを演算とするN項のSegment Treeを作成

        N:要素数
        calc:演算(2変数関数,モノイド)
        unit:モノイドcalcの単位元 (xe=ex=xを満たすe)
        """
        self.calc=calc
        self.unit=unit

        N=max(N,len(L))

        d=max(1,(N-1).bit_length())
        k=2**d

        X=[unit]*(k-1)+L+[unit]*(k-len(L))

        self.num=k
        self.depth=d

        for i in range(k-2,-1,-1):
            X[i]=calc(X[2*i+1],X[2*i+2])

        self.data=X

    def index(self,k,index=0):
        return self.data[(self.num-1)+(k-index)]

    def update(self,k,x,index=0):
        """第k要素をxに変え,更新を行う.

        k:数列の要素
        x:更新後の値
        """

        m=(self.num-1)+(k-index)
        self.data[m]=x

        for _ in range(self.depth):
            m=(m-1)//2
            self.data[m]=self.calc(self.data[2*m+1],self.data[2*m+2])


    def sub_array(self,From,To,index=0,left_closed=True,right_closed=True):
        A=From-index+(not left_closed)
        B=To-index-(not right_closed)

        return self.__sub_array_second(A,B+1,0,0,self.num)

    def __sub_array_second(self,a,b,k,l,r):
        if r<=a or b<=l:
            return self.unit
        elif a<=l and r<=b:
            return self.data[k]
        else:
            alpha=self.__sub_array_second(a,b,2*k+1,l,(l+r)//2)
            beta=self.__sub_array_second(a,b,2*k+2,(l+r)//2,r)
            return self.calc(alpha,beta)

    def all_prod(self):
        return self.data[0]

    def max_right(self,l,r,cond,index=0):
        """以下の2つをともに満たすxの1つを返す.\n
        (1) r=l or cond(data[l]*data[l+1]*...*d[r-1]):True
        (2) r=x or cond(data[l]*data[l+1]*...*data[r]):False
        ※fが単調減少の時,cond(data[l]*...*data[r-1])を満たす最大のrとなる.

        cond:関数(引数が同じならば結果も同じ)
        cond(unit):True
        0<=l<=r<=n
        """
        l-=index
        assert 0<=l<=r<=self.num,"添字が範囲外"
        assert cond(self.unit),"単位元が条件を満たさない."

        if l==r:
            return r+index

        l+=(self.num-1)
        sm=self.unit

        calc=self.calc
        while True:
            while l%2:
                l=(l-1)>>1

            if not cond(calc(sm,self.data[l])):
                while l<self.num-1:
                    l=2*l+1

                    if cond(calc(sm,self.data[l])):
                        sm=calc(sm,self.data[l])
                        l+=1

                return min(l-(self.num-1)+index,r)

            sm=calc(sm,self.data[l])
            l+=1

            m=l+1
            if not (m&(-m) !=m):
                break

        return r+index
#================================================
N,Q=map(int,input().split())
A=list(map(int,input().split()))

S=Segment_Tree(N,lambda x,y:max(x,y),-float("inf"),A)

X=[]
for _ in range(Q):
    T,alpha,beta=map(int,input().split())

    if T==1:
        S.update(alpha,beta,1)
    elif T==2:
        X.append(S.sub_array(alpha,beta,1))
    else:
        X.append(S.max_right(alpha,N,lambda x:x<beta,1))

print("\n".join(map(str,X)))

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

using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll 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 = ll(n - 1); i >= 0; i--)
#define each(i, mp) for (auto &i : mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll n;
    cin >> n;
    vl a(n);
    cin >> a;

    ll tmp = 0;
    rep(i, n) tmp ^= a[i];
    rep(i, n) {
        cout << (tmp ^ a[i]) << ' ';
    }
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

int main(){
	int W,H,x,y,r;
	cin >> W >> H >> x >> y >> r;
    if((x>=r)&&(x<=W-r)&&(y>=r)&&(y<=H-r)){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
    return 0;
}

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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int A[105];
//! [i個の石が残っている時]=勝てるか
bool dp[100005];

int main()
{
    int N, K;
    cin >> N >> K;
    REP(i, N)
    {
        cin >> A[i];
    }
    REP(i, A[0])
    {
        dp[i] = false;
    }
    FOR(i, K + 1, A[0])
    {
        REP(j, N)
        {
            if (i - A[j] < 0)
                break;
            if (!dp[i - A[j]])
            {
                dp[i] = true;
                break;
            }
        }
    }

    if (dp[K])
    {
        cout << "First" << endl;
    }
    else
    {
        cout << "Second" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using boost::multiprecision::cpp_int;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll,pair<ll, ll>> lpll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;

const ll INF = LLONG_MAX;
const ll MOD = 1e9+7;

const ld PI = (acos(-1));
const ld EPS = 0.0000000001;

#define deg_to_rad(deg) (((deg)/360)*2*PI)

// cout << fixed << setprecision(10) <<  << endl;
ld a,b,x;
ld volume(ld theta) {
    theta = deg_to_rad(theta);
    if(a * tan(theta) <= b) {
        return a * a * b - a * a * a * tan(theta) / 2.0;
    } else {
        return b * b / tan(theta) * a / 2.0;
    }
}

int main() {
    // input, ready
    cin >> a >> b >> x;
    // output
    ld diff = 100;
    ld upper = 90;
    ld lower = 0;
    ld middle = 0;
    while (diff < -EPS || EPS < diff ) {
        middle = (upper+lower)/2;
        diff = x-volume(middle);
        if (diff > 0) upper = middle;
        else lower = middle;
    }

    cout << fixed << setprecision(10) << middle << endl;

    return 0;
}


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


Measured memory_bytes: 3560
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>

using namespace std;
typedef long long ll;

int gcd(int x, int y) {
  if (x < y) swap(x, y);
  while (y > 0) {
    int r = x % y;
    x = y;
    y = r;
  }
  return x;
}

/*迷路
const int INF = 50;

typedef pair<int,int> P;
char field[52][52];
int d[51][51];
int r,c;
int sx,sy;
int gx,gy;

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

int bfs(){
    queue<P> que;
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            d[i+1][j+1] = INF;
        }
    }
    que.push(P(sy,sx));
    d[sy][sx]=0;
while(que.size()){
    P p=que.front();
    que.pop();
    if(p.second==gx&&p.first==gy) break;
    for(int i=0;i<4;i++){
        int nx=p.second+dx[i];
        int ny=p.first+dy[i];

        if(1<=nx&&nx<=c&&1<=ny&&ny<=r&&field[ny][nx]!='#'&&d[ny][nx]==INF){
            que.push(P(ny,nx));
            d[ny][nx] = d[p.first][p.second] + 1;
        }
    }
}
return d[gy][gx];
}
*/

int main(){
    int H,W,h,w;
    cin>>H>>W>>h>>w;
    cout<<H*W-W*h-H*w+h*w<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int A;
    int B; 
    int C;
    int D;
    int E;
    int F;
    int ab;
    int cd;
    int abcd;
    int EF;
    int ABCD;
    int ABCDEF;
    scanf("%d",&A);
    scanf("%d",&B);
    scanf("%d",&C);
    scanf("%d",&D);

    scanf("%d",&E);
    scanf("%d",&F);
    ABCD=A+B+C+D;
    if(A>=B){
       ab=B;
    }
    if(B>=A){
       ab=A;
    }

    if(C>=D){
       cd=D;
    }
    if(D>=C){
       cd=C;
    }

    if(ab>=cd){
       abcd=cd;
      }
    if(cd>=ab){
       abcd=ab;
      }
    
    if(E<=F){
       EF=F;
    }
    if(F<=E){
       EF=E;
    } 

    ABCDEF=ABCD-abcd+EF;
     
    printf("%d\n",ABCDEF);

    return 0;

}

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

bool is_square(int n)
{
    for (int i = 0; i <= n; i++)
    {
        if (i * i == n)
        {
            return true;
        }
    }
    return false;
}
double distance(double x1, double y1, double x2, double y2)
{
    return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

int main()
{
    int n;
    cin >> n;
    vector<int> x(n);
    vector<int> y(n);
    for (size_t i = 0; i < n; i++)
    {
        cin >> x[i] >> y[i];
    }
    double sum = 0;
    int cnt = 0;
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = i + 1; j < n; j++)
        {
            cnt++;
            sum += distance(x[i], y[i], x[j], y[j]);
            /* code */
        }
    }
    printf("%.10f\n", 2 * sum / n);

    //    cout << 2 * sum / n << endl;
    return 0;
}

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

using namespace std;

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

int main() {
    long long A, B, C, K;
    cin >> A >> B >> C >> K;

    long long sum = 0;
    if(A > K){
        sum = K;
    }
    else {
        sum += A;
        if((K-A) > B){
            rep(i, K-A-B){
                sum -= 1;
            }
        }
    }
    cout << sum << endl;
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define drrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
	os << "{";
	rep(i, (int)v.size()) {
		if (i)
			os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
	for (auto val : array)
		std::cout << val << ", ";
	std::cout << "\n";
}

const int MOD = 1'000'000'000 + 7;
const int INF = 1'000'000'000 + 5;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(16);

	int n, m; std::cin >> n >> m;
	vi p(m), y(m);
	vvi vvp(n);
	rep(i, m) {
		std::cin >> p[i] >> y[i];
		p[i]--;
		vvp[p[i]].pb(y[i]);
	}
	rep(i, n) {
		sort(rng(vvp[i]));
	}
	rep(i, m) {
		auto it = lower_bound(rng(vvp[p[i]]), y[i]) - vvp[p[i]].begin();
		printf("%06d%06d\n", p[i]+1, (int)it+1);
	}
}


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

#define PI acos(-1)
#define int long long int
#define pb push_back
#define mp make_pair
#define pi pair<int, int>
#define fir first
#define sec second
#define MAXN 501
#define MAXL 20
#define mod 1000000007

signed main()
{
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int total = (h2 - h1) * 60;
  total += (m2 - m1);
  total -= k;
  cout << total << endl;
  return 0;
}


Measured memory_bytes: 3624
#include<iostream>
using namespace std;
int main() {
	int x, y;
	cin >> x >> y;
	for (int i = 0; i < x+1; i++) {
		if (i * 2 + (x - i) * 4 == y) {
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";
}

Measured memory_bytes: 3632
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <climits>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

#define DIV 1000000007

using namespace std;

double r, l;
int main(){
	cin >> r >> l;

	printf("%.20f\n", 1/(1/r+1/l));

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define arrprint(v,n) rep(i,0,n-1)cout << v[i] << " ";cout << endl;
#define matprint(v,n,m) rep(i,0,n-1){rep(j,0,m-1){cout << v[i][j] << " ";}cout << endl;}
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
typedef long long ll;
typedef pair<int,int> P;
 
int main(){
    string s;
    int q;
    cin >> s;
    cin >> q;
    int g = 0,cnt = 0;
    vector<int> tt,ff;
    vector<string> cc;
 
    rep(i,1,q){
        int t;
        cin >> t;
        tt.push_back(t);
        if(t==1){
            cnt++;
        }
        if(t==2){
            int f;
            string c;
            cin >> f >> c;
            f--;
            ff.push_back(f);
            cc.push_back(c);
        }
    }
    if(cnt%2 == 1){
        reverse(s.begin(),s.end());
        g = 1;
    }
    int cnt_2 = 0;
    string head="",tail="";
    rep(i,0,q-1){
        if(tt[i]==1){
            g=1-g;
        }
        if(tt[i]==2){
            string ccc = cc[cnt_2];
            if(ff[cnt_2] == 0 && g == 0){ccc+=head;head=ccc;}
            if(ff[cnt_2] == 1 && g == 1){ccc+=head;head=ccc;}

            if(ff[cnt_2] == 1 && g == 0)tail += ccc;
            if(ff[cnt_2] == 0 && g == 1)tail += ccc;

            cnt_2++;
        }
    }
    if(g==0)cout << head << s << tail << endl;
    if(g==1){
        drep(i,sz(tail)-1,0){
            cout << tail[i];
        }        
        drep(i,sz(s)-1,0){
            cout << s[i];
        }
        drep(i,sz(head)-1,0){
            cout << head[i];
        }
        cout << endl;
    }
 
    // cout << s << endl;
//  printf("%.10f\n",ans);
 
    return 0;
}

Measured memory_bytes: 13784
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
using namespace std;

int main(void){
    string s;
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    if(s.size() == 2) {
        cout << s << endl;
    } else {
        cout << s[2] << s[1] << s[0] << endl;
    }
}

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





int main()
{
   int n;
   cin>>n;
   int A[4]={0};
   for(int i=0;i<n;i++)
   {
       string x;
       cin>>x;

       if(x=="AC")
       {
           A[0]++;
       }
       else if(x=="WA")
       {
           A[1]++;
       }
       else if(x=="TLE")
       {
           A[2]++;
       }
       else if(x=="RE")
       {
           A[3]++;
       }

   }

   cout<<"AC x "<<A[0]<<"\n"<<"WA x "<<A[1]<<"\n"<<"TLE x "<<A[2]<<"\n"<<"RE x "<<A[3]<<"\n";

  
}
       
  




Measured memory_bytes: 3624
#include<iostream>
#include<fstream>
#include<complex>
#include<iomanip>

using namespace std;

typedef long double elem;
typedef complex<elem> point,vec;

const elem pi = 2.0*acos(0.0);
const elem eps = 1e-9;
bool eq(elem a, elem b){
  return abs(b-a)<eps;
}
vec uvec(vec a){ return a / abs(a); }
vec nmr(vec a){ return a * vec(0,-1); }
vec nml(vec a){ return a * vec(0,1); }
vec unmr(vec a){ return uvec( nmr(a) ); }
vec unml(vec a){ return uvec( nml(a) ); }

bool near(const point &a, const point &b){
  return abs(b-a) < eps;
}

struct buggy
{
  point center;
  point left;
  point right;
  buggy(){}
  buggy(point c, point l, point r):center(c),left(l),right(r){}
};

point Rot(point p, elem theta){ return p * polar((elem)1.0, theta); }
buggy rot_buggy(const buggy &b, point &center, double rot)
{
  buggy ret;
  ret.left = Rot(b.left - center,rot)+center;
  ret.right = Rot(b.right - center,rot)+center;
  ret.center = Rot(b.center - center,rot)+center;
  return ret;
}

buggy move(const buggy &b, vec direction, elem d)
{
  buggy ret; 
  ret.left = b.left + direction * d;
  ret.right = b.right + direction * d;
  ret.center = b.center + direction * d;
  return ret;
}


int main()
{
  while(true){
    int N;
    elem D;
    cin >> N >> D;
    if(N==0&&eq(D,0))break;
    buggy b(point(0,0),point(-D,0),point(D,0));
    for(int i = 0; i < N; ++i){
      elem Lsp,Rsp,time;
      cin >> Lsp >> Rsp >> time;
      if(eq(Lsp,Rsp)){
        vec v = unml( b.right-b.left );
        elem progress = time * pi * (Lsp / 180.0);
        b = move(b,v,progress);
        continue;
      }else{
        if(eq(Rsp,0)){
          b = rot_buggy(b,b.right,-pi*((Lsp*time)/180.0)/(2*D));
          continue;
        }else{
          elem x = 2*D*Rsp / (Lsp-Rsp);
          vec v = b.right-b.left;
          point rot_center = x*(v/abs(v))+b.right;
          double rot = -pi*(((Rsp*time)/180.0)/x);
          b = rot_buggy(b,rot_center,rot);
        }
      }
    }
    cout.precision(8);
    cout << fixed << b.center.real() << endl;
    cout << fixed << b.center.imag() << endl;
  }
  return 0;
}

Measured memory_bytes: 0
import math

A, B, H, M = map(int, input().split())

M_deg = M / 60 * 360
H_deg = (H / 12 * 360) + (M_deg / 12)


deg = min(abs(H_deg - M_deg), abs(M_deg - H_deg))

rad = math.radians(deg)

ans = math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(rad))

print(ans)

Measured memory_bytes: 9364
#include <iostream>

using namespace std;

int main()
{
	unsigned int n;

	cin >> n;

	for (unsigned int i = 1; i <= n; ++i) {
		unsigned int x = i;
		if (x % 3 == 0) {
			cout << " " << i;
		} else {
			do {
				if (x % 10 == 3) {
					cout << " " << i;
					break;
				} else {	
					x /= 10;
				}
			} while (x);
		}
	}
	cout << endl;
	return 0;
}



Measured memory_bytes: 3100
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val MOD = 1e9.toInt + 7
  // (x ^ n) % mod
  def repeatSquares(x: Long, n: Int, mod: Int): Long = {
    if(n == 0)
      1
    else if(n % 2 == 0)
      repeatSquares(x*x % mod, n/2, mod)
    else
      (x * repeatSquares(x*x % mod, n/2, mod)) % mod
  }

  val N = in.next().toInt
  val X = in.next().toInt
  val _S = new Array[Int](N)

  for (i <- 0 until N)
    _S(i) = in.next().toInt


  //
  val S = 0 +: _S.sorted.reverse
  val dp = Array.ofDim[Long](N+1, X+1)
  for (n <- 0 to N; x <- 0 to X)
    dp(n)(x) = -1L

  def calc(i: Int, X: Int): Long = {
    if(i == N)
      X % S(i)
    else if(dp(i)(X) != -1L)
      dp(i)(X)
    else {
      val denom = repeatSquares(N+1-i, MOD-2, MOD)
      val r1 = (denom * calc(i+1, X % S(i))) % MOD
      val r2 = ((N-i) * denom % MOD) * calc(i+1, X) % MOD
      dp(i)(X) = (r1 + r2) % MOD
      dp(i)(X)      
    }
  }

  def fact(n: Long, acc: Long): Long =
    if(n == 1)
      acc
    else
      fact(n-1, (n*acc) % MOD)

  val expected = calc(1, X) % MOD
  val ans = expected * fact(N, 1L)
  println(ans % MOD)
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}



Measured memory_bytes: 227140
import Control.Monad
import Data.List
import Data.Maybe
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = do
    n <- read <$> getLine :: IO Int
    ns <- replicateM n (map (fst . fromJust . B.readInt) . B.words <$> B.getLine) :: IO [[Int]]
    let ms = map (\[a,b] -> (a `div` gcd' a b, b `div` gcd' a b)) ns
    print . (\(a,b) -> a+b) $ foldl' (\(a,b) (na, nb)-> f a b na nb) (1,1) ms

gcd' :: Int -> Int -> Int
gcd' a b = head [ x | let c = min a b, x <- [c,c-1..1], mod a x == 0 && mod b x ==0]

f :: Int -> Int -> Int -> Int -> (Int, Int)
f a b na nb = head [(na*i, nb*i)|i<-[max (div a na) (div b nb)..], na*i >= a, nb*i >= b]

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

int main(){
    int64_t n, ans = 0; cin >> n;
    map<pair<int, int>, int64_t> cnt;
    for (auto i = 0; i < n; i++) {
        string a, b; bool flg = false; int digits = 0; cin >> a;
        for (char j : a) {
            if(flg) digits++;
            if(j != '.') b += j;
            else flg = true;
        }
        for ( ; digits < 9; digits++) b += '0';
        auto tmp = stoll(b); int cnt2 = 0, cnt5 = 0;
        while(tmp % 5 == 0) { tmp /= 5; cnt5++; }
        while(tmp % 2 == 0) { tmp /= 2; cnt2++; }
        cnt[{cnt2, cnt5}]++;
    }
    for (auto & elm1 : cnt) {
        for (auto & elm2 : cnt) {
            if(elm1.first.first + elm2.first.first < 18) continue;
            if(elm1.first.second + elm2.first.second < 18) continue;
            if(elm1 == elm2 and elm2.second > 0) ans += elm1.second * (elm2.second - 1);
            else ans += elm1.second * elm2.second;
        }
    }
    cout << ans / 2 << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
int main(void)
{
    int i,n,num,min=1000001,max=-1000001;
    long sum=0;
    scanf("%d",&n);
     
    for(i=0;i<n;i++)
    {
        scanf("%d",&num);
        sum+=num;
             
        if(min>num){
            min=num;
        }
         
        if(max<num){
            max=num;
        }
    }
    printf("%d %d %ld\n",min,max,sum);
    return 0 ;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	string s;
	cin >> s;
	sort(all(s));
	if(s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;

int main()
{
  int n,k;
  cin>>n>>k;
  string s;
  cin>>s;
  int one = 0;
  int two = 0;
  int lr = 0;
  for(int i:boost::irange(0, n-1)) {
    if (s.substr(i,2) == "RL") ++two;
    if (s.substr(i,2) == "LR") ++lr;
  }
  if (s.front() == 'L') ++one;
  if (s.back() == 'R') ++one;
  int res = n - two*2 - one;
  if ((two + lr) % 2 == 0) {
    int sub2 = min(two, k);
    res += 2*sub2;
  } else {
    if (lr > two) {
      int sub2 = min(two, k);
      res += 2*sub2;
      int rem = k - sub2;
      if (rem && one==2) ++res;
    } else if (two > 0) {
      int sub2 = min(two-1, k);
      res += 2*sub2;
      int rem = k - sub2;
      if (rem) ++res;
    }
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 512
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int m,d,ans;
int main(){
	scanf("%d%d",&m,&d);
	for(int i=1;i<=m;i++)
		for(int j=1;j<=d;j++){
			int d1=j%10,d10=j/10;
			if(d1>=2 && d10>=2 && d1*d10==i){
				ans++;
			}
		}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    Int N, M, V, P; cin >> N >> M >> V >> P;
    vector<int> A(N); for (auto &a : A) cin >> a;
    sort(rbegin(A), rend(A));
    int ans = 0;
    if (V <= P) {
        ans = P;
        for (int i = P; i < N; i++) if (A[i] + M >= A[P - 1]) ans++;
    } else {
        ans = P;
        int i = P, same = 0;
        while (i < N && A[i] == A[P - 1]) ans++, i++, same++;
        int ok = i - 1, ng = N;
        while (abs(ok - ng) > 1) {
            int mid = (ok + ng) / 2;
            Int val = A[mid] + M;
            Int add = 0;
            bool fail = false;
            for (int i = P - 1; i < N; i++) {
                if (A[i] > val) { fail = true; break; }
                add += min(M, val - A[i]);
            }
            if (!fail && (V - P + 1) * M <= add) {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        ans = ok + 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include <cassert>

using namespace std;

string s;
int cnt[200000] = {0};
int moveto[200000] = {0};
int tmp[26] = {0};
vector<int> v[26];

template <typename T>
class BIT {
private:
    vector<T> v;
    const int n;

public:
    BIT(int _n) : v(_n + 1, 0), n(_n) {}

    // a[0] + a[1] + ... + a[i - 1]
    // O(log n)
    T sum (int i) {
        assert(0 <= i && i < n + 1);
        T s = 0;
        while(i > 0) {
            s += v[i - 1];
            i -= i & -i;
        }
        return s;
    }

    // a[i] + a[i + 1] + ... + a[j - 1]
    // O(log n)
    T sum (int i, int j) {
        return sum(j) - sum(i);
    }

    // a[i] += x
    // O(log n)
    void add(int i, T x) {
        assert(0 <= i && i < n);
        i++;
        while (i <= n) {
            v[i - 1] += x;
            i += i & -i;
        }
    }

};

int main() {
    cin >> s;
    int n = s.size();

    for (int i = 0; i < n; ++i) {
        cnt[i] = tmp[s[i] - 'a'];
        tmp[s[i] - 'a']++;
        v[s[i] - 'a'].push_back(i);
    }
    int odd = 0;
    for (auto vi : v) {
        if (vi.size() % 2 == 1)odd++;
    }

    if (odd > 1) {
        cout << -1 << endl;
        return 0;
    }

    int forecnt = 0;
    for (int i = 0; i < n; ++i){
        int c = s[i] - 'a';
        int totalcnt = tmp[c];
        if (cnt[i] < totalcnt / 2) {
            moveto[i] = forecnt;
            forecnt++;
        } else if (totalcnt % 2 == 1 && totalcnt / 2 == cnt[i]) {
            moveto[i] = n / 2;
        } else {
            int pairpos = v[c][totalcnt - cnt[i] - 1];
            moveto[i] = n - moveto[pairpos] - 1;
        }
    }

    // for (int i = 0; i < n; ++i){
        // cout << moveto[i] << " ";
    // }

    BIT<int> b = BIT<int>(n);
    long long ans = 0;
    for (int i = 0; i < n; ++i) {
        ans += i - b.sum(moveto[i] + 1);
        b.add(moveto[i], 1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4084
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int main()
{
	string s;
	int ans=0;
	
	cin>>s;
	while(!s.empty())
	{
		bool f=true;
		s.pop_back();
		if(s.length()%2!=0)
			continue;
		
		for(int i=0;i<s.length()/2;i++)
		{
			if(s[i]!=s[i+s.length()/2])
				f = false;
		}
		if(f)
		{
			cout<<s.length()<<endl;
			return 0;
		}
	}

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

Measured memory_bytes: 256
use std::cmp;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        a: u64,
        b: u64
    }

    let dist = b - a + 1;
    let one_num = (dist / 2) % 2;
    if dist % 2 == 0 {
        if a % 2 == 0 {
            println!("{}", one_num);
        } else {
            println!("{}", a ^ b ^ (1 - one_num));
        }
    } else {
        if a % 2 == 0 {
            println!("{}", b ^ one_num);
        } else {
            println!("{}", a ^ one_num);
        }
    }
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


Measured memory_bytes: 8572
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node {
    int key;
    Node *next, *prev;
};

Node *nil;

Node* listSearch(int key) {
    Node *cur = nil->next;
    while ( cur != nil && cur->key != key) {
        cur = cur->next;
    }
    return cur;
}

void init(){
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void printList() {
    Node *cur = nil->next;
    int isf = 0;
    while ( 1 ){
        if ( cur == nil )break;
        if ( isf++ > 0 )printf(" ");
        printf("%d",cur->key);
        cur = cur->next;
    }
    printf("\n");
}

void deleteNode(Node *t) {
    if ( t == nil ) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst() {
    deleteNode(nil->next);
}

void deleteLast() {
    deleteNode(nil->prev);
}

void deleteKey(int key) {
    
    deleteNode(listSearch(key));
}

void insert(int key) {
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

int main() {
    int key, n, i;
    int size = 0;
    char com[20];
    int np = 0,nd = 0;
    scanf("%d", &n);
    init();
    for ( i = 0; i < n; i++ ) {
        scanf("%s%d", com, &key);
        if ( com[0] == 'i' ) {insert(key);np++;size++;}
        else if ( com[0] == 'd' ) {
            if ( strlen(com) > 6 ) {
                if ( com[6] == 'F' ) deleteFirst();
                else if ( com[6] == 'L' )deleteLast();
            }else{
                deleteKey(key); nd++;
            }
            size--;
        }
    }

    printList();

    return 0;

}



Measured memory_bytes: 33824
#include <cstdio>
#include <queue>
#include <vector>
using namespace std;
int main(void){
	int count[200000]={};
	int n,k; scanf("%d %d",&n,&k);
	int memo;
	int species=0;
	int answer=0;
	priority_queue<int,vector<int>,greater<int> > pq;
	for(int loop=0; loop<n;loop++){
		scanf("%d",&memo);
		count[memo-1]++;
	}
	
	for(int loop=0;loop<n;loop++){
		if(count[loop]>0){
			species++;
			pq.push(count[loop]);
		}
	}
	
	for(int loop=species;loop>k;loop--){
		answer+=pq.top();
		pq.pop();
	}
	
	printf("%d\n",answer);
	
	return 0;
}
	
	


Measured memory_bytes: 2168
#include<bits/stdc++.h>
using namespace std;
using ll=int_fast64_t;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int n;
    in>>n;
    vector<int> l(n);
    for(auto&i:l) in>>i;
    sort(l.begin(),l.end());
    int ans=0;
    fr(i,n) fr(j,i) ans+=lower_bound(l.begin(),l.end(),l[j]+l[i])-l.begin()-i-1;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long comb(long long a){
	return a*(a-1)/2;
}
int main(){
	int n;
	cin >> n;
	vector<long long> a(n);
	map<long long,long long> mp;
	for(int i=0; i<n; ++i){
		cin >> a[i];
		++mp[a[i]];
	}

	long long sum=0;
	for(auto i: mp){
		sum += i.second*(i.second-1)/2;
	}
	for(int i=0; i<n; ++i){
		cout << sum-comb(mp[a[i]])+comb(mp[a[i]]-1) << endl;
	}
}

Measured memory_bytes: 11008
#include <bits/stdc++.h>
#define int long long
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % moder;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), moder - 2, moder) % moder * mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/

int n, k;
int a[114514];
signed main() {
	string s;
	cin >> n >> k >> s;
	rep(i, n) {
		a[i] = s[i] - '0';
	}
	vector<int>v;
	v.push_back(0);
	if (a[0] == 0)v.push_back(0);
	rep(i, n) {
		if (a[i] != a[i + 1])v.push_back(i + 1);
	}
	if (a[n - 1] == 0) {
		v.push_back(n);
		v.push_back(n);
	}
	int ans = 0;
	for (int i = 1; i < v.size(); i += 2) {
		int l = min((int)v.size() - 1, i + 2 * k);
		ans = max(ans, v[l] - v[i - 1]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 2296
from collections import Counter
n = int(input())
c = Counter(map(int, input().split()))
cnt = sorted(c.values())

x = [0]*(n+1)
ad = [0]*(n+1)

for i in cnt:
    x[0] += 1
    x[i] -= 1
    ad[i] += i
    ad[-1] -= i

for i in range(n):
    x[i+1] += x[i]
    ad[i+1] += ad[i]

b = [0]*(n+1)
for i in range(n):
    b[i] = x[i] + ad[i]//(i+1)

prev = 0
ans = [0]*n
for i in reversed(range(n)):
    if prev !=b[i]:
        for j in range(prev, b[i]):
            ans[j] = i+1
        prev = b[i]
print(*ans, sep="\n")

Measured memory_bytes: 121656
def main():
    n = int(input())
    div = []
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            div.append(n//i)
    
    f = div[-1]
    ans = 0
    while f > 0:
        f//=10
        ans+=1
    print(ans)
main()

Measured memory_bytes: 64096
#include<stdio.h>

int main(){
	int n,m;
	int i;
	int s[10001][2]={0};
	while(scanf("%d%d",&n,&m),n!=0&&m!=0){
		int a[501]={0},b[501]={0},cnt=0;
		for(i=1;i<=m;i++){
			scanf("%d%d",&s[i][0],&s[i][1]);
			if(s[i][0]==1)a[s[i][1]]=1,b[s[i][1]]=1;
		}
		for(i=1;i<=m;i++){
			if(a[s[i][0]]==1)b[s[i][1]]=1;
			if(a[s[i][1]]==1)b[s[i][0]]=1;
		}
		for(i=2;i<=n;i++)if(b[i]==1)++cnt;
		printf("%d\n",cnt);
	}
	return 0;
}


Measured memory_bytes: 1976
#include <stdio.h>
#include <stdlib.h>

int f (const void *a, const void *b) {
    return *(int *)a - *(int*)b;
}

void swap(int *a, int *b) {
    int tmp = *a;
    *a = *b;
    *b = tmp;
}

void show(int *arr, int N) {
    for (int i = 0; i < N; i++) {
        printf("[%d]: %d\n", i, arr[i]);
    }
}

int main() {
    int N;
    scanf("%d", &N);
    int *p = malloc(N * sizeof(int));
    int *sorted = malloc(N * sizeof(int));
    for (int i = 0; i < N; i++) {
        scanf("%d", &p[i]);
        sorted[i] = p[i];
    }
    qsort(sorted, N, sizeof(int), f);
    // 交換しないケース確認
    int same = 1;
    for (int k = 0; k < N; k++) {
        if (p[k] != sorted[k]) {
            same = 0;
            break;
        }
    }
    if (same == 1) {
        printf("YES");
        return 0;
    }


    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N; j++) {
            swap(p+i, p+j);
            int same = 1;
            for (int k = 0; k < N; k++) {
                if (p[k] != sorted[k]) {
                    same = 0;
                    break;
                }
            }
            if (same == 1) {
                printf("YES");
                return 0;
            }
            swap(p+i, p+j);
        }
    }

    printf("NO");
    return 0;
}


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

def input_one_number():
    return int(input())

def input_multiple_number():
    return map(int, input().split())

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

A,B,N = input_multiple_number()


ans = 0

x = (min(B-1,N))


wk = A*x//B - x//B*A
ans = max(ans,wk)
print(ans)

Measured memory_bytes: 9196
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define N 200005
 

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	
	int x,y;
	cin>>x>>y;
	int val=0,i;
	for(i=0;i<=x;i++){
		if(i*2+(x-i)*4 == y){
			val=1;
		}
	}
	if(val)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

vector<int> D;
vector<vector<int>> G;
void dfs(int cur, int par = -1) {
    for(int a: G[cur]) {
        if(a != par) {
            D[a] = D[cur] + 1;
            dfs(a, cur);
        }
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    D.assign(N, -1);
    G.resize(N);
    rep(i, N - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    D[0] = 0;
    dfs(0);
    
    int depth = 0;
    int s = 0;
    rep(i, N) if(D[i] > depth) {
        depth = D[i];
        s = i;
    }
    
//    cout << "s:" << s << endl;
    
    D.assign(N, -1);
    D[s] = 0;
    dfs(s);
   
    depth = 0;
    rep(i, N) {
        depth = max(D[i], depth);
    }
    
    int di = depth + 1;
//    cout << di <<  endl;
    if(di % 3 != 2) output("First");
    else output("Second");
    
    return 0;
}


Measured memory_bytes: 21376
#ifdef MY_LOCAL
#define MY_NAMESPACE(ns) namespace ns {
#define MY_NAMESPACE_    }
#define MY_DEBUG(s)      s
#else
#define MY_NAMESPACE(ns) 
#define MY_NAMESPACE_    
#define MY_DEBUG(s)      
#endif

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define EPS (1e-7)
#define IINF ((int)1e9)


MY_NAMESPACE(testbed)
class ModComb
{
public:
	ModComb(int max_n, ll mod) : m_mod(mod)  // mod and any i (1<i<=max_n) must be mutually prime. in reality mod must be a prime number and mod>max_n
	{
		m_fac.resize(max_n + 1);
		m_inv.resize(max_n + 1);
		m_fin.resize(max_n + 1);
		m_fac[0] = 1;
		m_fac[1] = 1;
		m_inv[0] = 0;  // dummy
		m_inv[1] = 1;
		m_fin[0] = 1;
		m_fin[1] = 1;
		for (int i = 2; i <= max_n; i++)
		{
			m_fac[i] = m_fac[i - 1] * i % mod;
			m_inv[i] = mod - m_inv[mod % i] * (mod / i) % mod;
			m_fin[i] = m_fin[i - 1] * m_inv[i] % mod;
		}
	}

	ll nCk(int n, int k)
	{
		if (n < 0 || k < 0)
			return 0;
		if (n < k)
			return 0;
		return m_fac[n] * (m_fin[k] * m_fin[n - k] % m_mod) % m_mod;
	}

	ll nPk(int n, int k)
	{
		if (n < 0 || k < 0)
			return 0;
		if (n < k)
			return 0;
		return m_fac[n] * m_fin[n - k] % m_mod;
	}

private:
	ll m_mod;
	vector<ll> m_fac;  // factorial
	vector<ll> m_inv;  // inverse element
	vector<ll> m_fin;  // factorial of inverse
};

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

	ll modval = 1000000007;  // 10^9 + 7

	int n, m;
	cin >> n >> m;
	ModComb c(max(n, m), modval);

	ll res = 0;
	for (int k = 0; k <= n; k++)
	{
		ll this_res = c.nCk(n, k) * c.nPk(m, k) % modval;
		this_res *= c.nPk(m - k, n - k);
		this_res %= modval;
		this_res *= c.nPk(m - k, n - k);
		this_res %= modval;

		if (k % 2 == 0)
		{
			res += this_res;
			res %= modval;
		}
		else
		{
			res -= this_res;
			res %= modval;
			res += modval;
			res %= modval;
		}
	}
	cout << res << "\n";
	return 0;
}
MY_NAMESPACE_

Measured memory_bytes: 15060
//#define FILE_INPUT
#define _CRT_SECURE_NO_WARNINGS
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vbl;
 
#define majorro cout.precision(20); ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define forn(i, n) for(ll (i) = 0; (i) < (n); ++(i))
#define fornm(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define rfornm(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define fin() for(ll i = 0; i < n; ++i)
#define readvec(vector, n) {ll temp_vec_val;forn(i, n){cin >> temp_vec_val;vector.push_back(temp_vec_val);}}
#define printvec(vector, delimeter) {ll length_of_vector=vector.size();\
                                    forn(elementvec, length_of_vector){cout << vector[elementvec] << delimeter;}}
#define printarr(arr, length, delimeter) {forn(elementarr, length){cout << arr[elementarr] << delimeter;}}
#define sortvec(vector) sort(vector.begin(), vector.end())
 
 
struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
 
unsigned long long bpow(unsigned long long a, ll n, ll mod)
{
    return n ? n & 1 ? (bpow(a, n - 1, mod) * a) % mod : (bpow((a * a) % mod, n >> 1ll, mod)) % mod : 1ll;
}

int get_digit(ll num, int len, int index)
{
    return num / bpow(10, len - index - 1, 1) % 10;
}
 
ll digit_sum(ll num)
{
    ll dig_sum = 0;
    while(num > 0)
    {
        dig_sum += num % 10;
        num /= 10;
    }
    return dig_sum;
}

const ldbl EPS = 0.000001;
const ll MOD = 1000000007;
// const ll MOD = 3037000499;
// const ull MOD = 1000000000000000003;
const ll INF = 1e18;
const double pi = 2 * acos(0.0);
ll n, m, k, p, q, t, sum = 0, cnt = 0;
ll mx = INT64_MIN;
ll mn = INT64_MAX;
bool flag = 0;
vll v;
str s = "", s1, s2;

void bad_solve(){}

void solve() //set.merge() -> c++17
//DELET DEBUG OUTPUT!11!1
//DONT FORGET MODULO SUBSTRACTION
{
    cin >> n >> m >> k >> p;
    if(n == k) cout << 0;
    else cout << 1;
}
 
int main()
{
#ifdef FILE_INPUT
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    majorro
 
    solve();
 
    // freopen("test.txt", "w", stdout);
    // bad_solve();
 
//  memset(v, INT_MAX, 1000*2000*sizeof(int));
 
    return 0;
}

Measured memory_bytes: 384
#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--)
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    cout << (n - 1) * (m - 1) << endl;
}


Measured memory_bytes: 256