akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > piii;
#define pb push_back
#define debug(x) cout << x << endl
#define fastio ios_base::sync_with_stdio(0), cin.tie(0)
#define PI acos(-1)
#define all(c) c.begin(), c.end()
#define SET(x, y) memset((x), y, sizeof(x))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const LL INF64 = 1e18;

const int N = 1e5 + 5;

LL dp[105][N]; //W, N
LL val[N];
LL weight[N];

LL knapsack(LL n, LL w) {
	for (LL i = 0; i <= n; i++) {
		for (LL j = 0; j <= w; j++) {
			if (i == 0 || j == 0)
				dp[i][j] = 0LL;
			else if (weight[i - 1] <= j)
				dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - weight[i - 1]] + val[i - 1]);
			else dp[i][j] = dp[i - 1][j];
		}
	}
	return dp[n][w];
} 

int main() {
	LL n, w;
	scanf("%lld %lld", &n, &w);
	for (int i = 0; i < n; i++) 
		scanf("%lld %lld", weight + i, val + i);
	printf("%lld\n", knapsack(n, w));
	return 0;
}
		

Measured memory_bytes: 80768
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <sstream> 
#include <cctype>
#include <stack>
#include <queue>
#include <cstring>
#include <map>
#include <list>
#include <cassert>
 
using namespace std; 


int main(){

	int n,m;
	cin>>n>>m;

	set<int> red;
	red.insert(0);

	vector<int> cnt(n,1);

	for(int i=0;i<m;i++){
		int x,y;
		scanf("%d %d",&x,&y);
		x--; y--;

		if(red.find(x)!=red.end()){
			if(cnt[x]==1){
				red.erase(x);
			}
			red.insert(y);
		}

		cnt[x]--;
		cnt[y]++;
	}

	cout<<red.size()<<endl;

}

