akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
    public static void main(String[] args) {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
         
        String x = "";
        String ins = "";
        try {
            x = in.readLine();
            String[] num = x.split(" ");
            Dice d = new Dice (num);
 
            ins = in.readLine();
            for (int i = 0; i < ins.length(); i++) {
                d.move(ins.charAt(i));
            }
            System.out.println(d.getTop());
        } catch (NumberFormatException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
 
class Dice {
    private int t, b, n, s, e, w;
     
    public Dice(String[] num) {
        t = Integer.parseInt(num[0]);
        s = Integer.parseInt(num[1]);
        e = Integer.parseInt(num[2]);
        w = Integer.parseInt(num[3]);
        n = Integer.parseInt(num[4]);
        b = Integer.parseInt(num[5]);
    }
     
    public void move(char c) {
        int tmp = 0;
         
        switch (c) {
        case 'N' :
            tmp = t;
            t = s;
            s = b;
            b = n;
            n = tmp;
            break;
        case 'S' :
            tmp = t;
            t = n;
            n = b;
            b = s;
            s = tmp;
            break;
        case 'E' :
            tmp = t;
            t = w;
            w = b;
            b = e;
            e = tmp;
            break;
        case 'W' :
            tmp = t;
            t = e;
            e = b;
            b = w;
            w = tmp;
            break;
        }
    }
     
    public int getTop() {
        return t;
    }
}


Measured memory_bytes: 24468
//
#include <vector>
#include <set>
#include <map>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
#define outD(fpv) cout << setprecision(20) << fpv << endl;
inline void yes(bool cond) { cond ? puts("YES") : puts("NO"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
template<typename Type> inline void unique(Type& arr) { sort(arr); arr.erase(unique(arr.begin(), arr.end()), arr.end()); }
constexpr double BIGP = 1000000007L;
constexpr double INF_I = std::numeric_limits<ll>::max();
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll ans = 0;
    rep(i, N)
    {
        ll j = i+1;
        ll keta = 0;
        while (j != 0)
        {
            j /= 10;
            ++keta;
        }
        if (keta % 2 != 0)
        {
            ++ans;
        }
    }
    cout << ans;
    
    //
    return 0;
}

Measured memory_bytes: 3660
//AtCoder ABC129
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
#if LOCAL&0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll N;
    cin>>N;
    vector<ll> wn(N+1,0);
    ll sum=0;//total
    vector<ll> acc(N+1,0);
    for(ll i=1;i<=N;++i){
        cin>>wn[i];
        sum+=wn[i];
        acc[i]=sum;
    }
    ll ans=INT64_MAX;
    for(ll i=1;i<=N;++i){
        ll s1=acc[i];
        ll s2=sum-s1;
        ans=min(abs(s1-s2),ans);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.math;

void main(){
	double[3] size;
	int n, r;
	while (readf("%s %s %s\n", &size[0], &size[1], &size[2])) {
		if(size[0] == 0 && size[1] == 0 && size[2] == 0) break;
		readf("%d\n", &n);
		for (int i = 0; i < n; i++) {
			readf("%d\n", &r);
			// solve
			size.sort;
			double diagonal = sqrt(size[0] * size[0] + size[1] * size[1]);
			if (diagonal < r*2) {
				writeln("OK");
			}else {
				writeln("NA");
			}
		}
	}
}

Measured memory_bytes: 1028
#include<iostream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    int F[50];
    F[0] = F[1] = 1;
    
    for(int i =2 ; i<=n ; i++){
        F[i] = F[i-1] + F[i-2];
    }
    
    cout << F[n] << endl;
  
    return 0;
}


Measured memory_bytes: 3104
n,k=map(int,input().split())
d=[]
a=[]
for _ in range(k):
  d.append(int(input()))
  a.append(list(map(int,input().split())))

f=[False]*n

for i in range(k):
  for x in a[i]:
    f[x-1]=True

print(n-sum(f))

Measured memory_bytes: 67508
import math
N, A, B = map(int, input().split())
monsters = [int(input()) for _ in range(N)]
monsters.sort(reverse=True)

def can_terminate(x):
  count = 0
  for monster in monsters:
    count += max(0, math.ceil((monster-B*x)/(A-B)))
  return count <= x

l, r = 0, 10**9+1
while r-l > 1:
  mid = (r+l)//2
  if can_terminate(mid):
    r = mid
  else:
    l = mid
print(r)
  
  

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

int main()
{
	int n, k;
	cin >> n >> k;
	vector<int> qk(n,0);
	double maximum=0;
	double probmax=0;

	for(int i=0; i<k; i++)
	{
		int p;
		cin >> p;
		qk.at(i) = p;
		maximum += (p + 1.0)/ 2.0;
	}
	probmax = maximum;

	for (int i=k; i<n; i++)
	{
		probmax -= (qk.at(i-k) + 1.0)/ 2.0;
		int p;
		cin >> p;
		qk.at(i) = p;
		probmax += (p + 1.0)/2.0;
		maximum = max(maximum, probmax);
	}

	printf("%.8f\n", maximum);

}

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

using namespace std;
typedef long long ll;
const int N=1e5+9;
int n,k;
int a[N][4];
int dp[N][4];
int main(){

    while(~scanf("%d",&n)){
        memset(dp,-1,sizeof dp);
        for(int i=1;i<=n;i++){
            scanf("%d%d%d",&a[i][0],&a[i][1],&a[i][2]);
        }
        for(int i=0;i<3;i++)dp[0][i]=0;
        for(int i=1;i<=n;i++){
            for(int j=0;j<3;j++){
                dp[i][j]=max(dp[i-1][(j+1)%3]+a[i][j],dp[i-1][(j+2)%3]+a[i][j]);
            }
        }
        cout<<*max_element(dp[n],dp[n]+3)<<"\n";
    }

    return  0;
}





Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
int n,a,b;
int li[100010],li2[100010];
vector<int> g[100010];

int bfs(int s, int d[]){
	queue<int> qu;
	REP(i,0,n) d[i]=INF;
	qu.push(s); d[s]=0;
	
	while(!qu.empty()){
		int p=qu.front(); qu.pop();
		
		for(auto e:g[p]){
			if(d[e]<=d[p]+1) continue;
			d[e]=d[p]+1;
			qu.push(e);
		}
	}
	
	return 0;
}

int main(){
	cin >> n;
	REP(i,0,n-1) cin >> a >> b,g[a-1].push_back(b-1),g[b-1].push_back(a-1);
	bfs(0,li); bfs(n-1,li2);
	
	int c=0,d=0;
	REP(i,0,n){if(li[i]>li2[i]) c++; else d++;}
	
	if(d>c) cout << "Fennec" << endl;
	else cout << "Snuke" << endl;
	return 0;
}



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

using ll = long long;
const int MAXN = 2005;
pair<ll, int> a[MAXN];

int n;
ll memo[MAXN][MAXN];

ll dp(int L, int R) {
    if(L > R) return 0;
    if(memo[L][R] != -1) return memo[L][R];
    int i = L + (n-1-R);
    ll& ans = memo[L][R];
    ll on_left = a[i].first * abs(a[i].second - L);
    ll on_right = a[i].first * abs(a[i].second - R);
    ans = max(on_left + dp(L+1, R), on_right + dp(L, R-1));
    return ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    memset(memo, -1, sizeof memo);

    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a, a+n);
    reverse(a, a+n);
    cout << dp(0, n-1) << endl;
}


Measured memory_bytes: 35136
#include<stdio.h>

#define MAX(x,y) (((x)>(y))?(x):(y))

int main(void){
  long long nowT,nowA,N,T,A;
  long long coef;

  scanf("%d",&N);
  scanf("%lld%lld",&nowT,&nowA);
  while(--N){
    scanf("%lld%lld",&T,&A);
    if(nowT%T!=0) nowT+=T-nowT%T;
    if(nowA%A!=0) nowA+=A-nowA%A;
    coef=MAX(nowT/T,nowA/A);
    nowT=T*coef;
    nowA=A*coef;
  }
  printf("%lld\n",nowT+nowA);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define forr(i,n,a) for(ll i=n-1;i>=a;i--)
#define scan(arr,a,n) for(int i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(int i=(a);i<(n);i++)cout<<(arr)[i]<<' ';

const ll inf = 1e18;

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}

int main(){
	fast;
	ld a[3];
	scan(a, 0, 3);
	sort(a, a+3);
	cout<<(a[0]*a[1])/2<<endl;
	
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,i;
    int a[100005],dp[100005];
    cin>>n;
    for(i=0;i<n;i++)
    cin>>a[i];
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(i=2;i<n;i++)
    dp[i]=min(dp[i-1]+abs(a[i-1]-a[i]),dp[i-2]+abs(a[i-2]-a[i]));
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <time.h>
#define int long long int
#define pb push_back
#define all(a) a.begin(), a.end()
#define scnarr(a, n) for (int i = 0; i < n; ++i) cin >> a[i]
#define vi vector<int>
#define si set<int>
#define pii pair <int, int>
#define sii set<pii>
#define vii vector<pii>
#define mii map <int, int>
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
using namespace chrono;
/*
	Things to remember : check for coners n = 1, pass references instead
*/
/* -------------------------------Solution Sarted--------------------------------------*/

//Constants
const int MOD = 1000000007; // 1e9 + 7
const int MAXN = 1000005; // 1e6 +5
const int INF = 100000000000005; // 1e15 +5

void solve(){
	int n, d, x, y, ans = 0;
	cin >> n >> d;
	for(int i = 0; i < n; ++i){
		cin >> x >> y;
		if(sqrt(x*x + y*y) <= d){
			ans++;
		}
	}
	cout << ans << endl;
	
}

signed main()
{
	faster;
#ifndef ONLINE_JUDGE
	freopen("ip.txt", "r", stdin);
	freopen("op.txt", "w", stdout);
#endif
	// int t; cin >> t; while(t--)
		solve();
	return 0;
}


//Author : Ankit Raj
//Problem Link :

/*Snippets*/
/*
sieve - prime factorization using sieve and primes in range
zpower - pow with mod
plate - Initial template
bfs 
dfs
fenwik - BIT
binary_search
segment_tree
*/
	

Measured memory_bytes: 3700
#include <bits/stdc++.h>
#include <iostream>
#include <string>

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define REP(idx, N) for (u64 idx = 0; idx < N; idx++)

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

  map<u32, u32> mods;
  u32 mod = 0;
  u32 mod_dig = 1;

  u32 digit = 0;
  mods[0] = 1;
  for (auto it = --s.end(); it >= s.begin(); it--) {
    u64 m = (*it - '0');
    mod = (mod + m*mod_dig) % 2019;
    mod_dig = mod_dig* 10 % 2019;
    mods[mod] += 1;
    digit++;
  }

  u32 ans = 0;
  for (auto &m : mods) {
    ans += m.second * (m.second - 1) / 2;
  }
  cout << ans;

  return 0;
}


Measured memory_bytes: 3732
ENV[A='RUBY_THREAD_VM_STACK_SIZE']||exec({A=>?5*8},'ruby',$0)
F=->c{H[c].all?{|e|Z[e]?Z[c]-Z[e]&1>0:(Z[e]=1^Z[c];F[e])}}
N,M=gets.split.map &:to_i;H=Hash.new{|h,k|h[k]=[]};Z={1=>0}
$<.map{|e|a,b=e.split.map &:to_i;H[a]<<b;H[b]<<a}
p (F[1]?(x,y=Z.partition{|k,v|v>0};x.size*y.size):N*~-N/2)-M

Measured memory_bytes: 111300
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = 3.141592654;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw	 "\n"
#define mod 1000000007


int main(void)
{
	CIN;
	ll tc,l,k=0,sum=0,x=0,y,z=0,m=1,n=0,ans=0,cnt=0;
	cin>>n>>x>>y;
	if((y-x)%2==0)
		return cout<<(y-x)/2,0;
	cout<<min(x,n-y+1)+(y-x-1)/2;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    string s;
    cin>>s;
    ll n = s.length();
    //0
    ll tmp = n;
    rep(i,n){
        if(s[i]=='0'){
            chmin(tmp,max(n-1-i,i));
        }
    }
    ll tmp2 = n;
    rep(i,n){
        if(s[i]=='1'){
            chmin(tmp2,max(n-1-i,i));
        }
    }
    cout<<max(tmp,tmp2)<<endl;
    return  0;
}


Measured memory_bytes: 512
using System;

namespace tst
{
    class Program
    {
        static void Main(string[] args)
        {   //「x y」で入力されたものをx,yに振り分ける
            string str = Console.ReadLine();
            string[] data = str.Split();
            int d1 = int.Parse(data[0]);
            int d2 = int.Parse(data[1]);
            //x>=yならxとyの最大公約数はxとx%yの大歳公約数に等しい
            //ex)x=15,y=10の時、x%y=5
            int x = 0;
            int y = 0;
            int GCD = 0;
            if (d1 >= d2)
            {
                x = d1;
                y = d2;

            }else if(d1 < d2){
                x = d2;
                y = d1;
            }
            if (x % y == 0)
            {
                GCD = y;
            }
            else
            {
                while(true)
                {
                    GCD = x % y;
                    if (y % GCD == 0)
                    {
                        break;
                    }
                    else
                    {
                        x = y;
                        y = GCD;
                    }
                }
            }
            Console.WriteLine(GCD);
        }
    }
}


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

typedef long long ll;
const ll MAXN = 1e5 + 5;
const ll MOD = 1e9 + 7;

ll a[MAXN];
inline ll add(ll x, ll y) {
	return (x + y) % MOD;
}

inline ll sub(ll x, ll y) {
	return (x - y + MOD + MOD) % MOD;
}

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

inline ll inv(ll a) {
	ll b = MOD-2;
	a %= MOD;

	ll res = 1;
	while (b > 0) {
		if (b & 1) res = mul(res, a);
		a = mul(a, a);
		b >>= 1;
	}

	return res;
}

ll f[MAXN];
inline void pre() {
	f[0] = 1;
	for (ll i = 1; i < MAXN; i++) f[i] = mul(f[i-1], i);
}

inline ll nck(ll n, ll k) {
	return mul(f[n], inv(mul(f[n-k], f[k])));
}

int main() {
	pre();

	ll n, k; scanf("%lld%lld", &n, &k);
	for (ll i = 0; i < n; i++) scanf("%lld", a+i);
	sort(a, a+n);

	ll maxi = 0, mini = 0;
	for (ll i = 0, qtt = n - 1; i < n && qtt >= k - 1; i++, qtt--) {
		mini = add(mini, mul(a[i], nck(qtt, k - 1)));
	}

	for (ll i = n-1, qtt = n - 1; i >= 0 && qtt >= k - 1; i--, qtt--) {
		maxi = add(maxi, mul(a[i], nck(qtt, k - 1)));
	}

	printf("%lld\n", sub(maxi, mini));
}

Measured memory_bytes: 1792
# https://atcoder.jp/contests/abc096/tasks/abc096_d
# 制約は小さい
# まず 55555以下の素数をエラトステネスの篩であぶり出す

# 55555以下の素数からN個選ぶ。N個の中からどの5つの素数を選んでも合成数となるのが良い

# 性質を列挙
# 5の倍数+1の素数を5a+1とする #aはなんでも
# このとき、5つの和は 5a+1 + 5b+1 + ... + 5d+1 で5で割り切れる合成数となる
# よって5の倍数+1となるような素数を探して列挙すれば良い


def ret_erators(N: int):
    # エラトステネスの篩
    is_prime = [True] * (N + 1)

    # 0と1は素数ではない
    is_prime[0] = False
    is_prime[1] = False

    for i in range(2, int(N**0.5) + 1):
        if is_prime[i]:
            j = i * 2  # iの倍数は素数ではない
            while j < N + 1:
                is_prime[j] = False
                j += i
    return is_prime


is_prime = ret_erators(55555)
# print(len(is_prime))
# print(sum(is_prime))
candi = []
for i in range(55555):
    n = i * 5 + 1
    if n > 55555:
        break
    if is_prime[n]:
        candi.append(n)


print(*candi[:int(input())])


Measured memory_bytes: 3444
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char c[100005];
int len,ans;
int main()
{
    scanf("%s",c+1);
    len=strlen(c+1);ans=len;
    for(int i=2;i<=len;i++)
        if(c[i]!=c[i-1])ans=min(ans,max(i-1,len-i+1));
    printf("%d",ans);
}




Measured memory_bytes: 256
fun main() = abc166d()

@OptIn(ExperimentalStdlibApi::class)
fun abc166d() {
    val x = readLine()!!.toLong()

    val set = mutableSetOf<Long>()

    for (i in -500L..500L) {
        set.add(pow(i, 5))
    }

    val list = set.sorted().toLongArray()

    for (left in list.indices) {
        for (right in list.indices) {
            if (list[left] - list[right] == x) return println("${left - 500} ${right - 500}")
        }
    }

    error("nande?")
}

private fun pow(n: Long, p: Long): Long = (1L..p).fold(1L) { acc, i -> acc * n }


Measured memory_bytes: 38440
N = int(input())
ans = N
for i in range(1,N):
    A,B = 0,0
    A_str = list(str(i))
    B_str = list(str(N-i))
    for e in A_str:
        A += int(e)
    for e in B_str:
        B += int(e)
    if A + B < ans:
        ans = A + B       
print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
using ll = long long;
using ull = decltype(1ull);
template<class T>int size(T&&a) { return a.size(); }
#define REP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.first,_l##t=a.second;t<_l##t;t++)
#define RREP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.second-1,_l##t=a.first;t>=_l##t;t--)
template<class B>pair<int, B>make_pair(B b) { return{ 0,b }; }
#define rep(t,...)REP(t,make_pair(__VA_ARGS__))
#define rrep(t,...)RREP(t,make_pair(__VA_ARGS__))
#define all(a)begin(a),end(a)
#define rall(a)a.rbegin(),a.rend()
#define var(t, ...) t __VA_ARGS__;in,__VA_ARGS__;

void Calc();
int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr);
  cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
template<class A>int comp(A a, A b) { return a < b ? 1 : b < a ? -1 : 0; }
struct Scanner {
  template<class A = string>A Next() { A a; cin >> a; return a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for (A&i : a) cin >> i; return a; }
  string Line() const { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;

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


void Calc() {
  int n = in;
  vector<vector<int>> edge(n);
  rep(i, n - 1) {
    int a = in;
    int b = in;
    a--, b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }

  vector<int> path;
  auto dfs = [&](auto &dfs, int i, int pre) {
    path.push_back(i);
    if (n - 1 == i) return true;
    for (auto& j : edge[i]) {
      if (j == pre) continue;
      if (dfs(dfs, j, i)) return true;
    }
    path.pop_back();
    return false;
  };

  dfs(dfs, 0, -1);
  err(path);
  int k = path.size() / 2;
  int a = k + path.size() % 2;
  int b = k;
  vector<int> check(n);
  auto dfs2 = [&](auto& dfs, int i, int pre) ->int {
    int ans = 1;
    for (auto& j : edge[i]) {
      if (j == pre) continue;
      if (check[j]) continue;
      ans += dfs(dfs, j, i);
    }
    return ans;
  };
  rep(i, a, path.size()) check[path[i]] = 1;
  err(check);
  int suma = dfs2(dfs2, 0, -1);
  check.clear();
  check.resize(n, 0);
  rep(i, 0, a) check[path[i]] = 1;
  err(check);
  int sumb = dfs2(dfs2, n - 1, -1);
  err(a, b, suma, sumb);
  if (suma <= sumb) {
    cout << ("Snuke") << endl;
  }
  else {
    cout << ("Fennec") << endl;
  }


}


Measured memory_bytes: 9464
#include <bits/stdc++.h>
#define REP(type, i, a, b) for( type i = a; i < b; i++ )
using namespace std;

int main(){
  int n;
  int x,ans[200002];
  scanf("%d",&n);
  REP(int,i,1,n+1){
    ans[i]=0;
  }
  REP(int,i,2,n+1){
    scanf("%d",&x);
    ans[x]++;
  }
  
  REP(int,i,1,n+1){
    printf("%d\n",ans[i]);
  }
}


Measured memory_bytes: 4592
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)

#define INF INT_MAX / 2 - 1
#define PI 2*acos(0.0)
#define ll long long

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

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int ans = max(a * b, c * d);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
/***************************************** SHORT - TEMPLATE ***************************************************/
#pragma optimization_level 3
#include<bits/stdc++.h>
using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  all(x)         (x).begin(),(x).end()
#define  newl           cout<<"\n"
#define  pb             push_back
#define  s              second
#define  f              first
#define  ll             long long
#define  vll            vector<ll>
#define  MOD            1000000007
#define  INF            LLONG_MAX
#define  N              100008

/***************************************** FUNCTIONS / DECLARATIONS ********************************************/
ll t=1;

/***************************************** MAIN FUNCTION - DRIVER *******************************************************/
void MAIN(){
	string s;
	cin>>s; s="#"+s;
	if(s[3]==s[4] && s[5]==s[6])cout<<"Yes";
	else cout<<"No";
	newl;
	
}

int main(){
	fastio;//cin>>t;
	while(t--){
		MAIN();
	}
}

Measured memory_bytes: 256
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
b=[0,t-h[0]*0.006]
for (i,x) in enumerate(h):
	if abs((t-x*0.006)-a) < abs(b[1]-a):
		b=[i,(t-x*0.006)]
print(b[0]+1)


Measured memory_bytes: 3060
#include <stdio.h>
#include <math.h>

int main(void){
    int N,D,X[10][10];
    int i,j,k,count=0,tmp;
    double distance;

    scanf("%d %d",&N,&D);

    for(i=0;i<N;i++){
        for(j=0;j<D;j++){
            scanf("%d",&X[i][j]);
        }
    }

    for(i=0;i<N-1;i++){
        for(j=i+1;j<N;j++){
            distance = 0;
            for(k=0;k<D;k++){
                distance += pow(X[i][k]-X[j][k],2);
            }
            tmp = sqrt(distance);
            distance = sqrt(distance);
            if((double) tmp < distance) continue;
            else count++;
        }
    }

    printf("%d\n",count);

    return 0;
}

Measured memory_bytes: 128
N = gets.to_i
A = gets.split.map(&:to_i)
A.sort_by!{|i|-i}
r = [A.shift] * 2
c = 0
until A.empty?
    (r.size - 1).times{|i|
        break if A.empty?
        r[i * 2 + 1, 0] = A.shift
        c += [r[i * 2], r[i * 2 + 2]].min
    }
end
warn r.inspect
puts c


Measured memory_bytes: 41692
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

static bool find(size_t pos,
                 const string& s,
                 const string& p) {
  auto it = s.begin() + pos;
  for (auto c : p) {
    if (*it != c)
      return false;

    ++it;
    if (it == s.end())
      it = s.begin();
  }
  return true;
}

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

  bool found = false;
  for (size_t i = 0; i < s.length(); ++i) {                                                                                                                               
    if (find(i, s, p)) {
      found = true;
      break;
    }
  }

  if (found)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}

Measured memory_bytes: 3212
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 500005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int64 dp[305][305],ans,cost[305][305];
int H,W;
char s[305][305];
void Solve() {
    read(H);read(W);
    for(int i = 1 ; i <= H ; ++i) scanf("%s",s[i] + 1);
    for(int i = 1 ; i < W ; ++i) {
	for(int j = 0 ; j <= H ; ++j) {
	    for(int h = 0 ; h <= H ; ++h) {
		dp[j][h] = 1e18;
	    }
	}
	dp[0][0] = 0;
	memset(cost,0,sizeof(cost));
	for(int j = 0 ; j <= H ; ++j) {
	    int p1 = H - j,p2 = H;
	    while(p1 >= 1 && p2 >= 1) {
		if(s[p1][i] == s[p2][i + 1]) ++cost[j][0];
		--p1;--p2;
	    }
	}
	for(int j = 1 ; j <= H ; ++j) {
	    int p1 = H,p2 = H - j;
	    while(p1 >= 1 && p2 >= 1) {
		if(s[p1][i] == s[p2][i + 1]) ++cost[0][j];
		--p1;--p2;
	    }
	}
	for(int j = 1 ; j <= H ; ++j) {
	    for(int h = 1 ; h <= H ; ++h) {
		cost[j][h] = cost[j - 1][h - 1] - (s[H - j + 1][i] == s[H - h + 1][i + 1]);
	    }
	}
	for(int j = 0 ; j <= H * 2 ; ++j) {
	    for(int h = 0 ; h <= min(j,H) ; ++h) {
		int a = h,b = j - h;
		if(a > H || b > H) continue;
		int c = cost[a][b];
		if(a + 1 <= H) {
		    dp[a + 1][b] = min(dp[a + 1][b],dp[a][b] + c);
		}
		if(b + 1 <= H) {
		    dp[a][b + 1] = min(dp[a][b + 1],dp[a][b] + c);
		}
	    }
	}
	ans += dp[H][H];
    }
    out(ans);enter;
}

int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  int i;
  for (i = 0; i < n; i++) {
    int k, p;
    cin >> k >> p;
    cout << (k % p == 0 ? p : k % p) << endl;
  }
  return 0;
}



Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#define N 101
typedef struct {
  int u; //???????????????
  int k; //????¬???°
  int v[N]; //??£??\?????????????????????
} mat_t;

