akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#include <unordered_map>

//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

#define rep(i,n) for(i=1;i<=n;i++)
#define Rep(i,n) for(i=0;i<n;i++)
#define For(i,a,b) for(i=a;i<=b;i++)

#define pb(x) push_back(x)
#define sz(x) (int)x.size()

#define mem(ara,val) memset(ara,val,sizeof(ara))
#define eps 1e-7

#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define ss(str) scanf("%s",str)
#define pi(x) printf("%d",x)
//#define pii(x,y) printf("%d %d",x,y)
#define piii(x,y,z) printf("%d %d %d",x,y,z)
#define pl(x) printf("%lld",x)
#define pll(x,y) printf("%lld %lld",x,y)
#define plll(x,y,z) printf("%lld %lld %lld",x,y,z)
#define NL printf("\n")
#define Max 200005
#define INF 1e18
#define un(x) x.erase(unique( x.begin() , x.end() ), x.end())
#define md 998244353

#define FI freopen("z.txt","r",stdin)

#define D(x) cout << #x << " = " << x << endl
#define DD(x,y) cout << #x << " = " << x << "   " << #y << " = " << y << endl
#define DDD(x,y,z) cout << #x << " = " << x << "   " << #y << " = " << y << "   " << #z << " = " << z << endl
#define all(x) x.begin(),x.end()
#define prntvctr(x) for(int i = 0; i < x.size(); i++) printf("%d%c", x[i], i + 1 == x.size() ? '\n' : ' ' );
#define pc(x) __builtin_popcount(x)

typedef long long LL;
typedef unsigned long long ULL;

const double PI = acos(-1.0);

using namespace std;

int setb(int n,int pos)
{
    return n=n | (1 << pos);
}
int resb(int n,int pos)
{
    return n=n & ~(1 << pos);
}
bool checkb(LL n,LL pos)
{
    return (bool)(n & (1ll << pos));
}

LL bigmod(LL b,LL p,LL m)
{
    if( p == 0 ) return 1;
    LL ret = bigmod(b,p/2,m);
    ret = ( ret * ret ) % m;
    if( p & 1 ) ret = ( ret * b ) % m;
    return ret;
}

int n;
double ara[Max];
LL act[Max];

/*double get_val(double x)
{
	double mn = 0, mx = 0, sum = 0, retmx = -1e18, retmn = -1e18;
	int i;
	rep(i,n)
	{
		sum += ( ara[i] + x );
        mn = min( mn, sum );
        mx = max( mx, sum );
        retmx = max( retmx , sum - mn );
        retmn = max( retmn , mx - sum );
	}
	return max( fabs(retmx), fabs(retmn) );
}*/

double get_val(double x)
{
	int i;
	double sum = 0;
	rep(i,n)
	{
		sum += fabs( ara[i] - x );
	}
	return sum;
}

double solve()
{
	double low = -1e18, high = 1e18;
	int cnt = 400;
	while( cnt-- )
	{
		double a = low + 1 * ( high - low ) / 3;
		double b = low + 2 * ( high - low ) / 3;
		double mya = get_val(a);
		double myb = get_val(b);
		if( mya < myb ) high = b;
		else low = a;
	}
	return low;
}

LL go(LL x)
{
	LL ret = 0, i;
	rep(i,n)
	{
		LL my = act[i] - x;
		ret += llabs( my );
	}
	return ret;
}

int main()
{
	//FI;
	int i;
	si(n);
	rep(i,n)
	{
		sl( act[i] );
		act[i] -= i;
		ara[i] = act[i];
	}
	double my = solve();
	LL here = (LL)my;
	LL ret = 1e18;
	for(LL i = here - 50; i <= here + 50; i++) ret = min( ret , go(i) );
	pl( ret ); NL;
	return 0;
}


Measured memory_bytes: 3328
import java.util.*;

public class Main {
	public static void main(String[] orgs) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();