Measured memory_bytes: 5376
/*-- ILSH  --*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef double ld;

#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < ll > 
#define pii pair< ll, ll > 
#define len length 
#define fi first
#define se second
#define dt cout<<"HEre\n";
#define sz(x) (ll)x.size()
const ll inf=1e18+1e17;
const ll mod = 1e9+7;

ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return (res%mod);}
const int N=2e5+5;
ll check ( ll a, ll n){
	ll res=0;
	while ( n!=0){
		res+=n%a;
		n=n/a;
	}
	return res;
}
void solve(){
	ll n,s;
	cin>>n>>s;
	if ( s>n){
		cout<<-1<<'\n';
		return;
	}
	if ( s==n){
		cout<<n+1<<'\n';
		return;
	}
	for (int i=2;i<=1e6;i++){
		if ( check ( i,n)==s){
			cout<<i<<'\n';
			return;
		}
	}
	
	ll ans=inf;
	ll val=n-s;
	ll sq=sqrt( val);
	for ( int i=1;i<=sq;i++){
		if ( val%i==0){
			if ( check( val/i+1,n)==s)
				ans=min( val/i+1,ans);
		}
	}

	if ( ans==inf)
		cout<<-1<<'\n';
	else
		cout<<ans<<'\n';
	
}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie( NULL);
	cout.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen ("INPUT.txt" , "r" , stdin);
		freopen ("OUTPUT.txt", "w" , stdout);
	#endif
	ll t=1;
	//cin>>t;
	for ( ll i=1;i<=t;i++){
		//cout<<"Case #"<<i<<": ";
    	solve();
    }
    //	cout << clock() / double(CLOCKS_PER_SEC) << endl;
}


Measured memory_bytes: 3664
package main

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

const (
	maxBufsize = 1000000
)

func inputs(lines int) []string {
	var strSlice []string

	rdr := bufio.NewReaderSize(os.Stdin, maxBufsize)

	for i := 0; i < lines; i++ {

		line := ReadLine(rdr)
		strSlice = append(strSlice, line)

	}

	return strSlice
}

// ReadLine is to read long line
func ReadLine(rdr *bufio.Reader) string {
	buf := make([]byte, 0, maxBufsize)
	for {
		l, p, e := rdr.ReadLine()

		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}

	return string(buf)
}

func main() {
	lines := inputs(1)

	pi := 3.14

	R, _ := strconv.Atoi(lines[0])

	fmt.Println(2.0 * float64(R) * pi)
}


Measured memory_bytes: 1828
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
#include<iostream>
#include<cmath>
using namespace std;


int main(){
  int n,m,x;
  cin >>n>>m>>x;
  int a[110];
  for(int i=0;i<m;i++)
  cin >>a[i];

  int cost1=0;
  int cost2=0;

  for(int i=x;i<n;i++){
    for(int j=0;j<m;j++){
      if(i+1==a[j])cost1++;
    }
  }
  for(int i=x-2;i>=0;i--){
    for(int j=0;j<m;j++){
      if(i+1==a[j])cost2++;
    }
  }
  if(cost1<cost2) cout<<cost1<<endl;
  else cout <<cost2<<endl;
}


Measured memory_bytes: 256
def main(N,K):

    if K == 1:
        return int(N[0]) + 9 * (len(N)-1)
    if K == 2:
        if len(N) == 1:
            return 0
        less = (len(N)-1) * (len(N)-2) // 2 * 9 * 9
        mid = (len(N)-1) * 9 * (int(N[0])-1)
        for i in range(1,len(N)):
            if N[i] != "0":
                break
        one = main(N[i:],1)
        return less+mid+one
    if K == 3:
        if len(N) < 3:
            return 0
    less = (len(N)-1) * (len(N)-2) * (len(N)-3) // 6 * 9 * 9 * 9
    mid = (int(N[0])-1) * (len(N)-1) * (len(N)-2) // 2 * 9 * 9
    for i in range(1,len(N)):
        if N[i] != "0":
            break
    one = main(N[i:],2)
    return (less+mid+one)
        
print(main(input(),int(input())))


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

 using namespace std;

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

   if (S.length() == 2) cout << S << endl;
   if (S.length() == 3) cout << S.at(2) << S.at(1) << S.at(0) << endl;
 }


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

typedef long long ll;

ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

ll max(ll a, ll b) { return (a > b) ? a : b; }

ll min(ll a, ll b) { return (a < b) ? a : b; }

ll asc(const void* a, const void* b) { return *(ll*)a - *(ll*)b; }

ll dsc(const void* a, const void* b) { return *(ll*)b - *(ll*)a; }

bool flag;

int main() {
	ll n,ans,res;
	scanf("%lld", &n);
	if (n % 11 == 0) res = 0;
	else if (n % 11 >= 1 && n % 11 <= 6) res = 1;
	else res = 2;
	ans = n / 11 * 2 + res;
	printf("%lld", ans);
	
	return 0;
}

Measured memory_bytes: 2056
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <queue>
#include <map>
#include <set>
using namespace std;
using Int = int64_t;
const Int INF = 1<<30;
const Int MOD = (Int)1e9 + 7;
const Int MAX_N = (Int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

template<typename Type> map<Type, int > prime_factor(Type n)
{
    map<Type, int > res;
    for(Type i = 2; i * i <= n; i++)
    {
        while(n % i == 0)
        {
            res[i]++;
            n /= i;
        }
    }
    if(n != 1) res[n] = 1;
    return res;
}


void solve()
{
    Int N; cin >> N;
    map<Int, int> prime_factors = prime_factor(N);
    set<Int> st;
    for(const auto& prime_factor : prime_factors)
    {
        int num = prime_factor.second;
        Int value = prime_factor.first;
        for(int i = 0; i < num; i++)
        {
            st.insert(value);
            value *= prime_factor.first;
        }
    }
    Int ans = 0;
    for(const auto& x : st)
    {
        if(N % x != 0) continue;
        N /= x;
        if(N == 0) break;
        ans++;
    }
    cout << ans << endl;
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

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

using namespace std;

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

    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int A,B,x,y,z,t;
    while(~scanf("%d %d",&A,&B))
    {
        x=A*B;
        y=A+B;
        z=A-B;
        if(x<y)
            t=y,y=x,x=t;
        if(x<z)
            t=z,z=x,x=t;
        if(y<z)
            t=z,z=y,y=t;
        printf("%d\n",x);
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
 
#define f0r(a, b) for (long long a = 0; a < (b); a++)
#define f1r(a, b, c) for (long long a = (b); a < (c); a++)
#define f0rd(a, b) for (long long a = (b); a >= 0; a--)
#define f1rd(a, b, c) for (long long a = (b); a >= (c); a--)
#define ms(arr, v) memset(arr, v, sizeof(arr))
#define pb push_back
#define mp make_pair
#define f first
#define s second
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vpl = vector<pll>;
 
void fio() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); 
  cout.tie(0);
}
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const long double pi = 3.14159265358979323846;



void solve() {
  ll n, m, cc; cin >> n >> m >> cc;
  char grid[n][m];
  f0r(i, n) {
    string s; cin >> s;
    f0r(j, m) grid[i][j] = s[j];
  }

  ll ans = 0;
  f0r(i, (1 << n)) {
    f0r(j, (1 << m)) {
      bool orv[n], ocv[m];
      f0r(k, n) orv[k] = (i & (1 << k));
      f0r(k, m) ocv[k] = (j & (1 << k));
      ll cn = 0;
      f0r(k, n) f0r(l, m) {
        if (!orv[k] && !ocv[l] && grid[k][l] == '#') ++cn;
      }
      if (cn == cc) ++ans;
    }
  }

  cout << ans << '\n';
}
 
int main() {
  fio();
  
  int T = 1;
  // cin >> T;
  while (T--) solve();
} 

Measured memory_bytes: 3656
#include "bits/stdc++.h"
using namespace std;

//23
typedef long long ll;
			
int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; ++i) cin >> v[i];
	map<int,int> m1;
	map<int,int> m2;
	for (int i = 0; i < n; i += 2) {
		m1[v[i]]++;
	}
	for (int i = 1; i < n; i += 2) {
		m2[v[i]]++;
	}
	set<pair<int,int>> p1;
	set<pair<int,int>> p2;
	for (auto it = m1.begin(); it != m1.end(); ++it) {
		p1.insert({it->second,it->first});
	}
	for (auto it = m2.begin(); it != m2.end(); ++it) {
		p2.insert({it->second,it->first});
	}
	auto it1 = p1.rbegin(); 
	auto it2 = p2.rbegin();
	if (it1->second != it2->second) { 
		//cout << "";
		cout << n - it1->first - it2->first;
	}else {
		if ((int)p1.size() == 1 && (int)p2.size() == 1) {
			cout << n - max(it1->first,it2->first);
		}else if ((int)p1.size() == 1) {
			//cout << "hello";
			++it2;
			cout << n - it1->first - it2->first; 
		}else if ((int)p2.size() == 1) {
			++it1;
			cout << n - it1->first - it2->first;
		}else {
			auto it3 = it1;
			auto it4 = it2;
			++it1;
			++it2;
			cout << n - max(it3->first + it2->first, it1->first + it4->first);
		}	
	}
}


Measured memory_bytes: 13004
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

public class Main {

	private static int[] a;

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int s = Integer.parseInt(br.readLine());
		br.close();

		Set<Integer> aSet = new HashSet<Integer>();
		aSet.add(s);
		a = new int[1000001];
		a[1] = s;
		for (int i = 2; i <=1000000; i++) {
			a[i] = ai(i);
			boolean flg = aSet.add(a[i]);
			if (!flg) {
//				for (int j = 0; j <= i; j++) {
//					System.out.print(a[j] + " ");
//				}
//				System.out.println();
				System.out.println(i);
				break;
			}
		}
	}

	private static int fn (int n) {
		if (n % 2 == 0) {
			return n / 2;
		} else {
			return 3 * n + 1;
		}
	}

	private static int ai (int i) {
		if (i == 1) {
			return a[1];
		} else {
			return fn(ai(i - 1));
		}
	}
}


Measured memory_bytes: 26580
#define ll long long
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define set2d(array, val, m, n) memset(array, val, sizeof(array[0][0]) * m * n);
#include <bits/stdc++.h>
using namespace std;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x %= p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
ll po(ll base, ll powerRaised)
{
    if (powerRaised != 0)
        return (base * po(base, powerRaised - 1));
    else
        return 1;
}
int main()
{
    ll n;
    cin >> n;
    map<string, ll> mpp;
    ll res = INT_MIN;
    for (int i = 0; i < n; i++)
    {
        string c;
        cin >> c;
        mpp[c]++;
        res = max(res, mpp[c]);
    }
    for (auto itr = mpp.begin(); itr != mpp.end(); itr++)
    {
        if (itr->ss == res)
            cout << itr->ff << endl;
    }
    return 0;
}


Measured memory_bytes: 25216
from collections import Counter
N , M = (map(int , input().split()))
A = [list(map(int, input().split())) for i in range(N)]
kaku_list = []
for i in A:
    for j in range(i[0]):
        kaku_list.append(i[j+1])
ct = dict(Counter(kaku_list))
ans = 0
for v in ct.values():
    if N == v:
        ans += 1
print(ans)

Measured memory_bytes: 3316
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int a[1001];
int main()
{
	int n,x;
	cin>>n>>x;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i]; 
	}
	sort(a+1,a+1+n); 
	int sum=0;
	for(int j=1;j<=n;j++)
	{
		if(j==n)
		{
			if(x!=a[j])break;
		}
		if(x<a[j])
		{
		break;
 	    }
		x-=a[j];
		sum++;
	}
	cout<<sum;
	return 0;
} 

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

using namespace std;

int main()
{
	int n,m,c[15][15];
	cin >> n >> m;
	memset(c,0,sizeof(c));
	for (int i = 0; i < 10; ++i)
		for (int j = 0; j < 10; ++j)
			cin >> c[i][j];

	for (int k = 0; k < 10; ++k) {
		for (int i = 0; i < 10; ++i) {
			for (int j = 0; j < 10; ++j) {
				if (i != j && c[i][k] + c[k][j] < c[i][j]) {
					c[i][j] = c[i][k] + c[k][j];
				}
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			int x;
			cin >> x;
			if (x != -1) {
				ans += c[x][1];
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
A = sorted([int(_) for _ in input().split()])
B = sorted([int(_) for _ in input().split()])
C = sorted([int(_) for _ in input().split()])


def f(_A, _B):
    bcnt = [0] * n
    j = 0
    for i in range(n):
        if i > 0: bcnt[i] = bcnt[i - 1]
        while j < n:
            if _B[i] > _A[j]:
                bcnt[i] += 1
                j += 1
            else:
                break
    return bcnt


spam = f(A, B)
for i in range(1, n):
    spam[i] += spam[i - 1]

ham = f(B, C)
ans = 0
for i in range(n):
    if ham[i] <= 0: continue
    ans += spam[ham[i] - 1]
print(ans)

Measured memory_bytes: 23604
protocol InitFromString {
    init?(_ str: String)
}

extension Int: InitFromString {}
extension Int8: InitFromString {}
extension Int16: InitFromString {}
extension Int32: InitFromString {}
extension Int64: InitFromString {}
extension Double: InitFromString {}
extension String: InitFromString {}

func input<T: InitFromString>() -> [T] {
    readLine()!.split(separator: " ").map(String.init).compactMap(T.init)
}

let a: [Double] = input()
let d = a[0]
print(Double.pi * d * 2)


Measured memory_bytes: 8008
#include <iostream>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

#define MAX 100000
typedef long long llong;

int n, k;
llong T[MAX];

int check(llong p){
	int i = 0;
	for (int j = 0; j < k; j++){
		llong s = 0;
		while ( s + T[i] <= p){
			s += T[i];
			i++;
			if (i == n) return n;
		}
	}
	return i;
}

int solve(){
	llong left = 0;
	llong right = 100000 * 10000;
	llong mid;
	while( right - left > 1){
		mid = (left + right) / 2;
		int v = check(mid);
		if (v >= n) right = mid;
		else left = mid;
	}

	return right;
}

int main(){
	cin >> n >> k;
	for (int i=0; i<n; i++) cin >> T[i];
	llong ans = solve();
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1944
n = int(input())
H = list(map(int, input().split()))

ans = 0
curr = 0
for i in range(1, n):
    if H[i] <= H[i - 1]:
        curr += 1
    else:
        ans = max(ans, curr)
        curr = 0
ans = max(ans, curr)
print(ans)


Measured memory_bytes: 14224
#include<bits/stdc++.h>
#define db double
#define ll long long
#define reg register
#define pb(x) push_back(x)
#define fup(i,x,y) for(reg int i=x;i<=y;++i)
#define fdw(i,x,y) for(reg int i=x;i>=y;--i)
using namespace std;
const int N=4010;
int cnt[4][N],n;
ll ans;
char c[N];
inline int read()
{
	int x=0,ff=1;
	char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-') ff=-1;ch=getchar();}
	while(isdigit(ch)) {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*ff;
}
int main()
{
	//freopen("1.in","r",stdin);
	n=read();
	scanf("%s",c+1);
	for(int i=1;i<=n;++i) 
	{
		cnt[1][i]=cnt[1][i-1];
		cnt[2][i]=cnt[2][i-1];
		cnt[3][i]=cnt[3][i-1];
		if(c[i]=='R') cnt[1][i]++;
		else if(c[i]=='G') cnt[2][i]++;
		else if(c[i]=='B') cnt[3][i]++;
	}
	for(int i=1;i<=n;++i)
		for(int j=i+1;j<=n;++j) 
		{
			if(c[i]==c[j]) continue;
			int op;
			if(c[i]!='R'&&c[j]!='R') op=1;
			else if(c[i]!='G'&&c[j]!='G') op=2;
			else if(c[i]!='B'&&c[j]!='B') op=3;
			int p=cnt[op][n]-cnt[op][j];
			if(2*j-i<=n&&((c[2*j-i]=='R'&&op==1)||(c[2*j-i]=='G'&&op==2)||(c[2*j-i]=='B'&&op==3))) p--;
			ans+=(ll)p; 
		}		
	printf("%lld",ans);
	return 0;	
}



Measured memory_bytes: 3872
require 'set'

class Graph
	def initialize
		@nodes = Set.new
		@edges = Set.new
	end

	def add_node(label = nil)
		Node.new(label)
	end

	def add_edge(u, v)
		e = Edge.new(u, v)
		u.outgoings << e
		v.incomings << e
		e
	end
	
	def del_edge(e)
		u, v = e.from, e.to
		u.outgoings.delete(e)
		v.incomings.delete(e)
		e
	end

	class Node
		def initialize(label)
			@label = label
			@outgoings = Set.new
			@incomings = Set.new
		end
		
		def to_s
			@label
		end
		attr_accessor :incomings, :outgoings
		attr_reader :label
	end

	class Edge
		def initialize(u, v)
			@from = u	
			@to = v
		end
		attr_reader :from, :to
	end

	def Graph::get_path_bfs(s, t)
		path_edge = {}
		reached = Set[s]
		queue = [s]
		while !queue.empty? 
			u = queue.shift
			u.outgoings.each{|e|
				v = e.to
				next if reached.include?(v)	
				reached << v
				queue << v
				path_edge[v] = e

				if v == t
					path = []
					while e = path_edge[v]
						path.unshift e
						v = e.from
					end
					return path
				end
			}
		end	
		return nil
	end

	def Graph::get_path_dfs(s, t, reached = Set.new)
		reached << s	
		s.outgoings.each{|e|
			v = e.to
			next if reached.include?(v)
			return [e] if v == t
			
			path = get_path_dfs(v, t, reached) 
			return [e] + path if path
		}
		nil
	end

	def make_layer_graph(s, t) #nodes:copy, edges:alias
		lg = Graph.new
		correspond = {}

		path_edge = {}
		reached = Set[s]
		current_queue = [s]

		correspond[s] = lg.add_node

		while 0
			next_queue = []
			while !current_queue.empty? 
				u = current_queue.shift
				u.outgoings.each{|e|
					v = e.to
					next if reached.include?(v)

					correspond[v] ||= lg.add_node 
					correspond[e] = lg.add_edge(correspond[u], correspond[v])

					next_queue << v unless reached.include?(v)	
				}
			end	

			break if next_queue.empty?
			next_queue.each{|v| reached << v}
			current_queue = next_queue
		end

		nil
	end
end

def get_integers
	gets.split(" ").map(&:to_i)
end

loop {
	n, m = get_integers
	break if n == 0

	g = Graph.new

	indent = -1
	stack = []
	name_to_node = {}
	n.times {
		gets =~ /^(\s*)(\w+)$/
		indent = $1.size
		stack.pop until stack.size <= indent
		v = g.add_node($2)
		g.add_edge(stack.last, v) if stack.size > 0
		stack << v
		name_to_node[v.label] = v
	}

	m.times {
		gets =~ /^(\w+) is \w+ (\w+) of (\w+)\.$/
		u = name_to_node[$1]
		relation = $2
		v = name_to_node[$3]
		
		bool = false
		case relation
		when "descendant"
			bool = Graph::get_path_bfs(v, u)
		when "ancestor"
			bool = Graph::get_path_bfs(u, v)
		when "child"
			bool = !u.incomings.empty? && u.incomings.all?{|e| e.from == v}
		when "parent"
			bool = !v.incomings.empty? && v.incomings.all?{|e| e.from == u}
		when "sibling"
			bool = (!u.incomings.empty? && u.incomings.map(&:from) == v.incomings.map(&:from))
		end
		puts bool ? "True" : "False"
	}

	puts
}

Measured memory_bytes: 8116
import java.util.*;
 
class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] info = new String[n];
 
        for(int i = 0;i < n;i++){
            info[i] = sc.next() + "_" + (1100 - sc.nextInt()) + "_" +(i+1);
        }
        Arrays.sort(info);
        for(int i = 0;i < n;i++){
            String[] s = info[i].split("_");
            System.out.println(s[2]);
        }
    }
}

Measured memory_bytes: 21972
import numba
from numba import njit, b1, i4, i8, f8
import numpy as np  # noqa

N = int(input())
A = np.array([int(x) for x in input().split()], dtype=np.int32)


@njit((i4[:], ), cache=True)
def main(A):
    count = np.zeros(10**6 + 10, np.int32)
    for x in A:
        if count[x] > 1:
            continue
        count[::x] += 1
    ret = 0
    for x in A:
        ret += count[x] == 1
    return ret


print(main(A))


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

using namespace std;

int main()
{
	int N;
	cin >> N;
	if (N % 1000 == 0) {
		cout << 0 << endl;
		return 0;
	}
	cout << 1000 - (N % 1000) << endl;
	return 0;
}


Measured memory_bytes: 3640
def include3(x, i):
	if x % 10 == 3:
		print(' ' + str(i) , end='')
	else:
		x = int(x/10)
		if x:
			include3(x, i)

n = int(input())

for i in range(1, n + 1):
	x = i
	if x % 3 == 0:
		print(' ' + str(i), end='')
	else:
		include3(x, i)

print('')



Measured memory_bytes: 5872
/// Bismillahir Rahmanir Rahim
/* Author: Mohammad Morsalin (aka white_space)
    Dept of ICE, NSTU
*/
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define f0(n) for(int i=0;i<n;i++)
#define ms(x) memset(x,0,sizeof(x))
#define ins insert
#define ALL(v) v.begin(),v.end()
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define PI acos(-1)
#define IOS ios::sync_with_stdio(false);
using namespace std;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
int main()
{
    IOS
    string s,t;
    cin>>s>>t;
    string st=t.substr(0,(int)s.size());
    if(st==s)cout << "Yes\n";
    else cout << "No\n";
    return 0;
}
///Alhamdulillah


Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define mset(a,x) memset(a,x,sizeof(a))
#define FASTIO cin.tie(0),ios::sync_with_stdio(0)