int main(){
  int n,i,j,k=0;
  int matrix[N][N];
  mat_t arr[N];
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d%d",&arr[i].u,&arr[i].k);
    if(arr[i].k==0) continue;
    /*arr[i].v=(int *)malloc(sizeof(arr[i].k));*/
    for(j=0;j<arr[i].k;j++){
      scanf("%d",&arr[i].v[j]);
    }
  }

    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
        if(arr[i].v[k]==j+1) {
          matrix[i][j]=1;
          k++;
        }
        else matrix[i][j]=0;
      }
      k=0;
    }

    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
        printf("%d",matrix[i][j]);
        if(j!=n-1) printf(" ");
      }
      printf("\n");
    }

  /*for(i=0;i<n;i++) free(arr[i].v);*/
  return 0;
}

Measured memory_bytes: 680
#include <cstdint>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;

int main() {
	int n, k, x, y;
	cin >> n >> k >> x >> y;
	int r = 0;
	r = min(k, n)*x + max(0, n - k)*y;
	cout << r << endl;
	return 0;
}


Measured memory_bytes: 256
# 2点 or 3点
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def 外心(p1,p2,p3):
    # https://qiita.com/tatesuke/items/59133758ec25146766c3
    a,b = p1
    c,d = p2
    e,f = p3
    aa = a * a
    bb = b * b
    cc = c * c
    dd = d * d
    ee = e * e
    ff = f * f
    # 直線判定がめんどくさい!!!
    if (2 * (e - a)*(b - d) - 2 * (c - a) * (b - f)) == 0:
        return 0, 0

    py = ((e - a) * (aa + bb - cc - dd) - (c - a) * (aa + bb - ee- ff)) / (2 * (e - a)*(b - d) - 2 * (c - a) * (b - f))

    if c == a:
        px = (2 * (b - f) * py - aa - bb + ee + ff) / (2 * (e - a))
    else:
        px = (2 * (b - d) * py - aa - bb + cc + dd) / (2 * (c - a))

    return px, py

