akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <map>

std::vector<intmax_t> divisor(intmax_t n) {
  std::vector<intmax_t> res;
  for (intmax_t i = 1; i*i <= n; ++i) {
    if (n % i) continue;
    res.push_back(i);
    if (n/i != i) res.push_back(n/i);
  }
  std::sort(res.begin(), res.end());
  return res;
}

template <typename InputIt>
auto compress(InputIt first, InputIt last) {
  using value_type = typename InputIt::value_type;
  std::map<value_type, size_t> res;
  while (first != last) res[*first++];
  size_t i = 0;
  for (auto& p: res) p.second = i++;
  return res;
}

template <typename Tp>
Tp gcd(Tp a, Tp b, Tp& x, Tp& y) {
  x = Tp(0);
  y = Tp(1);
  for (Tp u = y, v = x; a;) {
    Tp q = b/a;
    std::swap(x -= q*u, u);
    std::swap(y -= q*v, v);
    std::swap(b -= q*a, a);
  }
  return b;
}

template <typename Tp>
Tp modinv(Tp a, Tp mod) {
  Tp x, y;
  gcd(a, mod, x, y);
  x %= mod;
  if (x < 0) x += mod;
  return x;
}

template <typename Tp>
Tp modadd(Tp a, Tp b, Tp mod) {
  a += b % mod;
  if (a < 0) a += mod;
  if (a >= mod) a -= mod;
  return a;
}

template <typename Tp>
Tp modadd(std::initializer_list<Tp> const& adds, Tp mod) {
  Tp res = 0;
  for (auto const& add: adds) {
    res += add % mod;
    if (res < 0) res += mod;
    if (res >= mod) res -= mod;
  }
  return res;
}

template <typename Tp>
Tp modsub(Tp a, Tp b, Tp mod) {
  a -= b % mod;
  if (a < 0) a += mod;
  if (a >= mod) a -= mod;
  return a;
}

template <typename Tp>
Tp modmul(std::initializer_list<Tp> const& muls, Tp mod) {
  Tp res = 1;
  for (auto const& mul: muls) (res *= mul) %= mod;
  return res;
}

template <typename Tp>
Tp modpow(Tp base, intmax_t iexp, Tp mod) {
  Tp res = 1;
  for (Tp dbl = base; iexp; iexp >>= 1) {
    if (iexp & 1) res = res * dbl % mod;
    dbl = dbl * dbl % mod;
  }
  return res;
}

constexpr intmax_t  operator ""_jd(unsigned long long n) { return n; }
constexpr uintmax_t operator ""_ju(unsigned long long n) { return n; }
constexpr size_t    operator ""_zu(unsigned long long n) { return n; }
// constexpr ptrdiff_t operator ""_td(unsigned long long n) { return n; }

constexpr intmax_t mod = 1e9+7;

int main() {
  intmax_t n, k;
  scanf("%jd %jd", &n, &k);

  std::vector<intmax_t> ds = divisor(n);
  std::map<intmax_t, size_t> map = compress(ds.begin(), ds.end());
  std::vector<size_t> dp(map.size());
  intmax_t inv2 = modpow(2_jd, mod-2, mod);
  intmax_t res = 0;
  for (auto d: ds) {
    intmax_t cur = modpow(k, (d+1)/2, mod);
    for (auto d0: ds) {
      if (d == d0) break;
      if (d % d0) continue;
      cur = (cur + mod - dp[map.at(d0)]) % mod;
    }
    dp[map.at(d)] = cur;

    (cur *= d) %= mod;
    if (d % 2 == 0) (cur *= inv2) %= mod;
    (res += cur) %= mod;
  }
  printf("%jd\n", res);
}


Measured memory_bytes: 384
function Main(input) {
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});
    let K = parseInt(input[0][0], 10);
    let ans = -1;
    let candidate = 7;
	for (let i = 1; i <= K; i ++){
        if (candidate % K === 0){
            ans = i;
            break;
        } else {
            candidate = candidate * 10 + 7;
            candidate %= K;
        }

    }	
	console.log(ans);
	
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 32536
#include <iostream>

int main()
{
    int A, B;
    std::cin >> A >> B;
    if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) {
        std::cout << "Possible\n";
    } else {
        std::cout << "Impossible\n";
    }
    return 0;
}


Measured memory_bytes: 256
while True:
    try:
        N = int(input())
        A = list(map(int, input().split()))
        A.sort()
        result = None
        for i in A:
            if result is None:
                result = i
                continue
            result += i
            result = result / 2
        print(result)
    except EOFError:
        break

Measured memory_bytes: 3060
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong(), M = sc.nextLong();
        long ans;
        if (N == 1 && M == 1) {
            ans = 1;
        } else if (N == 1 && M > 1) {
            ans = M - 2;
        } else if (N > 1 && M == 1) {
            ans = N - 2;
        } else {
            ans = (N - 2) * (M - 2);
        }
        System.out.println(ans);
        sc.close();
    }
}