int a, b, c, d, e, f;
double maxd = -1;
int ans1 = 0, ans2 = 0;
int dp[3000][3000];

void dfs(int A, int B) {

    //cout << A << " " << B << endl;
    int tot = A + B;
    if (tot > f) {
        return;
    }
    if (dp[A][B]) return;
    dp[A][B] = 1;

    double noudo = 1.0 * 100 * B / tot;
    if (noudo > maxd) {
        maxd = noudo;
        ans1 = A; ans2 = B;
    }

    dfs(A + 100 * a, B);
    dfs(A + 100 * b, B);
    if (A*e >= 100 * (B + c))
        dfs(A, B + c);
    if (A*e >= 100 * (B + d))
        dfs(A, B + d);

    return;
}

int main() {
    cin >> a >> b >> c >> d >> e >> f;
    mset(dp, 0);
    dfs(0, 0);
    printf("%d %d\n", ans1 + ans2, ans2);

    return 0;
}

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

int main()
{
  int N;
  cin >> N;
  vector<int64_t> L(N);
  for (int i = 0; i < N; i++)
  {
    cin >> L.at(i);
  }
  int ans = 0;
  for (int i = 0; i < N - 2; i++)
  {
    for (int j = i + 1; j < N - 1; j++)
    {
      for (int k = j + 1; k < N; k++)
      {
        if (L[i] != L[j] && L[j] != L[k] && L[k] != L[i])
        {
          if (L[i] + L[j] > L[k] && L[j] + L[k] > L[i] && L[i] + L[k] > L[j])
          {
            ans++;
          }
        }
      }
    }
  }
  cout << ans << endl;
}

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