n = int(input())
points = [list(map(int, input().split())) for i in range(n)]

from itertools import combinations

候補 = []
# two
for p1, p2 in combinations(points, 2):
    px, py = (p1[0]+p2[0])/2, (p1[1]+p2[1])/2
    候補.append((px, py))

# three
for p1, p2, p3 in combinations(points, 3):
    候補.append(外心(p1,p2,p3))

from math import sqrt

ans = float("Inf")
for x,y in 候補:
    tmp = 0
    for px, py in points:
        tmp = max(tmp, (px-x)**2 + (py-y)**2)
    ans = min(ans, tmp)
ans = sqrt(ans)
print(ans)
    

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

int main() {
	int A , B , C;
	cin >> A >> B >> C;
	int X = A - B;
	int Y = C - X;
	 if ( Y<0){
	cout << 0 << endl;
	 }else {
	 	cout << Y << endl;
	 }

	// your code goes here
	return 0;
}







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

std :: vector < char > v [2] ;

int main ( )  {
	char s [100] ;
	for ( int i = 0 ; i < 2 ; ++ i )  {
		scanf ( "%s", s ) ;
		for ( char* pt = s ; *pt ; ++ pt )  v [i].push_back ( *pt ) ;
	}

	std :: reverse ( v [1].begin ( ), v [1].end ( ) ) ;

	puts ( v [0] == v [1] ? "YES" : "NO" ) ;

	return 0 ;

}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const ll inf = 4523372036854775807;
const ld pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct S {//辺の情報を入れる変数
	int from, to, cost;
};
struct H {
	int x, y;
};
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(ld a, ld b, ld c, ld d) {
	return sqrt(pow(a - c, 2) + pow(b - d, 2));
}//rad＝座標上の2点間の距離
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	int sum = 0, n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int l, r;
		cin >> l >> r;
		sum += (r - l) + 1;
	}
	cout << sum << endl;
	getchar(); getchar();
}

