akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

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

LL moddev(LL a, LL b){
	return a * modinv(b) % MOD;
}

void Main()
{
    string s; cin>>s;
    REP(i,SIZE(s)){
        cout << "x";
    }
    cout << endl;

	return;
}

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

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    cout << 0 << endl;

    string s;
    cin >> s;
    if (s == "Vacant") return 0;
    string f = s;

    int l = 0;
    int r = n - 1;

    int p = -1;
    while (s != "Vacant") {
        int c = (r + l) / 2;
        if (p == c) {
            c++;
        }
        cout << c << endl;
        cin >> s;
        if (c % 2 == 0) {
            if (s == f) {
                l = c;
            } else {
                r = c;
            }
        } else {
            if (s == f) {
                r = c;
            } else {
                l = c;
            }
        }
        p = c;
    }
}


Measured memory_bytes: 852
s = input()

S = s[:-1]

for i in range(len(s)):
    if len(S) % 2 == 0:
        c= len(S)//2
        a = S[0:c]
        b = S[c:len(S)]
        if a == b:
            print(len(s)-i-1)
            break
        else:
            S = S[:-1]
    else:
        S = S[:-1]

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
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; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n;
  cin >> n;
  vector<pair<string,int>> v;
  rep(i,n){
    string s;
    int p;
    cin >> s >> p;
    v.push_back(make_pair(s,-p));
  }
  auto t = v;
  sort(t.begin(),t.end());
  rep(i,n){
    rep(j,n){
      if(v[j]==t[i]){
        cout << j+1 << endl;
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256
import sys
rm = lambda: map(int, sys.stdin.buffer.readline().split())
ri = lambda: int(sys.stdin.readline())
a, v = rm()
b, w = rm()
t = ri()
if v - w == 0:
  print('NO')
  exit()
if 0 <= abs(a-b) / (v-w) <= t:
  print('YES')
else:
  print('NO')



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

int main() {
    long long a,b,v,w,t;
    cin>>a>>v>>b>>w>>t;
    long long c=(v-w)*t,d=abs(a-b);
    if(c>=d)
        cout<<"YES\n";
    else
        cout<<"NO\n";
}


Measured memory_bytes: 3604
h, w, a, b = map(int, input().split())

for i in range(h):
    for j in range(w):
        if i < b and j < a:
            print(0, end="")
        elif i >= b and j < a:
            print(1, end="")
        elif i < b and j >= a:
            print(1, end="")
        else:
            print(0, end="")
    print()


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

#define fio() cin.tie(0); ios::sync_with_stdio(false);
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;

//str.substr(pos,number) str.insert(str.begin()+5,'3')
//set.insert(num) set.count(i)!=0
const int MAXN = 2e5 + 5;
const int INF = 1e9;
typedef pair<int,int> P;
int n;
int main(){
    fio();
	int a,b;
	cin>>a>>b;
	cout<<a*b<<endl;

}














Measured memory_bytes: 3636
local mfl = math.floor

local function func(i)
  return mfl(i * (i + 1) / 2)
end

local function lower_bound(x, max)
  if x == 1 then return 1 end
  if func(max) < x then return max + 1 end
  local min = 1
  while(1 < max - min) do
    local mid = mfl((min + max) / 2)
    if(func(mid) < x) then
      min = mid
    else
      max = mid
    end
  end
  return max
end

local x = io.read("*n")
local r = lower_bound(x, x)
print(r)
x = x - r
while 1 <= x do
  r = lower_bound(x, r - 1)
  print(r)
  x = x - r
end


Measured memory_bytes: 256
//  B - Christmas Eve Eve
//  main.c

#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int n,price,max,sum = 0;
    
    scanf("%d",&n);
    
    for(int i = 0; i < n; i++){
        scanf("%d",&price);
        if(max < price){
            sum += max;
            max = price;
        }else{
            sum += price;
        }
    }
    
    printf("%d\n", sum + (max/2));
    
    return 0;
}

Measured memory_bytes: 128
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N = int(input())
A = list(map(int, input().split()))
A.sort()

L = 1000010
ps = [False] * L

cs = [0] * L
for i in range(N):
    cs[A[i]] += 1

cnt = 0
for i in range(N):
    if cs[A[i]] > 1:
        if not ps[A[i]]:
            j = A[i]
            while j < L:
                ps[j] = True
                j += A[i]
        continue
    if not ps[A[i]]:
        ps[A[i]] = True
        cnt += 1
        j = A[i] * 2
        while j < L:
            ps[j] = True
            j += A[i]

print(cnt)

Measured memory_bytes: 106836
N = int(input())
H = list(map(int,input().split()))
maxMove = 0
tempoMove = 0
for i in range(N):
  if N-len(range(i)) <= maxMove:
    break
  if tempoMove > 0:
    tempoMove = tempoMove - 1
    continue
  for j in range(N-i-1):
    if H[i+j]>=H[i+j+1]:
      tempoMove = tempoMove + 1
    else:
      break
  if tempoMove > maxMove:
    maxMove = tempoMove
print(maxMove)

Measured memory_bytes: 14224
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define FOR(i, b, n) for (ll i = b; i < n; ++i)

using namespace std;
using ll = long long;
using P = pair<int, int>;

void solve(string S, string T) {
  ll s = S.length();
  ll t = T.length();
  ll ans(t);
  REP(i, s - t + 1) {
    ll diff(0);
    REP(j, t) {
      if (S[i + j] != T[j])
	diff++;
    }
    ans = min(ans, diff);
  }
  cout << ans << endl;
}

int main(){
  // int 3E4  long 2E9  ll 9E18
  cin.tie(0);
  ios::sync_with_stdio(false);

  string S;
  cin >> S;
  string T;
  cin >> T;

  solve(S, T);

  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int main(void){
    int P,A,S,j,u;
    cin>>P>>A>>S>>j>>u;
    
    int minP=min(P,A);
    int minA=min(minP,S);
    int minj=min(j,u);
    
    cout<<(minA+minj)-50<<endl;
}



Measured memory_bytes: 3068
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();
        boolean bl;
        if ((a==b&&a!=c) || (a==c&&a!=b) || (b==c&&a!=c)) {
            bl =true;
        } else {
            bl = false;
        }
        System.out.println(bl?"Yes":"No");
    }
}

Measured memory_bytes: 23892
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
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; }