using namespace std;
const int N = 2500 + 3;
int n, a[N];
bool valid(int i, int j) {
	swap(a[i], a[j]);
	for (int k = 2; k <= n; ++k) {
		if (a[k] < a[k - 1]) {
			swap(a[i], a[j]);
			return false;
		}
	}
	return true;
}
int main() {
#ifndef ONLINE_JUDGE
//	freopen("input.in", "r", stdin);
//	freopen("output.out", "w", stdout);
#endif
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i)
		scanf("%d", a + i);
	for (int i = 1; i <= n; ++i) {
		for (int j = i; j <= n; ++j) {
			if (valid(i, j)) {
				puts("YES");
				return 0;
			}
			
		}
	}
	puts("NO");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
#define MAX 1000000
int p[MAX];
void f(){
	int n=0;
	for(int i=2;i<MAX;i++){
		if(p[i]==0){
			p[i] = ++n;
			for(int j=2;j*i<MAX;j++)
				p[j*i] = -1;
		}
		else p[i] = n;
	}
} 
int main(){
	int n;
	f();
	while(cin>>n){	
		cout<<p[n]<<endl;
	}
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  int ans = 0;
  int step = 0;
  int prev = -1;
  for(int i = 0; i<n; i++) {
    int now;
    cin >> now;
    if(now<=prev) {
      step ++;
    }
    else {
      if(step > ans) {
      ans = step;
      step = 0;
      }
      else {
	step = 0;
      }
    }
    prev = now;
  }
  if(step > ans) {
    ans = step;
  }
  cout << ans  << endl;
  return 0;
}


