akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
signed main(){
  int a,b,k;
  cin>>a>>b>>k;
  
  V<int> d;
  for(int i=a;i<min(b+1,a+k);i++){
    d.pb(i);
  }
  for(int i=b;i>max(a-1,b-k);i--){
	d.pb(i);
  }
  Sort(d);
  d.erase(unique(d.begin(),d.end()),d.end());
  fo(i,d.sz)
    cout<<d[i]<<endl;
}


Measured memory_bytes: 256
{-# OPTIONS_GHC -O #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}

import Control.Monad
import Data.List
import Data.Bits ((.&.), xor)
import qualified Data.ByteString.Char8 as B

shaku :: Int -> [Int] -> [Int] -> Int -> Int -> Int
shaku n _ [] _ _ = n
shaku n la@(l:ls) ra@(r:rs) c t =
    case t .&. r of
        0  -> shaku (n+c) la rs (c+1) $ xor t r
        t' -> shaku n ls ra (c-1) $ xor t l

main = do
    _ <- getLine
    as <- unfoldr (B.readInt.B.dropWhile (==' ')) <$> B.getLine
    print $ shaku 0 as as 1 0


Measured memory_bytes: 8572
N=int(input())
a = list(map(int,input().split()))
mincost=10000000

cost=0
for i in range(201):
    for j in range(len(a)):
      cost=cost+(a[j]-(i-100))* (a[j]-(i-100))
    if cost<=mincost:
        mincost=cost
        change_num=i-100
    cost=0

print(mincost)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,l1=0,l2=0,l3=0,l4=0;
 cin>>n;
   string s[n];
for(int i=0;i<n;i++){

     cin>>s[i];

 }

 for(int i=0;i<n;i++){

    if(s[i]=="AC")
    {
        l1++;

    }
   else if(s[i]=="WA")
    {
        l2++;

    }

 else if(s[i]=="TLE")
    {
        l3++;

    }
   else  if(s[i]=="RE")
    {
        l4++;

    }

 }




        cout<<"AC"<<" "<<"x"<<" "<<l1<<endl;


        cout<<"WA"<<" "<<"x"<<" "<<l2<<endl;

        cout<<"TLE"<<" "<<"x"<<" "<<l3<<endl;

        cout<<"RE"<<" "<<"x"<<" "<<l4<<endl;


 return 0;

}





Measured memory_bytes: 6700
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String n = sc.next();
    String num[] = n.split("");
    for (int i = 0; i < 3; i++){
      if (num[i].equals("1")){
        num[i] = "9";
      }else{
        num[i] = "1";
      }
      System.out.print(num[i]);
    }
  }
}

Measured memory_bytes: 35624
ans :: Integer -> [Integer] -> [Integer]
ans k [] = [k]
ans k (x:y) = min k x : ans x y

main = do
  n <- readLn :: IO Int
  a0:b <- map read . words <$> getLine :: IO [Integer]
  putStrLn . show $ foldl (+) a0 $ ans a0 b


Measured memory_bytes: 1020
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int main()
{
    int n, k;
    while(~scanf("%d%d", &n, &k))
    {
        int minnum = 0;
        int sum = 1;
        for(int i = 0; i < n; ++i)
        {
            if(sum * 2 < (sum + k))
            {
                minnum = sum * 2;
                sum = sum * 2;
            }
            else
            {
                minnum = sum + k;
                sum = sum + k;
            }
        }
        printf("%d\n", minnum);
    }
}

Measured memory_bytes: 256
// AOJ1149
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define e_b emplace_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ipair;
typedef pair<ll,ll> lpair;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
void map_p(map<int,int>& d){cout<<"map: ";for(auto a : d){cout<<"{"<<a.first<<":"<<a.second<<"}";}cout<<endl;} //mapの中身を見る
void set_p(set<int>& d){cout<<"set: ";for(int a : d){cout<<a<<" ";}cout<<endl;} //setの中身を見る

struct info{int ind,x,y;};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int n,w,d;
    while(cin>>n>>w>>d){
        if(n+w+d==0) break;
        info cur;
        cur.ind=0,cur.x=0,cur.y=0; //1-indにするため
        vector<info> pi={cur};
        cur.ind=1,cur.x=w,cur.y=d;
        pi.e_b(cur);
        int max_ind=1;
        rep(i,n){
            int p,s;
            cin>>p>>s;
            info now=pi[p];
            s=s%(now.x+now.y); //無駄な周回をなくす
            int x1,x2,y1,y2;
            if(s<now.x) x1=s,x2=now.x-s,y1=now.y,y2=now.y;
            else x1=now.x,x2=now.x,y1=s-now.x,y2=now.y-(s-now.x);
            if(x1*y1>x2*y2){ //x1*y1を小さいほうにしたい
                swap(x1,x2),swap(y1,y2);
            }
            pi.erase(pi.begin()+p);
            cur.ind=max_ind,cur.x=x1,cur.y=y1;
            pi.e_b(cur);
            cur.ind=max_ind+1,cur.x=x2,cur.y=y2;
            pi.e_b(cur);
            max_ind++;
        }
        multiset<int> area;
        for(int i=1;i<=pi.size()-1;i++) area.insert(pi[i].x*pi[i].y);
        auto itr=area.begin();
        rep(i,area.size()-1){
            cout<<*itr<<" ";
            itr++;
        }
        cout<<*itr<<endl;
    }
    return 0;
}


