akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  string S;
  cin >> S;
  long N = S.size();

  bool Afirst = S[0] == 'A';
  long Ccount = 0;
  bool NG = false;
  for (long i = 1; i < N; i++) {
    if (2 <= i and i <= N-2 and S[i] == 'C') Ccount++;
    else if ('a' <= S[i] and S[i] <= 'z') continue;
    else NG = true;
  }

  bool result = Afirst and Ccount == 1 and not NG;
  puts(result ? "AC" : "WA");
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define vv(T) std::vector<std::vector<T>>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;

int		main(void)
{
	string S, T;
	cin >> S >> T;

	reverse(all(S));
	reverse(all(T));
	for (int i = 0; i < (int)S.size(); ++i)
	{
		int j = 0;
		while (j < (int)T.size() && (S[i+j] == '?' || S[i+j] == T[j]))
			++j;
		if (j == (int)T.size())
		{
			--j;
			for (int k = (int)S.size()-1; k >= 0; --k)
			{	
				if (i <= k && k <= i+j)
					cout << T[j--];
				else if (S[k] == '?')
					cout << 'a';
				else
					cout << S[k];
			}
			cout << endl;
			return 0;
		}
	}
	cout << "UNRESTORABLE" << endl;
}



Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,l,r;
  int total = 0;
	cin >> N;
  
  for(int i = 0 ; i<N ; i++){
   cin >> l >> r;
    total += (r-l+1);
  }
  cout << total << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    
    char S[7];

    // input
    scanf("%s", S);

    // output
    if (S[2] == S[3] && S[4] == S[5]) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less  
using namespace         std;
#define                 int long long
#define                 double long double
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<'\n'
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define N 1014159
#define  vi vector<int>
#define  v  vector
#define die exit(0)
#define alln(arr) arr+1 , arr+1+n
using namespace __gnu_pbds;  
typedef tree<int, null_type, less<int>, rb_tree_tag,  
            tree_order_statistics_node_update> oset; 

int n,m,k,arr[N];
int brr[N];




void solve()
{
    cin>>n;
    set<pi> A;
    forn(i,0,n-1)cin>>arr[i];
    forn(i,0,n-1){cin>>brr[i];A.insert({brr[i],i});}
    int t = 0;
    int ans = 0;
    while(A.size())
    {   
        t++;
        if(t>1e7)
        {
            cout<<-1;
            exit(0);
        }
        auto i = *A.rbegin();
        A.erase(i);
        int x = i.Y;
        int a = (x-1+n)%n;
        int b = (x+1)%n;
        

        int pp = brr[x]-arr[x];
        int xx = pp/(brr[a]+brr[b]);
        brr[x]-=xx*(brr[a]+brr[b]);
        ans+=xx;



        if(brr[x]!=arr[x])
        {
            A.insert({brr[x],x});
        }
    }

    cout<<ans;
    



}


signed main() 
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
    int t = 1;
    //cin>>t;
    forn(i,1,t)
    {
        solve();
        nl;
    }



    return 0;

}

//       clang++ c.cpp ; ./a.out < a.txt ;  

Measured memory_bytes: 18816
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
using T = tuple<int, int, int>;
const int INF = 1e9;

struct Loc {
    int dyx;
    int y;
    int x;

    Loc(T t) {
        dyx = get<0>(t);
        y = get<1>(t);
        x = get<2>(t);
    }
};

int main() {
    int h, w, cy, cx, dy, dx;
    cin >> h >> w >> cy >> cx >> dy >> dx;
    char s[h][w];
    rep(i, h) rep(j, w) cin >> s[i][j];
    cy--, cx--, dy--, dx--;

    vector<vector<int>> d(h, vector<int>(w, INF));
    d[cy][cx] = 0;

    priority_queue<T> q;
    q.push({0, cy, cx});

    while (!q.empty()) {
        Loc loc = Loc(q.top());
        q.pop();
        if (loc.dyx > d[loc.y][loc.x]) continue;

        for (int i = -2; i <= 2; i++) {
            int y = loc.y + i;
            if (y < 0 || y >= h) continue;

            for (int j = -2; j <= 2; j++) {
                int x = loc.x + j;
                if (x < 0 || x >= w) continue;
                if (s[y][x] == '#') continue;

                int dt = d[loc.y][loc.x] + (abs(i) + abs(j) > 1 ? 1 : 0);
                if (dt < d[y][x]) {
                    d[y][x] = dt;
                    q.push({-dt, y, x});
                }
            }
        }
    }

    cout << (d[dy][dx] != INF ? d[dy][dx] : -1) << endl;
    return 0;
}


Measured memory_bytes: 8632
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll N,Q;
    cin >> N >> Q;
    string S;
    cin >> S;
    vector<ll> sum(N+1);
    sum[0] = 0;
    sum[1] = 0;
    sum[2] = (S[0] == 'A' && S[1] == 'C') ? 1 : 0;
    for (int i = 3; i <= N; ++i) {
        sum[i] = sum[i-1] + ((S[i-2] == 'A' && S[i-1] == 'C') ? 1 : 0);
    }
    for (int j = 0; j < Q; ++j) {
        ll l,r;
        cin >> l >> r;
        cout << sum[r]-sum[l] << endl;
    }
}