Measured memory_bytes: 256
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N;
LL C[200000];

LL ans = 1;

void solve(){
    //ランレングス圧縮
    vector<LL> C_pressed;
    C_pressed.push_back(C[0]);
    for(int i=1;i<N;i++){
        if(C[i]!=C[i-1]) C_pressed.push_back(C[i]);
    }
    N = C_pressed.size();
    // for(int i=0;i<N;i++) cout << C_pressed[i] << " ";
    //     cout << endl;

    vector<LL> color_num(200001,0);
    color_num[C_pressed[0]]++;
    vector<LL> dp(N,0);
    dp[0] = 1;
    for(int i=1;i<N;i++){
        dp[i] = (dp[i-1] + color_num[C_pressed[i]])%mod;
        color_num[C_pressed[i]] = dp[i];
    }
    // for(int i=0;i<N;i++) cout << dp[i] << " ";
    // cout << endl;
    ans = dp[N-1];
}
 
int main(){
    cin >> N;
    for(int i=0;i<N;i++) cin >> C[i];
 
    solve();

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

Measured memory_bytes: 6640
#include <stdio.h>

int main()
{
	int A, B, C;
	scanf("%d %d %d", &A, &B, &C);
	if (A >= B && A >= C) printf("%d\n", A * 10 + B + C);
	else if (B >= C && B >= A) printf("%d\n", B * 10 + C + A);
	else  printf("%d\n", C * 10 + A + B);
	fflush(stdout);
	return 0;
}

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

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

    static class Task
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int N = in.nextInt(); // > 0, odd, up to 3000
            double[] p = CPUtils.readDoubleArray(N, in); //head probability

            double[] dp = new double[N + 2];
            // dp[i] = probability of having i heads
            dp[0] = 1;
            for (int coin = 0; coin < N; coin++)
            { // coins
                for (int i = N + 1; i >= 0; i--)
                {
                    if (i - 1 >= 0)
                    {
                        dp[i] = dp[i - 1] * p[coin] + dp[i] * (1 - p[coin]);
                    } else
                    {
                        dp[i] = +dp[i] * (1 - p[coin]);
                    }
                }
            }
            double sum = 0;
            for (int heads = 0; heads <= N; heads++)
            {
                int tails = N - heads;
                if (heads > tails)
                {
                    sum += dp[heads];
                }
            }
            out.print(sum);
        }

    }

    static class CPUtils
    {
        public static double[] readDoubleArray(int size, Scanner in)
        {
            double[] array = new double[size];
            for (int i = 0; i < size; i++)
            {
                array[i] = in.nextDouble();
            }
            return array;
        }

    }
}