void solve(long long N){
    N %= 10;
    if( N == 2 || N == 4 ||N == 5 ||N == 7 ||N == 9 ){
        cout<<"hon"<<endl;
    }
    else if(N == 0 ||N == 1 ||N == 6 ||N == 8 ){
        cout<<"pon"<<endl;
    } else{
        cout<<"bon"<<endl;
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


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

#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int n,k;
  cin >> n >> k;
  int x,y;
  for(int t=0;t<k;t++){
    cin >> x >> y;
    int c=min(min(x,n+1-x),min(y,n+1-y));
  c%=3;
  if(c==0) c+=3;
  cout << c << endl;
  }
  return 0;
}



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
  map<char, int> mp{};
  for (int i = 0; i < 26; i++) {
    mp[i + 97] = 0;
  }

  char s;
  while (cin >> s) {
    if (isalpha(s)) {
      if (isupper(s)) {
        s += 32;
      }
      mp[s] += 1;
    }
  }

  for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
    cout << itr->first << " : " << itr->second << endl;
  }
  return 0;
}



Measured memory_bytes: 3088
#include<bits/stdc++.h>
    using namespace std;
     
    int main(){
      long long int number;
      cin >> number;
      long long int H[number];
      long long int memo=0,result=0,tempo,memomemo;
      for (int i=0;i<number;i++){
        cin >> H[i];
      }
      for (int i=0;i<number;i++){
        tempo = H[i];
        memomemo = i;
        if(H[i] >= H[i+1]){
          memo++;
          //cout << H[i]<<H[i+1] <<" ";
          //cout <<memo<<endl;
        }
        if (H[i] < H[i+1]) {
          memo=0;
        }
       	if(memo>result){
          result = memo;
        }
        
      }
     
    cout << result;
    }

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

int main () {
  int n, t;
  cin >> n >> t;
  vector<int> vec(n);
  rep(i, n) cin >> vec.at(i);
  vector<int> time(n-1);
  rep(i, n-1) time.at(i) = vec.at(i+1) - vec.at(i);
  ll ans = 0;
  rep(i, n-1) {
    if (time.at(i) > t) ans += t;
    else ans += time.at(i);
  }
  ans += t;
  cout << ans << endl;
}

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

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    sort(h.begin(), h.end());
    rep(i, min(n, k)) h.pop_back();
    ll ans = 0;
    rep(i, h.size()) ans += h[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4032
n = gets.chomp.to_i
A = gets.chomp.split(' ').map(&:to_i)
B = gets.chomp.split(' ').map(&:to_i)
C = gets.chomp.split(' ').map(&:to_i)

ans = 0
pre = -1
A.each do |a|
  ans += B[a - 1]
  if (a - pre) == 1
    ans += C[pre - 1]
  end
  pre = a
end

puts ans.to_s


Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
constexpr int MOD = 1e9 + 7;

long dp[101][101010];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int N, K; cin >> N >> K;
    vector<int> states;
    for(int i = 0; i * i <= N; ++i) {
        states.push_back(i);
        if(i != 0) states.push_back(N / i);
    }
    sort(states.begin(), states.end());
    int M = states.size();
    
    dp[0][0] = 1;
    for(int i = 1; i <= K; ++i) {
        for(int j = 1; j <= M; ++j) dp[i-1][j] += dp[i-1][j-1];
        for(int j = 0; j <  M; ++j) {
            dp[i][j] = dp[i-1][M - 2 - j] * (states[j+1] - states[j]) % MOD;
        }
    }

    long ans = 0;
    for(int i = 0; i < M; ++i) ans = (ans + dp[K][i]) % MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 78844
#include<cstdio>
#include<algorithm>
using namespace std;
int n,W;
int v[100],w[100];
int dp[10001];
int main(){
    scanf("%d %d",&n,&W);
    for(int i=0;i<n;i++) scanf("%d %d",v+i,w+i);
    fill(dp,dp+W+1,-1);
    dp[0]=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<=W;j++){
            if(j-w[i]>=0&&dp[j-w[i]]>=0) dp[j]=max(dp[j-w[i]]+v[i],dp[j]);
        }
    }
    int res=0;
    for(int i=0;i<=W;i++) res=max(res,dp[i]);
    printf("%d\n",res);
    return 0;
}

