akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

const int mod = 1e9+7;
struct mint {
    ll x;
    mint (ll x = 0) : x((x%mod+mod)%mod) {}
    mint operator -() const {return mint(-x);}
    mint& operator +=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator -=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator *=(const mint a) {(x *= a.x) %= mod; return *this;}
    mint operator +(const mint a) const {return mint(*this) += a;}
    mint operator -(const mint a) const {return mint(*this) -= a;}
    mint operator *(const mint a) const {return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const {return pow(mod-2);}
    mint operator /=(const mint a) {return *this *= a.inv();}
    mint operator /(const mint a) {return mint(*this) /= a;}
};
istream& operator >>(istream &is, const mint &a) {return is >> a.x;}
ostream& operator <<(ostream &os, const mint &a) {return os << a.x;}

mint dp[200005];

int main() {
    int n; cin >> n;
    vvint data(200001);
    vint c(n);
    rep(i,n) cin >> c[i];
    c.erase(unique(all(c)),c.end());
    n = c.size();
    rep(i,n) data[c[i]].push_back(i);
    dp[0] = 1;
    REP(i,n+1) {
        dp[i] = dp[i-1];
        int id = lower_bound(all(data[c[i-1]]),i-1)-data[c[i-1]].begin();
        if (id == 0) continue;
        dp[i] += dp[data[c[i-1]][id-1]+1];
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 16348
#include <bits/stdc++.h>
using namespace std;
int main() 
{
	//freopen("1.txt","w",stdout);
	long long x,y;
	scanf("%lld%lld",&x,&y);
	if(x>y) swap(x,y);
	if(x==y||(x+1==y)) printf("Brown\n");
	else printf("Alice\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <unordered_map>
#define ull unsigned long long
#define int long long
#define ll long long
#define fr(i, n) for (int i = 0; i < n; i++)
#define frf(i, j, n) for (int i = j; i <= n; i++)
#define frd(i, n) for (int i = n; i >= 0; i--)
#define mp(i, j) make_pair(i, j)
#define pb(x) push_back(x)
using namespace std;
// typedef vector<vector<ll>> matrix;
// const ll PRIME = 1e9 + 7;
// typedef pair<int,pair<int,int> >  ppi;

void solve()
{

    int x, k, d;
    cin >> x >> k >> d;
    int y = abs(x) / d;
    int ans;
    if (y <= k)
    {
       ans = abs(x) - y * d;
        k -= y;
    }
    else
    {
        ans = abs(x) - k * d;
        k = 0;
    }
    if(k>0)
    {
        if(abs(ans-d)<=abs(ans))
        {
           ans = ans - d;
            k--;
        }
    }
    
    if (k & 1)
    {
        if (ans > 0)
        {
            ans -= d;
        }
        else
        {
            ans += d;
        }
    }

    cout << abs(ans);
}
int32_t main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t;
    // cin >> t;
    t = 1;
    while (t--)
    {
        solve();
    }
}

Measured memory_bytes: 3644
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    cout << N/3 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;} 


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

i64 N, D, A; cin>> N >> D >> A;
VP XH(N); rep(i, 0, N) cin >> XH[i].first >> XH[i].second;
sort(ALL(XH));
VI X, H; 
rep(i, 0, N){
    X.push_back(XH[i].first);
    H.push_back(XH[i].second);
}

VI d(N+1, 0); // imosでダメージ記録
i64 ans = 0;
rep(i, 0, N){
    if (H[i] - d[i] > 0){
        int att = ((H[i] - d[i]) + A - 1) / A;//iを倒す攻撃回数
        ans += att;
        d[i] += A * att;
        d[upper_bound(ALL(X), X[i] + 2*D) - X.begin()] -= A * att;
    }
    d[i+1] += d[i];
}

cout << ans << "\n";



return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 8292
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<algorithm>
#include<functional>
 
 
using namespace std;
 
int main()
{
	int n;
	cin >> n;
	int s[3] = { 0,0,0 };
	for (int i = 0; i < n; i++) {
		int j;
		cin >> j;
		if (j % 4 == 0)s[0]++;
		else if (j % 4 == 2)s[2]++;
		else s[1]++;
	}
	if (s[2]>0&& s[1] - s[0] <= 0)cout << "Yes" << endl;
	else if(s[2]==0&&s[1]-s[0]<=1) cout << "Yes" << endl;
	else cout << "No" << endl;
 
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U> bool chmax(T &a, U b) { if (a <= b) {a = b; return 1;} return 0; }
template <class T, class U>  bool chmin(T &a, U b) { if (a > b) { a = b; return 1; } return 0; }
template <typename T>  ostream &operator<<(ostream &os, vector<T> &v) { os << "{"; rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); } os << "}"; return os; }

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)
    
int main() {
    ll x=0,y=0,z=0,k,n,m,h,w,ans=0,sum=0,Max=-1,Min=1e9+1;
    bool ok = true;
    string t;
    cin >> x;
    y = 100;
    while(x > y){
        y = y + y/100;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int n; cin >> n;
    vector<int> a(n);
    for(int i =0 ; i < n; i++) {
        cin >> a[i];
    }
    int cost = 1000000000;
    for(int i = -100; i <= 100; i++) {
        int sum = 0;
        for(int j = 0; j < n; j++) {
            sum += (a[j] - i) * (a[j] - i); 
        }
        cost = min(cost, sum);
    }
    cout << cost << endl;
}


Measured memory_bytes: 256
s = gets.to_i
hash = {}
hash[s] = true

ans = 2
loop do
    if s%2 == 0
        s /= 2
    else
        s = 3*s+1
    end
    if hash[s]
        puts ans
        exit
    end
    hash[s] = true
    ans += 1
end

Measured memory_bytes: 1788
import std.stdio, std.string, std.conv, std.range, std.array, std.algorithm;
import std.uni, std.math, std.container, std.typecons, std.typetuple;
import core.bitop, std.datetime;

immutable long mod = 10^^9 + 7;
immutable long inf = mod;

void main(){
    int n = readln.chomp.to!int;

    int ans;

    foreach(i ; 0 .. n){
        int x = readln.chomp.to!int;
        ans += is_prime(x);
    }

    writeln(ans);
}

bool is_prime(int x){
    for(int i = 2; i*i <= x; ++i){
        if (x % i == 0) {
            return false;
        }
    }

    return true;
}

T modpow(T)(T x, T y, T mod){
    return y ? modpow(x, y>>1, mod)^^2 % mod * x^^(y&1) % mod : 1;
}

void readVars(T...)(auto ref T args){
    auto line = readln.split;
    foreach(ref arg ; args){
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    if(!line.empty){
        throw new Exception("args num < input num");
    }
}

Measured memory_bytes: 2692
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int n,ans=0;
  cin>>n;
  vi a(n),b(n);
  rep(i,n)cin>>a[i];
  rep(i,n)cin>>b[i];
  for(int i=0;i<=28;i++){
    int bit=(1<<(i+1));
    vi list;
    rep(i,n){
      list.pb(b[i]%bit);
    }
    sort(all(list));
    int cnt=0;
    rep(j,n){
      cnt+=lower_bound(all(list),bit-a[j]%bit)-lower_bound(all(list),(bit>>1)-a[j]%bit);
      cnt+=list.end()-lower_bound(all(list),(3<<i)-a[j]%bit);
    }
    if(cnt%2)ans+=(1<<i);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>

using namespace std;

int main(){
	string w, s;
	int count=0;
	
	cin >> w;
	transform( w.begin(), w.end(), w.begin(), ::tolower );
	
	while(1){
		cin >> s;
		if(s == "END_OF_TEXT") break;
		
		transform( s.begin(), s.end(), s.begin(), ::tolower );
		if(w == s) ++count;
	}
	
	printf("%d\n", count);	

	return 0;
}

Measured memory_bytes: 1200
use std::str::FromStr;

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

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn get_vec_by_lines<T : FromStr>(n : usize) -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for _i in 0..n {
        let x : T = get_one();
        v.push(x);
    }
    return v;
}

fn main() {
    let mut n : i32 = get_one();
    println!("{}", (n+1)/2);
}


Measured memory_bytes: 4352
import java.util.Scanner;



public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] A = new long[N];
		long[] B = new long[N - 1];

		for (int i = 0; i < N; i++) {
			A[i] = sc.nextLong();
		}
		B[0] = A[N-1];
		for (int i = N-2; i > 0; i--) {
			B[(N - 1) - i] = (A[i] + B[(N - 1) - i - 1] ) % 1000000007;
		}
		long ans = 0;
		for (int i = 0; i < N-1; i++) {
			long let = (A[i] * B[N-2-i]) % 1000000007;
			ans = (ans + let) % 1000000007;
		}

		System.out.println(ans);
	}

}

