akhauriyash/Code-Regression huggingface dataset:
function memoization(f) {
  const cache = {};
  return (...param) => {
    const c = cache[param];
    return typeof c === 'undefined' ? cache[param] = f(...param) : c;
  };
}

class _Node {
  constructor(id, parentId, leftId, rightId) {
    this.id = id;
    this.parentId = parentId;
    this.leftId = leftId;
    this.rightId = rightId;
  }
  get type() {return this.parentId === -1 ? 'root' : this.leftId === -1 && this.rightId === -1 ? 'leaf' : 'internal node'}
}

class BinaryTree {
  constructor() {
    this.nodes = [];
    this._nodeInfo = [];
    this.getDepth = memoization(this.getDepth.bind(this));
    this.getHeight = memoization(this.getHeight.bind(this));
  }
  static get Node() {return _Node;}

  add(id, leftId, rightId) {this.nodes[id] = new BinaryTree.Node(id, -1, leftId, rightId);}
  find(id) {return this.nodes[id]}
  connect() {
    for (let i = 0; i < this.nodes.length; i++ ) this._nodeInfo[i] = {node:null, sibling:-1, degree:0};
    this.nodes.forEach(n => {
      if (n.leftId !== -1) {
        this.nodes[n.leftId].parentId = n.id;
        this._nodeInfo[n.leftId].sibling = n.rightId;
      }
      if (n.rightId !== -1) {
        this.nodes[n.rightId].parentId = n.id;
        this._nodeInfo[n.rightId].sibling = n.leftId;
      }
    });
    this.nodes.forEach(n => {
      this._nodeInfo[n.id] = {sibling: this._nodeInfo[n.id].sibling, node: n, degree: (n.leftId !== -1) + (n.rightId !== -1)}
    });
  }
  getDepth(id, i = 0) {
    let pid = this.find(id).parentId;
    return pid === -1 ? i : this.getDepth(pid, i + 1);
  }
  getHeight(id, i = 0) {
    if (id === -1) return i - 1;
    let n = this.find(id);
    return Math.max(this.getHeight(n.leftId, i + 1), this.getHeight(n.rightId, i + 1))
  }
  print() {
    console.log(this._nodeInfo.map(o =>
      `node ${o.node.id}: parent = ${o.node.parentId}, sibling = ${o.sibling}, degree = ${o.degree}, depth = ${this.getDepth(o.node.id)}, height = ${this.getHeight(o.node.id)}, ${o.node.type}`
    ).join('\n'));
  }
}

(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());
  let tree = new BinaryTree();
  lines.map(l => l.split(' ').map(Number)).forEach(line => tree.add(...line));
  tree.connect();
  tree.print();
})();



Measured memory_bytes: 16448
import numpy as np
import itertools


def pd(s):
    #print(s)
    pass


# input
H, W, M = map(int, input().split())
ms = [
    [int(i) for i in input().split()]
    for m in range(M)
]
pd(f"{H=} {W=} {M=}")
pd(f"{ms=}")

rows = [0]*(H+1)
cols = [0]*(W+1)
bombs = {}
for h,w in ms:
    rows[h] += 1
    cols[w] += 1
    bombs[f"{h},{w}"] = True

rmax = max(rows)
cmax = max(cols)
rmax_hs = [i for i, v in enumerate(rows) if v == rmax]
cmax_wh = [i for i, v in enumerate(cols) if v == cmax]

for h,w in itertools.product(rmax_hs, cmax_wh):
    if f"{h},{w}" not in bombs:
        print(rmax + cmax)
        exit()
print(rmax + cmax - 1)


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

#define ll long long
#define pb push_back
#define ep emplace_back
#define st first
#define sc second

using namespace std;

const ll mod = 1e9 + 7;
const int e = 1e6 + 69;
const int base = 311;

// dung inverse module de tinh kCn
// 68
// cach tao hoan vi tu n so : n*(n+1)/2;

//vector<ll>adj[e];
ll gt[e], igt[e], a[e];

/*ll Pow(ll n, ll dem)
{
    if(dem == 0) return 1;
    if(dem == 1) return n % mod;
    ll t = Pow(n, dem/2);
    if(dem % 2 == 0) return (t%mod*t%mod)%mod;
    else return ((t%mod * t%mod)%mod * n %mod)%mod;
}

ll C(ll k, ll n)
{
    if(k == 0) return 1;
    if(n < k) return 0;
    return (gt[n]%mod * (igt[k]%mod * igt[n-k]%mod)%mod)%mod;
}
*/
int n, m;


int main()
{
    cin >> n >> m;
    map<ll, map<ll,ll>>adj;
    for(int i=1; i<=m; i++)
    {
        ll x, y;
        cin >> x >> y;
        adj[x][y] ++;
    }
    for(int i=2; i<n; i++)
    {
        if(adj[1][i] && adj[i][n])
        {
            cout << "POSSIBLE";
            return 0;
        }
    }
    cout <<"IMPOSSIBLE";

}
/*
10 1
306<<>4>04
1 10

3 1 1 2 3 1 1 0 0 0
*/


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