Measured memory_bytes: 1064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
typedef long long ll;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  double w,h,x,y;
  cin>>w>>h>>x>>y;
  cout<<w*h/2<<" ";
  if(x==w/2&&y==h/2)cout<<1<<endl;
  else cout<<0<<endl;
  return 0;
}


Measured memory_bytes: 384
//
// Created by 永徳泰明 on 2019-01-12.
//

#include <bits/stdc++.h>

typedef long long ll;

using namespace std;
#define dump(x)  cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define fill(x, y) memset(x,y,sizeof(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 999999999;

void readFromInputFile() {
#ifdef LOCAL
    static std::ifstream in("/Users/hoo/CLionProjects/for_atcoder/input");
    std::cin.rdbuf(in.rdbuf());
#endif
}

int N, W;

int dp(int index, int weight, int m[101][10001], vector<int> v, vector<int> w) {

    if (m[index][weight] != -1) {
        return m[index][weight];
    }

    int res;

    if (index >= N) {
        res = 0;
    } else if (weight < w[index]) {
        res = dp(index + 1, weight, m, v, w);
    } else {
        res = max(
            dp(index + 1, weight, m, v, w),
            dp(index + 1, weight - w[index], m, v, w) + v[index]);
        m[index][weight] = res;
    }

    return res;
}

int main() {
    readFromInputFile();
    int m[101][10001] = {};
    fill(m, -1);
    cin >> N >> W;
    vector<int> v, w;
    rep(i, N) {
        int tv, tw;
        cin >> tv >> tw;
        v.push_back(tv);
        w.push_back(tw);
    }

    cout << dp(0, W, m, v, w) << endl;


    return 0;
}



Measured memory_bytes: 7244
#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

macro_rules! eprint {
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = write!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! eprintln {
	() => { eprintln!(""); };
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = writeln!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! dbg {
	($v:expr) => {{
		let val = $v;
		eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
		val
	}}
}

macro_rules! mat {
	($($e:expr),*) => { Vec::from(vec![$($e),*]) };
	($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
	($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
	($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
	($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
		$a$([$i])*.$f($($t),*)
	};
	($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
		let t = $e;
		ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
	} };
}

pub fn readln() -> String {
	let mut line = String::new();
	::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
	line
}

macro_rules! read {
	($($t:tt),*; $n:expr) => {{
		let stdin = ::std::io::stdin();
		let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
			let line = line.unwrap();
			let mut it = line.split_whitespace();
			_read!(it; $($t),*)
		}).collect::<Vec<_>>();
		ret
	}};
	($($t:tt),*) => {{
		let line = readln();
		let mut it = line.split_whitespace();
		_read!(it; $($t),*)
	}};
}

macro_rules! _read {
	($it:ident; [char]) => {
		_read!($it; String).chars().collect::<Vec<_>>()
	};
	($it:ident; [u8]) => {
		Vec::from(_read!($it; String).into_bytes())
	};
	($it:ident; usize1) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
	};
	($it:ident; [usize1]) => {
		$it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
	};
	($it:ident; [$t:ty]) => {
		$it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
	};
	($it:ident; $t:ty) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
	};
	($it:ident; $($t:tt),+) => {
		($(_read!($it; $t)),*)
	};
}