Measured memory_bytes: 1792
#D
import sys
input=sys.stdin.readline
class SegmentTree():
    def __init__(self,param,default,func):
        if isinstance(param,list):
            n=len(param)
        else:
            n=param
        self.d=default
        self.leaf=1<<(n-1).bit_length()
        if isinstance(param,list):
            self.tree=[default]*(self.leaf-1)+param+[default]*(self.leaf-n)
            for i in range(self.leaf-2,-1,-1):
                self.tree[i]=func(self.tree[i*2+1],self.tree[i*2+2])
        else:
            self.tree=[default]*(self.leaf*2-1)
        self.f=func
    def find(self,i):
        return self.tree[i+self.leaf-1]
    def update(self,idx,a):
        idx+=self.leaf-1
        self.tree[idx]=a
        while idx:
            idx=(idx-1)>>1
            self.tree[idx]=self.merge(self.tree[idx*2+1],self.tree[idx*2+2])
    def merge(self,a,b):
        return self.f(a,b)
    def get_top(self):
        return self.tree[0]
    def query(self,a,b): #[a,b)
        T=self.tree
        l,r=a+self.leaf-1,b+self.leaf-1
        res=self.d
        while l<r:
            if not l%2:
                res=self.merge(res,T[l])
                l+=1
            if not r%2:
                r-=1
                res=self.merge(res,T[r])
            l>>=1; r>>=1
        return res

def main():
    n,m=map(int,input().split())
    LRC=[list(map(int,input().split())) for _ in range(m)]
    LRC.sort()
    #print(LRC)
    seg=SegmentTree(n+1,float('inf'),min)
    seg.update(1,0)
    for l,r,c in LRC:
        a=seg.query(l,r)
        b=seg.find(r)
        k=min(a+c,b)
        seg.update(r,k)
    print(-1 if seg.find(n)==float('inf') else seg.find(n))

if __name__=='__main__':
    main()

Measured memory_bytes: 141400
import itertools


def checkArrays(arr1, arr2):
    if len(arr1) != len(arr2):
        return False

    for i in range(len(arr1)):
        if arr1[i] != arr2[i]:
            return False

    return True


n = int(input())

arrays = list(itertools.permutations([i for i in range(1, n + 1)]))

p = list(map(int, input().split()))
q = list(map(int, input().split()))

a = b = 1
for i in range(len(arrays)):
    ar = list(arrays[i])
    if checkArrays(ar, p):
        a = i + 1
    if checkArrays(ar, q):
        b = i + 1

print(abs(a - b))



Measured memory_bytes: 8052
#include<bits/stdc++.h>
#define pb push_back
#define pii pair<int,int>
#define crp make_pair
using namespace std;
const int N=4050,inf=1e8;
int n,rt,ans=inf,tot,nas;
char s[N];
vector<int> e[N];
int det[N],cnt[N],low[N],hig[N];
pii h[N];
void dfs(int x,int nf)
{
	int i,vsi,v,pos,bmx,val;
	det[x]=det[nf]+1;
	cnt[x]=(s[x]=='1');
	if(s[x]=='1') nas+=det[x]-1;
	vsi=e[x].size();
	for(i=0;i<vsi;i++)
	{
		v=e[x][i];
		if(v==nf) continue; 
		dfs(v,x);
		cnt[x]+=cnt[v];
	}
	tot=0;pos=0;
	low[x]=0;hig[x]=0;
	for(i=0;i<vsi;i++)
	{
		v=e[x][i];
		if(v==nf) continue;
		h[++tot]=crp(low[v]+cnt[v],hig[v]+cnt[v]);
		low[x]+=h[tot].first;hig[x]+=h[tot].second;
		if(pos==0||h[tot].second>h[pos].second) pos=tot;
	}
	if(tot>1)
	{
		low[x]%=2;
		bmx=0;
		for(i=1;i<=tot;i++)
		{
			if(i!=pos) bmx=max(bmx,h[i].second);
		}
		if(bmx<h[pos].first) bmx=h[pos].first;
		val=bmx*2;
		//printf("bmx%d\n",bmx);
		for(i=1;i<=tot;i++)
		{
			val-=min(h[i].second,bmx);
		}
		low[x]=max(low[x],val);
	}
	//printf("x%d C%d P%d %d\n",x,cnt[x],low[x],hig[x]);
}
int main()
{
	int i,x,y;
	scanf("%d",&n);
	scanf("%s",s+1);
	for(i=1;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		e[x].pb(y);e[y].pb(x);
	}
	//puts("OK");
	for(rt=1;rt<=n;rt++)
	{
		nas=0;
		dfs(rt,0);
		//printf("#%d %d\n",rt,low[rt]);
		if(low[rt]==0) ans=min(ans,nas>>1);
		//exit(0);
	}
	if(ans==inf) puts("-1");
	else printf("%d",ans);
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

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

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int a, b;
    cin >> a >> b;

    cout << a * b << "\n";

    return 0;
}



Measured memory_bytes: 3608
#include <stdio.h>

#define N 10