int main()
{
    int n,lb=0,ub=1; cin>>n;
    vector<string> v;
    vector<string> ans;
    v.push_back("a");
    for(int i=2;i<=n;i++)
    {
        int tub=ub;
        while(lb<ub)
        {
            string s=v[lb];
            bool vis[26]={false};
            for(int j=0;j<s.size();j++)
            {
                if(!vis[s[j]-'a'])
                {
                    string t=s+s[j];
                    vis[s[j]-'a']=true;
                    v.push_back(t);
                    tub++;
                    if(i==n)
                        ans.push_back(t);
                }
            }
            char ch;
            for(int j=0;j<26;j++)
            {
                if(!vis[j])
                {
                    ch='a'+j;
                    break;
                }
            }
            string t=s+ch;
            v.push_back(t);
            tub++;
            if(i==n)
            ans.push_back(t);
            lb++;
        }
        lb=ub;
        ub=tub;
    }
    if(n==1)
        cout<<"a"<<endl;
    for(int i=0;i<ans.size();i++)
        cout<<ans[i]<<endl;
}


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

using ll = long long;
using pp = pair<ll,ll>;
const ll amari = 1e9+7;
const char BC = 'A' - 'a';
#define ben(a) a.begin(),a.end()
#define pb(a,b) a.push_back(b)
//fixed << setprecision(20)