Measured memory_bytes: 3164
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

pub fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);

// ===

fn main() {
    let n: usize = read();
    let (d, x): (usize, usize) = read();
    let mut consumed = 0;
    for i in 0..n {
        let a: usize = read();
        consumed += (d - 1) / a + 1;
    }
    println!("{}", x + consumed);
}


Measured memory_bytes: 4352
from functools import reduce

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

# 小さい番号の勇者から順に小さい番号の街のモンスターを優先して倒す
ans, _ = reduce(
    lambda acc, i: (
        acc[0] + min(acc[1] + A[i + 1], B[i]),
        max(0, A[i + 1] - max(0, B[i] - acc[1]))
    ),
    range(N),
    (0, A[0])
)

print(ans)


Measured memory_bytes: 19248
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const int MOD = 998244353;
const ll INF = 1000000000000000000;


int main()
{
	int N;
	cin >> N;
	double ans = 0.0;
	for (int i = 0; i < N; i++) {
		double A;
		cin >> A;
		ans += 1.0 / A;
	}
	printf("%.10f\n", 1.0 / ans);
}

Measured memory_bytes: 3700
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

def main():
    N,K=map(int,input().split())
    h=[int(input()) for i in range(N)]
    h.sort()
    ans=INF
    for i in range(N-K+1):
        ans=min(ans,h[i+K-1]-h[i])
    print(ans)

if __name__ == '__main__':
    main()


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