pub fn main() {
	let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: u32 = 1_000_000_007;
const INF: i64 = std::i64::MAX/2;

fn solve() {
	let n = read!(usize);
	let a = read!([usize]);
	let mut ans = vec![0;n];
	for i in a {
		ans[i-1] += 1;
	}
	for i in 0..n {
		println!("{}", ans[i]);
	}
}


fn run() {
    solve();
}


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



int main() {
    double a, b, x;
    cin >> a >> b >> x;
    
    double ans;
    if(x >= a*a*b/2) {
        double h = (a*a*b - x) * 2 / (a*a);
        ans = atan(h/a);
        ans = ans * 180.0 / M_PI;
    }
    else {
        double h = x * 2 / (a*b);
        ans = atan(h/b);
        ans = 90 - ans * 180.0 / M_PI;
    }
    
    cout << fixed << setprecision(8) << ans << endl;
    
    
    
    return 0;
}




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

int main()
{
    string str;
    int n;
    cin >> str;
    cin >> n;
    for(int i = 0;i < (int)str.size();i++)
    {
        if(n == 1)
        {
            cout << str;
            break;
        }
        if((i + 1) % n == 1)
        {
            cout << str[i];
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
class Program
{   
    
    public void Slove()
    {
        int n = int.Parse(Console.ReadLine());
        long result = 0;
        int rem = 0;
        foreach(int i in Enumerable.Range(0, n))
        {
            int count = int.Parse(Console.ReadLine());
            if(count == 0)
            {
                rem = 0;
                continue;
            }
            count += rem;
            result += count / 2;
            rem = count % 2;
        }
        System.Console.WriteLine(result);
    }
    
    static void Main(string[] args)
    {
        new Program().Slove();
    }
}


Measured memory_bytes: 17360
X =int(input())
def jug(n):
    if n>0:
        return 1
    else:
        return -1

ALL = [i**5 for i in range(-200,200+1)]
for a in ALL:
    for b in ALL:
        if a-b ==X:
            ans =[jug(a)*int(abs(a)**(1.0/5)),jug(b)*int(abs(b)**(0.2))]
            print(ans[0],ans[1])
            exit()

Measured memory_bytes: 9440
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
  int N, K;
  cin >> N >> K;
  int a, b, c;
  ll count = 0;
  ll count2 = 0;
  if (K % 2 == 0) {
    // even
    count = N / K;
    count2 = N / (K / 2) - N / K;
    cout << count * count * count + count2 * count2 * count2 << endl;
  } else {
    // odd
    count = N / K;
    cout << count * count * count << endl;
  }
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    S = []
    boxx = []
    for i in range(N):
        tmp = list(input())
        if i == 0:
            boxx.append(tmp)
        else:
            momo = []
            for c in tmp:
                if c in boxx[-1]:
                    momo.append(c)
                    boxx[-1].remove(c)
            boxx.append(momo)
            
    ans = boxx[-1]
    ans.sort()
    print("".join(ans))
    
    
if __name__ == "__main__":
	main()


Measured memory_bytes: 40816
#include<iostream>
using namespace std;
static const int MAX = 100;
static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

int prim(){
    int u, minv;
    int d[MAX], p[MAX], color[MAX];
    
    for(int i = 0;i<n;i++){
        d[i] = INFTY;
        p[i] = -1;
        color[i] = WHITE;
    }
    
    d[0] = 0;
    
    while(1){
        minv = INFTY;
        u = -1;
        for(int i = 0;i<n;i++){
            if(minv > d[i] && color[i] != BLACK){
                u = i;
                minv = d[i];
            }
        }
        if(u == -1) break;
        color[u] = BLACK;
        for(int v= 0;v<n;v++){
            if(color[v] != BLACK && M[u][v] != INFTY){
                if(d[v] > M[u][v]){
                d[v] = M[u][v];
                p[v] = u;
                color[v] = GRAY;
            }
        }    
    }
 }
int sum = 0;
for(int i =0;i<n;i++){
    if(p[i] != -1) sum += M[i][p[i]];
}

return sum;
}

int main(){
    cin>>n;
    
    for(int i = 0;i<n;i++){
        for(int j = 0;j<n;j++){
            int e; cin>>e;
            M[i][j] = (e == -1) ? INFTY : e;
        }
    }
    
    cout << prim() << endl;
    
    return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int P,Q,R;
  cin>>P>>Q>>R;
  vector<int>F(3);
  F[0]=P;
  F[1]=Q;
  F[2]=R;
  sort(F.begin(),F.end());
  cout<<F[0]+F[1]<<endl;
}

Measured memory_bytes: 3608
import sys
import math
sys.setrecursionlimit(500000)
INF = float('inf')

def main():
    n = int(input())
    for i in range(n, 1000):
        flag = True
        for j, c in enumerate(str(i)):
            if j == 0:
                continue
            else:
                if c != str(i)[0]:
                    flag = False
                    break
        if flag:
            return i

if __name__ == '__main__':
    print(main())


Measured memory_bytes: 9176
/*ॐॐ*/
/* I have already deleted My old account because somebody stole my code
and i have no idea how. If you are copying this code atleast make it look different.
Change variable names or change some Data structres or anything just make sure MOSS do not
Detect Anything.
Yours Faithfully
Shobhit Yadav */

/* I do not fear this new challenge. Rather like a true warrior I will rise to meet it. 
                                       -Prince Vegeta  */

 /* “Strength is the only thing that matters in this world. Everything else is just a delusion for the weak.” – Vegeta */

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

ll R,N;
/*ll freq[200005];*/
void solve(){
   /*memset(freq,0,sizeof(freq));*/
  cin>>N>>R;

  if(N<10)
    cout<<R+ 100*(10-N)<<'\n';


  else
    cout<<R<<'\n';

}



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

  return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include<functional>
#include<stdio.h>
using namespace std;
#define int long long
void dfs(int x,vector<int>v[],bool vis[])
{
    if(vis[x]==false)
        vis[x]=true;
    for(int i=0;i<v[x].size();i++)
    {
        if(vis[v[x][i]]==false)
        {
            vis[v[x][i]]=true;
            dfs(v[x][i],v,vis);
        }
    }
}
signed main()
{
    int n,m;
    cin>>n>>m;
    vector<int>v[n+1];
    int a,b;
    for(int i=0;i<m;i++)
    {
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    bool vis[n+1];
    memset(vis,0,sizeof(vis));
    int con=0;
    for(int i=1;i<=n;i++)
    {
        if(vis[i]==false)
        {
        dfs(i,v,vis);
        con++;
        }
    }
    cout<<con-1<<endl;
}


Measured memory_bytes: 10764
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.rmi.server.ExportException;
import java.util.Arrays;
        import java.util.Scanner;

class Main {
    static Scanner sc;

    private static void nextArr(int[] h) {
        for(int i = 0; i < h.length; i++) h[i] = sc.nextInt();
    }

    private static int nextInt() {
        return sc.nextInt();
    }

    private static void print(Object... vals) {
        for(int i = 0; i < vals.length; i++) {
            if (i != vals.length - 1) {
                System.out.print(vals[i] + ",");
            } else {
                System.out.print(vals[i]);
            }
        }
        System.out.println();
    }

    public static void main(String[] args) {
        sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        int n = s.length();
        int m = t.length();

        int[][] dp = new int[n + 1][m + 1];
        int[][][] prev = new int[n + 1][m + 1][2];
        for(int i = 0; i <= n; i++) {
            for (int j = 0; j <= m; j++) {
                dp[i][j] = Integer.MIN_VALUE;
                dp[i][0] = 0;
                dp[0][j] = 0;
                prev[i][j][0] = -1;
                prev[i][j][1] = -1;
            }
        }

        for(int i = 1; i <= n; i++) {
            for(int j = 1; j <= m; j++) {
                char left = s.charAt(i - 1);
                char right = t.charAt(j - 1);
                if (left == right) {
                    dp[i][j] = fn(i, j, i - 1, j - 1, dp[i - 1][j - 1] + 1, dp, prev);
                }
                dp[i][j] = fn(i, j, i, j - 1, dp[i][j - 1], dp, prev);
                dp[i][j] = fn(i, j, i - 1, j, dp[i - 1][j], dp, prev);
            }
        }
        int x = n;
        int y = m;
        StringBuffer ans = new StringBuffer();
        while(x > 0 && y > 0) {
            int px = x;
            int py = y;
            x = prev[px][py][0];
            y = prev[px][py][1];
            if (x == px - 1 && y == py - 1) {
                ans.append(s.charAt(px - 1));
            }
        }
        print(ans.reverse().toString());
    }

    private static int fn(int i, int j, int i1, int j1, int val, int[][] dp, int[][][] prev) {
        if (val >= dp[i][j]) {
            prev[i][j][0] = i1;
            prev[i][j][1] = j1;
            return val;
        }
        return dp[i][j];
    }
}


Measured memory_bytes: 387660
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    ll a; cin >> a;
    string b; cin >> b;
    for(int i = 0; i < b.size(); i++) {
        if(b[i] == '.') {
            b.erase(b.begin()+i);
            break;
        }
    }
    cout << a*stol(b)/100 << endl;
}


Measured memory_bytes: 3620
#include<stdio.h>
int t[3];
int gcd(int a,int b){
	while(a){
		b%=a;
		int c=a;
		a=b;
		b=c;
	}
	return b;
}
int L[10000];
int R[10000];
int main(){
	int a;scanf("%d",&a);
	int p;
	int b,c;scanf("%d%d",&b,&c);p=gcd(b,c);
	if(a==3){
		scanf("%d",&b);
		p=gcd(p,b);
	}
	int at=0;
	for(int i=1;i*i<=p;i++){
		if(p%i==0){
			L[at]=i;
			R[at++]=p/i;
		}
	}
	for(int i=0;i<at;i++){
		if(L[i]*L[i]==p)break;
		printf("%d\n",L[i]);
	}
	for(int i=at-1;i>=0;i--){
		printf("%d\n",R[i]);
	}
}

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

def main():
    X,N = map(int,input().split())
    if N == 0:
        print(X)
        exit()
    p = set(map(int,input().split()))
    if N == 100:
        print(0 if X<=50 else 101)
        exit()
    lst = [0] + list(set(range(1,101)) - p) + [101]
    lst2 = [abs(lst[i] - X) for i in range(len(lst))]
    min_ = min(lst2)
    print(lst[lst2.index(min_)])    



if __name__ == '__main__':
    main()

Measured memory_bytes: 9228
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
int main(){
  string s;
  cin>>s;
  int c=0,m=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='A'||s[i]=='T'||s[i]=='G'||s[i]=='C') c++;
    else{
      m=max(m,c);
      c=0;
    }
  }
  cout<<max(m,c);
}


Measured memory_bytes: 256
# coding:utf-8

import sys
import math
import time
import numpy as np
import collections
from collections import deque
import queue
import copy

# 最大公約数
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

# 幅優先探索(BFS)でスタート座標(x, y)からの最大距離返す
def bfs(SS, x, y, H, W):#入力(座標系(迷路), x, y, xの端, yの端)
  x_next = [0, 0, -1, 1]
  y_next = [1, -1, 0, 0]
  tempx = x
  tempy = y
  mlength = 0
  q = deque()
  xytuple = (x, y, 0)
  q.append(xytuple)


  while q:
    xytuple = q.popleft()
    SS[xytuple[0]][xytuple[1]] = "x" #探索した場所は探索できないようにする
    for i in range(4): #このforで上下左右を調べてる
      tempx = xytuple[0] + x_next[i]
      tempy = xytuple[1] + y_next[i]
      #print(tempx, tempy, xytuple[2])
      #print(S)
      if(0 <= tempx and tempx < H and 0 <= tempy and tempy < W and SS[tempx][tempy] == "."):
        temptuple = (tempx, tempy, xytuple[2]+1)
        SS[temptuple[0]][temptuple[1]] = "x" #探索した場所は探索できないようにする
        mlength = max(mlength, xytuple[2] +1)
        q.append(temptuple)
      #print(q)
  return mlength

def brick(a,n,m,N):#ABC 148
  #n番目以降にmがあるか調べる
  if not m in a[n:]:
    print(N-(m-1))
  else:
    #b = copy.deepcopy(a)
    brick(a,a[n:].index(m),m+1,N)

#X = str(input()).split()
#a = [int(x) for x in input().split()]
HA = str(input()).split()
H = int(HA[0])
A = int(HA[1])
a = [int(x) for x in input().split()]

count = 0
for i in range(A):
    count += a[i]

if(count<H):
    print("No")
else:
    print("Yes")


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

#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define forn(i,n) for(ll i=0;i<n;i++)
#define fore(i,a,b) for(ll i=a;i<=b;i++)
#define ford(i,n) for(ll i=n-1;i>=0;i--)
#define fi first
#define se second
#define endl "\n"
#define all(a) a.begin(),a.end()
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PI 3.14159265

/******************************************************************************************************/
void file(){
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
}
/******************************************************************************************************/

const ll nax=2e5+1,mod=1e9+7;



int main(){

    sync
  //  file();
    
    int n,x;
    cin>>n>>x;
    fore(i,max(x-n+1,-1000000),min(x+n-1,1000000)){
        cout<<i<<" ";
    }


  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <regex>
#include <set>
#include <cmath>
#include <sstream>
#include <numeric>
#include <set>

using namespace std;

int point(int& x, int p)
{
    if(x > 500)
    {
        x -= 500;
        p += 1000;       
        return point(x, p);
    } else if( x > 5)
    {
        x -= 5;
        p += 5;
        return point(x, p);
    }

    return p;
}

int main()
{
    int x;
    std::cin >> x;
    int ans = 0;
    while(x >= 500)
    {
        ans += 1000;
        x -= 500;
    }
    while(x >= 5)
    {
        ans += 5;
        x -=5;
    }
    std::cout << ans;
    return EXIT_SUCCESS;
}


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

int main() {
    int n, b, f, r, v, result[4][3][10]; //result[b][f][r]
    cin >> n;

    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 10; k++) {
                result[i][j][k] = 0;
            }
        }
    }

    for (int i = 0; i < n; i++) {
        cin >> b >> f >> r >> v;

        result[b-1][f-1][r-1] += v;
    }

    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 10; k++) {
                cout << " " <<result[i][j][k];
            }
            cout << endl;
        }
        if (i == 3) break;
        cout << "####################" << endl;
    }

}


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