Measured memory_bytes: 256
// ~maqsat~
/*    
**    “Anyone who has never made a mistake has never tried anything new.”
**    © Albert Einstein
*/

// #pragma GCC target ("avx2")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")

// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

#define F first
#define S second
#define in insert
#define pb push_back
#define eb emplace_back
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define count1 __builtin_popcountl
#define debug(x) cerr << (#x) << " = " << (x) << "\n"
#define ACCELERATE ios_base::sync_with_stdio(false),cin.tie(nullptr)
#define fre(f) if(fopen(f".in", "r")) freopen(f".in", "r", stdin),freopen(f".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ull = unsigned long long;
// using big = __int128_t; // -10^38...10^38
using db = double;
using ld = long double;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T> inline void cmin(T &a, T b) { a = min(a, b); }
template <class T> inline void cmax(T &a, T b) { a = max(a, b); }

const int oo = 0x3f3f3f3f;
const ll N = 1e5 + 345;
const ll MOD = 1e9 + 7;
const ll INF = 1e10 + 9;
const db EPS = 1e-9;
const db PI = acos(-1); // 3.14159265358979323846
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};

int main() {
    fre("");
    ACCELERATE;

	int m, k;
	cin >> m >> k;

	if(k > (1 << m) - 1) {
		cout << -1;
		return 0;
	}
	if(m == 0) {
		cout << "0 0";
		return 0;
	}
	if(k == 0) {
		for(int i = 0; i < (1 << m); i++) cout << i << ' ' << i << ' ';
		return 0;
	}

	int sum = 0;
	vector<int> ans;
	for(int i = 0; i < (1 << m); i++) {
		sum ^= i;
		if(i != k) ans.eb(i);
	}

	if(sum) return !(cout << -1);
	for(int i = 0; i < sz(ans); i++) cout << ans[i] << ' ';
	cout << k << ' ';
	for(int i = sz(ans)-1; i >= 0; i--) cout << ans[i] << ' ';
	cout << k;

    return 0;
}
/*
 
*/


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