int main(void)
{
    int i,j;
    int l[N];
    int tmp;
    for(i=0;i<N;i++){
        scanf("%d",&(l[i]));
    }
    for(i=0;i<N-1;i++){
        for(j=i+1;j<N;j++){
            if(l[j]>l[i]){
                tmp=l[j];
                l[j]=l[i];
                l[i]=tmp;
            }
        }
    }
    for(i=0;i<3;i++){
        printf("%d\n",l[i]);
    }
    return 0;
}
     

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

#define sswap(x, y) { x+=y; y=x-y; x-=y; }
#define LSOne(S) ((S) & (-S))

#define EPS 1e-6
#define MOD 1000000007

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;

int d[10];

int valid(int n) {
	int p = 1;
	while (p <= n) {
		if (d[(n%(p*10))/p]) return 0;
		p *= 10;
	}
	return 1;
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
	
	int n, k;
	mset(d, 0);
	cin >> n >> k;
	for (int i = 0; i < k; i++) {
		int e; cin >> e;
		d[e] = 1;
	}
	for (int m = n; m < 10*n; m++)
		if (valid(m)) {
			cout << m << ende;
			break;
		}
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  char S;
  string type;
  
  type = "Three";
  
  for (int i = 0; i < N; i++) {
    cin >> S;
    if (S == 'Y') {
      type = "Four";
      break;
    }  
  }
  
  cout << type <<endl;
  
}

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