int main(){
	ll n,k,q;
	cin >> n >> k >> q;
	ll a[n] = {};
	int b;
	for(int i = 0; i < q; i++){
		cin >> b;
		a[b - 1]++;
	}
	for(int i = 0; i < n; i++){
		if(k - (q - a[i]) > 0)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}
 

Measured memory_bytes: 1408
C,D = [int(e) for e in input().split()]

if C <= D:
    m = D
    n = C
else:
    m = C
    n = D

while  n != 0 :
    a = m%n
    m = n
    n = a

J = []

for i in range(1,int(m**0.5)+1):
    if m % i == 0:
        J.append(i)
        if i != m//i:
            J.append(m//i)


J.sort()

N = int(len(J))
M = [1]

for i in range(1,N):
    cnt = 0
    for p in range(1,int(J[i]**0.5)+1):
        if J[i]%p == 0:
            cnt += 1
            if cnt >=2:
                break
    if cnt == 1:
        M.extend([J[i]])


M = int(len(M))

print(M)

Measured memory_bytes: 3276
#include <stdio.h>

int main(void)
{
	int num;
	int dig;
	int sum;
	int n, a, b,j=0;
	scanf("%d %d %d", &n, &a, &b);

	for (int i = 1; i <= n; i++) {
		num = i;
		sum = 0;
		/* 自然数の各桁の数字の和を計算 */
		while (num) {
			dig = num % 10;
			sum = sum + dig;
			num = num / 10;
		}
		if (sum >= a && sum <= b) j += i;
	}
	printf("%d", j);
	return 0;
}

Measured memory_bytes: 128
now = {"t":0,"x":0,"y":0}
can = True
for i in range(int(input())):
    t,x,y = map(int,input().split())
    dx = abs(x - now["x"]) #x距離
    dy = abs(y - now["y"]) #y距離
    d = dx + dy #距離合計
    if d > t-now["t"] or d%2 != (t-now["t"])%2:
        print("No")
        can = False
        break
    now = {"t":t,"x":x,"y":y}
if can:
    print("Yes")

Measured memory_bytes: 3064
W,H,x,y = map(int, input().split())

# quad = [[0,0],[W,0],[W,H],[0,H]] 
# S = (quad[1][0]-quad[0][1]) * (quad[2][1]-quad[0][1])
S = W*H
ans = 0

if W/2 == x and H/2 == y:
    ans = 1

print(S/2 , ans)


Measured memory_bytes: 2940
#include<iostream>
using namespace std;
const int MOD = 1000000007;
int ans[100000];
long long int POW(int n,int k){
	long long int r;
	if(k==0)return 1;
	r=POW(n,k/2)%MOD;
	r=(r*r)%MOD;
	if(k%2)r=(n*r)%MOD;
	return r;
}
long long int solve(int n,int k){
	long long int sum=0;
	//k以下の自然数n個が互いに素になるのは何通りか
	//k^nから最大公約数が1より大きいものを全部引く
	if(ans[k]>=1)return ans[k];
	sum = POW(k,n);
	for(int i=2;i<=k;i++){//最大公約数がiになるものの個数
		sum-=solve(n,k/i);
		sum=(sum+MOD)%MOD;
	}
	ans[k]=sum;
	return sum;
}
int main(){
	int N,K;
	long long int sum=0;
	cin>>N>>K;
	ans[1]=1;
	for(int i=1;i<=K;i++){
		sum+=i*solve(N,K/i);
		sum%=MOD;
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 3696
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

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

//scanf("%lld", &);
//cin >> ;
//cout << ans << endl;

ll N, M, K, i, j, k, l, ans, cnt = 0;

typedef struct _F{
    ll sum = 0;
    vector<ll> A;
}F;

bool fCheck(F f, ll X){
    ll i;
    REP(i, f.A.size()){
        if(f.A.at(i) < X){
            return false;
        }
    }
    return true;
}

int main(){
    //cin >> ;
    //cout << ans << endl;
    ll X, tmp, c, a;
    vector<ll> C;
    vector<vector<ll>> A;

    scanf("%lld", &N);
    scanf("%lld", &M);
    scanf("%lld", &X);

    REP(i, N){
        scanf("%lld", &c);
        C.push_back(c);
        vector<ll> init;
        A.push_back(init);
        REP(j, M){
            scanf("%lld", &a);
            A.at(i).push_back(a);
        }
    }

    queue<F> q;
    F f;
    REP(i, M){
        f.A.push_back(0);
    }

    q.push(f);

    ans = INF;

    REP(i, N){
        ll si = q.size();
        REP(k, si){
            F fTmp;
            fTmp = q.front();
            q.pop();
            //加算しないパターン追加
            q.push(fTmp);
            //加算するパターン追加
            REP(j, M){
                fTmp.A.at(j) += A.at(i).at(j);
            }
            fTmp.sum += C.at(i);
            if(fCheck(fTmp,X)){
                chmin(ans, fTmp.sum);
            }
            else{
                q.push(fTmp);
            }
        }
    }

    if(ans == INF){
        ans = -1;
    }

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

Measured memory_bytes: 4224
#include<iostream>

using namespace std;
const int N = 100;
const int UNVISITED = 0;
const int VISITING = 1;
const int VISITED = 2;
int A[N][N];
int state[N], d[N], f[N];
int n, tt;
int nt[N];

void dfs_visit(int u) {
   
	state[u] = VISITED;
	d[u] = ++tt;

	for( int v =0; v < n; v++ ) {
		if( A[u][v] && state[v] == UNVISITED ) dfs_visit(v);
	}
	f[u] = ++tt;
}
void dfs() {
   for( int i = 0; i < n; i++) {
   	 state[i]=UNVISITED;
   }
   tt = 0;

   for( int u = 0; u < n; u++ ) {
   		if( state[u] == UNVISITED ) dfs_visit(u);
   }

   for ( int i = 0; i < n; i++ ) {
   		cout << i+1 << " " << d[i] << " " << f[i] << endl;
   }


}
int main() {
	int u, k, v;
	cin>>n;
	for( int i = 0; i < n; i++ ) {
		for( int j = 0; j< n; j++ ) A[i][j] = 0;
	}
	
	for ( int i = 0; i < n; i++ ) {
		cin >> u >> k;
		u--;
		while( k-- ) {
			cin >> v;
			A[u][ v - 1] = 1;
		}
	}
	dfs();

	return 0;
}


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

int main(){
  string A,B,C;
  cin>>A>>B>>C;
  
  int x=A.size();
  int y=B.size();
  
  if((A.at(x-1)==B.at(0))&&(B.at(y-1)==C.at(0))){
    cout<<"YES"<<endl;
  }
  else{cout<<"NO"<<endl;
      }
}
  
  
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    ll N; cin >> N;

    if (N == 2) {
        cout << 1 << endl;
        return 0;
    }

    set<int> S;
    for (ll i = 1; i * i <= (N - 1); i++) {
        ll tmp = N - 1;
        if (tmp % i != 0) continue;

        S.insert(i);
        S.insert(tmp / i);
    }

    for (ll i = 2; i * i <= N; i++) {
        ll tmp = N;
        if (S.find(i) != S.end()) continue;
        while (tmp % i == 0) tmp /= i;
        if (tmp == 1) {
            // cout << "tmp : " << tmp << " i : " << i << endl;
            S.insert(i);
        } else if (tmp > i && tmp % i == 1) {
            // cout << "tmp : " << tmp << " i : " << i << endl;
            S.insert(i);
        }
    }
    cout << S.size() << endl;
    
    return 0;
}

Measured memory_bytes: 256
s = input()
n = len(s)

arr = [0 for _ in range(n)]
r_arr = [0 for _ in range(n)]
l_arr = [0 for _ in range(n)]

for i in range(n - 1):
    if s[i] == "R" and s[i + 1] == "L":
        arr[i] += 1
        arr[i + 1] += 1

r_pos = []
for i in range(n - 1):
    if s[i] == "R":
        if s[i + 1] == "L":
            for r in r_pos:
                if (r - i) % 2 == 0:
                    r_arr[i] += 1
                else:
                    r_arr[i + 1] += 1
            r_pos = []
        else:
            r_pos.append(i)
l_pos = []
for i in range(n - 1, 0, -1):
    if s[i] == "L":
        if s[i - 1] == "R":
            for l in l_pos:
                if (l - i) % 2 == 0:
                    l_arr[i] += 1
                else:
                    l_arr[i - 1] += 1
            l_pos = []
        else:
            l_pos.append(i)

ans = [0 for _ in range(n)]
for i in range(n):
    ans[i] = str(arr[i] + r_arr[i] + l_arr[i])

print(" ".join(ans))



Measured memory_bytes: 12596
#import sys
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

#import numpy as np


def main():
	n,k=MI()
	p=LI()

	p.sort()

	print(sum(p[:k]))







if __name__ == "__main__":
	main()


Measured memory_bytes: 9280
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int a = sc.nextInt();
		sc.close();
		System.out.println((h / a) + (h % a == 0 ? 0 : 1));
	}

	public static int arrayMax(int[] array) {
		int ans = Integer.MIN_VALUE;
		for (int i = 0; i < array.length; i++) {
			if (array[i] > ans)
				ans = array[i];
		}
		return ans;
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
}

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

int main(){
int N,saveN,Kurai[9],root = 100000000,sum = 0;
cin >> N;
saveN = N;
for (int i=0;i<9;i++){
  Kurai[i] = N/root;
  if (Kurai[i]!=0){
    N -= Kurai[i]*root;
  }
  sum = sum + Kurai[i];
  root /= 10;
}
if (saveN%sum == 0){
  cout << "Yes" <<endl;
}else{
  cout << "No" <<endl;
}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n; cin >> n;
	string s; cin >> s;
	int b = 0;
	int w = 0;
	for( char c : s ){
		if( c == '.' ) ++w;
	}
	int ans = min(INF, b+w);
	for( char c : s ){
		if( c == '.' ) --w;
		if( c == '#' ) ++b;
		// cout << b+w << endl;
		ans = min(ans, b+w);
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
  string s;
  cin >> s;
  if(s[size(s) - 1] == 's'){
    cout << s + "es" << endl;
  } else{
    cout << s + "s" << endl;
  }
  return 0;
}
  

Measured memory_bytes: 3632
n,k=input().split()
n=int(n)
k=int(k)
p=list(map(int,input().split()))

s=[0]*(n+1)

for i in range(1,n+1):
  s[i]=s[i-1]+1/2*(p[i-1]+1)
res=s[k]
for i in range(n-k+1):
  res = max(res,s[i+k]-s[i])
print(res)


Measured memory_bytes: 25060
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////

int n;double dp[310][310][310];
int a[5];

double rec(int ii, int jj, int kk){
  if(dp[ii][jj][kk] != -1)return dp[ii][jj][kk];
  double i = ii, j = jj, k = kk, e = n/(i+j+k), ret = 0.0;
  if(ii != 0)ret += (rec(ii-1, jj, kk)+e)*i/(i+j+k); 
  if(jj != 0)ret += (rec(ii+1, jj-1, kk)+e)*j/(i+j+k); 
  if(kk != 0)ret += (rec(ii, jj+1, kk-1)+e)*k/(i+j+k);
  return dp[ii][jj][kk] = ret;
}

signed main(){
  cin>>n;
  rep(i,n){
    int aa;cin>>aa;a[aa]++;
  }
  rep(i,310)rep(j,310)rep(k,310)dp[i][j][k] = -1;
  dp[0][0][0] = 0.0;
  cout << fixed << setprecision(10) << rec(a[1],a[2],a[3]) << endl;;
}


Measured memory_bytes: 465792
#include <stdio.h>
int main() {
 
    int N, K;
    scanf("%d%d", &N, &K);
    int arr[N];
    for(int i=0;i<N;i++){
        scanf("%d", &arr[i]);
    }
 
    for(int j=0;j<N-K;j++){
        if(arr[j]<arr[j+K]){
            printf("Yes\n");
        } else {
            printf("No\n");
        }
    }
 
    return 0;
}

Measured memory_bytes: 2440
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  read::<String>().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
  (0..n).map(|_| read_vec()).collect()
}

pub trait LexicalPermutation {
  /// Return `true` if the slice was permuted, `false` if it is already
  /// at the last ordered permutation.
  fn next_permutation(&mut self) -> bool;
}
impl<T> LexicalPermutation for [T] where T: Ord {
  /// Original author in Rust: Thomas Backman <serenity@exscape.org>
  fn next_permutation(&mut self) -> bool {
    // These cases only have 1 permutation each, so we can't do anything.
    if self.len() < 2 { return false; }

    // Step 1: Identify the longest, rightmost weakly decreasing part of the vector
    let mut i = self.len() - 1;
    while i > 0 && self[i-1] >= self[i] {
      i -= 1;
    }

    // If that is the entire vector, this is the last-ordered permutation.
    if i == 0 {
      return false;
    }

    // Step 2: Find the rightmost element larger than the pivot (i-1)
    let mut j = self.len() - 1;
    while j >= i && self[j] <= self[i-1]  {
      j -= 1;
    }

    // Step 3: Swap that element with the pivot
    self.swap(j, i-1);

    // Step 4: Reverse the (previously) weakly decreasing part
    self[i..].reverse();

    true
  }
}
fn main() {
  let (n, m) = {
    let tmp: Vec<usize> = read_vec();
    (tmp[0], tmp[1])
  };

  let mut chart: Vec<(usize, usize)> = Vec::new();

  for _ in 0..m {
    let (a, b) = {
      let tmp: Vec<usize> = read_vec();
      (tmp[0], tmp[1])
    };
    chart.push((a, b));
  }

  let mut graph = vec![vec![false; n]; n];

  for (a, b) in chart {
    graph[a-1][b-1] = true;
    graph[b-1][a-1] = true;
  }


  let mut permutations: Vec<usize> = (0..n).collect();
  let mut count = 0;

  loop {
    let mut flag = true;
    for i in 0..n-1 {
      let a = permutations[i];
      let b = permutations[i + 1];
      if !graph[a][b] {
        flag = false;
        break;
      }
    }
    if permutations[0]==0 && flag { count += 1; }
    if !permutations.next_permutation() { break; }
  }
  println!("{}", count);
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

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

    ll h, w;cin >> h >> w;
    vector<P> v;
    REP(i, h){
        ll mi = INF;
        ll ma = -INF;
        REP(j, w){
            char c;
            cin >> c;
            if(c == 'B'){
                mi = min(mi, j);
                ma = max(ma, j);
            }
        }
        if(abs(mi) != INF)v.EB(i, mi);
        if(abs(ma) != INF)v.EB(i, ma);
    }

    ll ans = 0;
    REP(i, v.size()){
        REP(j, i){
            ans = max(ans, abs(v[i].FI - v[j].FI) + abs(v[i].SE - v[j].SE));
        }
    }

    cout << ans << endl;

	return 0;
}



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

struct node{
   struct node *right;
   struct node *left;
   struct node *parent;
  int key;
 };
typedef struct node * Node;

struct node *root, *NIL;

struct node *find(struct node *u, int k){
  while(u != NIL && k != u->key){
    if(k < u->key) u = u->left;
    else u = u->right;
  }
  return u;
}

void insert(int k){
  struct node *y = NIL;
  struct node *x = root;
  struct node *z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }else{
      x = x->right;
    }
  }

  z->parent = y;
  if(y == NIL){
    root = z;
  }else{
    if(z->key < y->key){
      y->left = z;
    }else{
      y->right = z;
    }
  }
}

void inorder(struct node *u){
  if(u == NIL) return ;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}

void preorder(struct node *u){
  if( u == NIL) return;

  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[5000];
  scanf("%d", &n);

  for(i=0;i<n;i++){
    scanf("%s", com);
    if(strcmp(com,"find")==0){
      scanf("%d", &x);
      struct node *t = find(root, x);
      if(t != NIL) printf("yes\n");
      else printf("no\n");
    }else if(strcmp(com,"insert")==0){
      scanf("%d", &x);
      insert(x);
    }else if(com[0] == 'p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}





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

using namespace std;

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

    int currentlyPassed = 0;
    int overseasSoFar = 0;

    for(int i=0; i<n; i++) {
        if(s[i] == 'a') {
            int cond = currentlyPassed < (a+b);
            currentlyPassed += cond;
            if(cond) cout<<"Yes\n";
            else cout<<"No\n";
        }
        else if(s[i] == 'b') {
            int cond = currentlyPassed < (a+b) && overseasSoFar < b;
            currentlyPassed += cond;
            overseasSoFar++;
            if(cond) cout<<"Yes\n";
            else cout<<"No\n";
        }
        else cout<<"No\n";
    }
	
	return 0;
}

Measured memory_bytes: 896
#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
#define ll long long
using namespace std;
int read(){
	int s=0,t=1;char c;
	while(!isdigit(c=getchar()))if(c=='-')t=-1;
	do{s=s*10+c-'0';}while(isdigit(c=getchar()));
	return s*t;
}
const int maxn=5010;
int n,m,a[210][maxn],f[210][maxn],s[maxn],w[maxn];
ll A[maxn],g[maxn];
int main(){
	n=read();m=read();
	for(int i=2;i<=n;i++)A[i]=read();
	for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)a[j][i]=read();
	int top=0;
	/*for(int i=1;i<=m;i++){
		for(int j=1;j<=n;j++)printf("%d ",a[i][j]);
		puts("");
	}*/
	for(int i=1;i<=m;i++){
		top=0;
		for(int j=n;j>=1;j--){
			while(top&&a[i][j]>=s[top])top--;
			if(top)f[i][j]=w[top];else f[i][j]=n+1;
			s[++top]=a[i][j];w[top]=j;
			//printf("[%d][%d]%d\n",i,j,f[i][j]);
		}
	}
	for(int i=1;i<=m;i++){
		int j=1;g[1]+=a[i][1];
		while(f[i][j]<=n)g[f[i][j]]+=a[i][f[i][j]]-a[i][j],j=f[i][j];
	}
	ll ans=-1ll<<60,sum=g[1];ans=max(ans,sum);
	//for(int j=1;j<=n;j++)printf("%lld ",g[j]);puts("");
	for(int i=2;i<=n;i++)ans=max(ans,sum=sum-A[i]+g[i]);//,printf("sum=%lld\n",sum);
	for(int k=2;k<=n;k++){
		for(int i=1;i<=m;i++){
			int j=k,pre=0;//g[k]+=a[i][k];
			//while(f[i][j]<=n&&f[i][j]!=f[i][k-1])g[f[i][j]]+=a[i][f[i][j]]-a[i][j],j=f[i][j];
			while(j<=n&&j!=f[i][k-1])g[j]+=a[i][j]-a[i][pre],pre=j,j=f[i][j];
			//printf("[%d]",j);
			//g[f[i][j]]-=a[i][f[i][j]]-a[i][k-1];g[f[i][j]]+=a[i][f[i][j]]-a[i][j];
			g[j]-=a[i][j]-a[i][k-1];g[j]+=a[i][j]-a[i][pre];
		}//puts("");
		sum=g[k];ans=max(ans,sum);
		for(int j=k+1;j<=n;j++)ans=max(ans,sum=sum-A[j]+g[j]);
		//for(int j=1;j<=n;j++)printf("%lld ",g[j]);puts("");
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 8320
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
pair<long,long> p[maxn];
long long  par[maxn],s[maxn],sum,ans[maxn];
long long find(long long x){ 
	return par[x]==x?x:par[x]=find(par[x]); 
}
int main() {
    long long n,m;
    cin>>n>>m;
    for (int i=1;i<=n;i++) {
        par[i]=i;
        s[i]=1;
    }
    for(int i=0;i<m;i++) {
        cin>>p[i].first>>p[i].second;
    }
    sum=1LL*n*(n-1)/2;
    for(int i=m-1;i>=0;i--) {
        ans[i]=sum;
        int x=find(p[i].first),y=find(p[i].second);
        if(x!=y){
            par[y]=x;
            sum=sum-(s[x]*s[y]);
            s[x]=s[x]+s[y];
        }
    }
    for (int i=0;i<m;i++){
    	cout<<ans[i]<<endl; 
	}
    return 0;
}

Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int count =0;
  for(int i=1;i<=n;i++)
  {
      for(int j=1;j<=n;j++)
      {
          for(int k=1;k<=n;k++)
          {
              count += __gcd(i,__gcd(j,k));
          }
      }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define F first
#define S second
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
#define PI 3.141592653589
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
// Iterator
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define M 1000000007
#define N 500005
int main()
{
    ll d,z;
    ll t1,t2,a1,a2,b1,b2;
    cin >> t1 >> t2;
    cin >> a1 >> a2;
    cin >> b1 >> b2;
    ll x,y;
    x=(a1*t1+a2*t2);
    y=(b1*t1+b2*t2);
    if(x==y)
    {
        printf("infinity");
        exit(0);
    }
    d=abs(x-y);
    if(x<y)
    {
        if(a1*t1<b1*t1)
            out(0),exit(0);
    }
    else if(x>y)
    {
        if(a1*t1>b1*t1)
            out(0),exit(0);
    }
    z=abs(a1*t1-b1*t1);
    x=(z/d);
    y=(2*x)+1;
    if(z==d*x)
        y--;
    llout(y);
}







Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
#include<numeric>
#include<queue>
#include<string>
#include<vector>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
ll mod = 1000000007;
using namespace std;
priority_queue<ll int>A;//きゅー
int main(void)
{
	ll int N, K, Q;

	int A[100010];
	scanf("%lld%lld%lld", &N, &K, &Q);
	ll int player[100010] = { 0 };
	rep(i, Q) {
		scanf("%d", &A[i]);
		player[A[i] - 1]++;
	}
	rep(i, N) {
		if (player[i] - Q +K<= 0) {
			printf("No\n");
		}
		else {
			printf("Yes\n");
		}
	}
	
	return 0;

}


Measured memory_bytes: 1792
#include <iostream>
#include <utility>
#include <algorithm>
using namespace std;
const int MAX = 200005;

int main()
{
	pair<int, int> A[MAX];
	int N,a,b;
	cin >> N;
	for (int i = 0; i < N; ++i)
	{
		cin >> a >> b;
		A[i].first = b;
		A[i].second = a;
	}

	sort(A,A+N);

	int temp = 0;
	for (int i = 0; i < N; ++i)
	{
		temp += A[i].second;
		if (temp > A[i].first)
		{
			cout << "No" << endl;
			return 0;
		}
	}

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

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

vi par,sz,vis,dis;
vector<vi> graph;
vector<vector<pair<li,li>>> wgraph;

void init(li n)
{
    par.resize(n);
    sz.resize(n);
    wgraph.resize(n);
    dis.resize(n);
    vis.resize(n);
    graph.resize(n);

    f(i,0,n-1)
    {
        par[i]=i;
        sz[i]=1;
        dis[i]=1e18;
    }
}

li root(li a)
{
    while(a!=par[a])
    {
        par[a]=par[par[a]];
        a=par[a];
    }

    return a;
}

void unio(li a,li b)
{
    li r_a=root(a);
    li r_b=root(b);

    if(par[r_a]!=r_b)
    { 
        if(sz[r_a]<sz[r_b])
        {
            par[r_a]=par[r_b];
            sz[r_b]+=sz[r_a];
            sz[r_a]=0;
        }
        else
        {
            par[r_b]=par[r_a];
            sz[r_a]+=sz[r_b];
            sz[r_b]=0;
        }
    }
}

int main()
{    
   

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

    li n;

    cin>>n;

    li a[n];

    for(li i=0;i<n;i++)
        cin>>a[i];

    li ans=1;

    f(i,0,n-1)
    {
        if(a[i]%2==0)
        {
            if(a[i]%3!=0 && a[i]%5!=0)
                ans=0;
        }
    }

    if(ans)
        cout<<"APPROVED";
    else
        cout<<"DENIED";

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <vector>
#include <stack>
#include <map>
#define ri register
#define inf 0x7fffffff
#define E (1)
#define mk make_pair
#define int long long
using namespace std; const int N=5010;
inline int read()
{
	int s=0, w=1; ri char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-') w=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar(); return s*w;
}
int n,dp[N]; struct Node{int h,p; }e[N];
inline bool cp(Node x,Node y) { return x.h+x.p<y.h+y.p; }
signed main()
{
	n=read();
	for(ri int i=1;i<=n;i++) e[i].h=read(), e[i].p=read();
	sort(e+1,e+1+n,cp); int res=0;
	for(ri int i=1;i<=n;i++) dp[i]=1e16;
	for(ri int i=1;i<=n;i++)
	{for(ri int j=i;j;j--)if(e[i].h>=dp[j-1])dp[j]=min(dp[j],dp[j-1]+e[i].p);}
	for(ri int i=0;i<=n;i++)if(dp[i]<1e16)res=i; printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 3888
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

#include<unistd.h>
char buff[1 << 22];
template <int size>
struct Buffer{
    int idx = 0;
    Buffer(){ read(0, buff, size); }
    void next(int& ret){
        // int ret = 0;
        ret = 0;
        while(!(buff[idx] & 0x10)){ idx++; }
        while(buff[idx] & 0x10){ ret = ret * 10 + buff[idx++] - '0'; }
        // while(!isdigit(buff[idx])){ idx++; }
        // while(isdigit(buff[idx])){ ret = ret * 10 + buff[idx++] - '0'; }
        // return ret;
    }
};
struct FastInput {
    Buffer<1 << 22> buf;
    template <class T>
    FastInput& operator >> (T& num) { buf.next(num); return *this; }
    // FastInput& operator >> (T& num) { num = buf.next(); return *this; }
    void tie(int){ }
    template <class S, class T>
    friend FastInput& operator >> (FastInput& in, pair<S, T>& p){ return in >> p.first >> p.second; }
    template <class T>
    friend FastInput& operator >> (FastInput& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
};
FastInput fin;
#define cin fin

enum { SIZE = 1 << 20 };
char buf[SIZE];
int accs[512][512];
pair<int, int> pqs[100000];
int main(){
    int n, m, q;
    cin >> n >> m >> q;
    for(int i = 0; i < m; i++){
        int l, r;
        cin >> l >> r;
        accs[1][r]++;
        accs[l + 1][r]--;
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            accs[i + 1][j] += accs[i][j];
            accs[i][j] += accs[i][j - 1];
        }
    }
    int idx = SIZE;
    for(int i = 0; i < q; i++){
        cin >> pqs[i].first >> pqs[i].second;
    }
    for(int i = q - 1; i >= 0; i--){
        int p = pqs[i].first, q = pqs[i].second;
        buf[--idx] = '\n';
        div_t num2;
        num2.quot = accs[p][q];
        do{
            num2 = div(num2.quot, 10);
            buf[--idx] = num2.rem + '0';
        }while(num2.quot);
    }
    write(1, buf + idx, SIZE - idx);
}


Measured memory_bytes: 6784
#include<bits/stdc++.h>
#define int  long long
#define ll long long
#define ld long double
#define mod ((ll)1e9+7)
#define maxx ((ll)1e6+5)
#define pb push_back
#define ins insert
#define usefile freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
ll expo(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
/*int sv[1000000]={0};
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
void sve() {sv[0]=1;sv[1]=1;for(int i=2;i*i<=maxx;i++){if(!sv[i]){for(int j=2*i;j<=maxx;j+=i)sv[j]=1;}}}//0 hai to prime
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(expo(fact[r],mod-2)))%mod; res=(res*(expo(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(expo(fact[n-r],mod-2)))%mod; return res;}*/
using namespace std;
ld d[3000][3000];
signed main()
{
    int n,i,j;
    cin >> n;
    cout << setprecision(15);
    ld a[n+1]={0};
    for(i=1 ; i<=n ; i++)
    	cin >> a[i];
    d[0][0] = 1;
    ld p=1;
    for(i=1 ; i<=n ; i++)
    {
    	p*=(1-a[i]);
    	d[i][0] = p;
    }
    for(i=1 ; i<=n ; i++)
    {
    	for(j=1 ; j<=i ; j++)
    	{
    		d[i][j] = a[i]*d[i-1][j-1] + (1.000000-a[i])*d[i-1][j];
    		//cout <<d[i][j]<<" ";
    	}//cout <<"\n";
    }
    ld ans=0.0;
    for(i=n/2+1 ; i<=n ; i++)
    	ans += d[n][i];
    cout << ans<<"\n";
    return 0;
}

Measured memory_bytes: 139136
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(b >= a)System.out.println(a);
        else System.out.println(a - 1);
    }
}

Measured memory_bytes: 35620
N, X, Y = map(int,input().split())
X -= 1
Y -= 1

npath = [0] * (N-1)

indx = 0
for j in range(N-1):
    for i in range(j+1,N):
        if i <= X:
            distance = i - j
        elif j >= Y:
            distance = i - j
        elif j <= X and Y<= i:
            distance = i - j - (Y-X-1)
        elif  X <= j < i <= Y:
            distance = min(i-j, (j-X)+(Y-i)+1)
        elif j <= X and X < i <= Y:
            distance = (X-j) + min(i-X, Y-i+1)
        else:
            distance = (i-Y) + min(Y-j, j-X+1)
        npath[distance-1] +=1
for i in range(N-1):print(npath[i])


Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#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++)
typedef long long ll;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);
  int a, b, t;
  cin >> a >> b >> t;
  cout << t / a * b << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

int h, w, sx, sy, tx, ty;
char s[1009][1009];
int dis[1009][1009];

int dx[]{0, 1, 0, -1};
int dy[]{1, 0, -1, 0};
bool used[1009][1009];

bool in(int x, int y) { return x >= 0 && x < h && y >= 0 && y < w; }

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

    cin >> h >> w;
    cin >> sx >> sy >> tx >> ty;
    sx--, sy--, tx--, ty--;

    rep(i, h) cin >> s[i];

    memset(dis, -1, sizeof(dis));

    deque<pair<int, int>> que;
    dis[sx][sy] = 0;
    que.emplace_back(sx, sy);
    while(!que.empty()) {
        auto [x, y] = que.front();
        que.pop_front();
        if(used[x][y]) continue;
        used[x][y] = true;
        rep(i, 4) {
            int xx = x + dx[i];
            int yy = y + dy[i];
            if(in(xx, yy) && (!~dis[xx][yy] || dis[xx][yy] > dis[x][y]) &&
               s[xx][yy] == '.') {
                dis[xx][yy] = dis[x][y];
                que.emplace_front(xx, yy);
            }
        }
        FOR(xx, x - 2, x + 3) FOR(yy, y - 2, y + 3) {
            if(in(xx, yy) && (!~dis[xx][yy] || dis[xx][yy] > dis[x][y] + 1) &&
               s[xx][yy] == '.') {
                dis[xx][yy] = dis[x][y] + 1;
                que.emplace_back(xx, yy);
            }
        }
    }

    cout << dis[tx][ty] << endl;

    return 0;
}

Measured memory_bytes: 9640
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>
#include <utility>


using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// const ll INF = 1LL <<60;
const int INF = 10000;

//最大公約数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}
// ここから開始
int main(){
  int n;
  cin>>n;
  vector<int> d(n);
  for(int i = 0; i < n; i++) cin>>d[i];
  int m;
  cin>>m;
  vector<int> r(m);
  for(int i = 0; i < m; i++) cin>>r[i];
  int d_mark = 0;
  int r_mark = 0;
  sort(d.begin(),d.end());
  sort(r.begin(),r.end());
  while(d_mark<n&&r_mark<m){
    if(d[d_mark]<r[r_mark]) d_mark++;
    else if(d[d_mark]>r[r_mark]) {
      cout<<"NO"<<endl;
      return 0;
    }
    else{
      d_mark++;
      r_mark++;
    }
  }
  cout<<"YES"<<endl;
  return 0;
}



Measured memory_bytes: 1792
#include<iostream>
#define ll long long
#define w(t) int t; cin>>t; while(t--)
#define f(N) long long N,k; cin>>N>>k; long long a[N]; for(int i=0;i<N;i++){cin>>a[i];}
#define g(N)  for(int i=0;i<N;i++){cout<<a[i]<<" ";}
using namespace std;
int main()
{
    int n,a=0,b=0,c=0,d=0;
    cin>>n;
    string str[n];
    for(int i=0;i<n;i++)
    {
        cin>>str[i];
    }
    for(int i=0;i<n;i++)
    {
        if(str[i]=="AC")
            a++;
        else if(str[i]=="WA")
            b++;
        else if(str[i]=="TLE")
            c++;
        else
            d++;
    }
    cout<<"AC"<<" "<<"x"<<" "<<a<<endl;
    cout<<"WA"<<" "<<"x"<<" "<<b<<endl;
    cout<<"TLE"<<" "<<"x"<<" "<<c<<endl;
    cout<<"RE"<<" "<<"x"<<" "<<d;
}

Measured memory_bytes: 5572
# -*- coding: utf-8 -*-
from itertools import combinations
from collections import Counter
import math

N = int(input().strip())
A_list = list(map(int, input().rstrip().split()))
#-----

A_cnt = Counter(A_list)

A_sum_of_combination={}
A_sum_of_combination_minus1={}
for k,v in A_cnt.items():
    # 個数2で場合分け
    if v >= 2:
        tmp_sum=1
        for i in range(2):
            tmp_sum *= (v-i)/(i+1)
        
        A_sum_of_combination[k] = int(tmp_sum)
        
    else:
        A_sum_of_combination[k] = 0
    
    if (v-1) >= 2:
        tmp_sum=1
        for i in range(2):
            tmp_sum *= ((v-1)-i)/(i+1)
        
        A_sum_of_combination_minus1[k] = int(tmp_sum)
        
    else:
        A_sum_of_combination_minus1[k] = 0

sum_all = sum( [ v for k,v in A_sum_of_combination.items()] )

for i in A_list:
    num_selected = A_cnt[i] - 1
    
    if num_selected >= 2:
        ans = sum_all - A_sum_of_combination[i] + A_sum_of_combination_minus1[i]
        print(ans)
    else:
        ans = sum_all - A_sum_of_combination[i]
        print(ans)


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

#define MAX 200

int stack[MAX];
int pos;

void push(int ele);
int pop(void);


int main() {

    char s[MAX];
    int i, b;
    pos = -1;
    i = 0;
    while(scanf("%s", s) != EOF) {
        switch (s[0]) {
            case '+':
                push(pop() + pop());
                break;
            case '-':
                b = pop();
                push(pop() - b);
                break;
            case '*':
                push(pop() * pop());
                break;
            default:
                push(atoi(s));
                break;
        }
    }
    printf("%d\n", pop());
    
    
    return 0;
}

void push(int ele) {
    stack[++pos] = ele;
}

int pop(void) {
    return stack[pos--];
}


Measured memory_bytes: 2052
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N, T;
        public long MOD = 1000000007;

        public void Run()
        {
            {
                var line = Input.ReadIntArray();
                N = line[0];
                T = line[1];
            }

            int ret = int.MaxValue;
            for (int i = 0; i < N; i++)
            {
                var line = Input.ReadIntArray();
                int c = line[0];
                int t = line[1];
                if (t <= T)
                {
                    ret = Math.Min(ret, c);
                }

            }

            if (ret == int.MaxValue)
            {
                Console.WriteLine("TLE");
            }
            else
            {
                Console.WriteLine(ret);
            }
        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 11348