long long X, N;
set<long long> p;

int main(){
	cin >> X >> N;
	for(long long i = 0; i < N; i++) {
		long long tmp;
		cin >> tmp;
		p.insert(tmp);
	}

	long long ans = -1;
	for(long long i = X - 100; i < X + 100; i++) {
		if(p.count(i) > 0) {
			continue;
		}

		if(ans == -1 || abs(ans - X) > abs(i - X)) {
			ans = i;
		}
	}
	cout << ans << endl;
}


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

int main() {
	string s, p, tmp;
	bool flag = false;

	cin >> s;
	cin >> p;

	for (int i = 0; i < s.size(); i++){
		tmp = "";
		for(int j = 0; j < p.size(); j++){
			tmp += s[(i + j) % s.size()];
		}
		if (p == tmp){
			flag = true;
		}
	}

	if (flag) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3156
n = int(input())
p=list(map(int, input().split()))
cnt = 0
for i in range(n-2):
    if (p[i] > p[i+1] and p[i+1] > p[i+2]) or (p[i] < p[i+1] and p[i+1] < p[i+2]):
        cnt += 1
print(cnt)

Measured memory_bytes: 38384
n = int(input())
li = [0]*5

for k in range(n):
    s = input()
    if s[0]=="M":
        li[0]+=1
    elif s[0]=="A":
        li[1]+=1
    elif s[0]=="R":
        li[2]+=1
    elif s[0]=="C":
        li[3]+=1
    elif s[0]=="H":
        li[4]+=1
        
ans = 0
for i in range(2**5):
    num = 1
    if str(bin(i)).count("1")==3:
        for j in range(5):
            if (i>>j&1)==1:
                num *= li[j]
        else:
            ans += num
print(ans)

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

int main()
{
  int N;
  cin >> N;
  
  int p[N-1];
  int no;
  no = 0;
  
  for(int i=0;i<N;i++){
    cin >> p[i];
    if(p[i]==i+1)
      continue;
    else
      no=no+1;
  }
  
  if(no<3)
    cout << "YES";
  else
    cout << "NO";
  
  return 0;
}


Measured memory_bytes: 256
from collections import Counter
n = int(input())
lst = [x for x in input().split()]

lst1 = Counter(lst[0::2]).most_common()
lst2 = Counter(lst[1::2]).most_common()

if lst1[0][0] != lst2[0][0]:
    print(n - lst1[0][1] - lst2[0][1])
else:
    if len(lst1) == 1 or len(lst2) == 1:
        print(n // 2)
    else:
        a = n - lst1[1][1] - lst2[0][1]
        b = n - lst1[0][1] - lst2[1][1]
        print(min(a, b))

Measured memory_bytes: 23004
#include <bits/stdc++.h>
using namespace std;;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


ll l[200005];
ll r[200005];
bool ok[200005];
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,k,c;cin >> n >> k >> c;
  string s;cin >> s;
  rep(i,n){
    if(s[i]=='o')ok[i] = true;
  }
  ll pos = 0;
  ll num = 0;
  while(pos <n){
    if(ok[pos]){
      l[num] = pos;
      num++;
      pos +=c;
    }
    pos++;
  }
  ll minum = num;
  pos = n-1;
  num = 0;
  while(pos>=0){
    if(ok[pos]){
      r[num] = pos;
      num++;
      pos -= c;
    }
    pos--;
  }
  minum = min(minum, num);
  ll ans = 0;
  rep(i,k){
    if(l[i]==r[k-1-i])cout << l[i]+1 << endl;
  }
}

Measured memory_bytes: 5140
import numpy as np

N, K, Q = map(int, input().split())
A = np.array([int(input()) for i in range(Q)])
  
points = np.full(N, K-Q)

for i in range(0, Q):
  points[A[i]-1] += 1
 
for i in points:
  if i > 0:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 17124
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int m=1e9+7;
int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    fastio
    vector<string>s={"Sunny","Cloudy","Rainy"};
    string k;
    cin>>k;
    auto it=find(s.begin(),s.end(),k);
    cout<<s[(it-s.begin()+1)%3];
    return 0;
}