int main() {
  string abcd;
  cin >> abcd;
  for (int bit = 0; bit < (1 << 3); bit++) {
    int sum = abcd[0] - '0';
    for (int i = 0; i < 3; i++) {
      if (bit & (1 << i)) {
        sum += abcd[i + 1] - '0';
      }
      else {
        sum -= abcd[i + 1] - '0';
      }
    }
    if (sum == 7) {
      cout << abcd[0];
      for (int i = 0; i < 3; i++) {
        if (bit & (1 << i)) {
          cout << "+";
        }
        else {
          cout << "-";
        }
        cout << abcd[i + 1];
      }
      cout << "=7" << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 3628
use std::cmp;
use std::io::{self, Read};

fn main() {
    let stdin = io::stdin();
    let mut sc = Scanner::new(stdin.lock());

    let r: i32 = sc.read().unwrap();
    let d: i32 = sc.read().unwrap();
    let mut x: i32 = sc.read().unwrap();

    for _ in (0..10) {
        x = r * x - d;
        println!("{}", x);
    }
}

struct Scanner<R: Read> {
    reader: R,
}

impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn read<T: std::str::FromStr>(&mut self) -> Option<T> {
        self.reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse()
            .ok()
    }

    fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Option<Vec<T>> {
        (0..n).map(|_| self.read()).collect()
    }

    fn read_vec2d<T: std::str::FromStr>(&mut self, m: usize, n: usize) -> Option<Vec<Vec<T>>> {
        (0..m).map(|_| self.read_vec(n)).collect()
    }
}


Measured memory_bytes: 4352
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  int n;
  string s;
  cin >> n>>s;
  
  int red = 0;
  rep(i,n){
    if(s[i]=='R')red++;
  }
  
  cout << (red>n-red?"Yes":"No") << endl;
  
}


Measured memory_bytes: 256
S = input()
N = len(S)
ans = [1] * N

for i, s in enumerate(S):
  if s == "R":
    if S[i+1] == "R":
      ans[i+2] += ans[i]
      ans[i] = 0

for i in range(N-1, -1, -1):
  if S[i] == "L":
    if S[i-1] == "L":
      ans[i-2] += ans[i]
      ans[i] = 0

print(" ".join(map(str, ans)))


Measured memory_bytes: 10484
object Main {

  def calc(a: Int, b: Int, c: Int, d: Int): Boolean = {
    math.abs(a - c) <= d || math.abs(a - b) <= d && math.abs(b - c) <= d
  }

  def main(args: Array[String]): Unit = {
    val in = io.Source.fromInputStream(System.in).getLines()
    val Array(a, b, c, d) = in.next().split(' ') map (_.toInt)
    System.out.println(if (calc(a, b, c, d)) "Yes" else "No")
  }
}

Measured memory_bytes: 25540
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main()
{
  ifstream fIn("input.txt");
  if (fIn.is_open())
    cin.rdbuf(fIn.rdbuf());

  int x, a;
  cin >> x >> a;
  if(x < a){
    cout << 0 << endl;
  }else{
    cout << 10 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a =sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int flag=0;
        while(a>0 && c>0) {
        	if(flag==0) {
        		c=c-b;
        		flag=1;
        	}
        	else if(flag==1) {
        		a=a-d;
        		flag=0;
        	}
        }
        if(a<=0)
        	System.out.println("No");
        else
        	System.out.println("Yes");
    }
}

Measured memory_bytes: 35832
import itertools
n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
c = []
for i in range(n):
    c.append(i+1)
l = []
for x in itertools.permutations(c,n):
    l.append(list(x))
l.sort()
p0 = 0
q0 = 0
for i in range(len(l)):
    if l[i] == p:
        p0 = i
    if l[i] == q:
        q0 = i
print(abs(p0-q0))

Measured memory_bytes: 10228
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  while (true) {
    int a, b; char c; cin >> a >> c >> b;
    if (c == '?') break;
    if (c == '+') cout << a+b << endl;
    if (c == '-') cout << a-b << endl;
    if (c == '*') cout << a*b << endl;
    if (c == '/') cout << a/b << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
n = gets.chomp.to_i
as = Array.new(n)
n.times do |i|
  as[i] = []
  a = gets.chomp.to_i
  a.times do
    xy = gets.split.map(&:to_i)
    xy[0] -= 1
    xy[1] = xy[1] == 1
    as[i] << xy
  end
end

solve = ->i,s {
  if i == n
    s.each.with_index.select(&:first).each do |_, j|
      return 0 if as[j].any? { |k, b| s[k] != b }
    end.length
  else
    s[i] = true
    r1 = solve.(i+1, s)
    s[i] = false
    r2 = solve.(i+1, s)
    r1 > r2 ? r1 : r2
  end
}

puts solve.(0, Array.new(n))

Measured memory_bytes: 1916
format = ['YYMM', 'MMYY', 'AMBIGUOUS', 'NA']
s = input()
ft,bk = s[0:2],s[2:4]
if 1 <= int(ft) <= 12:
    if 1 <= int(bk) <= 12:
        print(format[2])
    else:
        print(format[1])
else:
    if 1 <= int(bk) <= 12:
        print(format[0])
    else:
        print(format[3])

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <set>
using namespace std;
#pragma warning (disable: 4996)

long long N, L[1 << 18], R[1 << 18];

// 傾きがある点をすべて入れる
multiset<long long> cl, cr;
long long offset_l, offset_r, Answer;

int main() {
	scanf("%lld", &N);
	for (int i = 1; i <= N; i++) scanf("%lld%lld", &L[i], &R[i]);

	cl.insert(L[1]);
	cr.insert(L[1]);

	for (int i = 2; i <= N; i++) {
		offset_l += (R[i] - L[i]);
		offset_r += (R[i - 1] - L[i - 1]);

		auto itr1 = cl.end(); itr1--;
		auto itr2 = cr.begin();
		long long el = (*itr1) - offset_l, er = (*itr2) + offset_r;
		if (el <= L[i] && L[i] <= er) {
			cl.insert(L[i] + offset_l);
			cr.insert(L[i] - offset_r);
		}
		else if (L[i] < el) {
			Answer += (el - L[i]);
			cl.erase(itr1);
			cr.insert(el - offset_r);
			cl.insert(L[i] + offset_l);
			cl.insert(L[i] + offset_l);
		}
		else if (L[i] > er) {
			Answer += (L[i] - er);
			cr.erase(itr2);
			cl.insert(er + offset_l);
			cr.insert(L[i] - offset_r);
			cr.insert(L[i] - offset_r);
		}
	}

	cout << Answer << endl;
	return 0;
}

Measured memory_bytes: 12416
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    double r, ans, pi = 3.141592;
    cin >> r;
    ans = 2 * pi * r;
    out(ans);
}

Measured memory_bytes: 3780
#include <cstdio>

int main()
{
	int i, num, max = 0, ans = 0;
	for (i = 0; i < 3; i++) {
		std::scanf("%d", &num);
		if (num > max)
			max = num;
		ans += num;
	}
	std::printf("%d\n", ans + 9 * max);

	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = 1LL << 60;
typedef pair<int, int> P;
int mark[1000][1000];
vector<P> G[1000][1000];
int A[1000][1000];
int dp[1000][1000];
bool is_DAG(int a, int b) {
	mark[a][b] = 1;
	for (P to : G[a][b]) {
		int c = to.first, d = to.second;
		if (mark[c][d] == 1) return 0;
		if (mark[c][d] == 0) {
			if (!is_DAG(c, d)) return 0;
		}
	}
	mark[a][b] = 2;
	return 1;
}
int calc(int a, int b) {
	if (dp[a][b] != -1) return dp[a][b];
	dp[a][b] = 1;
	for (P to : G[a][b]) {
		int c = to.first, d = to.second;
		dp[a][b] = max(dp[a][b], calc(c, d) + 1);
	}
	return dp[a][b];
}
int main() {
	ll N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N - 1; j++) cin >> A[i][j];
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j + 1 < N - 1; j++) {
			int a = i, b = A[i][j] - 1;
			int c = i, d = A[i][j + 1] - 1;
			if (a > b) swap(a, b);
			if (c > d) swap(c, d);
			G[a][b].emplace_back(c, d);
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			if (mark[i][j] == 0) {
				if (!is_DAG(i, j)) {
					cout << -1 << endl;
					return 0;
				}
			}
		}
	}
	memset(dp, -1, sizeof(dp));
	int ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			ans = max(ans, calc(i, j));
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 51072
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split(' ').Select(int.Parse);
        var b = Console.ReadLine().Split(' ').Select(int.Parse);
        var c = Console.ReadLine().Split(' ').Select(int.Parse);

        var answer = 0;
        var pre = -1;

        foreach(var aa in a)
        {
            answer += b.ElementAt(aa - 1);
            if (aa - pre == 1) answer += c.ElementAt(aa - 1 - 1);
            pre = aa;
        }

        Console.WriteLine(answer);
    }
}