using namespace std;


int main()
{
	string s, t;
	cin >> s >> t;

	size_t i = s.length() - t.length();
	do {
		size_t j;
		for (j = 0; j < t.length(); ++j) {
			if (s[i+j] != '?' && s[i+j] != t[j])
				break;
		}
		if (j == t.length()) {
			for (j = 0; j < i; ++j)
				if (s[j] == '?')
					s[j] = 'a';
			for (j = 0; j < t.length(); ++j)
				s[i+j] = t[j];
			for (; j < s.length(); ++j)
				if (s[j] == '?')
					s[j] = 'a';
			cout << s << endl;
			return 0;
		}

		--i;
	} while (i <= s.length());

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int R;
  cin >> R;
  if (R < 1200) {
    cout << "ABC" << endl;
  }
  else if (R < 2800) {
    cout << "ARC" << endl;
  }
  else {
    cout << "AGC" << endl;
  }
}
     
      

Measured memory_bytes: 3620
import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *

N, K = map(int, input().split())
a = list(map(int, input().split()))
f = [0] * (N+1)
for i in range(N):
    f[i+1] += f[i]+a[i]
g = [0] * (N+1)
for i in range(N):
    g[i+1] += g[i]+max(0, a[i])
ans = 0
for i in range(N-K+1):
    ans = max(ans, max(0, f[i+K]-f[i])+g[i]+g[N]-g[i+K])