Measured memory_bytes: 37724
#![allow(unused_imports)]
use proconio::{input, fastout};
use proconio::marker::*;
use nalgebra::max;

#[fastout]
fn main() {
    input! {
    a: i64,
    b: i64,
    c: i64,
    d: i64
    }
    let ans = max(a * c, max(a * d, max(b * c ,b * d)));
    println!("{}", ans);
}


Measured memory_bytes: 2168
#include <iostream>
#include <string>
#include <cmath> 
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <numeric> 
#include <iomanip>
#include <map> 
#include <stack>
#include <sstream>
#define sz(x) ((int)(x).size())
#define full(a) a.begin(), a.end()
#define FOR(i,a,n) for (int i = a; i < n; i++)
#define IFOR(i,n,a) for (int i = n; i >= a; i--)
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
using namespace std;
const int MAX = 1e6;
long long max(long long a, long long b) { if (a > b)return a; else return b; }
long long min(long long a, long long b) { if (a < b)return a; else return b; }
const int MAXC = 1e5;


  		     	/*ll n, k;
		std::cin >>  n;
		std::vector <int> v(n);
			for (ll i = 0; i < n; i++)
			{
					std::cin >> v[i];
			}
		std::sort(v.begin(), v.end());*/
/*void sortString(string &str)
{
	sort(str.begin(), str.end());
	cout << str;
}*/


int main() {
	
	ios::sync_with_stdio(false);
	cin.tie(0);
	int x, y;
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll ma = max(a * c, b *d);
	ll ma1 = max(b * c, d * a);
	ll m = max(ma, ma1);
	cout << m << endl;
	return 0;

}

	

  



Measured memory_bytes: 3192
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#define endl '\n'
/*
freopen("type.in","r",stdin);
freopen("type.out","w",stdout);
fclose(stdin);
fclose(stdout);
#pragma GCC diagnostic error "-std=c++11"
#pragma GCC optimize(2)
*/
using namespace std;
struct read
{
    inline long long  get()
    {
        register long long  x=0,t=1;
        register char ch=getchar();
        while ((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
        if (ch=='-') {t=-1;ch=getchar();}
        while (ch>='0'&&ch<='9') {x=x*10+ch-48;ch=getchar();}
        return x*t;
    }
    inline char getch()
    {
        register char ch=getchar();
        while (!(('a'<=ch&&ch<='z')||('A'<=ch&&ch<='Z'))) ch=getchar();
        return ch;
    }
    inline operator long long (){return get();}
    inline operator char(){return getch();}
    inline read operator>>(long long  &a){a=get();return *this;}
    inline read operator>>(char &a){a=getch();return *this;}
    inline read operator<<(long long  t){printf("%lld",t);return *this;}
    inline read operator<<(char t){printf("%c",t);return *this;}
};
const long long  N=1e5+100;
long long  a[N],n,b[N];
bool check(int x)
{
    long long  b[N],p[2*N],ans[N],num=0;
    memset(ans,0,sizeof(ans));
    memset(p,0,sizeof(p));
    memset(b,0,sizeof(b));
    for(long long  i=1;i<=n;++i)
        b[i]=b[i-1]+(a[i]>=x?1:-1);
    for(long long  i=1;i<=n;++i)
    {
        long long  l=p[b[i]+n];
        ans[i]=ans[l];
        if(l!=0||b[i]>=0) ans[i]++;
        if(b[i-1]<b[i])
            ans[i]+=i-l-1;
        num+=ans[i];
        p[b[i]+n]=i;
    }
    if (num>=(n*(n+1)/2+1)/2) return true;
    else return false;
}
int main()
{
    read cin,cout;
    cin>>n;
    for(long long  i=1;i<=n;++i)
        b[i]=a[i]=cin;
    sort(b+1,b+1+n);
    long long  l=1,r=n,mid;
    while(l<=r)
    {
        mid=(l+r)>>1;
        if(check(b[mid]))
            l=mid+1;
        else
            r=mid-1;
    }
    cout<<b[r]<<endl;
    return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int c[3][3];
  for(int i=0;i<3;i++)
    for(int j=0;j<3;j++)
      cin>>c[i][j];
  int f=0;
  for(int i=0;i<=100;i++)
    for(int j=0;j<=100;j++)
      for(int k=0;k<=100;k++){
	int t[3][3];
	for(int a=0;a<3;a++)
	  t[a][0]=c[a][0]-i;
	for(int a=0;a<3;a++)
	  t[a][1]=c[a][1]-j;
	for(int a=0;a<3;a++)
	  t[a][2]=c[a][2]-k;
	if(t[0][0]==t[0][1]&&t[0][0]==t[0][2])
	  if(t[1][0]==t[1][1]&&t[1][0]==t[1][2])
	    if(t[2][0]==t[2][1]&&t[2][0]==t[2][2])f=1;
	
      }
  if(f)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int k,n;
	while(cin>>n){
		k=0;
		for(int a=0;a<10;a++){
			for(int b=0;b<10;b++){
				for(int c=0;c<10;c++){
					for(int d=0;d<10;d++){
						if(a+b+c+d==n)k++;
						}
					}
				}
			}
		cout<<k<<endl;
	}
	return 0;
	}


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

int main() {
  char b; cin >> b;
  switch (b) {
  case 'A': cout << 'T'; break;
  case 'T': cout << 'A'; break;
  case 'C': cout << 'G'; break;
  default: cout << 'C'; break;
  }
  cout << endl;
}


Measured memory_bytes: 256
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + end + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw "ArrayIndexOutOfBoundsException ‚There is no more input";}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var list = nextIntArray();
  var output = 0;
  for(var i = 0; i < N - 1; i++){
    for(var j = i + 1; j < N; j++){
      output += list[i] * list[j];
    }
  }
  myout(output);
}