Measured memory_bytes: 11220
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    string s,ans="";
    cin>>s;
    rep(i,s.size()){
        if(s[i]=='0') ans+="0";
        else if(s[i]=='1') ans+="1";
        else{
            if(ans.size()==0) continue;
            else{
                ans.erase(ans.begin()+ans.size()-1);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, n) for (int i = 0; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

struct P {
    int index;
    int count;

    bool operator<(const P &another) const {
        if (count == another.count)
            return index < another.index;
        else
            return count > another.count;
    };
};

int main() {
    int N;
    cin >> N;
    vector<int> v(N);
    vector<P> left(100000,{0,0});
    vector<P> right(100000,{0,0});

    rep(i, N) {
        cin >> v[i];
    }

    rep(i, N) {
        int V = v[i];
        if (i % 2 == 0) {
            left[V].index = V;
            left[V].count++;
        } else {
            right[V].index = V;
            right[V].count++;
        }
    }
    sort(all(left));
    sort(all(right));

    if (left[0].index == right[0].index) {
        int mn1 = N - left[0].count - right[1].count;
        int mn2 = N - left[1].count - right[0].count;
        cout << min(mn1, mn2) << endl;
    } else {
        cout << N - left[0].count - right[0].count << endl;
    }
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll LINF = LLONG_MAX;
const int INF = INT_MAX;
const double PI=acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	ll n; ll k; cin>>n>>k;
	vector<ll> a(n);
	rep(i,0,n) cin>>a[i];

	rep(i,k,n){
		if(a[i-k]<a[i]){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}
}

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

namespace ConsoleApp15
{
    class Class394
    {
        static void Main()
        {
            var NM = Console.ReadLine().Split().Select(int.Parse).ToArray();
            long N = NM[0];int M = NM[1];

            var ans = new long[M];
            ans[M - 1] = N*(N-1)/2;
            var union = new Union_Find((int)N);
            var ab = new int[M][];
            for (int i = 0; i < M; i++)
            {
                ab[i] = Console.ReadLine().Split().Select(_=>int.Parse(_)-1).ToArray();
            }
            for (int i = M - 1; i >= 1; i--)
            {

                if (!union.IsSameGroup(ab[i][0], ab[i][1]))
                {
                    ans[i - 1] = ans[i] - union.getMem(ab[i][0]) * union.getMem(ab[i][1]);
                }
                else
                {
                    ans[i - 1] = ans[i];
                    continue;
                }
                union.Unite(ab[i][0], ab[i][1]);

            }
            foreach (var item in ans)
            {
                Console.WriteLine(item);
            }
        }
    }

    public class Union_Find
    {
        private int[] data;
        public Union_Find(int size)
        {
            data = new int[size];
            for (int i = 0; i < size; i++) data[i] = -1;
        }
        public bool Unite(int x, int y)
        {
            x = Root(x);
            y = Root(y);
            if (x != y)
            {
                if (data[y] < data[x])
                {
                    var tmp = y;
                    y = x;
                    x = tmp;
                }
                data[x] += data[y];
                data[y] = x;
            }
            return x != y;
        }
        public bool IsSameGroup(int x, int y) => Root(x) == Root(y);
        public int Root(int x) => data[x] < 0 ? x : data[x] = Root(data[x]);
        public long getMem(int x) => -data[Root(x)];
    }   
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  double t, x;
  cin >> t >> x;
  printf("%.4f\n", t / x);
}

int main()
{
  fastio;
  solve();

  return 0;
}

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

int main(){
	int n; cin >> n;
	multiset<ll> s;
	for(int i = 0; i < n; ++i){
		ll d; cin >> d;
		s.insert(d);
	}
	int m; cin >> m;
	for(int i = 0; i < m; ++i){
		ll t; cin >> t;
		auto ite = s.find(t);
		if(ite  != s.end()){
			s.erase(ite);
		}else{
			cout << "NO\n";
			return 0;
		}
	}
	cout << "YES\n";
	return 0;
}

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

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

	int n;
	n = S.size();
	char c = S[n-1];

	if (c == 's') {
		S.push_back('e');
		S.push_back('s');
	}
	else {
		S.push_back('s');
	}
	cout << S << endl;
}


Measured memory_bytes: 3636
import sys
sys.setrecursionlimit(2000)

D, goal = map(int, input().split())
q_num, bonus = [], []
for i in range(1,D+1):
  q, b = map(int, input().split())
  q_num.append(q)
  bonus.append(b)
ans = 100000

def rec2(current_qn, next_n, current_score, tyuuto_done):
  if next_n == D + 1:
    global ans
    if current_score >= goal:
      ans = min(ans, current_qn)
  else:
    rec2(current_qn+q_num[next_n-1], next_n+1, current_score+q_num[next_n-1]*next_n*100+bonus[next_n-1], tyuuto_done)
    rec2(current_qn, next_n+1, current_score, tyuuto_done)
    if not tyuuto_done:
      for i in range(1,q_num[next_n-1]):
        rec2(current_qn+i, next_n+1, current_score+i*next_n*100, 1)

def rec(comb, next_n, current_score):
  if next_n == D + 1:
    global ans
    if current_score >= goal:
      ans = min(ans, sum(comb))
  else:
    for i in range(q_num[next_n-1]):
      rec(comb + [i], next_n+1, current_score + i * next_n * 100)
    rec(comb + [q_num[next_n-1]], next_n+1, current_score + q_num[next_n-1] * next_n * 100 + bonus[next_n-1])

# rec([], 1, 0)
rec2(0, 1, 0, 0)

print(ans)

Measured memory_bytes: 3192
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <set>
using namespace std;

int main(){
    while(true){
        int m,f,r;
        cin>>m>>f>>r;
        if(m==-1&&f==-1&&r==-1)break;
        if(m==-1||f==-1){
            cout<<"F"<<endl;
            continue;
        }
        if(m+f<30){
            cout<<"F"<<endl;
            continue;
        }
        if(m+f>=80){
            cout<<"A"<<endl;
            continue;
        }
        if(m+f>=65){
            cout<<"B"<<endl;
            continue;
        }
        if(m+f>=50){
            cout<<"C"<<endl;
            continue;
        }
        if(r>=50){
            cout<<"C"<<endl;
            continue;
        }
        else{
            cout<<"D"<<endl;
            continue;
        }
    }
    return 0;
}


Measured memory_bytes: 3048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define all(v) v.begin(), v.end()

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

ll powm(ll a,ll n, ll m){
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=(ret*a)%m;
    }
    n>>=1;
    a=(a*a)%m;
  }
  return ret;
}

const string yesno(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int n;cin>>n;
  n%=10;
  string ans;
  if(n==3){
    ans="bon";
  }else if(n==2||n==4||n==5||n==7||n==9){
    ans="hon";
  }else{
    ans="pon";
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define debug(x1) cout<<#x1<<": "<<x1<<endl
#define debug2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl

signed main(){
    int n; cin >> n;
    vector<int> a(n),b(n+1,0);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        b[a[i]]++;
    }
    int cnt = 0;
    for(int i = 1; i < n+1; i++) {
        if(b[i]>0) cnt += b[i]*(b[i]-1)/2;
    }
    for(int i = 0; i < n; i++) {
        if(b[a[i]]>1) cout << cnt - b[a[i]]*(b[a[i]]-1)/2 + (b[a[i]]-1)*(b[a[i]]-2)/2  << endl;
        else cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 6400
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <numeric>
#define REP(i,n) for(int i = 0; i < (int)n; i++)
using namespace std;
 
struct edge{
  int to;
  long dist;
};
 
int main(){
  int n;
  cin >> n;
  vector<edge> connected[n];
  REP(i,n-1){
    long a,b,c;
    cin >> a >> b >> c;
    connected[a-1].push_back({b-1,c});
    connected[b-1].push_back({a-1,c});
  }
  int q,k;
  cin >> q >> k;
  long long distance[n] = {};
  queue<int> wait;
  wait.push(k-1);
  while(wait.size()>0){
    int node = wait.front();
    wait.pop();
    for(edge e : connected[node]){
      if(distance[e.to]==0){
        distance[e.to]=distance[node]+e.dist;
        wait.push(e.to);
      }
    }
  }
  REP(i,q){
    int x,y;
    cin >> x >> y;
    cout << distance[x-1]+distance[y-1] << endl;
  }
  return 0;
}

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

int main(int argc, char const *argv[])
{
	string s;
	cin>>s;
	sort(s.begin(), s.end());
	if (s.at(0)==s.at(1)&&s.at(1)!=s.at(2)&&s.at(2)==s.at(3))
	{
		cout<<"Yes\n";
	}
	else
	{
		cout<<"No\n";
	}
	return 0;
}


Measured memory_bytes: 256
import numpy as np
import sys
sys.setrecursionlimit(100000)


def acinput():
    return list(map(int, input().split(" ")))

N,K=acinput()
R,S,P=acinput()
T=list(input())

score={}
score["r"]=R
score["s"]=S
score["p"]=P
op={}
op["r"]="p"
op["s"]="r"
op["p"]="s"

hand=[-1]*N
res=0

#print(score)
#print(op)
for i in range(len(T)):
    if i>=K:
        if hand[i-K]!=op[T[i]]:
            res+=score[op[T[i]]]
            hand[i] = op[T[i]]
    else:
        res += score[op[T[i]]]
        hand[i]=op[T[i]]

print(res)

Measured memory_bytes: 21400
import java.util.Scanner;

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

        int n= in.nextInt();

        double odds=(n%2==0)?n/2:(n/2+1);
        double evens=n-odds;
        double ans= odds/n;
        System.out.println(ans);


    }
}


Measured memory_bytes: 23764
#include <stdio.h>
#include<vector>
#include<deque>
using namespace std;
#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)
inline void reader(int& x) { int k, m = 0; x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; x = x * 10 + k - '0'; }if (m) x = -x; }
inline void writer(int x, char c) { int s = 0, m = 0; char f[6]; if (x<0)m = 1, x = -x; while (x)f[s++] = x % 10, x /= 10; if (!s)f[s++] = 0; if (m)mypc('-'); while (s--)mypc(f[s] + '0'); mypc(c); }
inline void writerLn(int x) { writer(x, '\n'); }
#define rep(i,n)for(int i=0;i<n;i++)
vector<int>E[100000];
int u[200000], v[200000], r[200000], ans[200000], d[100000], cnt = 1;
char b[200000], ok[100000];
deque<int>que;

void bfs(int u, char t) {
	que.emplace_back(u);
	while (!que.empty()) {
		int p = que.front(); que.pop_front();
		for (int v : E[p]) {
			if (t) {
				if (d[v] > d[p] && !ok[v]) {
					ok[v] = 1; cnt++; que.emplace_back(v);
				}
			}
			else if (!d[v]) {
				d[v] = d[p] + 1; que.emplace_back(v);
			}
		}
	}
}
int main() {
	ok[0] = d[0] = 1;
	int n, m, q; reader(n); reader(m); reader(q);
	rep(i, m) {
		reader(u[i]); reader(v[i]);
		u[i]--; v[i]--;
		E[u[i]].emplace_back(v[i]); E[v[i]].emplace_back(u[i]);
	}
	bfs(0, 0);
	rep(i, m) {
		if (d[u[i]] > d[v[i]])swap(u[i], v[i]);
	}
	rep(i, n)E[i].clear();
	rep(i, q) {
		reader(r[i]); r[i]--;
		b[r[i]] = 1;
	}
	rep(i, m) {
		if (!b[i]) {
			if (d[v[i]] > d[u[i]]) {
				E[u[i]].emplace_back(v[i]);
			}
		}
	}
	bfs(0, 1);
	for (int i = q - 1; i >= 0; i--) {
		ans[i] = n - cnt;
		if (d[v[r[i]]] > d[u[r[i]]] && !ok[v[r[i]]]) {
			E[u[r[i]]].emplace_back(v[r[i]]);
			if (ok[u[r[i]]]) {
				cnt++; ok[v[r[i]]] = 1;
				bfs(v[r[i]], 1);
			}
		}
	}
	rep(i, q)writerLn(ans[i]);
}

Measured memory_bytes: 12988
#include <stdio.h>
#define MAX 500000
#define SENTINEL 2000000000

struct Card{
	char suit;
	int value;
};

struct Card L[MAX/2+2],R[MAX/2+2];

void merge(struct Card A[],int left,int mid,int right){
	int n1=mid-left;
	int n2=right-mid;
	for(int i=0;i<n1;i++) L[i]=A[left+i];
	for(int i=0;i<n2;i++) R[i]=A[mid+i];
	L[n1].value=R[n2].value=SENTINEL;
	int i=0,j=0;
	for(int k=left;k<right;k++){
		if(L[i].value<=R[j].value) A[k]=L[i++];
		else A[k]=R[j++];
	}
}

void mergesort(struct Card A[],int left,int right){
	if(left+1<right){
		int mid=(left+right)/2;
		mergesort(A,left,mid);
		mergesort(A,mid,right);
		merge(A,left,mid,right);
	}
}

int Partition(struct Card A[],int p,int r){
	int i=p-1,j;
	struct Card t,x=A[r];
	
	for(j=p;j<r;j++){
		if(A[j].value<=x.value){
			t=A[++i]; A[i]=A[j]; A[j]=t;
		}
	}
	
	t=A[++i]; A[i]=A[r]; A[r]=t;
	
	return i; 
}

void quickSort(struct Card A[],int p,int r){
	int q;
	if(p<r){
		q=Partition(A,p,r);
		quickSort(A,p,q-1);
		quickSort(A,q+1,r);
	}
}

int main(){
	int n,v;
	struct Card A[MAX],B[MAX];
	char S[10];
	int stable=1;
	
	scanf("%d",&n);
	
	for(int i=0;i<n;i++){
		scanf("%s %d",S,&v);
		A[i].suit=B[i].suit=S[0];
		A[i].value=B[i].value=v;
	}
	
	mergesort(A,0,n);
	quickSort(B,0,n-1);
	
	for(int i=0;i<n;i++) if(A[i].suit!=B[i].suit) stable=0;
	
	if(stable) printf("Stable\n");
	else printf("Not stable\n");
	for(int i=0;i<n;i++) printf("%c %d\n",B[i].suit,B[i].value);
	
	return 0;
}



Measured memory_bytes: 4960
#include <cstdio>
#include <stack>
#include <cmath>
using namespace std;
int main()
{
	int q;
	stack<double> x;
	while (scanf("%d", &q))
	{
		if (q == -1) break;
		x.push((double)q/2);
		while (abs(x.top()*x.top()*x.top() - q) >= 0.00001*(double)q)
			x.push(x.top() - (x.top()*x.top()*x.top() - q)/(3*x.top()*x.top()));
		printf("%.6f\n", x.top());
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    if(n>m)
    {
        int i=0;
        while(i!=n)
        {
            cout<<m;
            i++;
        }
    }
    else if(m>n)
    {
        int i=0;
        while(i!=m)
        {
            cout<<n;
            i++;
        }
    }
    else
    {
        int i=0;
        while(i!=n)
        {
            cout<<n;
            i++;
        }
    }
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var N int
	scanner.Scan()
	fmt.Sscanf(scanner.Text(), "%d", &N)

	sum := 0
	for _, d := range digits(N) {
		sum = sum + d
	}
	if N%sum == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}

func digits(n int) []int {
	ret := make([]int, 0)
	for n > 0 {
		ret = append(ret, n%10)
		n = n / 10
	}
	return ret
}


Measured memory_bytes: 640
import math
a, b, h, m = map(int, input().split())

C = min(abs((h * 60 + m) * 0.5 - m * 6), 360 - abs((h * 60 + m) * 0.5 - m * 6))

c = math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(math.radians(C)))

print(c)

Measured memory_bytes: 9496
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
int getDigit(int n);            // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// class
// ------------------------------------------------
class Combi
{
  public:
    Combi();
    long long Combination(long long n, long long k);
  private:
    vector<vector<long long>> memo;
    long long n_num;
    long long k_num;
    void Resize(long long n, long long k);
};

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<long> vll;
// code
// ------------------------------------------------
int main() {

  ll n;
  cin >> n;
  ll ans = n % 10;

  switch (ans)
  {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
      cout << "hon" << endl;
      break;
    case 0:
    case 1:
    case 6:
    case 8:
     cout << "pon" << endl;
     break;
    case 3:
      cout << "bon" << endl;
      break;
     
  }




  return 0;
}
// funcの実体
// ------------------------------------------------
int getDigit(int n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 1)
      break;
    i++;
  }
  return i;
}
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Combi::Combi(){
  n_num = -1;
  k_num = -1;
};
ll Combi::Combination(ll n, ll k)
{
  Resize(n,k);

  ll ret;
  if(memo[n][k] != 0)
  {
    ret = memo[n][k];
  }
  else if(n == k || k == 0)
  {
    memo[n][k] = 1;
    ret = 1;
  }
  else
  {
    ret = Combination(n - 1, k - 1) + Combination(n - 1, k);
    memo[n][k] = ret;
  }
  return ret;
}