print(ans)


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

int main() 
{
    int H, W;
    cin >> H >> W;
    
    while(true) {
    if (H == 0 && W == 0) {
            break;
        }
    for (int i=0; i < H; i++)  {
        for (int j=0; j < W; j++) {
            cout << "#";
        }
        cout << endl;
    }
    
    cout << endl;
            cin >> H >> W;
    
    }

    return 0;
}


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

using namespace std;

#define PI 3.14159265358979323846264338327950L

int main(void){
    long long X,ans=0;

    cin>>X;

    while(X >= 500){
        X=X-500;
        ans=ans+1000;
    }

    while(X>=5){
        X=X-5;
        ans=ans+5;
    }

    cout<<ans<<endl;


    return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize("O3")

#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<int, int> pi;
tree<int,int,greater<int>,rb_tree_tag,tree_order_statistics_node_update> map_t;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define sz(x) (int)x.size()
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define REV(x) reverse(x.begin(),x.end())
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    double a,b;
    cin >> a >> b;
    for(double i=1; i<1e4+1; i++)
    {
        if(floor(i*.08)==a && floor(i*.1)==b)
        {
            cout << i;
            return 0;
        }
    }
    cout << -1;

    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"regexp"
	"strconv"
)

func solve() {
	var S string
	fmt.Scan(&S)
	r := regexp.MustCompile(`^(eraser|erase|dreamer|dream)+$`)
	if r.MatchString(S) {
		println("YES")
	} else {
		println("NO")
	}
	return
}