Measured memory_bytes: 3652
from copy import copy
s = input() + "T"
x,y = map(int, input().split())

d = [len(p) for p in s.split("T")]
init = d[0]
d_x = d[2::2]
d_y = d[1::2]

xs = set([init])
ys = set([0])
dpx = [x in xs]
for d in d_x:
  xs_ = set()
  for u in xs:
    xs_.add(u+d)
    xs_.add(u-d)
  dpx.append(x in xs_)
  xs = copy(xs_)

dpy = []
for d in d_y:
  ys_ = set()
  for v in ys:
    ys_.add(v+d)
    ys_.add(v-d)
  dpy.append(y in ys_)
  ys = copy(ys_)

if dpx[-1] and dpy[-1]: print("Yes")
else: print("No")

Measured memory_bytes: 10396
//#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <deque>
#include <chrono>
#include <numeric>

using namespace std;
using namespace std::chrono;

typedef long long int lo;
#define fast ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(0);
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define inf (lo)1e9
#define N (lo)1e5 * 5
#define all(x) (x).begin(), (x).end()
#define ii pair<lo,lo>
#define iii pair<lo, pair<lo,lo> >
#define si pair<string,lo>
#define vi vector <lo> 
#define vii vector <ii> 
    
int main() {
    fast
    lo n,a[N];
    cin >> n;
    map <lo,lo> m;
    for(lo i = 0 ; i < n - 1 ; i++){
        cin >> a[i];
        m[a[i]]++;
    }
    for(lo i = 1 ; i <= n ; i++){
        cout << m[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 17728
#include<bits/stdc++.h>
#define ll long long
#define maxn 5002
using namespace std;
const int inf=1e9+7;
inline int read(){
	int u=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){u=u*10+c-'0';c=getchar();}
	return u*f;
}

int R[maxn],L[maxn],G[maxn],a[maxn],b[maxn],n,ans=inf,q[maxn];
char c[maxn];
bool cmp(int x,int y){
	return R[x]<R[y];
}
int main(){
	scanf("%s",c+1);n=strlen(c+1);
	for(int i=1;i<=n;i++)a[i]=c[i]-'0',L[i]=R[i]=inf;
	scanf("%s",c+1);
	for(int i=1;i<=n;i++)b[i]=c[i]-'0';
	int sa=0,sb=0;
	for(int i=1;i<=n;i++)sa|=a[i],sb|=b[i];
	if(!sb){
		if(!sa)puts("0");
		else puts("-1");
		return 0;
	}
	for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)if(b[j])L[i]=min(L[i],(i-j+n)%n),R[i]=min(R[i],(j-i+n)%n);
	for(int i=1;i<=n;i++){
		int k=i,r=0,j;
		for(j=1;j<=n;j++){
			if(a[k]!=b[j])q[++r]=k;
			k%=n;k++;
		}
		sort(q+1,q+r+1,cmp);
		G[r+1]=0;
		for(k=r;k;k--)G[k]=max(G[k+1],L[q[k]]);
		for(k=0;k<=r;k++){
			ans=min(ans,(R[q[k]]+max((i-j+n)%n,G[k+1]))*2-(i-j+n)%n+r);
			ans=min(ans,(G[k+1]+max((j-i+n)%n,R[q[k]]))*2-(j-i+n)%n+r);
		}
	}
	cout<<ans<<endl;
	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f(i,a,b) for(int i=a;i<=b;++i)
using namespace std;int M=998244353,N,K,a,s[303],d[303][303][303]={1};main(){string S;cin>>S>>K;K=min((int)S.size(),K);for(auto c:S)c=='0'?++N:++s[N];f(i,0,N)f(j,0,K)f(k,0,j)f(l,-min(k,s[i]),K-j)(d[i+1][j+max(l,0)][k+l]+=d[i][j][k])%=M;f(i,0,K)(a+=d[N+1][i][0])%=M;cout<<a;}

Measured memory_bytes: 58140
import math
a, b, x = map(int, input().split())
ans = 1
# x = a * a * (a * tan(ans) / 2)
# print(a * math.tan(math.atan((a * a * b - x) / a / a / a * 2)))
if a * math.tan(math.atan((a * a * b - x) / a / a / a * 2)) <= b:
    print(math.degrees(math.atan((a * a * b - x) / a / a / a * 2)))
else:
    print(90 - math.degrees(math.atan(x / a / b / b * 2)))


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var ans = 0;
            for (var i = 1; i <= N; i += 2)
            {
                var tmp = 0;
                for(var j = 1; j <= i; j++)
                {
                    if (i % j == 0) tmp++;
                }
                if (tmp == 8) ans++;
            }

            Console.WriteLine(ans);
        }
    }
}

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