Measured memory_bytes: 64196
#include <iostream>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long a, b, c;
  cin >> a >> b >> c;
  for (int r = 0; r < 64; ++r) {
    if (a&1 || b&1 || c&1) {
      cout << r << endl;
      return 0;
    }
    long ta = a/2, tb = b/2, tc = c/2;
    a = tb+tc;
    b = ta+tc;
    c = ta+tb;
  }
  cout << -1 << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
const int INF = (1 << 30);

//毎回変える定数
#define N_MAX 200


//変数
vector<vector<int>> c;
bool ans = false;

//サブ関数
//入力
void input(){
	REP(i, 3){
		vector<int> tmpv;
		REP(j, 3) {
			int tmp;
			cin >> tmp;
			tmpv.push_back(tmp);
		}
		c.push_back(tmpv);
	}
}

bool judge(vector<vector<int>> A, int a, int b, int c) {
	REP(i, 3)A[0][i] -= a;
	REP(i, 3)A[1][i] -= b;
	REP(i, 3)A[2][i] -= c;
	/*
	for (auto num : A) {
		for (auto num2 : num) {
			cout << num2 << " ";
		}
		cout << endl;
	}
	cout << endl;
	*/
	if (!(A[0][0] == A[1][0] && A[0][0] == A[2][0])) {
		return false;
	}if (!(A[0][1] == A[1][1] && A[0][1] == A[2][1])) {
		return false;
	}if (!(A[0][2] == A[1][2] && A[0][2] == A[2][2])) {
		return false;
	}
	return true;
}