int main(void){
    int N;
    cin >> N;
    int A[N];
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    int c = 0;
    for(int i = 0; i <= N - 3; i++){
        int m = max(A[i+2],max(A[i], A[i+1]));
        int n = min(A[i+2],min(A[i],A[i+1]));
        if(A[i+1] != m && A[i+1] != n){
            c++;
        }
    }
    cout << c << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;

int N,Z,W,A[2002],P[2002],Q[2002];

int main()
{
	scanf ("%d %d %d",&N,&Z,&W);
	for (int i=1;i<=N;i++) scanf ("%d",&A[i]);

	for (int i=N;i>=1;i--){
		P[i] = Q[i] = abs(A[i-1]-A[N]);
		for (int j=i;j<N;j++){
			P[i] = max(P[i],Q[j+1]);
			Q[i] = min(Q[i],P[j+1]);
		}
	}

	int ans = abs(W-A[N]);
	for (int j=2;j<=N;j++) ans = max(ans,Q[j]);
	printf ("%d\n",ans);

	return 0;
}

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

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int x[51], y[51];
    rep(i, N) cin >> x[i] >> y[i];
    int ans = INF2;
    rep(i, N) {
        rep(j, N) {
            if(i == j) continue;
            rep(k, N) {
                //if(i == k || j == k) continue;
                rep(s, N) {
                    //if(i == s || j == s || k == s) continue;
                    int L = min({x[i], x[j], x[k], x[s]});
                    int R = max({x[i], x[j], x[k], x[s]});
                    int U = min({y[i], y[j], y[k], y[s]});
                    int D = max({y[i], y[j], y[k], y[s]});
                    int cnt = 0;
                    rep(t, N) {
                        if(L <= x[t] && x[t] <= R && U <= y[t] && y[t] <= D) cnt++;
                        if(cnt >= K || cnt + N - t < K) break;
                    }
                    if(cnt >= K) ans = min(ans, (R - L) * (D - U));
                }
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int Binary(int[],int,int);

int main(){
  int S[100000],T,n,q,i,j,count=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  for(j=0;j<q;j++){
    scanf("%d",&T);
    if(Binary(S,T,n)==0)count=count+1;
  }

  printf("%d\n",count);
  return 0;
}

int Binary(int S[],int T,int n){
  int l=0;
  int r=n;
  int m;

  while(l<r){
    m = (l+r)/2;

    if(T==S[m])return 0;
    if(T > S[m])l = m+1;
    else if(T < S[m])r = m;
  }

  return 1;
}



Measured memory_bytes: 2244
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <set>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;
const ll inf = 1000000007;

vector<vector<ll> > warshallFloyd(const vector<set<Pii> > &edge) {
  int n = edge.size();
  vector<vector<ll> > d(n, vector<ll>(n, inf));
  for (int i = 0; i < n; i++) {
    d[i][i] = 0;
    for (Pii x : edge[i]) {
      d[i][x.first] = x.second;
    }
  }
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }
  return d;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  for (auto &x: s) cin >> x;

  vector<set<Pii> > edge(h*w);
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w-1; j++) {
      if (s[i][j] == '.' && s[i][j+1] == '.') {
        edge[i*w+j].emplace(i*w+j+1, 1);
        edge[i*w+j+1].emplace(i*w+j, 1);;
      }
    }
  }
  for (int i = 0; i < h-1; i++) {
    for (int j = 0; j < w; j++) {
      if (s[i][j] == '.' && s[i+1][j] == '.') {
        edge[i*w+j].emplace((i+1)*w+j, 1);
        edge[(i+1)*w+j].emplace(i*w+j, 1);
      }
    }
  }

  auto dist = warshallFloyd(edge);

  ll maximum = 0;
  for (int i = 0; i < h*w; i++) {
    for (int j = i+1; j < h*w; j++) {
      if (dist[i][j] < inf && dist[i][j] > maximum) maximum = dist[i][j];
    }
  }

  cout << maximum << endl;

  return 0;
}


Measured memory_bytes: 1664
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vvvvll = vector<vector<vector<vector<ll>>>>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = vector<pair<ll,ll>>;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define vllin(x,n) vll (x)(n);FOR(i,0,n-1){cin >>(x)[i];}
#define vllin2(a,b,n) vll (a)(n);vll (b)(n);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i];}
#define vllin3(a,b,c,n) vll (a)(n);vll (b)(n);vll (c)(n);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i]>>(c)[i];}
#define vlling(x,n) (x).assign(n,0);FOR(i,0,n-1){cin >>(x)[i];}
#define vlling2(a,b,n) (a).assign(n,0);(b).assign(n,0);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i];}
#define vlling3(a,b,c,n) (a).assign(n,0);(b).assign(n,0);(c).assign(n,0);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i]>>(c)[i];}
#define vpl4in(x,n) vpl4 (x)((n),mp(0,0));FOR(i,0,n-1){cin >>x[i].fi>>x[i].se;}
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define rSORT(x) sort(x.rbegin(), x.rend())
#define say(x) cout<<(x);
#define sal(x) cout<<(x)<<endl;
#define says(x) cout<<(x)<<(' ');
#define sas cout<<(' ');
#define sayR(x) cout<<fixed<<setprecision(10)<<(x);
#define salR(x) cout<<fixed<<setprecision(10)<<(x)<<endl;
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl;
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<endl;
#define pow(a,b) ll(pow(a,b))

ll MOD=998244353;

signed main(){
        llin(n);
        str s;
        ll a=0;
        ll b=0;
        ll ab=0;
        ll k=0;
        FOR(i,0,n-1){
              cin >>s;
              FOR(j,0,s.sz-2){
                      if(s[j]=='A'&&s[j+1]=='B'){
                              k++;
                      }
              }
              if(s[0]=='B'){
                      if(s[s.sz-1]=='A'){
                              ab++;
                      }else{
                              b++;
                      }
              }else{
                      if(s[s.sz-1]=='A') a++;
              }
        }
        if(ab>0){
                k+=ab-1;
                b++;
                a++;
                if(b==1&&a==1){
                        a=0;
                        b=0;
                }
        }
        sal(k+min(a,b));
}

Measured memory_bytes: 256
N, L = list(map(int, input().split()))
total = N * (L - 1) + N * (N + 1) // 2

min_abs = 300
diff = 300

for i in range(1, N+1):
  if abs(L + i - 1) < min_abs:
  	min_abs = abs(L + i - 1)
  	diff = L + i - 1
print(total - diff)

Measured memory_bytes: 3060
from bisect import bisect_left

count = 0
n = int(input())
list = sorted([int(x) for x in input().split()])

for i in range(n):
    for j in range(i + 1, n) :
        sum = list[i] + list[j]
        a = bisect_left(list,sum)
        count += a - j - 1
print(count)


Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<tuple>
#include<string>
typedef unsigned long long ll;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define F first
#define S second
using namespace std;
const ll INF = 1e12;
const int i_INF = 2147483647;

int main() {
  int y,m,d;
  char c1,c2;
  cin>>y>>c1>>m>>c2>>d;
  puts(m<=4?"Heisei":"TBD");
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

int main() {
    long long ai, ao, at, aj, al, as, az, ret, ret2 = 0;
    std::cin >> ai >> ao >> at >> aj >> al >> as >> az;

    ret = ai / 2 * 2 + aj / 2 * 2 + al / 2 * 2 + ao;
    if (ai > 0 && aj > 0 && al > 0) ret2 = 3 + (ai - 1) / 2 * 2 + (aj - 1) / 2 * 2 + (al - 1) / 2 * 2 + ao;
    std::cout << std::max(ret, ret2) << std::endl;

    return 0;
}

Measured memory_bytes: 256
from sys import stdin


def main():
    S = input()

    if S == "SUN":
        print(7)
    elif S == "MON":
        print(6)
    elif S == "TUE":
        print(5)
    elif S == "WED":
        print(4)
    elif S == "THU":
        print(3)
    elif S == "FRI":
        print(2)
    elif S == "SAT":
        print(1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <stdio.h>
#include <stack>

using namespace std;

stack<int> s;
int ac;

int main(void) {
    while(~scanf("%d", &ac)) {
        if(ac == 0) {
            cout << s.top() << endl;
            s.pop();
        } else {
            s.push(ac);
        }
    }
    return 0;
}

Measured memory_bytes: 0
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
set<int> v[2 * maxn];
vector<bool> vis;
vector<int> cc;
void dfs(int node)
{
	vis[node] = true;
	cc.pb(node);
	for (auto i : v[node])
		if (!vis[i])
			dfs(i);
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n = 0, m = 0, x = 0, y = 0, res = 0;
	cin >> n >> m;
	vis.resize(n); vis.assign(n, false);
	for (int i = 0; i < m; ++i)
	{
		cin >> x >> y; --x; --y;
		v[x].insert(y); v[y].insert(x);
	}
	for (int i = 0; i < n; ++i)
		if (!vis[i])
		{
			cc.clear(); dfs(i);
			res = max(res, (int)cc.size());
		}
	cout << res << endl;
}

Measured memory_bytes: 44712
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n,k;
  cin >> n >>k;
  vl num(k);
  rrep(i,n){
    num[i%k]++;
  }
  ll ans = 0;
  rep(a,k){
    int b = (k-a) % k;
    int c = (k-a) % k;
    if((b+c)%k != 0) continue;
    ans += num[a]*num[b]*num[c];
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1792
import java.util.*;

class Main {

    static int[][] table;
    static int n;

    static void solve (  ) {

        for(int i = 0; i < n; i++) {
            table[i][n] = 0;
            for(int j = 0; j < n; j++) {
                table[i][n] += table[i][j];
            }
        }
        for(int j = 0; j <= n; j++) {
            table[n][j] = 0;
            for(int i = 0; i < n; i++) {
                table[n][j] += table[i][j];
            }
        }

        for(int i = 0; i <= n; i++) {
            for(int j = 0; j <= n; j++) {
                System.out.printf("%5d", table[i][j]);
           }
           System.out.println("");
        }

    }

    public static void main (String [] args) {

        Scanner sc = new Scanner(System.in);

        while (true) {
            n = sc.nextInt();
            if (n==0)   break;

            table = new int [n+1][n+1];

            for(int i = 0; i < n; i++) {
                for(int j = 0; j < n; j++) {
                    table[i][j] = sc.nextInt();
                }
            }

            solve();

        }

    }
}

Measured memory_bytes: 12000
n = int(input())
ratio_array = [tuple(map(int, input().split())) for _ in range(n)]

votes_numｓ = (1, 1)

for x, y in ratio_array:
    t, a = votes_numｓ
    m = max((t+x-1)//x, (a+y-1)//y)
    votes_numｓ = (m*x, m*y)

print(sum(votes_numｓ))

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

int main(){
    double r;
    cin >> r;
    r = r*2.0;
    r = r*3.141592653;
    printf("%.5f",r);
}

Measured memory_bytes: 3788
#include<vector>
#include<iostream>
#include<map>
using namespace std;
int main()
{
  int long long n;
  int long long ans = 0;
  int long long val;
  int long long temp;
  vector<int long long > v,s;
  map<int long long , int long long> m;
  cin>>n;
  for(int long long i=0;i<n;i++)
  {
      cin>>val;
      v.push_back(val);
      if(m[val]==0)
      {
        s.push_back(val);
      }
    m[val]++;
  }
  int long long k = s.size();
  for(int long long i=0;i<k;i++)
  {
    int long long x = m[s[i]];
    ans = ans + (x*(x-1))/2 ;
  }
  for(int long long i=0;i<n;i++)
  {
    temp = ans;
    int long long x = m[v[i]];
    int long long y = x-1;
    temp = temp - (x*(x-1))/2 + (y*(y-1))/2;
    cout<<temp<<endl;
  }
  return 0;
}


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

int main() {
  string str; cin >> str;
  
  char ch = 'a';
  string ans = "None";
  while(ch <= 'z') {
    if(str.find(ch) == string::npos) {
    	ans = ch;
	    break;
    }
    ch++;
  }
  
  cout << ans << endl;

  return 0;
}


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

int x; 

int main () {
	cin >> x;
	if (x<1200){
		cout << "ABC" << endl;
	}else{ if (x<2800){
		cout << "ARC" << endl;
	}else{
		cout << "AGC" << endl;
	}
	}

}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.*;
 
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{ 
 
 
    static long mod=1000000007;
    static int dx[]={1,-1,0,0};
    static int dy[]={0,0,1,-1};
    // static int dx[]={1,-1,0,0,1,1,-1,-1};
    // static int dy[]={0,0,1,-1,1,-1,1,-1};
    // PriorityQueue<Integer> que = new PriorityQueue<Integer>(); 
    // HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
    // ArrayList<Integer> lis = new ArrayList<Integer>();
    // ArrayList<Integer> map[]=new ArrayList[26];
    // static HashMap<Integer,Long> map = new HashMap<Integer,Long>();

    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // long n=sc.nextLong();
        // char c[][] = new char[h][w];
        // long a[] = new long [n];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {a[i]=sc.nextInt();}
        
        int n = sc.nextInt();
        int d[] = new int[100000*2+1];
        
        for(int i=0; i<n; i++) {
            d[sc.nextInt()] = i+1;
        }
        int pre=0, c=0, a=0;
        for(int i=0; i<n; i++) {
            if(pre<d[i+1])c++;
            else {a=max(c,a); c=1;}
            pre = d[i+1];
        }
        a=max(c,a);

        out.println(n-a);
        out.flush();
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
     
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }
     
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }    
}

class XY {
    int x,y,d;
    XY(int x, int y, int d) {
        this.x=x;
        this.y=y;
        this.d=d;
    } 
}
 
class P implements Comparable<P>{
    int x,y;
    P(int x, int y) {
        this.x=x;
        this.y=y;
    } 
      
    public int compareTo(P p){
        return -x + p.x;//des
    } 
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 45296
import java.util.*;
class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		s=s.replaceAll("eraser","").replaceAll("erase","").replaceAll("dreamer","").replaceAll("dream","");
		System.out.println(s.length()==0?"YES":"NO");
	}
}


Measured memory_bytes: 33452
import Foundation
func toTuple<T>(_ args: [T]) -> (T, T) { (args[0], args[1]) }
func readInts() -> [Int] { readLine()!.split(separator: " ").map { Int($0)! } }

let (a, b) = toTuple(readInts())
let s = readLine()!.split(separator: "-")
guard s.count == 2 else { print("No"); exit(0) }
if s[0].count == a , s[1].count == b{
  print("Yes")
} else {
  print("No")
}

Measured memory_bytes: 13484
# EDPC Q - Flowers
# 重み付きのLISと言って良いような問題
# これは、LISのdpを少し改造すれば解ける

## test data
## 5
## 4 2 3 1 5
## ans=3

import bisect

class SegTree:
	def __init__(self,size,func,init_val,undef):
		self.specSize = size
		self.datSize = 1
		self.compareFunc = func		# suppose to min or max
		self.INIT_VAL = init_val	# 0 etc
		self.UNDEFINED_VAL = undef	# 1e18 -1e18 etc
		while self.datSize < size: self.datSize *= 2

		# the tree is implemented by sequencial list
		self.datTree = [self.INIT_VAL for _ in range(2*self.datSize+1)]

	def update(self, i, val ):
		i -= 1	# 1-orderで指定され、内部では0-Order想定?
		i += (self.datSize - 1)
		# print("upd",i,val)
		self.datTree[i] = val
		while 0 < i:
			i = (i-1)//2
			self.datTree[i] = self.compareFunc( self.datTree[i*2+1], self.datTree[i*2+2] )
			# print("upd",i,self.datTree[i])

	def query(self,a,b):
		return self.query_(a,b,0,0,self.datSize)

	def query_(self,a,b,i,l,r):
		""" get minimun/maximum value of range[a,b)
		i is the root vertex of search 
		l,r is range of the root vertex
		"""
		if r <= a or b <= l:
			# (a,b) and (l,r) is not intersected
			return self.UNDEFINED_VAL

		if a <= l and r <= b:
			# i is index required
			return self.datTree[i]
		else:
			# search children
			m = (l+r) // 2
			vl = self.query_(a, b, i*2 + 1, l, m )
			vr = self.query_(a, b, i*2 + 2, m, r )
			return self.compareFunc(vl,vr)

	def debugPrint(self):
		print("=== seg tree debug print start ===")
		print(self.datTree)
		print("== root ==")
		print(self.datTree[0])
		print("== leaf ==")
		print(self.datTree[self.datSize-1:])
		print("=== seg tree debug print end ===")

def LongestIncreaseSeaquence(H,A):
	# === Coordinate compression ===
	# unique and sort asc
	N = len(H)
	# sortedA = sorted(list(set(A)))
	lis = 0

	# === Range Maximum Query ===
	# ここでは、各要素iに、最後の値がiの時のLISを登録
	tree = SegTree(N,max,0,-1e18)
	for n in range(N):

		# i=bisect.bisect_left(sortedA,A[n])

		maxValOfCurrentRange = tree.query(0,H[n])
		valOfNext = tree.query(H[n],H[n]+1)

		# i+=1

		if valOfNext < maxValOfCurrentRange + A[n]:
			# print( H[n], maxValOfCurrentRange + A[n] )
			# tree.debugPrint()
			tree.update( H[n], maxValOfCurrentRange + A[n] )

	lis = tree.query(0,N+1)
	return lis


def main():
	N = int(input())
	# 高さは、N以下で全部違うらしい
	H = list(map(int, input().split()))
	A = list(map(int, input().split()))
	# A = [ int(input()) for _ in range(N)]
	print(LongestIncreaseSeaquence(H,A))



if __name__ == "__main__":
	main()


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

int main (){
  int n;
  int taroPoint = 0;
  int hanakoPoint = 0;
  string  taro ,hanako ;
  cin >> n;
  for(int i = 0 ; i < n; i++){
    cin >> taro >> hanako;
    if(taro < hanako) hanakoPoint += 3;
    else if(taro == hanako){taroPoint ++; hanakoPoint ++;}
    else taroPoint += 3;
  }
  cout << taroPoint << ' ' << hanakoPoint << endl;
  return 0;
}



Measured memory_bytes: 3204
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
m = inp()
b = inpl()
ca = Counter(a)
cb = Counter(b)
for key in list(cb):
    if cb[key] > ca[key]:
        print('NO')
        break
else:
    print('YES')

Measured memory_bytes: 58060
import java.util.Scanner;
import java.util.LinkedList;
import java.util.Collections;

public class Main{

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);

        // input
        final int NUM = scan.nextInt();
        LinkedList<Integer> scores = new LinkedList<>();
        int delicious = scan.nextInt();
        for(int i = 0; i < NUM; i++){
            scores.add(delicious + (i + 1) - 1);
        }

        // search
        int sum = 0;
        Collections.sort(scores, (a, b) -> Integer.compare(Math.abs(a), Math.abs(b)));
        scores.poll();
        for(int i = 1; i < NUM; i++){
            sum += scores.poll();
        }

        // answer
        System.out.println(sum);


    }
}