Measured memory_bytes: 30284
#include <stdio.h>

int main() {
  int x[5];
  scanf("%d %d %d %d %d",&x[0],&x[1],&x[2],&x[3],&x[4]);
  for(int i=0;i<5;i++) {
    if(x[i]==0) {
      printf("%d",i+1);
    }
  }
  return 0;
}
  

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#include<stdio.h>
#include<cstdio> 

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;

#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define one 1.0
#define INF 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
#define FOR(i,a,n) for(int i=a;i<n;i++) 
#define FORE(i,a,n) FOR(i,a,n+1)
#define Endl endl
#define eNdl endl
#define enDl endl
#define endL endl

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);
	string s;
	cin>>s;
	if(s[0] == 'R'&&s[1] == 'R'&&s[2] == 'R')cout<<3<<endl;
	else if(s[0] == 'R'&&s[1] == 'R'
	        || s[1] == 'R'&&s[2] == 'R')cout<<2<<endl;
	else if(s[0] == 'R'||s[1] == 'R'||s[2] == 'R')cout<<1<<endl;
	else cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
typedef long long ll;
int main() {
    string S; cin >> S;
    int N = S.size();
    S = '0' + S;
    if(N == 1) {
        cout << 1 << endl;
    }
    else if(N == 2) {
        cout << (S[0] == S[1]? 1:2) << endl;
    }

    vector<vector<int>> dp(N+2,vector<int>(3, -1));
    dp[N][1] = 1;
    dp[N-1][2] = 1;
    for(int i=N-1; i>=1; i--) {
        if(i+1<=N && S[i]!=S[i+1]) chmax(dp[i][1], dp[i+1][1]+1);
            if(i+2<=N){
            chmax(dp[i][1], dp[i+1][2]+1);
            chmax(dp[i][2], dp[i+2][1]+1);

        }
      if(i+3<=N && S.substr(i,2)!=S.substr(i+2,2)) chmax(dp[i][2], dp[i+2][2]+1);

    
    }
cout << max(dp[1][1], dp[1][2]) << endl;
}

Measured memory_bytes: 11328
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
ll t[18];
int main(){
    ll n;
    cin >> n;
    if(n<10){
        cout << n << endl;
        return 0;
    }
    t[0] = 1;
    rep(i,17){
        t[i+1] = t[i]*10;
    }
    string s = to_string(n);
    int keta = (int)s.size();
    int ue = (int)s[0]-'0';
    int ans = 0;
    rep(i,s.size()){
        ans += (int)s[i]-'0';
    }
    //show(keta);
    //show(ue);
    rep(i,18){
        if(t[i]-1LL==n){
            cout << keta*9 << endl;
            return 0;
        }
        if(t[i]==n){
            cout << (keta-1)*9 << endl;
            return 0;
        }
    }
    cout << max(ans,(ue-1) + (keta-1)*9) << endl;
}

Measured memory_bytes: 888
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
char a,b;
int main()
{
 cin>>a>>b;
 if(a>b) {cout<<'>'<<endl;exit(0);}
 if(a==b) {cout<<'='<<endl;exit(0);}
 if(a<b) {cout<<'<'<<endl;exit(0);}
 return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.stream.Stream;

public class Main {
  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    int n = Integer.parseInt(br.readLine());
    String[] s = br.readLine().split(" ");
    int[] an  = Stream.of(s).mapToInt(Integer::parseInt).toArray();
    int res = 0;
    while (true) {
      boolean exist_odd = false;
      for (int i = 0; i < n; i++) {
        if (an[i] % 2 != 0) exist_odd = true;
      }
      if (exist_odd) break;
      for (int i = 0; i < n; i++) {
        an[i] /= 2;
      }
      res++;
    }
    out.println(res);
    out.close();
  }
}

Measured memory_bytes: 34404
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>

using namespace std;

int a, b;
int d[5];

int main()
{
    for (int i = 1; i <= 3; i++)
        cin >> a >> b, d[a]++, d[b]++;
    sort(d + 1, d + 4 + 1);
    if (d[1] == 1 && d[2] == 1 && d[3] == 2 && d[4] == 2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        ArrayList<Integer> valList = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            valList.add(scanner.nextInt());
        }
        int k = scanner.nextInt();
        Integer val = valList.get(0);
        for (int i = 1; i < valList.size(); i++) {
            if (Math.abs(val - valList.get(i)) > k) {
                System.out.println(":(");
                System.exit(0);
            }
        }
        System.out.println("Yay!");
    }
}


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