		if(A <= 8&&B <= 8){
			System.out.println("Yay!");
		}else {
			System.out.println(":(");
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)

using namespace std;

typedef long long ll;
const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;
const ll mod = 1e9+7;

template<typename T> ostream& operator << (ostream& os, vector<T> v) {
  for (auto& i : v) os << i << " "; return os; 
}
template<typename T> istream& operator >> (istream& is, vector<T>& v) {
  for (auto& i : v) is >> i; return is;
}
template<typename K, typename V> ostream& operator << (ostream& os, unordered_map<K, V> m) {
  for (auto& i : m) os << i.first << ":" << i.second << endl; return os;
}
template<typename T> inline bool chmin(T& x, T y) {
  if (x > y) {
    x = y;
    return true;
  }
  return false;
}
template<typename T> inline bool chmax(T& x, T y) {
  if (x < y) {
    x = y;
    return true;
  }
  return false;
}

int N, W, w[101], v[101];
int dp[101][200020];

int main() {
  cin >> N >> W;
  rep(i, 0, N) cin >> w[i] >> v[i];
  
  rep(i, 0, N+1) rep(val, 0, N * 1010) dp[i][val] = inf;
  dp[0][0] = 0;

  rep(i, 0, N) rep(val, 0, N * 1010) {
    chmin(dp[i+1][val], dp[i][val]);
    chmin(dp[i+1][val + v[i]], dp[i][val] + w[i]);
  }

  int res = 0;
  rep(val, 0, N * 1010) if (dp[N][val] <= W) chmax(res, val);
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 77696
import sys
sys.setrecursionlimit(10**9)

k = int(input())
l = 10
A = [str(i+1) for i in range(9)]
B = ["0"] + A
ans = []
#print(l)

def dfs(num,l):
    if len(num) >= l:
        ans.append(int(num))
    else:
        ans.append(int(num))
        for i in B:
            if abs(int(num[-1])-int(i)) < 2:
                dfs(num + i,l)
if k <= 9:
    print(k)
else:
    for i in A:
        dfs(i,l)
    ans = sorted(ans)
    #print(ans)
    print(ans[k-1])

Measured memory_bytes: 84360
#include <iostream>
#include <string>

using namespace std;

#define MIN(a, b)   ((a)>(b) ? (b) : (a))

int main(void)
{
    string S;
    int counter = 0;

    cin >> S;
    
    for(size_t i=0; i<S.size(); i++){
        if( (i%2) != ((S[i]=='0') ? 0 : 1) )
            counter++;
    }

    cout << MIN(counter, S.size()-counter);

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <regex>
#include <iomanip>
#include <climits>
#include <utility>
#include <queue>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;
const dd PI = 3.1415926435;

class UnionFind
{
public:
    UnionFind(int N) : par(N)
    {
        for (ll i = 0; i < N; i++)
        {
            par[i] = i;
        }
    }

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

    void unite(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry)
            return;
        par[rx] = ry;
    }

    bool same(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

private:
    vector<int> par;
};

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

ll fact(ll n)
{
    if (n == 0)
    {
        return 1;
    }
    if (n == 1)
    {
        return 1;
    }
    return n * fact(n - 1) % MOD;
}

ll pow_fast(ll n, ll k)
{
    if (k == 0)
    {
        return 1;
    }
    if (k == 1)
    {
        return n;
    }

    if (k % 2 == 0)
    {
        ll tmp = pow_fast(n, k / 2LL);
        return tmp * tmp % MOD;
    }
    else
    {
        ll tmp = pow_fast(n, k / 2LL);
        tmp *= tmp;
        tmp %= MOD;
        return tmp * n % MOD;
    }
}

map<ll, ll> sosuu(ll n)
{
    map<ll, ll> res;
    for (ll i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            res[i] += 1;
            n /= i;
        }
    }
    if (n != 1)
    {
        res[n] += 1;
    }
    return res;
}

struct Dish
{
    ll time;
    ll taste;
};
int main()
{
    ll N, X;
    cin >> N >> X;
    
    set<ll> st;
    ll sum = 0;
    for (ll i = 0; i < N; i++)
    {
        ll mi;
        cin >> mi;
        sum += mi;
        st.insert(mi);
    }
    ll mn = *(st.begin());
    cout << (N + (X - sum) / mn) << endl;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1e9+7;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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 main(){
    ll N,K;
    cin >> N >> K;
    ll last=-1;
    vector<ll> separator;
    separator.push_back(0);
    for (ll i=1;i*i<=N;++i){
        if (last!=N/i){
            separator.push_back(i);
            if (i*i!=N) separator.push_back(N/i);
        }
    }
    sort(separator.begin(),separator.end());
    ll s=separator.size();
    --s;
    vector<vector<ll>> dp(K,vector<ll>(s,0));
    rep(i,s) dp[0][i]=separator[i+1]-separator[i];
    rep(i,K-1){
        rep(j,s) dp[i+1][s-1-j]=(dp[i+1][s-1-j]+dp[i][j])%MOD;
        for (ll j=s-2;j>=0;--j) dp[i+1][j]=(dp[i+1][j]+dp[i+1][j+1])%MOD;
        rep(j,s) dp[i+1][j]=dp[i+1][j]*dp[0][j]%MOD;
    }
    ll ans=0;
    rep(j,s) ans=(ans+dp[K-1][j])%MOD;
    cout << ans << endl;
}

Measured memory_bytes: 50936
n = int(input())
#n,k = map(int,input().split())
#a = list(map(int,input().split()))
#mod = pow(10,9) + 7
if(n == 10000):
    print(0)
elif(n%1000 == 0):
    print(0)
else:  
    print(1000-n%1000)
'''
a = []
for i in range(n):
    a.append(list(map(int,input().split())))
print(a)
'''

Measured memory_bytes: 9168
<?php

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

$edges = [];
$restriction_edges = [];
for ($i = 0; $i < $n - 1; ++$i) {
    $restriction_edges[$i] = 0;
    fscanf(STDIN, "%d%d", $a, $b);

    if (!isset($edges[$a])) {
        $edges[$a] = [];
    }

    if (!isset($edges[$b])) {
        $edges[$b] = [];
    }

    $edges[$a][$b] = $i;
    $edges[$b][$a] = $i;
}

$path = [1 => []];
makePath($path, 1, $edges);

fscanf(STDIN, "%d", $m);

for ($i = 0; $i < $m; ++$i) {
    fscanf(STDIN, "%d%d", $u, $v);
    foreach (findPath($u, $v, $path) as $edge_id) {
        $restriction_edges[$edge_id] += 2 ** $i;
    }
}

$answer = 0;
for ($i = 0; $i < 2 ** $m; ++$i) {
    $count = 0;
    foreach ($restriction_edges as $edge_id => $value) {
        if ($value & $i) {
            ++$count;
        }
    }

    $will_add = true;
    for ($j = 0; $j < $m; ++$j) {
        if ($i & 2 ** $j) {
            $will_add = !$will_add;
        }
    }

    if ($will_add) {
        $answer += 2 ** ($n - 1 - $count);
    } else {
        $answer -= 2 ** ($n - 1 - $count);
    }
}

echo $answer;

function makePath(array &$path, int $target_vertex_id, array $edges): void
{
    foreach ($edges[$target_vertex_id] as $next_vertex_id => $edge_id) {
        if (isset($path[$next_vertex_id])) {
            continue;
        }
        $path[$next_vertex_id] = array_merge($path[$target_vertex_id], [$edge_id]);
        makePath($path, $next_vertex_id, $edges);
    }
}

function findPath(int $u, int $v, array $path): array
{
    $path_u = $path[$u];
    $path_v = $path[$v];

    $path_lca = array_intersect($path_u, $path_v);

    return array_diff(array_merge($path_u, $path_v), $path_lca);
}


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

int main(){
//srandom((unsigned long)time(NULL));
int x,y,z;
cin>>x>>y>>z;
int a,b,c;
a=z;
b=x;
c=y;
cout<<a<<" "<<b<<" "<<c;



return 0;
}

Measured memory_bytes: 256
import numpy as np
x1, y1, x2, y2 = list(map(int, input().split()))
z1 = [
    [x1],
    [y1]
]
z1 = np.matrix(z1)
z2 = [
    [x2],
    [y2]
]
z2 = np.matrix(z2)
v1 = z2 - z1
R = [
    [0, -1],
    [1, 0]
]
v2 = np.dot(R, v1)
z3 = z2 + v2
v3 = np.dot(R, v2)
z4 = z3 + v3
ans = [str(z3[0, 0]), str(z3[1, 0]), str(z4[0, 0]), str(z4[1, 0])]
print(" ".join(ans))

Measured memory_bytes: 21292
#include <iostream> // cout, endl, cin
#include <iomanip>
#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 <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int INF = 1001001001;
const int BG = 1000000007;

int main()
{
    string S;
    cin >> S;
    vector<int> v(30);
    for (char c : S)
    {
        int a = c - 97;
        v[a] = 1;
    }
    rep(i, 30)
    {
        if (v[i] == 0)
        {
            if (i > 25)
            {
                cout << "None" << endl;
                return 0;
            }
            cout << char(i + 97) << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static int Gcd(int a, int b)
        {
            if (a < b) { return Gcd(b, a); }
            return (b == 0) ? a : Gcd(b, a % b);
        }
        static int Gcd(int a, int b, int c)
        {
            return Gcd(Gcd(a, b), c);
        }
        static bool Solve(int[][] C)
        {
            if (C[0][1] - C[0][0] != C[1][1] - C[1][0]) { return false; }
            if (C[1][1] - C[1][0] != C[2][1] - C[2][0]) { return false; }
            if (C[0][2] - C[0][1] != C[1][2] - C[1][1]) { return false; }
            if (C[1][2] - C[1][1] != C[2][2] - C[2][1]) { return false; }
            if (C[1][0] - C[0][0] != C[1][1] - C[0][1]) { return false; }
            if (C[1][1] - C[0][1] != C[1][2] - C[0][2]) { return false; }
            if (C[2][0] - C[1][0] != C[2][1] - C[1][1]) { return false; }
            if (C[2][1] - C[1][1] != C[2][2] - C[1][2]) { return false; }
            return true;
        }
        static void Main(string[] args)
        {
            int[][] C = new int[3][];
            for (int i = 0; i < 3; ++i) { C[i] = ReadInts(); }
            Console.WriteLine(Solve(C) ? "Yes" : "No");
        }
    }
}


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

using namespace std;

int main()
{
    int h, a;
    cin >> h >> a;
    int q = 0;
    for (int i = 0; i < a; i++)
    {
        int x;
        cin >> x;
        q += x;
    }
    if(q >= h)
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

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

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////

int main() {
	int N;
	cin >> N;
	ll dp[110][4][4][4];
	for (int i = 0; i < 110; ++i) {
		for (int j = 0; j < 4; ++j) {
			for (int k = 0; k < 4; ++k) {
				for (int l = 0; l < 4; ++l) {
					dp[i][j][k][l] = 0;
				}
			}
		}
	}
	for (int j = 0; j < 4; ++j) {
		for (int k = 0; k < 4; ++k) {
			for (int l = 0; l < 4; ++l) {
				if (j == 0 && k == 2 && l == 1)continue;
				else if (j == 2 && k == 0 && l == 1)continue;
				else if (j == 0 && k == 1 && l == 2)continue;
				else {
					dp[3][j][k][l] = 1;
				}
			}
		}
	}
	//A=0,C=1.G=2,T=3
	//A*GC,AG*C,*GAC,*ACG,*AGC
	for (int i = 3; i < N; ++i) {
		for (int j = 0; j < 4; ++j) {
			for (int k = 0; k < 4; ++k) {
				for (int l = 0; l < 4; ++l) {
					for (int m = 0; m < 4; ++m) {
						if (m == 0 && j == 2 && l == 1)continue;
						if (m == 0 && k == 2 && l == 1)continue;
						if (j == 2 && k == 0 && l == 1)continue;
						if (j == 0 && k == 1 && l == 2)continue;
						if (j == 0 && k == 2 && l == 1)continue;
			            dp[i + 1][j][k][l] += dp[i][m][j][k];
						dp[i + 1][j][k][l] %= INF;
					}
				}
			}
		}
	}
	ll ans = 0;
	for (int i = 0; i < 4; ++i) {
		for (int j = 0; j < 4; ++j) {
			for (int k = 0; k < 4; ++k) {
				ans += dp[N][i][j][k];
				ans %= INF;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
const int limit = 50;
int n, m;
int a[limit], b[limit];
bool graph[limit][limit];
bool visited[limit];
void dfs(int v) {
	visited[v] = true;
	for (int i = 0; i < n; ++i) {
		if (!graph[v][i]) continue;
		if (visited[i]) continue;
		dfs(i);
	}
}
int main(void) {
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		cin >> a[i] >> b[i];
		--a[i]; --b[i];
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
	}
	int ans = 0;
	for (int i = 0; i < m; ++i) {
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;
		for (int j = 0; j < n; ++j) visited[j] = false;
		dfs(0);
		for (int j = 0; j < n; ++j) {
			if (!visited[j]) {
				++ans;
				break;
			}
		}
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
	}
	cout << ans << endl;
	return 0;
}

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

string s;
int sp(int,int);
int main()
{ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

cin>>s;
int l=s.length();
int r=0,s=0,flag=0;
for(int i=0;i<l;i++)
{   int q=sp(0,l-1);
   if(q==0)
   {
       cout<<"No"<<endl;
       return 0;
   }
   else
   {int r=sp(0,(l-2)/2);
   int s=sp((l+2)/2,(l-1));
     if((r==1)&&(s==1))
     {flag=1;
         
     }
   }
}
/*int i=0;
int j=l-1;*/
if(flag==1)
cout<<"Yes"<<endl;
else
{
    cout<<"No"<<endl;
}
//cout<<s[i]<<" "<<s[j]<<endl;
    return 0;
}


int sp(int x,int y)
{
    int i=x;
    int j=y;
    while(j>i)
    {
        if(s[i++]!=s[j--])
        {
            return 0;
            break;
        }
        else
        {
            continue;
        }
        
    }
    return 1;
}

Measured memory_bytes: 256
def main():
    K, T = map(int, input().split())
    A = list(map(int, input().split()))
    mx = max(A)
    if K % 2 == 0:
        ans = max((mx - K//2) * 2 - 1, 0)
    else:
        ans = max((mx - K//2 - 1) * 2, 0)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//:/
#define pb emplace_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=1e9+7;
const ll inf=LONG_LONG_MAX;
const ll ms=(2e5)+5;


int ar[100][2];
int br[100][2];

int main()
{
    idfc;
    int n,m;
    cin>>n>>m;
    int i,j;
    for(i=1;i<=n;i++)
    {
        cin>>ar[i][0]>>ar[i][1];
    }

    for(i=1;i<=m;i++)
    {
        cin>>br[i][0]>>br[i][1];
    }
    int mx;
    int ind;
    int e;
    for(i=1;i<=n;i++)
    {
        mx=INT_MAX;
        ind=-1;
        for(j=1;j<=m;j++)
        {
            e=abs(ar[i][0]-br[j][0])+abs(ar[i][1]-br[j][1]);
            if(mx>e)
            {
                mx=e;
                ind=j;
            }
        }
        cout<<ind<<"\n";
    }

    return 0;
}

Measured memory_bytes: 3516
#include<bits/stdc++.h>
using namespace std; 
#define int long long
int32_t main()
{
  int n, k, i, j, l,min1=1e16; 
 cin>>n>>k; 
int a[n+1];
for(i=1;i<=n; i++) cin>>a[i];
sort(a+1,a+n+1);
int dp[n+1];dp[0]=0;
for(i=1;i<=n; i++)
 dp[i]=dp[i-1]+a[i];
 for(i=k;i<=n;i++)
    {
      j=a[i]-a[i-k+1];
   min1=min(min1,j);
 }
cout<<min1;
}


Measured memory_bytes: 5144
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

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

#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int main() {

	ll R;
	std::cin >> R;

	std::cout << std::fixed << std::setprecision(15) << 2 * R * 3.1415926535 << endl;

	return 0;
}


Measured memory_bytes: 3788
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: i64 = read(&mut stdin_lock, &mut buf, b'\n');
    let mut xv = vec![0i64; 5];
    for i in 0..5 {
        xv[i] = read(&mut stdin_lock, &mut buf, b'\n');
    }

    let min_x = xv.iter().min().unwrap();
    let ans = (n + min_x - 1) / min_x + 4;
    println!("{}", ans);
}


Measured memory_bytes: 4352
/*      ex4_1
        Tarara  */
#include <stdio.h>
#include <math.h>

int main(void)
{
    int n;        // 林檎の木の本数
    int distance; //ひとりの監視員が監視する距離

    scanf("%d %d", &n, &distance);

    int range = 2 * distance + 1; //ひとりの監視員が監視できる最大範囲
    int observers = (int)ceil((double)n / range);
    printf("%d\n", observers);
    return 0;
}

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

int main(){
	int n; cin>>n;
	vector<int> v(n);
	rep(i,n) cin>>v[i];
	int cnt=0;
	for(int i=1; i<n-1; i++){
		if(v[i-1]==v[i]&&v[i]==v[i+1]) {cnt++; v[i]=0;}
	}
	for(int i=0; i<n-1; i++){
		if(v[i]==v[i+1]) {cnt++; v[i]=-1;}
	}
  cout<<cnt<<endl;
}

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

using namespace std;

typedef long long ll;

int main(){
  ll a[3];
  for(int i=0;i<3;i++){
    cin>>a[i];
  }
  sort(a,a+3);
  
  ll count=1;
  for(int i=0;i<2;i++){
    if(a[i]!=a[i+1]){
      count++;
    }
  }
  
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
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> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


int N;
vector<string> field(8, "........");

bool check(int x,int y){
  // 攻撃されるならtrue
  bool ng = false;
  for (int i=0; i<8; i++) if (field[i][y] == 'Q') ng = true;
  for (int j=0; j<8; j++) if (field[x][j] == 'Q') ng = true;
  int a = x, b = y;
  while (a >= 0 && b >= 0) if (field[a--][b--] == 'Q') ng = true;
  a = x, b = y;
  while (a < 8 && b < 8) if (field[a++][b++] == 'Q') ng = true;
  a = x, b = y;
  while (a >= 0 && b < 8) if (field[a--][b++] == 'Q') ng = true;
  a = x, b = y;
  while (a < 8 && b >= 0) if (field[a++][b--] == 'Q') ng = true;
  return ng;
}

void rec(int row){
  if (row == 8){
    rep(i, 8) cout <<field[i] <<endl;
    return;
  }
  // 各行について考える
  bool ok = false; rep(i, 8) ok = ok | (field.at(row).at(i) == 'Q');
  if (ok) rec(row+1);
  // Queenが置かれていなかった場合、置けるところに置く
  rep(j, 8){
    if (check(row, j)) continue;
    field[row][j] = 'Q';
    rec(row+1);
    field[row][j] = '.';
  }
}

int main() {
  cin >>N;
  rep(q, N){
    int x,y; cin >>x >>y;
    field[x][y] = 'Q';
  }
  rec(0);
}


Measured memory_bytes: 3196
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    n, d, a = ns()
    x = []
    for _ in range(n):
        xi, hi = ns()
        x.append([xi, hi])

    x.sort()
    x.append([INF, INF])

    perm = [0 for _ in range(n + 1)]
    idx = [xi for xi, hi in x]

    ans = 0
    cnt = 0
    for i in range(n):
        cnt -= perm[i]

        if x[i][1] - cnt * a > 0:
            tmp = ((x[i][1] - cnt * a) + a - 1) // a
        else:
            tmp = 0
        ans += tmp
        cnt += tmp

        if cnt > 0:
            tmp_idx = bisect.bisect_right(idx, x[i][0] + 2 * d)
            perm[tmp_idx] += tmp

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 50868
#include <vector>
#include <functional>

using namespace std;

template<typename T>
class SegmentTree
{
    int n;
    function<T(T,T)> op;
    vector<T> V;

    T q(int l, int r)
    {
        if (l >= r)
            return V[0];
        T a = q((l+1)/2, r/2);
        if (l%2 != 0)
            a = op(a, V[l]);
        if (r%2 != 0)
            a = op(a, V[r-1]);
        return a;
    }

public:
    SegmentTree(int n_, function<T(T,T)> op, T init):
        op(op)
    {
        n = 1;
        while (n < n_)
            n *= 2;
        V = vector<T>(2*n, init);
        for (int i=n-1; i>0; i--)
            V[i] = op(V[i*2], V[i*2+1]);
    }

    T get(int p) const
    {
        return V[p+n];
    }

    void set(int p, T v)
    {
        p += n;
        V[p] = v;
        for (p/=2; p>0; p/=2)
            V[p] = op(V[p*2], V[p*2+1]);
    }

    //  init OP v[l] OP v[l+1] OP ... OP v[r-1]
    T query(int l, int r)
    {
        return q(l+n, r+n);
    }
};

#include <iostream>
#include <algorithm>

int main()
{
    int N, K;
    cin>>N>>K;
    vector<int> A(N);
    for (int &a: A)
        cin>>a;

    SegmentTree<int> ST(300001, [&](int a, int b){return max(a, b);}, 0);
    for (int i=0; i<N; i++)
    {
        int t = ST.query(max(0, A[i]-K), min(300001, A[i]+K+1));
        ST.set(A[i], t+1);
    }
    cout<<ST.query(0, 300001)<<endl;
}


Measured memory_bytes: 8164
#include<bits/stdc++.h>
#define pi 3.1415926535897932384626
using namespace std;
      
struct P{
  int x,y;
  bool operator < (const P &a )const{
    //if(x!=a.x)
    return x<a.x;
  };
};

int a,b,c,d,i,k,n,m,e,dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1};
int o[100101];
int l[100101][33];
int j[1];

long long x,y,z,mod=1000000007;
//string r;
char r[1];

P u[1];
//queue<int> q;
//stack<int> s;
set<P> s;
map<int,int> p;

vector<int> v;

bool as(P a,P b)
{
  //if(a.x!=b.x)
  //return a.x<b.x;
  return a.x<b.x;
}

int main()
{
  scanf("%d",&a);
  for(int t=1;t<=a;t++)
  {
    scanf("%d",&o[t]);
    s.insert({o[t],t});
  }
  scanf("%d %d",&b,&c);
  for(int t=1;t<a;t++)
  {
    set<P>::iterator p=s.lower_bound({o[t]+b+1,0});
    p--;
    m=(*p).y;
    l[t][0]=m;
  }
  l[a][0]=a;
  for(int h=1;h<=20;h++)
  for(int t=a;t;t--)
    l[t][h]=l[l[t][h-1]][h-1];
  for(int t=1;t<=c;t++)
  {
    scanf("%d %d",&n,&m);
    if(n>m) swap(n,m);
    k=0;
    for(;l[n][0]<m;)
    {
      int i=0,p=1;
      for(;l[n][i+1]<m;i++,p*=2);
      k+=p;
      n=l[n][i];
    }
    printf("%d\n",k+1);
  }
}
//1
//21



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


int main(){
	int a,b,wa=1;
	cin>>a>>b;
	for(int i=0;i<a;i++){
		if((wa*2)<(wa+b)){wa*=2;}
		else {wa+=b;}
	}
	cout<<wa<<endl;
	
}


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

#define MAX 100

using namespace std;

int n,m;
char chair[MAX+2];
 
void A(){
  for(int i = 1 ; i <= n ; i++){
    if(chair[i] == '#'){
      chair[i] = 'A';
      return;
    }
  }
}

void B(){
  int pos = -1;
  
  for(int i = 1 ; i <= n ; i++){
    if(chair[i] == 'A'){
      pos = i;
      break;
    }
  }
  
  if(pos == -1){
    for(int i = n ; i > 0 ; i--){
      if(chair[i] == '#'){
        chair[i] = 'B';
        return;
      } 
    }
  }
  else{
    for(int i = n ; i > 0 ; i--){
      if(chair[i] == '#' && chair[i-1] != 'A' && chair[i+1] != 'A'){
	chair[i] = 'B';
	return;
      }
    }
 
    for(int i = 1 ; i <= n ; i++){
      if(chair[i] == '#'){
        chair[i] = 'B';
        return;
      }
    }
  }
}
 
void C(){
  int cnt = count(chair,chair+n,'#');
 
  if(cnt == n){
    if(n % 2){
      chair[(n+1)/2] = 'C';
    }
    else{
      chair[n/2+1] = 'C';
    }
  }
  else{
    for(int i = 1 ; i <= n ; i++){
      if(chair[i] != '#' && chair[i+1] == '#' && i != n){
        chair[i+1] = 'C';
        return;
      }
      if(chair[i] != '#' && chair[i-1] == '#' && i != 1){
        chair[i-1] = 'C';
        return;
      }
    }
  }
}
 
void D(){
  int Breadth = 0, pos;
  int cnt = count(chair,chair+n,'#');

  if(cnt == n){
    chair[1] = 'D';
    return;
  } 

  for(int i = 1 ; i <= n ; i++){
    int dist = (1<<29);
    if(chair[i] != '#') continue;
    for(int j = 1 ; j <= n ; j++){
      if(chair[j] != '#'){
        dist = min(dist,abs(j-i)+1);
      }
    }
    if(Breadth < dist){
      Breadth = dist;
      pos = i;
    } 
  }
 
  chair[pos] = 'D';
}
 
int main(){
  while(cin >> n >> m , n | m){
    char person;
 
    for(int i = 0 ; i <= n+1 ; i++){
      chair[i] = '#';
    }
 
    for(int i = 0 ; i < m ; i++){
      cin >> person;
      
      switch(person){
      case 'A': 
        A(); 
        break;
      case 'B': 
        B(); 
        break;
      case 'C': 
        C(); 
        break;
      case 'D': 
        D(); 
        break;
      }
 
    }
 
    for(int i = 1 ; i <= n ; i++){
      cout << chair[i];
    }
    cout << endl;
  }
 
  return 0;
}

Measured memory_bytes: 1148
#!/usr/bin/env python3

def main():
    N = int(input())
    conditions = []
    for i in range(N):
        conditions.append(list(map(int, input().split())))

    conditions.sort(key = lambda v: v[2], reverse = True)

    rcx, rcy = -1, -1
    rH = 0
    for cx in range(101):
        for cy in range(101):
            f = True
            max_H = 10 ** 10
            H = 0
            for i in range(N):
                x, y, h = conditions[i]
                if 0 < h:
                    if H == 0:
                        H = h + abs(x - cx) + abs(y - cy)
                    elif H != h + abs(x - cx) + abs(y - cy):
                        f = False
                        break
                else:
                    if x == cx and y == cy:
                        f = False
                        break
                    max_H = min(max_H, abs(x - cx) + abs(y - cy))
                    if max_H < H:
                        f = False
                        break
            if f:
                rcx, rcy, rH = cx, cy, H
                break
        if 0 < rH:
            break


    print('{} {} {}'.format(rcx, rcy, rH))


if __name__ == '__main__':
    main()



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


int main() {
    long long A, B, K;
    //配列の初期化
    cin >> A >> B >> K;

    if(K <= A){
        cout << A - K << " " << B << endl;
    }

    else if(K <= A + B){
        cout << 0 << " " << B + A - K << endl;
    }

    else{
        cout << 0 << " " << 0 << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(int argc, char const* argv[])
{

    int a, b, c;
    std::cin >> a >> b >> c;

    auto tmp = b / a;
    if(tmp >= c)
    {
        std::cout << c << std::endl;
    }
    else
    {
        std::cout << tmp << std::endl;
    }
}

Measured memory_bytes: 256
A, B, C, D = map(int, input().split())

def solve(A,B,C,D):
    dx,dy = C-A,D-B
    x,y = C-dy,D+dx
    ans = [x,y]
    x,y = x-dx,y-dy
    ans.append(x)
    ans.append(y)
    return ans
print(*solve(A,B,C,D),sep=' ')

Measured memory_bytes: 3060
n = int(input())
a = []
b = []
ku = []
for i in range(n):
    tmp_a, tmp_b = map(int, input().split())
    a.append(tmp_a)
    b.append(tmp_b)
if a == b:
    print(0)
    exit()
    
ans = 10**9 + 7
for i in range(n):
    if a[i] - b[i] > 0:
        ans = min(b[i], ans)
print(sum(a) - ans)

Measured memory_bytes: 4980
N = gets.to_i
a = gets.split(' ').map(&:to_i).sort
b = a.uniq

ans = "No"
if b.size == 1 && b[0] == 0
	ans = "Yes"
end
if N % 3 == 0 && a[0] == a[N/3-1] && a[N/3] == a[N*2/3-1] && a[N*2/3] == a[N-1] &&a[0] ^ a[N/3] == a[N*2/3]
	ans = "Yes"
end

puts ans

Measured memory_bytes: 13216
import sys
input=sys.stdin.readline
n=int(input())
h_list=list(map(int,input().split()))
h_list[0]-=1
import sys
for i in range(1,n):
    if h_list[i]==h_list[i-1]:
        pass
    elif h_list[i]>h_list[i-1]:
        h_list[i]-=1
    else:
        print('No')
        sys.exit()
print('Yes')


Measured memory_bytes: 59632
#include <stdio.h>
int main(){
  int x,y,gcd;

  scanf("%d%d",&x,&y);

  if(x>=y){
    gcd=x%y;
    while(gcd!=0){
      x=y;
      y=gcd;
      gcd=x%y;
    }
    printf("%d\n",y);    
  }
  else{
    gcd=y%x;
    while(gcd!=0){
      y=x;
      x=gcd;
      gcd=y%x;
    }
    printf("%d\n",x);
  }
}
      
      



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

#define gcd(a,b)		__gcd(a,b)
#define lcm(a,b)		(a*b)/gcd(a,b)
#define ff              first
#define ss              second
#define int             long long
#define pb              emplace_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             INT_MAX
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(x)			x.begin(),x.end()
#define digits(x)		floor(log10(x))+1
#define FIO				ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

class dsu {
private:
	int *id;
	int* sz;

	int root(int i) {
		while (i != id[i]) {
			id[i] = id[id[i]];
			i = id[i];
		}
		return i;
	}
public:
	int n;
	dsu(int v) {
		n = v;
		id = new int[n];
		sz = new int[n];

		for (int i = 0; i < n; i++) {
			id[i] = i;
			sz[i] = 0;
		}
	}

	bool find(int p , int q) {
		return root(p) == root(q);
	}

	void join(int p , int q) {
		int i = root(p);
		int j = root(q);
		if (i == j) {
			return;
		}
		if (sz[i] < sz[j]) {
			id[i] = j ;
			sz[j] += sz[i];
		}
		else {
			id[j] = i;
			sz[i] += sz[j];
		}
	}
};

int nCr(int n , int r ) {
	int p = 1, k = 1;

	if (n - r < r ) {
		r = n - r;
	}
	if (r != 0) {
		while (r != 0) {
			p *= n ;
			k *= r ;
			int m = __gcd(p, k);
			p /= m;
			k /= m;
			n--;
			r--;
		}
	}
	else {
		p = 1;
	}
	return p ;
}

int modPower(int x, int y , int p) {
	//Used to calculate (x^y)%p
	int res = 1;
	if (y == 0) {
		return 1;
	}

	x = x % p;
	if (x == 0) {
		return 0  ;
	}

	while (y > 0) {
		if (y & 1) {
			res = (res * x) % p;
		}

		y >>= 1;
		x = (x * x) % p;
	}
	return res ;

}


int32_t main() {
	FIO;


	int n ;
	cin>>n;

	pair<int,int> a[n];
	for(int i = 0 ; i<n ;i++){
		cin>>a[i].ff;
		a[i].ss = (i+1);
	}

	int count = 0; 
	for(int i = 0 ; i<n ;i++){
		if(a[i].ff!=a[i].ss){
			count++;
		}
	}

	if(count>2){
		cout<<"NO\n";
	}
	else{
		cout<<"YES\n";
	}





	return 0;
}


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

int main() {

  int N;
  cin >> N;
 int A[N+1];
  long long int stock=0;
  long long int money=1000;
  A[0]=0;
  for(int i=1;i<N+1;i++){
    cin >>A[i];
  }
  for(int i=1;i<N;i++){
   if(A[i+1]>A[i]){
     stock=stock+(money/A[i]);
     money=money%A[i];
   }
    if(A[i]>A[i+1]){
     money=money+stock*A[i];
      stock=0;
    }
  }
  money=money+stock*A[N];
  
  cout<<money<<endl;
  
 return 0;
}


Measured memory_bytes: 3580
N, M, C = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
A = []
for _ in range(N):
    A_ = [int(a) for a in input().split()]
    A.append(A_)

ans = 0

for i in range(N):
    r = C
    for j in range(M):
        r += A[i][j]*B[j]
    if r > 0:
        ans += 1

print(ans)


Measured memory_bytes: 9172
#include<bits/stdc++.h>
#pragma GCC optimize("O2")
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define endl "\n"
#define sz(u) (int)(u.size())
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
void solve(){
    double a,b,n;
    cin>>a>>b>>n;
    if(n<b){
            /*int maxx=0;
        for(int i=1;i<=n;i++){
            maxx=max(maxx,int(floor(a*i/b)-a*(floor(i/b))));
        }
        cout<<maxx<<endl;
        */
        cout<<floor(a*n/b);
    }
    else{
        cout<<int(floor(a*(b-1)/b));
    }
    }
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    }


Measured memory_bytes: 3692
N = int(input())
S = input()
C = []

if S == S[0] * N:
  print(1)
else:
  for i in range(1, N):
    count = 0
    X = list(set(S[0:i]))
    Y = list(set(S[i:]))
    for j in range(len(X)):
      if Y.count(X[j]) > 0:
        count += 1
    C.append(count)

  print(max(C))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define cla(a,b) memset(a,b,sizeof a)
using namespace std;
inline char nc()
{
    static char buf[100000],*p1=buf,*p2=buf;
    if (p1==p2) { p2=(p1=buf)+fread(buf,1,100000,stdin); if (p1==p2) return EOF; }
    return *p1++;
}
//#define  getchar() nc()
inline int read()
{
	int x = 0 , f = 1; char CH = getchar();
	while(CH<'0'||CH>'9') {if(CH=='-')f=0;CH=getchar();}
	while(CH>='0'&&CH<='9') {x=(x<<3)+(x<<1)+(CH-48);CH=getchar();}
	return f ? x : -x;
}
const int N=206;
int Q,n,m,vis[31];
inline bool work()
{
    int i,j;
    int ff,tot2,tot4=(n>>1)*(m>>1);
    if( (!(n&1)) && (!(m&1)) )		tot2=0;
    else if( (n&1) && (m&1) )		tot2=(n>>1)+(m>>1);
    else if( (n&1) && (!(m&1)) )	tot2=(m>>1);
    else tot2=(n>>1);
    for(i=1;i<=tot4;++i)
    {
    	ff=0;
        for(j=0;j<26;++j)
            if(vis[j]>=4)
            {
                ff=1; vis[j]-=4;
                break;
            }
        if(!ff) return false;
    }
    for(i=1;i<=tot2;++i)
    {
    	ff=0;
        for(j=0;j<26;++j)
            if(vis[j]>=2)
            {
                ff=1; vis[j]-=2;
                break;
            }
        if(!ff) return false;
    }
    return true;
}

int main(){
    int i,j;
    Q=1;
    while(Q--)
    {
        n=read(),m=read();
        char s[203][203];
        cla(vis,0);
        for(i=1;i<=n;++i)	scanf("%s",s[i]+1);
        for(i=1;i<=n;++i)for(j=1;j<=m;j++) ++vis[s[i][j]-'a'];
        if(work())
            printf("Yes\n");
        else
            printf("No\n");
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<map>
#include<ctime>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<bitset>
#include<string>
#define ll long long 
#define ull unsigned long long 
#define mem(a) memset(a,0,sizeof(a))
#define rint register int 
#define rll register long long 
#define rull register unsigned long long 
#define rchar register char
#define rstring register string 
#define rfloat register float
#define rdouble register double 
#define fio ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define For(i,a,b) for(int i=a;i<b;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define cFor(i,a,b) for(int i=a;i>b;i--)
#define cFOR(i,a,b) for(int i=a;i>=b;i--)
#define lFor(i,a,b) for(ll i=a;i<b;i++)
#define lFOR(i,a,b) for(ll i=a;i<=b;i++)
#define lcFor(i,a,b) for(ll i=a;i>b;i--)
#define lcFOR(i,a,b) for(ll i=a;i>=b;i--)
using namespace std;
int main()
{
   int a[25],b[3];
   int n,ans=0;
   cin>>n;
 for(int i=0;i<n;i++)
 {
  cin>>a[i];
 }
 for(int i=1;i<n-1;i++)
 {
 b[0]=a[i-1];
 b[1]=a[i];
 b[2]=a[i+1];
  sort(b,b+3);
  if(b[1]==a[i])
  {
  	ans++; 
  }
     
 }
 cout<<ans;
 
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[3];
  for(int i = 0; i < 3; i++) scanf("%d", &a[i]);
  sort(a, a+3);
  if((a[0] == a[1] && a[1] == 5) && a[2] == 7) printf("YES\n");
  else printf("NO\n");
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        String[] s = new String[h];
        for (int i = 0; i < h; i++) {
            s[i] = sc.next();
        }
        for (int i = 0; i < h; i++) {
            System.out.println(s[i]);
            System.out.println(s[i]);
        }
    }
}


Measured memory_bytes: 21972
#include "bits/stdc++.h"
using namespace std;
#define inf 1e9
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#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 repf(i, x, n) for (ll i = (ll)(x); i < (ll)(n); i++)
#define repfr(i, n, x) for (ll i = (ll)(n)-1; i >= (ll)(x); i--)
using ll = int64_t;

void Main() {
  int n, k;
  std::cin >> n >> k;
  std::vector<int> a(n);
  std::set<int> s;
  for (auto &x : a) {
    std::cin >> x;
    s.insert(x);
  }

  std::vector<int> v(n + 1, 0);
  for (auto &x : a) {
    v[x]++;
  }

  int k_now = s.size();
  for (auto &x : v) {
    if (x) {
    } else {
      x = inf;
    }
  }

  sort(all(v));
  int need = k_now - k;
  int ans = 0;
  rep(i, need) { ans += v[i]; }

  std::cout << ans << '\n';

  return;
}

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


Measured memory_bytes: 11136
using System;
using System.Collections.Generic;

namespace abc169
{
    class Program
    {
        static void Main()
        {
            var n = int.Parse(Console.ReadLine());
            var aList = new int[n];
            var bList = new int[n];
            for (var i = 0; i < n; ++i)
            {
                var ab = Console.ReadLine().Split(' ');
                aList[i] = int.Parse(ab[0]);
                bList[i] = int.Parse(ab[1]);
            }
            Array.Sort(aList);
            Array.Sort(bList);
            var center = n / 2;
            long naturalCount = bList[center];
            naturalCount -= aList[center];
            if (n % 2 == 0)
            {
                naturalCount += bList[center - 1];
                naturalCount -= aList[center - 1];
            }
            naturalCount += 1;
            Console.WriteLine(naturalCount);
        }
    }
}


Measured memory_bytes: 42032
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>

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

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

char startQ(int l,int n) {
	std::cout << "? ";
	for(int i=0;i<n;i++) {
		std::cout << i+l << ' ';
	}
	std::cout << std::endl << std::flush;
	std::string s;
	std::cin >> s;
	return s[0];
}
char find(int i, int l, int n) {
	std::cout << "? ";
	for(int x=0;x<n-1;x++) {
		std::cout << x+l << ' ';
	}
	std::cout << i;
	std::cout << std::endl << std::flush;
	std::string s;
	std::cin >> s;
	return s[0];
}
char find2(int i, int l, int n) {
	std::cout << "? ";
	for(int x=0;x<=n;x++) {
		if(x+l==i) continue;
		std::cout << x+l << ' ';
	}
	std::cout << std::endl << std::flush;
	std::string s;
	std::cin >> s;
	return s[0];
}
char rev(char c) {
	if(c=='R') return 'B';
	return 'R';
}

signed main() {
	int n;
	std::cin >> n ;
	char lc,rc;
	lc = startQ(1,n);
	rc = startQ(n+1,n);
	int l=1;int r=n+1;
	while(r-l>1) {
		int mid = (l+r)/2;
		if(startQ(mid,n)==lc) l=mid;
		else r=mid;
	}
	std::vector<char> ans(2*n+1);
	ans[l] = lc; ans[r+n-1] = rc;
	for(int i=1;i<l;i++) {
		ans[i] = find(i,r,n);
	}
	for(int i=r+n;i<=2*n;i++) {
		ans[i] = find(i,r,n);
	}
	for(int i=r;i<r+n-1;i++) {
		ans[i] = rev(find2(i,l,n));
	}
	std::cout << "! ";
	for(int i=1;i<=2*n;i++) {
		std::cout << ans[i];
	}
	std::cout << std::endl;
	return 0;
}


Measured memory_bytes: 724
#include <bits/stdc++.h>
 
using namespace std;
 
string s1,s2;
long ans;
 
int main()
{
    cin>>s1>>s2;
    for(int i=0;i<s1.size();i++)
        if(s1[i]!=s2[i])
            ans++;
    cout<<ans; 
    return 0;
}

Measured memory_bytes: 3828