Measured memory_bytes: 27092
public class Main {

    public static void main(String[] args) {
        java.util.Scanner sc = new java.util.Scanner(System.in);
        
        String s = sc.next();
        int count = 0;
        char[] cArray = s.toCharArray();
        
        for(Character c : cArray){
            if(c.equals('1')) count++;
        }
        
        System.out.println(count);
    }
    
}

Measured memory_bytes: 22608
#include <iostream>
#include <string>
using namespace std;
typedef long long int ll;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
string s[51];
int h,w;
void dfs(int y,int x){
  s[y][x]='.';
  for(int i=0;i<4;i++){
      int nx=x+dx[i];int ny=y+dy[i];
      if(nx>=w||ny>=h||nx<0||ny<0) continue;
      if(s[ny][nx]=='#') dfs(ny,nx);
    }
  return;
}
int main(){
  cin >>h>>w;
  int fl=0;
  for(int i=0;i<h;i++) cin >>s[i];
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(s[i][j]=='#') {
        for(int k=0;k<4;k++){
          int nx=j+dx[k];int ny=i+dy[k];
          if(nx>=w||ny>=h||nx<0||ny<0) continue;
          if(s[ny][nx]=='#') fl=1;
        }
        if(fl==0){
          cout <<"No"<<endl;
          return 0;
        }
      }
      fl=0;
    }
  }
  cout <<"Yes"<<endl;
}


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