func main() {
	defer out.Flush()
	in.Split(bufio.ScanWords)

	solve()
}

// --- template ---

var (
	in  = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func println(a ...interface{}) {
	fmt.Fprintln(out, a...)
}

func printf(format string, a ...interface{}) {
	fmt.Fprintf(out, format, a...)
}

func next() string {
	in.Scan()
	return in.Text()
}

func nextInt() int {
	s := next()
	i, e := strconv.Atoi(s)
	if e != nil {
		fmt.Println(e)
	}
	return i
}

func nextInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = nextInt()
	}
	return res
}

func unique(list []int) []int {
	m := make(map[int]bool)
	uniq := make([]int, 0)
	for _, e := range list {
		if !m[e] {
			m[e] = true
			uniq = append(uniq, e)
		}
	}
	return uniq
}


Measured memory_bytes: 1408
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;
//|\_
//g++ -std=c++1z temp.cpp
//./a.out





int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    int i,nmin,nmax,m,j;
    while(1){
        cin>>m>>nmin>>nmax;
        if(nmin==0&&m==0)break;
        
        int diff=0;
        int diffc=0;
        vector<int> v(m,0);
        rep(i,m)cin>>v[i];
        for(i=nmin-1;i<nmax;i++){
            // cout<<i<<" "<<v[i+1]-v[i]<<" "<<diff<<endl;
            if(v[i]-v[i+1]>=diff){
                diff=v[i]-v[i+1];
                diffc=i+1;
            }
        }
        fin(diffc);
    }
//////////////////////////////////////////////////////
return 0;}



Measured memory_bytes: 3172
#include<iostream>
#include<cmath>

using namespace std;

int main(void)
{
    int n;
    int primes[65536];

    for (int i=0; i < 65536; i++)
    {
        primes[i] = 1;
    }

    primes[0] = 0;
    primes[1] = 0;

    for (int i=2; i<65536; i++)
    {
        if(primes[i] == 0)
            continue;

        for(int j=i*2; j<65536; j+=i)
        {
           primes[j] = 0; 
        }
    }

    while (1)
    {
        cin >> n;
        if (!n) break;
        int count = 0;
        int h = int(n/2) + 1;
        for (int i=0; i<h; i++)
        {
            if (primes[i] == 1 && primes[n-i] == 1)
            {
               count++; 
            } 
        }
        cout << count << endl;
    }
}

Measured memory_bytes: 1416
def main():
	N, Q = [int(n) for n in input().split(" ")]
	edges = [[] for i in range(N)]
	counter = [0] * N

	for i in range(N - 1):
		a, b = [int(x) for x in input().split(" ")]
		edges[a - 1].append(b - 1)
		edges[b - 1].append(a - 1)

	for j in range(Q):
		p, x = [int(q) for q in input().split(" ")]
		counter[p - 1] += x

	to_visit = [0]
	checked = [1] + [0] * (N - 1)
	tree = [0] * N

	while len(to_visit) > 0:
		visiting = to_visit.pop()
		tree[visiting] += counter[visiting]
		for e in edges[visiting]:
			if checked[e] == 0:
				checked[e] = 1
				to_visit.append(e)
				tree[e] = tree[visiting]

	print(" ".join([str(s) for s in tree]))