using namespace std;

string s;
int q;

int main(){
    cin >> s;

    scanf("%d", &q);

    bool leftToRight = true;

    while (q--){
        int t;

        scanf("%d", &t);

        if (t == 1){
            leftToRight = leftToRight ? 0 : 1;
        } else {
            int edge;
            char c;

            scanf("%d %c", &edge, &c);

            if (leftToRight){
                if (edge == 1){
                    s.insert(0, 1, c);
                } else {
                    s.push_back(c);
                }
            } else {
                if (edge == 1){
                    s.push_back(c);
                } else {
                    s.insert(0, 1, c);
                }
            }
        }
    }

    if (leftToRight){
        for (int i=0;i<s.size();i++)
            cout << s[i];
    } else {
        for (int i=s.size()-1;i>=0;i--)
            cout << s[i];
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 900
n = input()

n1 = n[-1]

if n1 == '2' or n1 == '4' or n1 == '5' or n1 == '7' or n1 == '9':
    print('hon')
elif n1 == '0' or n1 == '1' or n1 == '6' or n1 == '8':
    print('pon')
else:
    print('bon')


Measured memory_bytes: 9128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll a,b,c,d; // health str
    cin>>a>>b>>c>>d;
    ll i=1;
    while(a>0 && c>0){
        if(i&1){
            c-=b;
        }
        else{
            a-=d;
        }
        i++;
        //cout<<a<<' '<<c<<endl;
    }

    if(a>0)
        cout<<"Yes"<<endl;
    else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

template <typename T>
struct edge
{
    int src, to;
    T cost;

    edge(int to, T cost) : src(-1), to(to), cost(cost) {}
    edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

    edge &operator=(const int &x)
    {
        to = x;
        return *this;
    }

    operator int() const { return to; }
};

//Weighted edge set
template <typename T>
using Edges = vector<edge<T>>;

//Weighted graph
template <typename T>
using WeightedGraph = vector<Edges<T>>;

template <typename T>
T Prim(WeightedGraph<T> &g)
{
    T res = 0;
    vector<bool> used(g.size(), false);
    priority_queue<pair<T, int>, vector<pair<T, int>>, greater<pair<T, int>>> que;
    que.emplace(0, 0);
    while (que.empty() != true)
    {
        auto p = que.top();
        que.pop();
        if (used[p.second] == true)
            continue;
        used[p.second] = true;
        res += p.first;
        for (auto &e : g[p.second])
        {
            que.emplace(e.cost, e.to);
        }
    }
    return res;
}

int N, a, b, c, d, p1, p2, cost;

int main()
{
    cin >> N;
    vector<pair<pair<int, int>, int>> x, y;
    WeightedGraph<int> G(N);

    for (int i = 0; i < N; i++)
    {
        scanf("%d%d", &a, &b);
        a--, b--;
        x.emplace_back(make_pair(a, b), i);
        y.emplace_back(make_pair(b, a), i);
    }

    sort(x.begin(), x.end());
    sort(y.begin(), y.end());

    for (int i = 0; i + 1 < N; i++)
    {
        a = x[i].first.first, b = x[i].first.second, c = x[i + 1].first.first, d = x[i + 1].first.second, p1 = x[i].second, p2 = x[i + 1].second;
        cost = min(abs(a - c), abs(b - d));
        G[p1].emplace_back(p2, cost);
        G[p2].emplace_back(p1, cost);

        a = y[i].first.first, b = y[i].first.second, c = y[i + 1].first.first, d = y[i + 1].first.second, p1 = y[i].second, p2 = y[i + 1].second;
        cost = min(abs(a - c), abs(b - d));
        G[p1].emplace_back(p2, cost);
        G[p2].emplace_back(p1, cost);
    }

    printf("%d\n", Prim(G));
}

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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 100010, M = 1010, mod = 1e9 + 7;

int x, y;

int qp(int a, int b)
{
	int res = 1;
	while (b)
	{
		if (b & 1) res = (LL)res * a % mod;
		a = (LL)a * a % mod;
		b >>= 1;
	}
	return res;
}

int C(int a, int b)
{
	int res = 1;
	for (int i = a; i > a - b; i -- ) res = (LL)res * i % mod;
	for (int i = 1; i <= b; i ++ ) res = (LL)res * qp(i, mod - 2) % mod;
	return res;
}

int main()
{
	cin >> x >> y;
	
	int s = x + y;
	if (s % 3 == 0 && min(x, y) >= s / 3)
	{
		int c = s / 3;
		if (c == 0) puts("1");
		else cout << C(c, x % c) << endl;
	}
	else puts("0");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
using std::string;

int main(){
  string str;
  int count=0;
  int flag=0;
  int tokusyu = 0;
  string migi = "zaqxswcdevfrbgt";
  string hida = "nhymjukiolp";

  while(cin >> str){
    if(str[0] == '#'){
      break;
    }
    count = 0;
    flag = 0;
    tokusyu = 0;

    for(int i = 0;i < str.length();i++){
      for(int j = 0;j < migi.length();j++){
        if(migi[j] == str[i] && flag == 1){
          count += 1;
          flag = 0;
        }
        if(str[i] == migi[j]){
          tokusyu = 1;
        }
      }
      for(int j = 0;j < hida.length(); j++){
        if(count == 0 && tokusyu == 0){
          flag = 1;
        }

        if(hida[j] == str[i] && flag == 0){
          count += 1;
          flag = 1;
        }
      }
    }
    cout << count << endl;
  }
}

Measured memory_bytes: 3020