int main(){
    int n;
    cin >> n;
    int cnt = 0;
    int max = -1;
    ll bh;
    for(int i=0;i<n;i++){
        ll h;
        cin >> h;
        if(i == 0){
            bh = h - 1;
        }
        if( h <= bh ){
            cnt++;
        }else{
            cnt = 0;
        }
        if(max < cnt) max = cnt;
        bh = h;
    }
    cout << max << endl;
}

Measured memory_bytes: 3560
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
#define ll long long
#define ld long double
using namespace std;

int A[100010], B[100010], E[100010];
pair<int, int> C[100010], D[100010];

int main() {
	int N;
	cin >> N;
	for(int i=0; i<N; ++i){
		cin >> A[i];
		C[i]=make_pair(A[i], i);
	}
	for(int i=0; i<N; ++i){
		cin >> B[i];
		D[i]=make_pair(B[i], i);
	}
	sort(C, C+N);
	sort(D, D+N);
	int cnt=0;
	for(int i=0; i<N; ++i){
		if(C[i].first>D[i].first){
			cout << "No" << endl;
			return 0;
		}
		if(i>0){
			if(C[i].first<=D[i-1].first){
				++cnt;
			}
		}
	}
	if(cnt>0){
		cout << "Yes" << endl;
		return 0;
	}
	for(int i=0; i<N; ++i){
		E[C[i].second]=D[i].second;
	}
	int now=E[0], k=1;
	while(now>0){
		now=E[now];
		++k;
	}
	if(k<N) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <iomanip>
#include <queue>
#include <map>
#include <set>
#include <random>
#include <sstream>
#include <stack>
#include <deque>

using namespace std;

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

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

int N, M;
vi G[300000];
int used[300000];

void dfs(int n) {
  used[n] = 1;
  for (int v : G[n]) {
    if (used[v]) continue;
    dfs(v);
  }
}

int main() {
  cin >> N >> M;
  rep(i,N) {
    int K;
    cin >> K;
    rep(j,K) {
      int L;
      cin >> L;
      L--;
      G[i].push_back(N+L);
      G[N+L].push_back(i);
    }
  }
  dfs(0);
  int f = 1;
  rep(i,N) if (!used[i]) f = 0;
  if (f) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int32_t inf = 1001001001;
const int64_t infll = 1001001001001001001ll;
const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const string YES = "YES", NO = "NO", Yes = "Yes", No = "No", yes = "yes", no = "no";

// clang-format off
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }

template <typename T> void sort(vector<T> &v) { sort(all(v)); }
template <typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  int n = in(), x = in();
  vector<int> a(n);
  cin >> a;

  sort(a);
  x -= accumulate(all(a), 0);

  cout << n + x / a[0] << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main
{
	
	private void solve()throws IOException
	{
		String s=nextLine();
		int n=s.length();
		if(n%2!=0)
		{
			out.println("No");
			return;
		}
		for(int i=0;i<n;i+=2)
		{
			if(s.charAt(i)=='h' && s.charAt(i+1)=='i');
			else
			{
				out.println("No");
				return;
			}
		}
		out.println("Yes");
	}

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

	public void run()throws IOException
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();

		br.close();
		out.close();
	}
	public static void main(String args[])throws IOException{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws IOException{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws IOException{
		return br.readLine();
	}
	int nextInt()throws IOException{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws IOException{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws IOException{
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 21332
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

class hateFactorization
{
    static void Main(string[] args)
    {

        var input = long.Parse(Console.ReadLine());

        var flag = false;
        var ans_one = 0;
        var ans_two = 0;

        
            for(var i = 0; i < 1000; i++)
            {
                for(var j = 1000; j > -1000; j--)
                {
                   if( Math.Pow(i,5) - Math.Pow(j,5) == input)
                    {
                    ans_one = i;
                    ans_two = j;
                        goto roop;
                    }
                }
            }

            roop:
        Console.WriteLine("{0} {1}",ans_one,ans_two);
        
    }
}

Measured memory_bytes: 27844
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)
 
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
#define repp(i, a, b) for(int i = a; i <= b; i++)
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, b, a) for(int i = b; i >= a; i--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define mem(a, b) memset(a, b, sizeof(a));
#define mem0(a) memset(a, 0, sizeof(a));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define in_edges(m) repp(i, 1, m){ll a, b; cin >> a >> b; v[a].pb(b), v[b].pb(a);}
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define endl "\n"
ll power(ll x, ll y); 

const ll MOD = 1000000007;
 
int main() //PointBlank's code ¯\_(ツ)_/¯
{
    ll k, n;
    cin >> k >> n;
    ll arr[n];
    rep(i, 0, n) cin >> arr[i];
    vector<ll> diff;
    rep(i, 1, n) diff.pb(arr[i] - arr[i - 1]);
    diff.pb(k - arr[n - 1] + arr[0]);
    sort(all(diff));
    ll res = 0;
    rep(i, 0, diff.size() - 1) res += diff[i];
    cout << res;

}
 
ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}

Measured memory_bytes: 3956
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n = inp()
    dp = [[0 for _ in range(10)] for _ in range(10)]
    for i in range(n+1):
        s = str(i)
        dp[int(s[0])][int(s[-1])] += 1
    ans = 0
    for i in range(1,10):
        for j in range(1,10):
            ans += dp[i][j] * dp[j][i]
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 42728
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

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

int k;
double p, e, t;

double ans = 0;

void dfs(double l, double r, int cnt, double x) {
	if(r < t - e) return;
	if(l > t + e) return;

	double h = (l + r) / 2;

	if(cnt == k) {
		if(t - e <= h && h <= t + e) ans += x;
		return;
	}

	if(h >= t) {
		dfs(l, h, cnt + 1, (1.0 - p) * x);
		dfs(h, r, cnt + 1, p * x);
	} else {
		dfs(h, r, cnt + 1, (1.0 - p) * x);
		dfs(l, h, cnt + 1, p * x);
	}
}

int main() {
	double l, r;
	cin >> k >> l >> r;
	cin >> p >> e >> t;

	dfs(l, r, 0, 1.0);

	cout << fixed;
	cout.precision(20);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1292
(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
      (cons (subseq str 0 pos)
            (split x (subseq str (+ pos size))))
      (list str))))

(setq *n* (read))
(setq *ws* (mapcar #'parse-integer (split " " (read-line))))

(defun cumulate (l s)
  (if (equal (car l) nil)
      nil
      (let ((next-s (+ s (car l))))
        (append (list next-s) (cumulate (cdr l) next-s)))))

(defun calc (l)
  (if (equal (cadr l) nil)
    nil
    (append (list (abs (- (- (car (last l)) (car l)) (car l)))) (calc (cdr l)))
    ))

;(print (cumulate (mapcar #'+ *ws*) 0))
(print (apply #'min (calc (cumulate (mapcar #'+ *ws*) 0))))


Measured memory_bytes: 12644
from collections import defaultdict
s = input()
t = input()
cnt_s = defaultdict(int)
cnt_t = defaultdict(int)
for i in range(len(s)):
    cnt_s[s[i]] += 1
    cnt_t[t[i]] += 1

cnt_s = sorted(cnt_s.values())
cnt_t = sorted(cnt_t.values())
if len(cnt_s) != len(cnt_t):
    ans = "No"
else:
    ans = "Yes"
    for i in range(len(cnt_s)):
        if cnt_s[i] != cnt_t[i]:
            ans = "No"
            break
print(ans)

Measured memory_bytes: 4144
N,M,*as=$<.read.split.map(&:to_i)
mod=10**9+7
fib = [1,1]
2.upto(N) do |i|
    fib << fib[i-2]+fib[i-1]
end
prev = 0
ret = 1
as << N+1
as.each do |a|
    if prev == a
        puts 0
        exit
    end
    ret = ret * fib[a-prev-1]
    prev = a+1
end
puts ret%mod



# 1

# 1 1
# 2

# 1 1 1
# 1 2
# 2 1

# 1 1 1 1
# 1 1 2
# 1 2 1
# 2 1 1
# 2 2

# 1 1 1 1 1
# 1 1 1 2
# 1 1 2 1
# 1 2 1 1
# 2 1 1 1
# 2 2 1
# 2 1 2
# 1 2 2

# 1 1 1 1 1 1
# 1 1 1 1 2
# 1 1 1 2 1
# 1 1 2 1 1
# 1 2 1 1 1
# 2 1 1 1 1
# 1 1 2 2
# 1 2 1 2
# 1 2 2 1
# 2 1 1 2
# 2 1 2 1
# 2 2 1 1
# 2 2 2

Measured memory_bytes: 461552
h,w = map(int,input().split())
grid = []
for i in range(h):
    temp = list(map(int,input().split()))
    grid.append(temp)

ans = []
for i in range(h):
    for k in range(w-1):
        if grid[i][k]%2 == 1:
            ans.append([i+1,k+1,i+1,k+2])
            grid[i][k] += -1
            grid[i][k+1] += 1
for i in range(h-1):
    if grid[i][-1]%2 == 1:
        ans.append([i+1,w,i+2,w])
        grid[i][-1] += -1
        grid[i+1][-1] += 1
print(len(ans))
for i in range(len(ans)):
    for k in range(4):
        if k != 3:
            print(ans[i][k],end = " ")
        else:
            print(ans[i][k])

Measured memory_bytes: 30268
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<utility>
#include<array>
#include<set>
#include <numeric>
#include <stdio.h>
#include <map>
#include <iomanip>
#include <sstream>
//#include <boost/math/common_factor_rt.hpp>
#include<fstream>
#define EPS (1e-7)
using namespace std;
#define ll long long



class Employee {
public:
	int id;
	int parent;
	vector<int> children;
	int salary;

	Employee() {
		
	}

	Employee(int num, int nparent) {
		id = num;
		parent = nparent;
		salary = -1;
	}



};



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;
}





pair<int, int> count_nonzero_cluster(vector<int>& vs) {

	int number = 0;
	int prev = 0;
	int vmax = -1;
	pair<int, int> re = make_pair(number, vmax);
	for (auto& v:vs)
	{
		if (prev <= 0 && v > 0) {
			re.first += 1;
		}
		if (re.second < v)re.second = v;
		prev = v;
	}


	return re;
}

int main() {
	
	ll N, M;
	cin >> N >> M;
	ll ans = 0;
	if (N == 1 && M == 1) {
		ans = 1;
	}
	else if (N == 1 || M == 1) {
		ans = N * M - 2;
	}
	else {
		ans = N * M - (N - 1) * 2 - (M - 1) * 2;
	
	}



	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256