int main(){
	string s,a,b;
	cin>>s;
	a="AAA";
	b="BBB";
	if(s==a||s==b){
		cout<<"No"<<endl;
	}else{
		cout<<"Yes"<<endl;
	}

}

Measured memory_bytes: 256
/* ****mittal**** */
#include<bits/stdc++.h>
#define ll          long long int 
#define pb          push_back
#define endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define jell        998244353
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repr(i,a,b)   for(ll int i=a;i>=b;i--)
#define lbnd    lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define DEC(N)  cout << std::fixed; cout << setprecision(N);
using namespace std;
ll add(ll x,ll y)
{
return (x%hell+y%hell)%hell;
}
ll mul(ll x,ll y)
{
return ((x%hell)*(y%hell))%hell;
}
ll sub(ll x,ll y)
{
return (x-y+hell)%hell;
}
#define N  100005
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
  // cin>>t;
    for(int ok=1;ok<=t;ok++)
    {
        ll n;
        cin>>n;
        ll ans=0;
        for(int i=1;i<=n;i++)
        {
          ll x=n/i;
          ans+=i*(x*(x+1))/2;
        }
        cout<<ans;
     
    }
    return 0;
}

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

typedef struct Node* NodePointer;//??¢?????¬???

typedef struct Node{
	int key;
	NodePointer next;
	NodePointer pre;
} Node;