Measured memory_bytes: 21844
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

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

ll calc(ll i){
  if(i==1) return 1;
  
  return i*calc(i-1);
}


int main(){
  ll n;
  cin>>n;
  
  cout<<calc(n)<<endl;
    
  return 0;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
typedef long long lol;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    lol result{0};
    lol n; cin >> n;
    lol k; cin >> k;
    vector<lol> a(n);
    lol ma{0};
    REP(i, n)
    {
        cin >> a[i];
        ma = max(ma, a[i]);
    }
    lol l{1}, r{ma};
    while(l < r)
    {
        lol mid = l + (r - l)/2;
        lol cuts{0};
        REP(i, n)
        {
            if(a[i]%mid)
                cuts += a[i]/mid;
            else
            {
                cuts += (a[i]-1)/mid;
            }
            
        }
        if(cuts > k)
            l = mid+1;
        else
        {
            r = mid;
        }
        
    }
    result = l;

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

Measured memory_bytes: 4772
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	string s,t,u;cin >> s >> t >> u;
	int ans=0;
	rep(i,n){
		if(s.at(i)==t.at(i) && t.at(i)==u.at(i)) continue;
		else if(s.at(i)==t.at(i) || t.at(i)==u.at(i) || u.at(i)==s.at(i)) ans++;
		else ans+=2;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

  int T;
  // cin >> T;
  T = 1;

  while (T--) {
    solve();
  }
}
void solve() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;

  s[k - 1] = s[k - 1] - 'A' + 'a';
  cout << s << endl;
}


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

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
struct multi {
  ll first;
  ll second;
  ll third;
};
bool multicomp(const multi &a, const multi &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  string S;
  cin >> N;
  cin >> S;
  vl A(N + 1, 0);
  vl B(N + 1, 0);
  REP(i, N) {
    if (S[i] == '#') {
      if (i > 0)
        A[i] = A[i - 1] + 1;
      else
        A[0] = 1;
    } else {
      if (i > 0)
        A[i] = A[i - 1];
      else
        A[0] = 0;
    }
  }
  B[N] = 0;
  RREP(i, N) {
    if (S[i] == '.')
      B[i] = B[i + 1] + 1;
    else
      B[i] = B[i + 1];
  }
  ll ans = llINF;
  ans = min(ans, B[0]); //####
  REP(i, N) { ans = min(ans, A[i] + B[i + 1]); }

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


Measured memory_bytes: 4340
a = input()
n = len(a)

l = [0]*(2*n-1)
i = 0
j = 0
while i < 2*n - 1:
    while i >= j and i+j+1 < 2*n and a[(i-j)//2] == a[(i+j+1)//2]:
        j += 1
    l[i] = j
    k = 1
    while i + k < 2*n-1 and i >= k and l[i] >= k and l[i-k] != l[i]-k:
        l[i+k] = min(l[i-k],l[i]-k)
        k += 1
    i += k
    if j > k:
        j -= k
    else:
        j = 0
ans = n*(n-1)//2+1
count = [0]*26
for i in a:
    count[ord(i)-ord("a")] += 1
for i in count:
    ans -= i*(i-1)//2
print(ans)



Measured memory_bytes: 24712
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long int ll;

ll mod=1e9+7;

ll mod_pow(ll a,ll b){
	a%=mod;
	if(b==0)return 1;
	if(b==1)return a;
	ll res=mod_pow(a,b/2)%mod;
	res*=res; res%=mod;
	if(b%2)res*=a;
	return res%mod;
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int m,n; cin >> m >> n;
	cout << mod_pow(m,n) << endl;
}


Measured memory_bytes: 3208
def main():
    n = int(input())
    x, y, z = 0, 0, 0
    f = False
    for i in range(1, 3501):
        for j in range(i, 3501):
            if (4*i*j - i*n - j*n) > 0 and i*j*n % (4*i*j - i*n - j*n) == 0:
                x = i
                y = j
                z = i*j*n // (4*i*j - i*n - j*n)
                f = True
                break
        if f:
            break
    print(x, y, z)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
import sys
sys.setrecursionlimit(2147483647)
 
h,w=map(int,input().split())
s=list(input() for _ in range(h))
 
yoko=[[0]*w for _ in range(h)]
tate=[[0]*w for _ in range(h)]
 
def yoko_check(y,x,cnt):
    global yoko,s
    if x==w-1:
        yoko[y][x]=cnt
        return cnt
    else:
        if s[y][x+1]=="#":
            yoko[y][x]=cnt
            return cnt
        else:
            yoko[y][x]=yoko_check(y,x+1,cnt+1)
            return yoko[y][x]
 
 
def tate_check(y,x,cnt):
    global tate,s
    if y==h-1:
        tate[y][x]=cnt
        return cnt
    else:
        if s[y+1][x]=="#":
            tate[y][x]=cnt
            return cnt
        else:
            tate[y][x]=tate_check(y+1,x,cnt+1)
            return tate[y][x]
 
 
for y in range(h):
    for x in range(w):
        if yoko[y][x]==0 and s[y][x]==".":
            yoko_check(y,x,1)
        if tate[y][x]==0 and s[y][x]==".":
            tate_check(y,x,1)
 
#print(tate)
 
result=0
for y in range(h):
    for x in range(w):
        if s[y][x]==".":
            result=max(result,tate[y][x]+yoko[y][x]-1)  
 
print(result)  

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

typedef long long ll;
using namespace std;

const ll MOD = 1e9 + 7;

ll rep_pow(int n, int p) {
    if (p == 0) {
        return 1;
    }
    if (p % 2 == 0) {
        ll t = rep_pow(n, p / 2);
        return t * t % MOD;
    } else {
        return n * rep_pow(n, p - 1) % MOD;
    }
}

int main() {
    int n;
    cin >> n;
    vector<ll> t(n), a(n);
    int ti = 0;
    int ai = n - 1;
    for (int i = 0; i < n; i++) {
        cin >> t[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 1; i < n; i++) {
        if (t[i] > t[i - 1]) {
            ti = i;
        }
    }
    for (int i = n - 2; i >= 0; i--) {
        if (a[i] > a[i + 1]) {
            ai = i;
        }
    }
    if (a[ai] != t[ti] || ai < ti) {
        cout << 0;
        return 0;
    }
    vector<ll> mins(n);
    for (int i = 0; i < n; i++) {
        mins[i] = min(a[i], t[i]);
    }
    ll cur = 0;
    ll ans = 1;
    for (int i = 0; i <= ti; i++) {
        if (cur < mins[i]) {
            cur = mins[i];
        } else {
            ans *= cur % MOD;
            ans %= MOD;
        }
    }
    cur = 0;
    for (int i = n - 1; i >= ai; i--) {
        if (cur < mins[i]) {
            cur = mins[i];
        } else {
            ans *= cur % MOD;
            ans %= MOD;
        }
    }
    if (ai - ti >= 2) {
        ans *= rep_pow(a[0], ai - ti - 1) % MOD;
        ans %= MOD;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 2560
A_1 = list(map(int, input().split()))
A_2 = list(map(int, input().split()))
A_3 = list(map(int, input().split()))

N = int(input())
for i in range(N):
    b = int(input())
    if A_1[0] == b:
        A_1[0] = 0
    if A_1[1] == b:
        A_1[1] = 0
    if A_1[2] == b:
        A_1[2] = 0
    if A_2[0] == b:
        A_2[0] = 0
    if A_2[1] == b:
        A_2[1] = 0
    if A_2[2] == b:
        A_2[2] = 0
    if A_3[0] == b:
        A_3[0] = 0
    if A_3[1] == b:
        A_3[1] = 0
    if A_3[2] == b:
        A_3[2] = 0
if A_1 == [0, 0, 0] or A_2 == [0, 0, 0] or A_3 == [0, 0, 0]:
    print("Yes")
    exit()
for j in range(3):
     if A_1[j] == 0 and A_2[j] == 0 and A_3[j] == 0:
         print("Yes")
         exit()
if A_1[0] == 0 and A_2[1] == 0 and A_3[2] == 0:
    print("Yes")
    exit()

if A_3[0] == 0 and A_2[1] == 0 and A_1[2] == 0:
    print("Yes")
    exit()

print("No")

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using T = tuple<string, int, int>;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<T> v(n);
  rep(i, n) {
    string s;
    int p;
    cin >> s >> p;
    v[i] = make_tuple(s, -p, i+1);
  }
  sort(v.begin(), v.end());
  rep(i, n)
    cout << get<2>(v[i]) << endl;
  return 0;
}

Measured memory_bytes: 256
/*
	---------O7Oo7oO7O-------------
*/

#include <bits/stdc++.h>

#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
using namespace std;
#define all(v) v.begin(),v.end()

const int mod = 1000*1000*1000 +7;
int Bin_expo(int n, int b)
{
	int res = 1;
	while (b > 0)
	{
		if (b & 1)
		{
			res = (res * n) % mod;

		}
		n = (n * n)  % mod;


		b /= 2;

	}
	return res % mod;
}


int32_t main()
{
	IOS


	

	int n;
	cin>>n;
	vector<int> v(n);
	vector<int> suf(n,0),pref(n);
	int p = 0;
	for(int i=0;i<n;i++)
	{
		cin>>v[i];
		
		if(i==0)
			pref[i] = v[i];
		else
			pref[i] = pref[i-1] +v[i];
		

	}

	suf[n-1] = v[n-1];
	for(int i=n-2;i>=0;i--)
	{
		suf[i] = (suf[i+1] + v[i]) % mod;
	}

	for(int i=0;i<n-1;i++)
	{
		p += (v[i] * suf[i+1]) % mod;
		p%=mod;
		if(p<0)
			p+=mod;
	}

	cout<<p<<"\n";
}




Measured memory_bytes: 7952
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 //Compiler version g++ 6.3.0
 
 int main()
 {
 	int n; string a, b, c;
 	cin >> n >> a >> b >> c;
 	int ans = 0;
 	for(int i = 0; i < n; i++){
 		int min = 4;
 		for(char j = 'a'; j <= 'z'; j++){
 			int cnt = 0;
 			if(a[i]!=j) cnt++;
 			if(b[i]!=j) cnt++;
 			if(c[i]!=j) cnt++;
 			if(cnt < min) min = cnt;
 		}
 		ans += min;
 	}
 	cout << ans << endl;
 	return 0;
 }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1*1e5+10,Mod=1e9+7;
typedef long long ll;
#define pb push_back
int n,a[150];
int main()
{
  double ans=0;
  cin>>n;
  for(int i=1;i<=n;i++) cin>>a[i];
  for(int i=1;i<=n;i++) ans+=1.0/(a[i]);
  printf("%.6lf\n",1/(ans));
  return 0;
}


Measured memory_bytes: 256
#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 Khela ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define llu long long unsigned int
#define pf printf
#define sf scanf
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define pii pair<int ,int>
#define PII pair<ll, ll>

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
 
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
int Set(int N,int pos){return N=N | (1<<pos);}
int reset(int N,int pos){return N= N & ~(1<<pos);}
bool check(int N,int pos){return (bool)(N & (1<<pos));}
const int Max=1e9+100;
const ll sz=1e6+100;
bool mark[sz];
vector<ll> prime;
ll siz;
void seive()
{
    ll i,j,k;
    ll sq=sqrt(sz);
    for(i=3;i<sz;i+=2)
    {
       mark[i]=true;
    }
    prime.pb(2);
    for(i=3;i<=sq;i+=2)
    {
        if(mark[i])
        {
            for(j=i*i;j<sz;j+=2*i) mark[j]=false;
        }
    }
    mark[1]=true;
    mark[2]=true;
    for(i=3;i<sz;i+=2) if(mark[i]) prime.pb(i);
    siz=prime.size();
}

ll fact(ll x)
{
      ll ct=0;
      ll i,j,k;
      if(x>0) ++ct;
      ll sq=sqrt(x);
      for(i=0;i<siz && prime[i]<=sq;i++)
      {
          if(x<sz && mark[x]) break;
          if(x%prime[i]==0)
          {
              ++ct;
              while(x%prime[i]==0) x/=prime[i];
              sq=sqrt(x);
          }
          
      }

      if(x>1) ++ct;
      return ct;
}
int main()
{
    Khela
    ll a,b,c,i,j,k,q,p,x,y,ct,ct1,m,l,r,x1,y1,mn,h,sum1,in,z,mid,n,mx;
    char ch;
    double d;
    string str1,str2,str;
    bool bl,bl1;
    int t,cs=1;
    seive();
    while(cin>>p>>q)
    {
        n=__gcd(p,q);
        ll ans=fact(n);
        cout<<ans<<endl;
    }

}


Measured memory_bytes: 2424
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC103_C solver = new ABC103_C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC103_C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();

            long ans = 0;
            for (int i = 0; i < n; i++) {
                ans += in.nextLong() - 1;
            }

            out.print(ans);
        }

    }
}



Measured memory_bytes: 25676
#include <stdio.h>
#include <string.h>
int main (){
    char s[300] = {0};
    int ans = 0;
    int i,j;
    scanf("%s",s);
    ans = strlen(s);
    while(1){
        ans -= 2;
        j = ans / 2;
        int z = ans /2; 
        for(i=0;i<j;i++){
            if(s[i] != s[z]){
                //printf("%d %d %d\n",i,j,ans);
                break;
            }else{
                z++;
            }
            
        }
         if(z  ==  ans){
                printf("%d\n",ans);
                break;
        }
    }


    return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
	int W, a, b;
	while(cin >> W >> a >> b) {
		if(b > a + W || b + W < a) {
			cout << min(abs(b - a - W), abs(a - b - W)) << endl;
		}
		else {
			cout << 0 << endl;
		}
	}
}

Measured memory_bytes: 256
#include<stdio.h>
#include<ctype.h>
#include<string.h>

int main(void)
{
	char T[1002] = {0}; 
	char W[10];
	int count = 0;
	int i;
	
	
	scanf("%s",W);
	
	while(1){
	scanf("%s",T);
	if(strcmp(T,"END_OF_TEXT")==0)
	break;
	for(i = 0;T[i] != '\0';i++)
		T[i] = tolower(T[i]);
		for(i = 0;W[i] != '\0';i++)
		W[i] = tolower(W[i]);
		if(strcmp(T,W)==0)
		count++;
			
		}
		printf("%d\n",count);
		return 0;
		
}
		


Measured memory_bytes: 2088
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
int main()
{

       int a,b,c;
       cin>>a>>b>>c;
       if(a==b&&b==c)
        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 = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  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 {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  int a,b,c;cin>>a>>b>>c;
  string ans="NO";
  if(b-a==c-b)ans="YES";
  cout(ans);
  
  return 0;
}

Measured memory_bytes: 125568
#include<bits/stdc++.h>
#define int long long
#define dd second
#define mp make_pair
#define pb push_back
#define ff first
#define dd second
#define pp pair<int,int>
using namespace std;
int n,k;
main()
{
    ios_base::sync_with_stdio(false);
    cin >> n >> k;
    unordered_map<int,int> mapa;
    for(int i = 0; i < n; ++i)
    {
        int temp; cin >> temp;
        mapa[temp]++;
    }
    vector<pp> nums;
    for(auto &i:mapa)
    {
        nums.pb(mp(i.second,i.first));
    }
    sort(nums.begin(),nums.end());
    reverse(nums.begin(), nums.end());
    int ans = 0;
    while(nums.size() >k)
    {
        ans += nums.back().ff;
        nums.pop_back();
    }
    cout << ans << endl;
}



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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

#include <iostream>
#include <vector>

using namespace std;


int main() {
    int n;
    cin >> n;

    vector<vector<ll>> edges(n);
    rep(i, n - 1) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }

    vector<ll> cs(n);
    rep(i, n) cin >> cs[i];

    priority_queue<ll> q;
    for (ll l : cs) q.push(l);

    vector<ll> ans(n, -1);
    queue<ll> r;

    int f1 = 0, f2 = edges[0][0];
    ans[f1] = q.top();
    q.pop();
    r.push(f1);
    ans[f2] = q.top();
    q.pop();
    r.push(f2);

    while (!r.empty()) {
        ll t = r.front();
        r.pop();
        for (ll next : edges[t]) {
            if (ans[next] != -1) continue;
            assert(!q.empty());
            ans[next] = q.top();
            q.pop();
            r.push(next);
        }
    }

    sort(cs.begin(), cs.end());
    ll sum = accumulate(cs.begin(), cs.end() - 1, 0ll);
    cout << sum << endl;

    for (ll l : ans) cout << l << ' ';
    cout << endl;

}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define repi(i,n) for(int i=0;i<(int)(n);i++)
#define repd(i,n) for(int i=(int)(n);i>=0;i--)
#define repm(i,m) for(auto i=m.begin();i!=m.end();i++)

int main()
{
    int N;
    vector<int> X(N);
    vector<int> Y(N);
    
    cin >> N;
    repi(i,N){
        cin >> X[i] >> Y[i];
    }
    vector<int> path(N);
    repi(i,N){
        path[i] = i;
    }

    double sum = 0.0;
    do{
        repi(i,N-1){
            int dx = X.at(path.at(i)) - X.at(path.at(i+1));
            int dy = Y.at(path.at(i)) - Y.at(path.at(i+1));
            sum += pow(dx*dx + dy*dy, 0.5);
        }
    } while (next_permutation(all(path)));
    int Frac = 1;
    for(int i=2;i <= N;i++){
        Frac *= i;
    }
    cout << fixed << setprecision(10) << sum/Frac << endl;
    return 0;
}

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

const int INF = 1001001001;

int main(){
    string t;
    cin >>t;
    rep(i,t.size())
    {
        if(t[i]=='?'){t[i]='D';}
    }
    cout<<t;
    return 0;

}


Measured memory_bytes: 3720
#include<iostream>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;
typedef long long LL;
int a[100005];
int main()
{
	int x, y, z;
	for (x = 1;x <= 100;x++)
		for (y = 1;y <= 100;y++)
			for (z = 1;z <= 100;z++)
			{
				if (x * x + y * y + z * z + x * y + y * z + x * z > 10000)
					break;
				a[x * x + y * y + z * z + x * y + y * z + x * z]++;
			}
	int n;
	cin >> n;
	for (int i = 1;i <= n;i++)
		cout << a[i] << endl;
	return 0;
}

Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;

const long long INFLL = 1LL << 60;
const int INFI = 1000000000;

int main(){
    int N, M; cin >> N >> M;
    int Lmax=0;int Rmin=N+1;
    for(int i=0;i<M;i++){
        int l,r; cin >> l >> r;
        if(l>Lmax) Lmax = l;
        if(r<Rmin) Rmin = r;
    }
    int ans = 0;
    if(Rmin>=Lmax) ans=Rmin-Lmax+1;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdlib>

using namespace std;

typedef long long ll;
struct info{ll from, to, cost;};
struct edge{ll to, cap, rev;};

const int MAX = 105;
vector<edge> G[MAX], cG[MAX];
bool used[MAX];

void add_edge(ll from, ll to, ll cap){
  cG[from].push_back((edge){to, cap, cG[to].size()});
  cG[to].push_back((edge){from, 0, cG[from].size()-1});
}

ll dfs(ll v, ll t, ll f){
  if(v == t) return f;
  used[v] = true;
  for(int i = 0; i < (int)G[v].size(); i++){
    edge& e = G[v][i];
    if(!used[e.to] && e.cap > 0){
      ll d = dfs(e.to, t, min(f, e.cap));
      if(d > 0){
	e.cap -= d;
	G[e.to][e.rev].cap += d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s, int t){
  for(int i = 0; i < MAX; i++) G[i] = cG[i];
  ll flow = 0;
  while(1){
    memset(used, false, sizeof(used));
    ll f = dfs(s, t, (1LL<<60));
    if(f == 0) return flow;
    flow += f;
  }
  return -1;
}

int N, M;

int main(){
  
  while(cin >> N >> M && N+M){
    for(int i = 0; i < MAX; i++){
      G[i].clear();
      cG[i].clear();
    }
    vector<info> v(M);
    ll neg = 0;
    for(int i = 0; i < M; i++){
      cin >> v[i].from >> v[i].to >> v[i].cost;
      if(v[i].cost < 0) neg += v[i].cost;
    }

    for(int i = 0; i < M; i++){
      if(v[i].cost > 0){
	add_edge(v[i].from, v[i].to, v[i].cost);
	add_edge(v[i].to, v[i].from, v[i].cost);
      }
    }
    
    ll ans = (1LL<<60);
    for(int i = 0; i < N; i++)
      for(int j = 0; j < N; j++)
	if(i!=j) ans = min(ans, max_flow(i,j)+neg);
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1336
from sys import setrecursionlimit
from collections import Counter
import networkx as nx
setrecursionlimit(1000000)
def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(input())
def m_in(type_): return map(type_, input().split())
def r_in(n, type_): return [type_(input()) for _ in range(n)]

def find_components(n, connectors):
    g = nx.Graph()
    for i in range(n): g.add_node(i+1)
    g.add_edges_from(connectors)
    return len(list(nx.connected_components(g)))


n, m = m_in(int)
ab = [list(m_in(int)) for _ in range(m)]

ans = find_components(n, ab) - 1

print(ans)


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

int main() {
    int N, T;
    cin >> N >> T;
    vector<int> c(N), t(N);
    for(int i=0; i<N; i++){
        cin >> c[i] >> t[i];
    }
    int ans = 1001;
    for(int i=0; i<N; i++){
        if(t[i]<=T){
            ans = min(ans, c[i]) ;
        }
    }

    if(ans == 1001){
        cout << "TLE" << endl;
    }else{
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: u8 = read();
    let s: String = read();
    let ans: String = s
        .as_bytes()
        .iter()
        .map(|&x| {
            let mut x = x + n;
            if x > 90 {
                x -= 26;
            }
            x as char
        })
        .collect();
    println!("{}", ans);
}


Measured memory_bytes: 2120
N = int(input())
B = list(map(int, input().split()))

A = [0]*N

A[0] = B[0]
A[N-1] = B[N-2]

for i in range(N-2):
    if A[i+1]<=B[i] and A[i+1]<=B[i+1]:
        A[i+1] = min(B[i], B[i+1])

print(sum(A))


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
#include<set>

/*for(int bit=0; bit<(1<<n);++bit){
rep(j,m){
if(bit>>j&1){
}*/
int dp[1001][10001];
const int INF = 1e9;
int main() {
	int h, n;
	cin >> h >> n;
	vector<int>a(n), b(n);
	rep(i, n) {
		cin >> a[i] >> b[i];
	}
	rep(i, n)rep(j, h+1)dp[i][j] = INF;
	rep(i, n)rep(j, h+1) {
		if (j == 0) {
			dp[i+1][j] = 0;
			continue;
		}
		if (j - a[i] < 0) {
			dp[i + 1][j] = min(dp[i][j], b[i]);
			//cout << "a" << " ";
		}
		else {
			dp[i + 1][j] = min(dp[i + 1][j - a[i]] + b[i], dp[i][j]);
		}
		
		//cout << i + 1 << " " << j << " "<<dp[i + 1][j] << endl;;
	}
	cout << dp[n][h];
	return 0;
}
	

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


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


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define s second
#define f first
#define double long double
const int MOD=1000000007;

int add(int x, int y)
{
	return (x + y) % MOD;
}

int sub(int x, int y)
{
	return add(x, MOD - y);
}

int mul(int x, int y)
{
	return (x * 1ll * y) % MOD;
}

int binpow(int x, int y)
{
	int z = 1;
	while(y > 0)
	{
		if(y % 2 == 1)
			z = mul(z, x);
		x = mul(x, x);
		y /= 2;
	}
	return z;
}

int inv(int x)
{
	return binpow(x, MOD - 2);
}

int fact[200005];
int ifact[200005];

int C(int n, int k)
{
	return mul(fact[n], (mul(ifact[k], ifact[n - k])));
}



 main() {
 	fact[0]=1;
 	for(int i=1; i<=200000; i++){
 		fact[i]=mul(i, fact[i-1]);
 	}
 	for(int i=0; i<=200000; i++){
 		ifact[i]=inv(fact[i]);
 	}
	int n, k;
	cin>>n>>k;
	k=min(k, n-1);
	int ans=0;
	for(int i=0; i<=k; i++){
		ans=add(ans, mul(C(n, i), C(n-1, n-i-1)));
	}
	cout<<ans;
	return 0;
}

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

#define ONLINE_JUDGE
#define pb(a) push_back(a)
#define ALL(a) a.begin(), a.end()
#define FOR(x,to) for(x=0;x<(to);x++)

using ll = long long;

const int E5 = 1e5;

//////////// Solution /////////////////////////////////

int dp[3][101];
int A[3][101];	
void solve() {	
	int N;
	cin >> N;
	for (int i = 1; i <= 2; ++i) {
		for (int j = 1; j <= N; ++j) {
			cin >> A[i][j];
		}
	}

	for (int i = 1; i<=2; ++i) {
		for (int j = 1; j <= N; ++j) {
			dp[i][j] = max(dp[i-1][j],dp[i][j-1]) + A[i][j];
		}
	}

	cout << dp[2][N] << '\n';
}	

/////////// End Solution ///////////////////////////////////////

//////// Initialization ////////////////////////////////////

int main() {

	#ifndef ONLINE_JUDGE
	FILE *FIN = freopen("/home/danil/prog/input.txt", "r", stdin);
	clock_t time_start = clock();
	#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	solve();

	#ifndef ONLINE_JUDGE
	fclose(FIN);
	cerr << "\x1b[031m\n-----------------\nTime=" << (ll)((double)(clock()-time_start) / CLOCKS_PER_SEC * 1000) << "ms\n\x1b[0m";
	#endif

	return 0;
}

//////// End Initialization ///////////////////////////////////////

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

#define ff              first
#define ss              second
//#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int, int>
#define mci             map<char,int>
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define rep(i,x,y)  for(int i=x;i<y;i++)
#define repr(i,x,y) for(int i=x;i>=y;i--)

using namespace std;
 
int main()
{
    int N;
    int D;
    cin>>N;
    cin>>D;
    int X,Y,count = 0;
    rep(i, 0, N)
    {
        cin>>X>>Y;
        double result = sqrt(pow(X,2)+pow(Y,2));
        if(result<=D)
            count++;
    }
    cout<<count<<"\n";
    return 0;
    }


Measured memory_bytes: 3676
while True:
    try:raw=[float(i) for i in input().split(" ")]
    except:break
    a=raw[:3]
    b=raw[3:]
    yx=[]
    ed={0:1,1:0}
    for e in range(2):
        ab=[i*b[e] for i in a]
        ba=[i*a[e] for i in b]
        yx.append((ab[2]-ba[2])/(ab[ed[e]]-ba[ed[e]]))
    sisya=[i*10000-int(i*1000)*10 for i in yx]
    kekka=[True if i>4 else False for i in sisya]
    x="{0:.3f}".format(yx[1]+int(kekka[1])/1000)
    y="{0:.3f}".format(yx[0]+int(kekka[0])/1000)
    print(x+" "+y)

Measured memory_bytes: 7448
/*Writer : Md. Shafiur Rahman Dipu  */

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

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

#define pi 2*acos(0.00)
#define INF 2e18

long long poW(long long base, long long power) {
    long long result = 1;
    while(power > 0) {
        if(power & 1) {
            result = (result*base) ;
        }
        base = (base * base);
        power = power / 2;
    }
    return result;
}


#define ull unsigned long long
#define ll long long
#define ld long double

const int mx = 105;
const int mod = 1000000007;
int w[mx];
ll v[mx];
int n,k;
ll dp[100005][mx];

ll func(int totw, int pos)
{
    if(pos >= n){return 0;}
    if(dp[totw][pos]!=-1){return dp[totw][pos];}

    if(totw+w[pos] > k){
        return dp[totw][pos] = func(totw,pos+1);
    }
    else{
        ll res1 = func(totw,pos+1);
        ll res2 = v[pos]+func(totw+w[pos], pos+1);

        return dp[totw][pos] = max(res1,res2);
    }
}

int main()
{
    #ifdef dipu
    //freopen("inp.txt","r",stdin);
    #endif

    cin >> n >> k;
    for(int i=0; i<n; i++){
        cin >> w[i] >> v[i];
    }
    memset(dp, -1, sizeof dp);
    ll res = func(0,0);

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 82304
import sys
from functools import lru_cache

sys.setrecursionlimit(1000000000)

MOD = 10 ** 9 + 7

@lru_cache(maxsize=None)
def r(k, smaller):
    global s

    if k == len(s):
        return 1

    if smaller:
        if s[k] == "1":
            return (2 * r(k + 1, True) + r(k + 1, False)) % MOD
        else:
            return r(k + 1, True) % MOD
    else:
        return (3 * r(k + 1, False)) % MOD


s = input()
print(r(0, True))


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

void swap(char &a,char &b){
	char temp=a;
	a=b;
	b=temp;
}

int stoi(string s){
	int a=0;
	for(int i=0,digit=1;i<s.length();i++,digit*=10){
		a+=(s[i]-'0')*digit;
	}
	return a;
}

int main(void){
	int n;
	cin>>n;
	while(n--){
		string s;
		cin>>s;
		for(int i=0;i<8;i++){
			for(int j=8-1;j>i;j--){
				if(s[i]>s[j])swap(s[i],s[j]);
			}
		}
		int A=stoi(s);
		for(int i=0;i<8;i++){
			for(int j=8-1;j>i;j--){
				if(s[i]<s[j])swap(s[i],s[j]);
			}
		}
		int B=stoi(s);
		cout<<A-B<<endl;
	}
	return 0;
}

Measured memory_bytes: 3160
s = []
log = []
l = gets.chomp.split("")
sum = 0
for i in 0..l.size-1 do
  c = l[i]
  if c=="\\"
    s.push(i)
  elsif c=="/" && s.size>0
    right,left = i,s.pop
    sum += right - left
    log << [left,right]
  end
end
printf("%d\n",sum)

log = log.sort_by{|left,right| left }
sum = 0
flood = [0]
for i in 0..log.size-1 do
  left,right = log[i]
  if i==0
    edge = right
  end
  if edge && edge < left
    flood << sum
    flood[0] += 1
    sum = 0
    edge = right
  end
  sum += right - left
  if i == log.size-1
    flood << sum
    flood[0] += 1
  end
end
printf("%s\n",flood.join(" "))


Measured memory_bytes: 8912
/*
    Created by Tejas Chaudhari
*/

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef double lf;
typedef bool bl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<lf> vd;
typedef vector<bl> vb;
typedef string st;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;

#define INF (LONG_LONG_MAX / 4)
#define Mod % 1000000007
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()

void re_curse() {
    ll x;
    cin>>x;
    if (x >= 30) {
        cout<<"Yes"<<endl;
    } else {
        cout<<"No"<<endl;
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin>>t;
    for (int i = 1; i <= t; ++i) {
        re_curse();
    }
    return 0;
}


Measured memory_bytes: 3632
import java.util.*;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] a = new int[M + 1];
        if(M==0){
            a[0] = 0;
        }
        else{
            a[0] = sc.nextInt();
        }

        for(int i=1; i<M; i++){
            a[i] = sc.nextInt();
            if(a[i]==a[i-1]+1){
                System.out.println(0);
                return;
            }
        }

        int[] ans = new int[N + 1];
        ans[0] = 1;
        int x = 0;
        if(a[0]==1){
            ans[1] = 0;
            x += 1;
        }
        else{
            ans[1] = 1;
        }
        for(int i=2; i<=N; i++){
            if(i==a[x]){
                ans[i] = 0;
                x += 1;
            }
            else{
                ans[i] = (ans[i - 1] + ans[i - 2]) % 1000000007;
            }
        }
        System.out.println(ans[N]);
    }
}

Measured memory_bytes: 46232
#include <iostream>
#include <vector>
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<int> a(N + 1);
  for (int i = 1; i <= N; i++)
    cin >> a[i];
  int now = 1;
  vector<int> count(N);
  int ans = 0;
  while (true)
  {
    if (now == 2)
    {
      cout << ans << endl;
      return 0;
    }
    if (0 < count[now])
    {
      cout << -1 << endl;
      return 0;
    }
    count[now]++;
    ans++;
    now = a[now];
  }
  return 0;
}

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

int main(){
  int A,B,C,X;
  int cnt = 0;
  cin >> A >> B >> C >> X;
  for(int i=0;i<=A;i++){
   for(int j=0;j<=B;j++){
     for(int k=0;k<=C;k++){
       if(X == 500*i+100*j+50*k)
         cnt++;
     } } }
  cout << cnt << endl;
}
       

Measured memory_bytes: 256
using System;

namespace AtCoder_ABC_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int count = 0;
            String strN = Console.ReadLine();
            int intN = int.Parse(strN);

            for(int i = 1; i <= intN; i++)
            {
                String temp = i.ToString();
                if (temp.Length % 2 == 1)
                {
                    count++;
                }
            }
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

void mod( ll &n, ll m=MOD ){ n%=m,n+=m,n%=m; }

const int MAXN = 1e5+5;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

int main() 
{
    fastio();

    ll a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    cout<<(a[0]+a[1]);

    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    if (s < t) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N, D;
    cin >> N >> D;

    int tmp = 2*D+1;
    cout << (N+tmp-1)/(tmp) << endl;
    return 0;
}

Measured memory_bytes: 256