//計算
void calc(){
	REP(i, 101){
		//cout << i << endl;
		REP(j, 101){
			REP(k, 101) {
				if (judge(c, i, j, k)) {
					ans = true;
					goto last;
				}
			}
		}
		
	}
last:;
}


//出力
void output(){
	cout << (ans ? "Yes" : "No") << endl;
}

//デバッグ
void debug(){
	int N;
	cin>>N;
}


//メイン関数
int main(){
	
	input();
	calc();
	output();
	debug();
	
	return 0;
}


Measured memory_bytes: 256
import bisect
N = int(input())
A = sorted(list(map(int, input().split())))
B = list(map(int, input().split()))
C = sorted(list(map(int, input().split())))
result = 0
for b in B:
    #print(search(A, b-1, True) + 1, N - search(C, b+1, False))
    result += bisect.bisect_right(A, b - 1) * (N-bisect.bisect_left(C, b + 1))
print(result)

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

const int Inf = 1000000007;

int best = Inf;
int n, t;
int C, T;

int main()
{
    scanf("%d %d", &n, &t);
    for (int i = 0; i < n; i++) {
        scanf("%d %d", &C, &T);
        if (T <= t) best = min(best, C);
    }
    if (best >= Inf) printf("TLE\n");
    else printf("%d\n", best);
    return 0;
}


Measured memory_bytes: 256
n = int(input())
h_ls = list(map(int, input().split()))

target = []
for i in range(1,n):
    d = h_ls[i] - h_ls[i-1]
    if d > 0:
        target = []
    elif d == 0:
        target.append(i-1)
    else:
        target.append(i-1)
        for j in target:
            h_ls[j] -= 1
        target = []
res = 'Yes'
for i in range(1,n):
    d = h_ls[i] - h_ls[i-1]
    if d < 0:
        res = 'No'
print(res)


Measured memory_bytes: 15020
(function main(){
  let lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n");
  let [n, k] = lines.shift().split(' ').map(Number);
  let w = lines.map(Number);

  const canAllStack = (p) => {
    let cnt = 0;
    let sum = 0;
    for (let i = 0; i < k; i++) {
      sum = 0;
      while (sum + w[cnt] <= p) {
        sum += w[cnt++]
        if (cnt === n) return n;
      }
    }
    return cnt;
  };

  let mid, left = 0, right = 1e9;
  while (right - left > 1) {
    mid = Math.round((right + left) / 2);
    if (canAllStack(mid) >= n) right = mid;
    else left = mid;
  }
  console.log(right);
})();


Measured memory_bytes: 29220
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll n;
  cin >> n;
  ll count = 0;
  rep(i,n){
    ll a;
    cin >> a;
    if(a%2==1){
      count++;
    }
  }
  if(count%2==0){
    print("YES");
  }
  else{
    print("NO");
  }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#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++)
using namespace std;
using P = pair<int, int>; 
using ll = long long;
using M = map<int, int>;

int main()
{
  int a, b, n;
  cin >> a >> b >> n;
  int ans = 0;
  for(;a <= b; a++){
    if(a % n == 0) ans++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3632
#include <iostream>

 

using namespace std;

 

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


Measured memory_bytes: 3112
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int T = sc.nextInt();
		int A = sc.nextInt();
		int[] H = new int[N];
		double min = 10000000;
		int a = 0;
		for(int i=0; i<N; i++) {
			H[i] = sc.nextInt();
		}
		sc.close();
		for(int i=0; i<N; i++) {
			double d = Math.abs(A - (T - H[i] * 0.006));
		      if (min > d) {
		        min = d;
		        a = i+1;
		      }
		}
		System.out.println(a);
	}

}

Measured memory_bytes: 38860
// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;