NodePointer head;
NodePointer last;

void init(){
	head = malloc(sizeof(Node));
	last = malloc(sizeof(Node));
	head->next = last;
	last->pre = head;
}

NodePointer makeNode(int key){
	NodePointer tmp = malloc(sizeof(Node));
	tmp->next = tmp->pre = NULL;
	tmp->key = key;
	return tmp;
}

void insert(NodePointer ins, int key){
	NodePointer newnode = makeNode(key);
	NodePointer tmp = ins->next;
	ins->next = newnode;
	newnode->pre = ins;
	newnode->next = tmp;
	tmp->pre = newnode;

}
void delete(NodePointer p){
	NodePointer s = p->pre;
	NodePointer tmp = p->next;
	s->next = tmp;
	tmp->pre = s;
	free(p);
}





int main(){
	int n,i;
	int num;
	char command[100];
	NodePointer p;
	init();
	scanf(" %d ", &n);
	for (i = 0; i < n; i++){
		scanf(" %s ", command);
		if (!strcmp(command,"insert")){
			scanf(" %d ", &num);
			insert(head,num);
		}else if (!strcmp(command, "delete")){
			scanf(" %d ", &num);
			for(p = head->next; p != last; p = p->next){
				if (p->key == num){//delete????????°???????????????????????????????????????
					delete(p);
					break;
				}
			}
		}else if (!strcmp(command, "deleteFirst")){
			delete(head->next);
		}else if (!strcmp(command, "deleteLast")){
			delete(last->pre);
		}

	}

	for (p = head->next; p != last; p = p->next){
			printf(p==head->next? "%d":" %d", p->key);
		}
		printf("\n");
	return 0;
}

Measured memory_bytes: 32920
#include <bits/stdc++.h>
using namespace std;
string s;
int a[1000];
int main()
{
    while (1>0)
    {
        s.clear();
        getline(cin,s);
        if (s=="") break;
        for(int i=0;i<s.size();i++)
            if ('A'<=s[i] && s[i]<='Z')
                a[s[i]+32-'a']++;
            else if (s[i]>='a')a[s[i]-'a']++;
    //    for(int i=0;i<=25;i++)
    //        cout<<a[i]<<endl;
    }
     for(int h=0;h<=25;h++)
        printf("%c : %d\n",(char)h+'a',a[h]);
}



Measured memory_bytes: 3248