main()


Measured memory_bytes: 76072
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
#define pb push_back
typedef long long ll; 
int main()
{
	// freopen("C.in", "r", stdin); 
	int n, m, d; 
	scanf("%d%d%d", &n, &m, &d);
	double x = n + std::max(n - 2 * d, 0); 
	if (!d)
		x = n; 
	// printf("%.10lf\n", x);
	printf("%.10lf\n", x * (m - 1) / n / n);
	return 0; 
}


Measured memory_bytes: 256
import math
import sys
N = int(input())
if N == 2:
  print(1)
  sys.exit()

def get_divisors(x):
  lim = math.ceil(math.sqrt(x))
  divisors = set()
  for i in range(1,lim+1):
    if x % i == 0:
      divisors.add(i)
      divisors.add(N//i)    
  return divisors
    
ans_1 = 0
#約数について
divisors = get_divisors(N)
for d in divisors:
  if d == 1: continue
  N_try = N
  while N_try % d == 0:
    N_try //= d
  if N_try % d == 1:
    ans_1 += 1
    
#約数でない数について
divisors = get_divisors(N-1)
ans_2 = len(divisors)-1
    
#print(ans_1, ans_2)
print(ans_1+ans_2)
    
  

Measured memory_bytes: 66632
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  ll n,d;
  cin >> n >> d;
  int cnt = 0;
  rep(i,n){
    ll x,y;
    cin >> x >> y;
    if(x*x+y*y<=d*d)cnt++;
  }
  cout << cnt << endl;
  
  return 0;
}


Measured memory_bytes: 3648
#include<iostream>

int main()
{
	int n;
	int ans = 0;
	while( std::cin >> n ){
		for( int a = 0; a <= 9; a++ ){
			for( int b = 0; b <= 9; b++ ){
				for( int c = 0; c <= 9; c++ ){
					for( int d = 0; d <= 9; d++ ){
						if( a + b + c + d == n ){
						 	ans++;
						}
					}
				}
			}
		}
		
		std::cout << ans << std::endl;
		ans = 0;
	}

 	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stdlib.h>

using namespace std;

int main() {
    int n,t,a;
    cin >> n >> t >> a;
    double h[n],spot = 0,temp,dif = 1000000;
    for(int i = 0; i < n; i++) {
        cin >> h[i];
        temp = t - h[i]*0.006;
        if(abs(a-temp) < dif) {
            dif = abs(a-temp);
            spot = i+1;
        }
    }
    cout << spot;
    return 0;
}


Measured memory_bytes: 256
import sys
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, K = i2nn()
    if K == 1:
        print(0)
    else:
        print(N-K)

main()


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

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

int main()
{
	int n; cin>>n;
	bool can=true;
	rep(i,n){
		int a; cin>>a;
		if(a%2==0 && a%3!=0 && a%5!=0) can=false;
	}
		if(can) cout<<"APPROVED"<<endl;
		else cout<<"DENIED"<<endl;
	return 0;
}


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

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

int main() {
    int n;
    cin >> n;
    call(n);
    return 0;
}



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

int N, Q;
struct LazySegmentTree {
private:
    int n;
    vector<ll> node, lazy;

public:
    LazySegmentTree(vector<int> v) {
        int sz = (int)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, 0);
        lazy.resize(2*n-1, 0);

        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = node[i*2+1] + node[i*2+2];
    }

    void lazyEvaluate(int k, int l, int r) {
        if(lazy[k] != 0) {
            node[k] += lazy[k];
            if(r - l > 1) {
                lazy[2*k+1] += lazy[k];
                lazy[2*k+2] += lazy[k];
            }
            lazy[k] = 0;
        }
    }

    void add(int a, int b, ll x, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        lazyEvaluate(k, l, r);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b) {
            lazy[k] = x;
            lazyEvaluate(k, l, r);
        }
        else {
            add(a, b, x, 2*k+1, l, (l+r)/2);
            add(a, b, x, 2*k+2, (l+r)/2, r);
            node[k] = node[k*2+1] + node[k*2+2];
        }
    }

    ll get(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        lazyEvaluate(k, l, r);
        if(b <= l || r <= a) return 0;
        if(a <= l && r <= b) return node[k];
        ll vl = get(a, b, 2*k+1, l, (l+r)/2);
        ll vr = get(a, b, 2*k+2, (l+r)/2, r);
        return vl + vr;
    }
};

int main() {
    cin >> N >> Q;
    LazySegmentTree seg( vector<int>(N, 0) );
    for(int i=0; i<Q; i++) {
        int query; cin >> query;
        if(query == 0) {
            int s, t; ll x; cin >> s >> t >> x;
            seg.add(s-1, t, x);
        }
        else {
            int x; cin >> x;
            cout << seg.get(x-1, x) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 7340