int main()
{
  ll a, b, t;

  cin >> a >> b >> t;

  cout << b * (t / a) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main(){
  int N, ac=0, wa=0, tle=0, re=0;
  cin >> N;
  string S;
  rep(i,N){
    cin >> S;
    if(S=="AC"){
      ac++;
    }else if(S=="WA"){
      wa++;
    }else if(S=="TLE"){
      tle++;
    }else{
      re++;
    }
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <random>

using ll = long long;

//vector
template <class T>
using vec = std::vector<T>;

void solve()
{
    using namespace std;
    ll X;
    cin >> X;
    ll t = 0;
    while (true)
    {
        if (t * (t + 1) / 2 >= X)
        {
            cout << t << endl;
            break;
        }
        ++t;
    }

}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false);
	int n; cin >> n;
	ll sum = 0;
	vi v(n);
	REP(i, n)
	{
		cin >> v[i];
		sum += v[i];
		if (v[i] > 4) v[i] = 4;
	}
	sort(ALL(v));
	if (n == 1)
	{
		cout << sum << endl;
	}
	else if (n == 2)
	{
		cout << sum - 1 << endl;
	}
	else if (n == 3)
	{
		cout << sum - 3 << endl;
	}
	else if (n == 4)
	{
		if (v[0] == 2)
		{
			if (v[3] == 2) cout << sum - 4 << endl;
			else cout << sum - 5 << endl;
		}
		else cout << sum - 6 << endl;
	}
	else if (n == 5)
	{
		if (v[4] == 4)
		{
			if (v[0] == 2)
			{
				if (v[1] == 2) cout << sum - 7 << endl;
				else cout << sum - 8 << endl;
			}
			else
			{
				if (v[3] == 3) cout << sum - 8 << endl;
				else if (v[0] == 3) cout << sum - 9 << endl;
				else cout << sum - 10 << endl;
			}
		}
		else if(v[4] == 3)
		{
			if (v[1] == 3) cout << sum - 8 << endl;
			else if (v[3] == 2) cout << sum - 6 << endl;
			else cout << sum - 7 << endl;
		}
		else cout << sum - 6 << endl;
	}
	return 0;
}

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

int main() {
    int N, K;
    cin >> N >> K;
    int z = 0;
    for (int i = 0; i < N; ++i){
        int a;
        cin >> a;
        if (a == 1){
            z = i;
            break;
        }
    }
    // (K - 1) * x >= z
    int x = z / (K - 1);
    if ((K - 1) * x < z) ++x;
    // (N - (K - 1) * x - 1) <= (K - 1) * y
    int R = N - (K - 1) * x - 1;
    int y = R / (K - 1);
    if ((K - 1) * y < R) ++y;
    cout << x + y << endl;
    return 0;
}

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

const int N=300010;
int n,m,i,ql,qr,ans[N];

int read()
{
	int d=0; char ch=getchar();
	while (!isdigit(ch)) ch=getchar();
	while (isdigit(ch)) d=(d<<3)+(d<<1)+ch-48,ch=getchar();
	return d;
}

int main()
{
	m=read(); n=read();
	while (m--)
	{
		ql=read()-1; qr=read();
		for (i=1;i<=ql;)
		{
			int d=qr/i,j=qr/d,k=ql/d;
			ans[max(k+1,i)]++; ans[j+1]--;
			i=j+1;
		}
		ans[i]++; ans[qr+1]--;
	}
	for (int i=1;i<=n;i++)
	{
		ans[i]+=ans[i-1];
		printf("%d\n",ans[i]);
	}
	return 0;
}

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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

const ll mod = 1e9+7;

int main(){
    int n; cin >> n;
    vector<ll> lis(n), lis1(n);
    REP(i, 0, n){cin >> lis[i];}
    ll ans = 0;
    REP(i, 0, 60){
        ll c0 = 0, c1 = 0;
        REP(l, 0, n){
            if((lis[l] >> i) & 1) c1++;
            else c0++;
        }
        ll mid = (((1LL << i) % mod)* ((c0 * c1) % mod)) % mod;
        ans = (ans + mid) % mod; 
    }
    cout << ans << endl;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int N=1e5+5;
int n,q,a[N];
ll sum[N],s[N];
int main()
{
    scanf("%d%d",&n,&q);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    sum[1]=s[1]=a[1];
    a[0]=a[n+1]=inf;
    for(int i=2;i<=n;i++) sum[i]=sum[i-2]+a[i],s[i]=s[i-1]+a[i];
    while(q--)
    {
        int x;scanf("%d",&x);
        int l=0,r=1e9;
        while(l<=r)
        {
            int m=l+r>>1;
            int fl=lower_bound(a+1,a+1+n,x-m)-a;
            int fr=upper_bound(a+1,a+1+n,x+m)-a-1;
            if(fr-fl+1<n-fr) l=m+1;
            else if(fr-fl+1>n-fr) r=m-1;
            else break;
        }
        int m=l+r>>1;
        int fl=lower_bound(a+1,a+1+n,x-m)-a;
        int fr=upper_bound(a+1,a+1+n,x+m)-a-1;
        while(fr-fl+1>n-fr)
            if(abs(x-a[fr])<=abs(x-a[fl])) fr--;
        else fl++;
        while(fr-fl+1<n-fr-1)
            if(abs(x-a[fl-1])<=abs(x-a[fr+1])) fl--;
            else fr++;
        if(fr-fl+1==n-fr) printf("%lld\n",s[n]-s[fr]+sum[fl-1]);
        else printf("%lld\n",s[n]-s[fr]+sum[max(0,fl-2)]);
    }
}


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

int main() {
    
    int c[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> c[i][j];
        }
    }
    
    bool ans = true;
    
    for (int i = 0; ans && i < 2; i++) {
        for (int j = 0; ans && j < 2; j++) {
            if (c[i][j] - c[i][j+1] != c[i+1][j] - c[i+1][j+1]) {
                ans = false;
            }
        }
    }
    for (int i = 0; ans && i < 2; i++) {
        for (int j = 0; ans && j < 2; j++) {
            if (c[i][j] - c[i+1][j] != c[i][j+1] - c[i+1][j+1]) {
                ans = false;
            }
        }
    }
    
    cout << (ans ? "Yes" : "No") << endl;
    
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define DEBUG fprintf(stderr, "check\n")
#define max(X, Y) ((X) > (Y) ? (X) : (Y))
#define min(X, Y) ((X) < (Y) ? (X) : (Y))
typedef long long ll;
typedef unsigned long long ull;

ll bin[128];
ll bit[128];
ll ans;

ull f(ll n, ll m)
{
	if (n % bin[m] - bin[m - 1ll] > 0) {
		return n % bin[m] - bin[m - 1ll];
	} else {
		return 0ll;
	}
}

int main()
{
	bin[0] = 1ll;
	for (ull i = 1ll; i < 60ll; i++) {
		bin[i] = bin[i - 1ll] * 2ll;
	}

	ull a, b;
	scanf("%llu %llu", &a, &b);
	b++;

	for (ull i = 0ll; i < 57ll; i++) {
		bit[i] = (b / bin[i + 1ll]) * bin[i];
		bit[i] += f(b, i + 1ll);
	}

	for (ull i = 0ll; i < 57ll; i++) {
		bit[i] -= (a / bin[i + 1ll]) * bin[i];
		bit[i] -= f(a, i + 1ll);
	}

	ans = 0;
	for (ll i = 57ll; i >= 0ll; i--) {
		ans = ans << 1ll;
		ans = ans | (bit[i] & 1ll ? 1ll : 0ll);
	}

	printf("%llu\n", ans);

	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <map>
#define MN 100000
#define MM 200000
typedef long long LL;
typedef std::map<LL,int>::iterator iter;
int n,hd[MN+5],to[MM+5],nxt[MM+5],rn=0;
std::map<LL,int> mp;
struct node{int i,sz;LL d;}a[MN+5];
void _add(int u,int v){
	to[rn]=v,nxt[rn]=hd[u];
	hd[u]=rn++;
}
void add(int u,int v){_add(u,v),_add(v,u);}
void gg(){puts("-1");exit(0);}
LL check(int u,int fa,int dep){
	LL ret=dep;
	for(int i=hd[u];~i;i=nxt[i]){
		if(to[i]==fa) continue;
		ret+=check(to[i],u,dep+1);
	}
	return ret;
}
int main(){
	memset(hd,0xff,sizeof(hd));
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&a[i].d);
		a[i].i=i,a[i].sz=1;
	}
	std::sort(a+1,a+1+n,[](node a,node b)->bool{return a.d>b.d;});
	for(int i=1;i<=n;i++) mp[a[i].d]=i;
	for(int i=1;i<=n;i++){
		int dta=n-(a[i].sz<<1);
		if(dta<=0) continue;
		iter it=mp.find(a[i].d-dta);
		if(it==mp.end()) continue;
		a[it->second].sz+=a[i].sz;
		add(a[i].i,a[it->second].i);
	}
	if(check(a[n].i,0,0)!=a[n].d) gg();
	if(rn!=(n-1)<<1) gg();
	for(int i=1;i<=n;i++)
		for(int j=hd[i];~j;j=nxt[j])
			if(i<to[j]) printf("%d %d\n",i,to[j]);
}

Measured memory_bytes: 13440
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const s = input[0][0];

  const display: string[] = [];

  s.split("").forEach((key) => {
    if (key === "B") {
      display.pop();
    } else {
      display.push(key);
    }
  });

  return display.join("");
};