void Combi::Resize(ll n, ll k)
{
  if(n_num <= n || k_num <= k)
  {
    n_num = (n + 1) * 2;
    k_num = (k + 1) * 2;
    memo.resize(n_num);
    for(auto itr = memo.begin(); itr != memo.end(); ++itr)
    {
      itr->resize(k_num);
    }
  }
}

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

int main() {
	int l;
	int r;
	int d;
	cin>>l>>r>>d;
	int count=0;
	for(int i=l;i<=r;i++)
	{
	    if(i%d==0)
	        count++;
	}
	cout<<count<<endl;
	return 0;
}


Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;
using MIte = multimap<vector<long>, int>::iterator;

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

	int A, B;
	cin >> A >> B;

	int fare = 0;
	if (A >= 13) {
		fare = B;
	}
	else if (A >= 6) {
		fare = B / 2;
	}
	else {
		fare = 0;
	}

	cout << fare << endl;


	return 0;
}

Measured memory_bytes: 256
-- | Main entry point to the application.
module Main where

import Control.Applicative
import Control.Monad
import Data.List
import Debug.Trace
import Text.Printf

rInt :: String -> Int
rInt str = read str :: Int

solve lst = scanl iter lst [0..length lst - 1]

iter lst n =
    insertMiddle x pre ++ post
    where (pre, x:post) = splitAt n lst
    