console.log(main(read()));


Measured memory_bytes: 29584
N = int(input())
A = list(map(int, input().split()))

min_idx = None
for i, a in enumerate(A):
    if min_idx is None or A[min_idx] > a:
        min_idx = i

while 1:
    next_min_idx = None

    for i, a in enumerate(A):
        if min_idx == i: continue
        A[i] = a % A[min_idx]

        if A[i] > 0:
            if next_min_idx is None or A[next_min_idx] > A[i]:
                next_min_idx = i

    if next_min_idx is None:
        print(A[min_idx])
        exit()

    min_idx = next_min_idx


Measured memory_bytes: 14224
s=list(input())
lens=len(s)
#print(s)

lr=[[0]*2 for i in range(lens)]
lrp=[0]*lens
icnt=0
lr[0][0]=1
for i in range(1,lens):
    if s[i]=="R":        
        if s[i-1]=="R":
            lr[icnt][0]+=1
        elif s[i-1]=="L":
            icnt+=1
            lr[icnt][0]+=1
    elif s[i]=="L":
        if s[i-1]=="L":
            lr[icnt][1]+=1
        elif s[i-1]=="R":
            lr[icnt][1]+=1        
            lrp[icnt]=i

ss=[0]*lens
for i in range(icnt+1):
    r1=lr[i][0]//2
    r2=lr[i][0]-r1
    l1=lr[i][1]//2
    l2=lr[i][1]-l1
    ss[lrp[i]]=r1+l2
    ss[lrp[i]-1]=r2+l1

#print(lr[:icnt+1])
tstr=str(ss[0])
for i in range(1,lens):
    tstr=tstr+" "+str(ss[i])
print(tstr)

Measured memory_bytes: 21732
#include <bits/stdc++.h>
using namespace std;
const int N = 200;
using ll = long long;
string n;
int k;
ll dp[N][5];
int main() {
	cin>>n>>k;
	reverse(n.begin(), n.end());
	int sz = (int) n.size();
	dp[0][0] = 1;
	for(int i = 1; i < sz; ++i) {
		dp[i][0] = 1ll;
		for(int j = 1; j <= k; ++j) {
			dp[i][j] = (9ll * dp[i - 1][j - 1]) + dp[i - 1][j]; 
		}
	}
	/*for(int i = 0; i < sz; ++i) {
		for(int j  =0; j <= k; ++j) cout<<dp[i][j]<<" ";
		cout<<endl;
	} cout<<endl;*/
	ll ans = 0;
	for(int i = sz - 1, j = k; i >= 0 and j >= 0; --i, --j) {
		if(j == 0) {
			ans++;
			break;
		}
		ll num = n[i] - '0';
		if(num == 0) {
			j++;
			continue;
		}
		// cout<<num<<" "<<dp[i][j]<<" "<<dp[i][j - 1]<<endl;
		ans += dp[i][j];
		int l = 1;
		if(i == 0) l = 0;
		ans += ((num - l) * dp[i][j - 1]);
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int K, A, B;
	int flag = 0;
	cin >> K;
	cin >> A >> B;
	for (int i = A; i <= B; ++i) {
		if (i % K == 0) {
			++flag;
			break;
		}
	}
	if (flag == 0) {
		cout << "NG";
	}
	else {
		cout << "OK";
	}
	return 0;
}

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


void solve(long long a, long long b) {

}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main() {
    long long aa, bb;
    cin >> aa >> bb;
    string a_tan, b_tan, a, b;
    a_tan = to_string(aa);
    b_tan = to_string(bb);
    for (int i=0;i<bb;i++)
        a += a_tan;

    for (int i=0;i<aa;i++)
        b += b_tan;

    if (a<b)
        cout << a << endl;
    else
        cout << b << endl;

}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
int main(){
    string s;cin>>s;
    int n =s.length();
    ll ans =0;
    bool f=false;
    string ns;
    rep(i,n){
        if(i==n-1){
            ns.push_back(s[i]);
        }
        else{
            if(s[i]=='B'&&s[i+1]=='C'){
                i++;
                ns.push_back('D');
            }
            else ns.push_back(s[i]);
        }
    }
    n =ns.length();
    //reverse(been(ns));
    int a=0;
    rep(i,n){
        if(ns[i]=='D'){
            ans+=a;
        }
        else if(ns[i]=='A'){
            a++;
        }
        else{
            a=0;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3896
count=gets.to_i
line=gets.chomp.split("")
sum=line.count("R")*line.count("G")*line.count("B")
count.times do |i|
  for j in (i+1)...count do
    k=2*j-i
    break if k>=count
    sum -= 1 if line[i] != line[j] && line[j] != line[k] && line[i] != line[k]
  end
end
puts sum

Measured memory_bytes: 14456
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define debug(...)
#endif
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define rall(c) c.rbegin(), c.rend()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
#define init(a, x) memset(a,x,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
// ordered_set X
//K-th smallest
//*X.find_by_order(k-1)
//NO OF ELEMENTS < A
//X.order_of_key(A)
const int L=1e6+7;
void fff()
{
	ll n;
	cin >> n;
	std::vector<ll> a(n);	
	std::vector<ll> b(n);
	trace(a,x)cin >> x;	
	trace(b,x)cin >> x;
	reverse(all(b));
	ll c = -1;
	FOR(i,0,n)
	{
		if(a[i] == b[i])
		{
			c = a[i];
			break;
		}
	}
	if(c == -1)
	{
		cout << "Yes\n";
		trace(b,x)cout << x <<" ";
		return;		
	}
	int l = n, r = -1;
	FOR(i,0,n)
	{
		if(a[i] == c && b[i] == c)
		{
			l = min(l, i);
			r = max(r, i);
		}
	}
	FOR(i,0,n)
	{
		if(l<=r && a[i] != c && b[i] != c)
		{
			swap(b[i], b[l++]);
		}
	}
	if(l<=r)
	{
		cout << "No\n";
		return;
	}
	cout << "Yes\n";
	trace(b,x)cout << x <<" ";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//int t;cin >> t;while(t--)
	fff();
	return 0;
}

Measured memory_bytes: 6352
use std::collections::VecDeque;

pub fn main() {
  fn read_line() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf);
    buf
  }
  fn read_tuple() -> (i32, i32) {
    let a: Vec<usize> = read_line()
      .split_whitespace()
      .map(|e| e.parse().unwrap())
      .collect();
    (a[0] as i32, a[1] as i32)
  }
  let (h, w) = read_tuple();
  let (ch, cw) = read_tuple();
  let (dh, dw) = read_tuple();

  let mut map: Vec<Vec<i32>> = Vec::new();
  for _ in 0..h {
    let mut row: Vec<i32> = Vec::new();
    let s: Vec<char> = read_line().trim().chars().collect();
    for j in 0..w {
      if s[j as usize] == '.' {
        row.push(-1);
      } else {
        row.push(-2);
      }
    }
    map.push(row);
  }

  let mv: Vec<(i32, i32)> = {
    let mut v = Vec::new();
    for i in -2..3 {
      for j in -2..3 {
        if !(i == 0 && j == 0) {
          v.push((i, j));
        }
      }
    }
    v
  };

  let mut deque: VecDeque<(i32, i32, i32)> = VecDeque::new();
  deque.push_front((ch, cw, 0));

  while !deque.is_empty() {
    let (cur_h, cur_w, point) = deque.pop_front().unwrap();
    map[(cur_h as usize) - 1][(cur_w as usize) - 1] = point;
    if cur_h == dh && cur_w == dw {
      println!("{}", point);
      return;
    }

    for next in &mv {
      let next_h = cur_h + next.0;
      let next_w = cur_w + next.1;
      if (next_h >= 1)
        && (next_w >= 1)
        && next_h <= h
        && next_w <= w
        && map[next_h as usize - 1][next_w as usize - 1] == -1
      {
        if next.0.abs() + next.1.abs() == 1 {
          deque.push_front((next_h, next_w, point));
        } else {
          deque.push_back((next_h, next_w, point + 1));
        }
      }
    }
  }
  println!("-1");
  return;
}

Measured memory_bytes: 11576
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

N,M = [int(x) for x in input().split()]
divisor = make_divisors(M)
ans = 0
for x in divisor:
    if(x>=N):
        ans = M//x
        break
print(ans)


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int n;
ll ans;

void calc(string const& s) {
  string t;
  stringstream ss;
  rep(i, s.size()) {
    if(s[i] == ' ') {
    }
    else if(isdigit(s[i])) {
      t.push_back(s[i]);
    }
    else {
      ss << t << " ";
      t.clear();
    }
  }
  ss << t;

  ll a;
  while(ss >> a) {
    ans += a;
  }
}

void dfs(string& t, int idx) {
  if(idx >= n) {
    calc(t);
    return;
  }

  dfs(t, idx + 2);
  assert(t[idx] == ' ');
  t[idx] = '+';
  dfs(t, idx + 2);
  t[idx] = ' ';
}

int main() {

  string s; cin >> s;
  string t = string(s.size() * 2, ' ');
  rep(i, s.size()) {
    t[i * 2] = s[i];
  }
  if(t.back() == ' ') {
    t = string(t.begin(), t.begin() + t.size() - 1);
  }

  n = t.size();
  dfs(t, 1);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG


int main() {
  ll X, Y, Z;
  cin >> X >> Y >> Z;
  //vector<ll> a(N);
  //vector<vector<int>> data(3, vector<int>(4));
  
  cout << Z << " " << X << " " << Y << endl;

  return 0;
}

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

int main() {
  int64_t A, B, tmp_A, tmp_B, r;
  cin >> A >> B;
  tmp_A = A;
  tmp_B = B;
  
  if (A < B) {
    A = B;
    B = tmp_A;
  }
  
  r = A % B;
  while (r != 0) {
    A = B;
    B = r;
    r = A % B;
  }
  
  cout << (tmp_A / B) * tmp_B << endl;
}

Measured memory_bytes: 256
// INCLUDES
#include <bits/stdc++.h>
#include<assert.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//DEFINES
#define MAX 1000001
#define pii pair<int, int>
#define F first
#define S second
#define all(s) begin(s),end(s)
#define MIN3POS(a, b, c) (a) =< (b) ? ((a) =< (c) ? 1 : 3) : ((b) =< (c) ? 2 : 3)
#define MAX3POS(a,b,c) (a) >= (b) ? ((a) >= (c) ? 1 : 3) : ((b) >= (c) ? 2:3)
#define endl '\n'
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define FOR(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define IOS   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
//NAMESPACES
using namespace __gnu_pbds; 
using namespace std;
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
//HELPERS

vector<int> powers2(32,0);void initialize(){ for(int i=1;i<powers2.size();i++) powers2[i] = powers2[i-1]*2;}
int32_t main()
{
IOS
int a,b,c,k;
cin>>a>>b>>c>>k;
int sum = 0;
if(k>=a) sum+=a,k-=a;
else sum+=k,k=0;
if(k>=b) k-=b;
else if(k>0) k=0;
if(k>=c) sum-=(c),k-=c;
else if(k>0) sum-=k,k=0;
cout<<sum;
return 0;
}
// Use emplace back in place of pushback
// Use tie function , for object destructuring

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip> 

using ll = long long;
using ull = unsigned long long;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

int inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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; }
template<typename T>inline void print(T&& x){cout<<setprecision(32)<<x<<endl;}// 改行付き出力

// TODO: write
int main() {
  string s;cin>>s;
  vector<int> exist(26,0);
  rep(i,s.size())exist[s[i]-'a']++;
  if(s.size() < 26){
    rep(i,26)if(!exist[i]){
      s += 'a'+i;
      break;
    }
    print(s);
  }else if(s == "zyxwvutsrqponmlkjihgfedcba"){
    print(-1);
  }else{
    for(int i = 25; i >= 0;--i){
      for(char c = ++s[i];c <= 'z';c++){
        bool can = true;
        rep(j,i)if(c == s[j])can = false;
        if(can){
          print(s.substr(0,i) + c);
          return 0;
        }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N,x,ans=0;
	vector<int> A;
	cin >> N >> x;
	for(int i=0;i<N;i++){
		int a;
		cin >> a;
		A.push_back(a);
	}
	sort(A.begin(),A.end());
	long long sum = 0;
	while(sum+A[ans]<=x&&ans<N){
		sum+=A[ans];
		ans++;
		if(ans==N&&sum<x) ans--; 
	}

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


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

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    if(a > b || (a < b && n == 1)){
        cout << 0 << endl;
    }else if(a == b || (a < b && n == 2)){
        cout << 1 << endl;
    }else if(a < b && n >= 2){
        cout << (n-2)*(b-a)+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  char s[5];
  scanf("%s", s);

  if ((s[2] == '0' && s[3] != '0') || (s[2] == '1' && s[3] >= '0' && s[3] <= '2')) {
    if ((s[0] == '0' && s[1] != '0') || (s[0] == '1' && s[1] >= '0' && s[1] <= '2')) {
      printf("AMBIGUOUS\n");
    } else {
      printf("YYMM\n");
    }
  } else {
    if ((s[0] == '0' && s[1] != '0') || (s[0] == '1' && s[1] >= '0' && s[1] <= '2')) {
      printf("MMYY\n");
    } else {
      printf("NA\n");
    }
  }

  return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if (a==b)
        {
          	if (a==c)
            {
              	System.out.println("No");
            }
            else
            {
				System.out.println("Yes");
            }
        }
      	else if(a==c)
        {
          	if (a==b)
            {
              	System.out.println("No");
            }
            else
            {
          		System.out.println("Yes");
            }
        }
      	else if(b==c)
        {
          	if (a==b)
            {
              	System.out.println("No");
            }
          	else
            {
              	System.out.println("Yes");
            }
        }
      	else
        {
          	System.out.println("No");
        }
	}
}

Measured memory_bytes: 23764