insertMiddle x ts =
    pre ++ (x:post)
    where (pre,post) = span (< x) ts

-- | The main entry point.
main :: IO ()
main = do
    _ <- getLine
    lst <- (map rInt . words) <$> getLine
    mapM_ (putStrLn . unwords . map show) $ drop 1 $ solve lst

Measured memory_bytes: 4080
from collections import Counter
n = int(input())
alp = "abcdefghijklmnopqrstuvwxyz"
dic = {}
e = set()
for i in range(n):
	s = input()
	c = Counter(list(s))
	d = c.keys()
	e = e & d
	if i == 0:
		for j in c.keys():
			dic[j] = c[j]
			e.add(j)
	else:
		for j in c.keys():
			if j in dic:
				dic[j] = min(dic[j],c[j])
s = ""
sor = sorted(dic)
for i in sor:
	if i in e:
		b = i * dic[i]
		s += b
print (s)

Measured memory_bytes: 3316
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
	long long a,b,c;
	cin>>a>>b>>c;
	int flag=1;
	int cas=0;
	long long sum;
	if(a%2==1||b%2==1||c%2==1){
		flag=0;	
	}
	if(a==b&&b==c&&a==c&&flag==1){
		cas=1;
			sum=-1;
	}
	long long m,n,p;
	m=a/2;
	n=b/2;
	p=c/2;
	if(flag==0&&cas==0)
	sum=0;
	else if(flag==1&&cas==0)
	sum=1;
	while(m%2==0&&n%2==0&&p%2==0&&flag==1&&cas==0){
		int mp,np,pp;
		mp=m;
		np=n;
		pp=p;
		++sum;
		m=np+pp;
		n=mp+pp;
		p=mp+np;
		m=m/2;
		n=n/2;
		p=p/2;
	}
	cout<<sum;
}

Measured memory_bytes: 256