akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

//  const int MOD = 1e9 + 7;

//unsigned seed1= chrono::system_clock::now().time_since_epoch().count();
//mt19937 rng (seed1);


int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
 int N;
  cin >> N;
  string s;
  cin >> s;
  

  
  string al = "";
  for(char c = 'A'; c <= 'Z'; ++c) al += c;
  for(char c : s){
    cout << al[ (c - 'A' + N)%26 ];
  }
  cout << endl;

      
  return 0;
}

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

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

bool comp(pair<ll, ll> a, pair<ll, ll> b){
  return a.first < b.first;
}

void Main(){
  ll N, K; cin >> N >> K;
  vector<pair<ll, ll>> vp(N);
  rep(i, 0, N) cin >> vp[i].first >> vp[i].second;
  sort(all(vp), comp);
  ll cnt = 0;
  while(true){
    if(vp[cnt].second < K){
      K -= vp[cnt].second;
      cnt++;
    }else{
      cout << vp[cnt].first << endl;
      break;
    }
  }
}

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

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  //cout << std::fixed << std::setprecision(15);

  Main();
}


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

using namespace std;

#define PB push_back
#define f first
#define s second
#define what_is(x) cerr << #x << " is " << x << endl;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

const int INF = 1000000007;
const ll MOD = 1000000007;

void solve_test()
{
    int n;
    cin >> n;
    int num[n];
    memset(num, 0, sizeof(num));
    for(int i=1; i<n; i++)
    {
        for(int j=i; j<n; j+=i)
        {
            num[j]++;
        }
    }
    for(int i=1; i<n; i++)
    {
        num[i] += num[i-1];
    }
    cout << num[n-1];
}

signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int tests;
    tests = 1;
    //cin >> tests;
    while(tests--)
    {
        solve_test();
    }
    return 0;
}


Measured memory_bytes: 7540
package main

import "fmt"

/*
展開図の展開の仕方を固定して、回転動作によってどのように展開図の数字が移るかを記録する。
展開図は次の通り。手前の目2番を中心に据える展開の仕方。
         ___
    ____|_1_|_______
    |_4_|_2_|_3_|_5_|
        |_6_|

サイコロの状態は上面と前面を指定することで一意に決定される。それぞれを指定された目に揃えて、
展開図の3番を記録。
入力された二つのサイコロについて上面前面を揃えた上で右側面の値を比較することで判定。
で、できるかと思ったが、サイコロの各面の数字がすべて異なるという制約は今回の問題にはないので、
この判定方法は不完全。

よって、力ずくで全通り調べる。
*/

type Dice struct {
	Nums []int
}

func (d *Dice) rotate(direction string, times int) {
	times %= 4
	switch direction {
	case "W":
		for i := 0; i < times; i++ {
			d.Nums[0], d.Nums[2], d.Nums[5], d.Nums[3] = d.Nums[2], d.Nums[5], d.Nums[3], d.Nums[0]
		}
	case "E":
		for i := 0; i < times; i++ {
			d.Nums[0], d.Nums[2], d.Nums[5], d.Nums[3] = d.Nums[3], d.Nums[0], d.Nums[2], d.Nums[5]
		}
	case "N":
		for i := 0; i < times; i++ {
			d.Nums[0], d.Nums[4], d.Nums[5], d.Nums[1] = d.Nums[1], d.Nums[0], d.Nums[4], d.Nums[5]
		}
	case "S":
		for i := 0; i < times; i++ {
			d.Nums[5], d.Nums[1], d.Nums[0], d.Nums[4] = d.Nums[1], d.Nums[0], d.Nums[4], d.Nums[5]
		}
	}
}

func (d *Dice) roll(direction string, times int) {
	times %= 4
	switch direction {
	case "R":
		for i := 0; i < times; i++ {
			d.Nums[3], d.Nums[1], d.Nums[2], d.Nums[4] = d.Nums[1], d.Nums[2], d.Nums[4], d.Nums[3]
		}
	case "L":
		for i := 0; i < times; i++ {
			d.Nums[3], d.Nums[1], d.Nums[2], d.Nums[4] = d.Nums[4], d.Nums[3], d.Nums[1], d.Nums[2]
		}
	}
}

func (d *Dice) printStatus() {
	status :=
`	　　　 _ _ _ _
     _ _ _|_%3d_|_ _ _ _ _ _
    |_%3d_|_%3d_|_%3d_|_%3d_|
 　       |_%3d_|
`
	fmt.Printf(status, d.Nums[0], d.Nums[3], d.Nums[1], d.Nums[2], d.Nums[4], d.Nums[5])
	fmt.Println()
}

func getIndex(nums []int, target int) (index int) {
	for i, v := range nums {
		if target == v {
			index = i
			break
		} else {
			index = -1
		}
	}
	return index
}

func (d *Dice) isEqual(other Dice) bool {
	for i, v := range d.Nums {
		if v != other.Nums[i] {
			return false
		}
	}
	return true
}

func main() {
	var n int
	fmt.Scan(&n)
	dice1 := Dice{
		make([]int, 6),
	}
	for i := 0; i < 6; i++ {
		var n int
		fmt.Scan(&n)
		dice1.Nums[i] = n
	}
	var flag bool
	for i := 0; i < n-1; i ++ {
		if flag == false {
			dice2 := Dice{
				make([]int, 6),
			}
			for i := 0; i < 6; i++ {
				var n int
				fmt.Scan(&n)
				dice2.Nums[i] = n
			}

			directionOrder := []string{"N", "S", "W", "E"}
			rollOrder := []string{"R", "L"}


		CHECK:
			for i := 0; i <= 2; i++ {
				for j := 0; j <= 2; j++ {
					for _, direction := range directionOrder {
						for _, roll := range rollOrder {
							tmp := new(Dice)
							tmp.Nums = append([]int{}, dice2.Nums...)
							tmp.rotate(direction, i)
							tmp.roll(roll, j)
							if tmp.isEqual(dice1) {
								flag = true
								break CHECK
							}
						}
					}
				}
			}
		} else {
			break
		}
	}
	if !flag {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}



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

int dp[100001][4];
long long int solve(int **a,int i,int prev,int n)
{
	if(i==n)
	{
		return(0);
	}
	if(dp[i][prev]!=-1)
	{
		return(dp[i][prev]);
	}
	if(prev==0)
	{
		long long int op1=solve(a,i+1,1,n)+a[i][1];
		long long int op2=solve(a,i+1,2,n)+a[i][2];
		return(dp[i][prev]=max(op1,op2));
	}
	else if(prev==1)
	{
		long long int op1=solve(a,i+1,0,n)+a[i][0];
		long long int op2=solve(a,i+1,2,n)+a[i][2];
		return(dp[i][prev]=max(op1,op2));
	}
	else if(prev==2)
	{
		long long int op1=solve(a,i+1,1,n)+a[i][1];
		long long int op2=solve(a,i+1,0,n)+a[i][0];
		return(dp[i][prev]=max(op1,op2));
	}
	else
	{
		long long int op1=solve(a,i+1,1,n)+a[i][1];
		long long int op2=solve(a,i+1,2,n)+a[i][2];
		long long int op3=solve(a,i+1,0,n)+a[i][0];
		return(dp[i][prev]=max(op1,max(op2,op3)));
	}
}
int main()
{
	long long int n,i,j;
	cin>>n;
	int **a=new int*[n];
	for(i=0;i<n;i++)
	{
		a[i]=new int[3];
	}
	for(i=0;i<n;i++)
	{
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	}
	for(i=0;i<=100000;i++)
	{
		for(j=0;j<4;j++)
		{
			dp[i][j]=-1;
		}
	}
	cout<<solve(a,0,3,n);
}

Measured memory_bytes: 12032
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a, count=0;
	for(int i=1;i<=3;i++){
		cin >> a;
		if(a==5){
			count+=1;
		}
		else if(a==7){
			count+=2;
		}
	}
	if(count==4){
		cout << "YES";
	}
	else{
		cout << "NO";
	}
}

Measured memory_bytes: 256
#include <bits//stdc++.h>
using namespace std;
#define rep(i,n,k) for(int i=n;i<k;i++)
#define int long long 
signed main(void){
    int n,m,ans,p,q;
    ans=0;
    double x=0;
    double a,b;
    vector<int> v;
    
    cin>>n;
    rep(i,0,n){
        v.push_back(i);
    }
    double num[n][2];
    
    rep(i,0,n){
        cin>>num[i][0]>>num[i][1];
    }
    do {
        a=0;
        rep(i,1,n){
            a=0;
        a+=(num[v[i]][0]-num[v[i-1]][0])*(num[v[i]][0]-num[v[i-1]][0]);
        a+=(num[v[i]][1]-num[v[i-1]][1])*(num[v[i]][1]-num[v[i-1]][1]);
        x+=sqrt(a);
        }
        
    }while (next_permutation(v.begin(),v.end()));
    rep(i,1,n){
        x=x/(i+1);
    }
    cout<<setprecision(20)<<x<<endl;
   
    
}


Measured memory_bytes: 256
using System;
namespace ITP1_2_D
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine().Split();
            var W = int.Parse(S[0]);
            var H = int.Parse(S[1]);
            var x = int.Parse(S[2]);
            var y = int.Parse(S[3]);
            var r = int.Parse(S[4]);
            if(x - r < 0 || W < x + r)
            {
                Console.WriteLine("No");
            }
            else if(y - r < 0 || H < y + r)
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
        }
    }
}


Measured memory_bytes: 17924
#include <bits/stdc++.h>
#define pb push_back
#define mkp make_pair
#define maxx 10000005
#define MOD 1000003
#define sf(n) scanf("%lld", &n);
#define sff(n,m) scanf("%lld %lld", &n, &m)
#define pf(n) printf("%lld\n", n)
#define pff(n,m) printf("%lld %lld\n", n, m)
#define mem(a) memset(a, 0, sizeof(a))
#define fr(i,n) for(ll i=0; i<n; i++)
#define my_sizeof(type) ((char *)(&type+1)-(char*)(&type))
#define pi 2*acos(0.0)
#define F first
#define S second
#define EPS 1e-9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


int main()
{
    string st;
    cin>>st;
    if(st=="SAT")
        cout<<1<<endl;
    else if(st=="SUN")
        cout<<7<<endl;
    else if(st=="MON")
        cout<<6<<endl;
    else if(st=="TUE")
        cout<<5<<endl;
    else if(st=="WED")
        cout<<4<<endl;
    else if(st=="THU")
        cout<<3<<endl;
    else if(st=="FRI")
        cout<<2<<endl;

}


Measured memory_bytes: 256
import java.util.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

// AOJ 0077
public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		while (true) {
			int N = sc.nextInt();
			if (N == 0) break;
			
			int x = N / 2, y = N / 2 + 1;
			int[][] mc = new int[N][N];
			for (int i = 0; i < N; i++) fill(mc[i], -1);
			for (int i = 0; i < N * N; i++)  {
				if (mc[(y + i) % N][(x + i) % N] != -1) {
					y++; x--;
				}
				mc[(y + i) % N][(x + i) % N] = i + 1;
			}
			
			for (int i = 0; i < N; i++) {
				for (int j = 0; j < N; j++) {
					System.out.printf("%4d", mc[i][j]);
				}
				System.out.println();
			}
			
		}
	}	
}

Measured memory_bytes: 12000
using System;

public class Test
{
	public static void Main()
	{
		string[] str = Console.ReadLine().Split(' ');
		int a = 0;
		int b = 0;
		a = int.Parse(str[0]);
        b = int.Parse(str[2]);
        
        if(str[1].Equals("+")) Console.Write(a+b);
        if(str[1].Equals("-")) Console.Write(a-b);
	}
}

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

using namespace std;

int main() {
	int N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;

	int moneyX = ( ((int)N / A) + (N % A != 0) ) * B;
	int moneyY = ( ((int)N / C) + (N % C != 0) ) * D;

	cout << min(moneyX, moneyY) << endl;

	return 0;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)


int main(){
ll t;
t=1;
fast;
//cin>>t;

while(t--){
ll a,b,c,d;
cin>>a>>b>>c>>d;

cout<<max({a*c, b*d, a*d, b*c});

}
return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;  
  cin >> A >> B >> C >> D;

  A = A + B - C - D;  

  if (A > 0)
	cout << "Left" << endl;
  else if (A == 0)
	cout << "Balanced" << endl;
  else
	cout << "Right" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <typeinfo>
#include <set>
#include <bitset>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
using namespace std;
typedef long long ll;



int main(){
  int n,k;
  cin >> n >> k;
  vector<int> s(n,0);
  int d;
  int a;
  for(int i=0; i<k; i++){
    cin >> d;
    for(int j=0; j<d; j++){
      cin >> a;
      s[a-1] += 1;
    }
  }
  int ans = 0;
  for(int i=0; i<n; i++){
    if(s[i] == 0){
      ans += 1;
    }
  }
  cout << ans << endl;

}

Measured memory_bytes: 3600
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <math.h>
const long long mod = 1000000007;
//const long long mod = 998244353;
int main() {
	int H, W, N;
	scanf("%d", &H);
	scanf("%d", &W);
	scanf("%d", &N);
	int M = H > W ? H : W;
	int res = (N - 1) / M + 1;
	printf("%d", res);
	return 0;
}

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  ll sum = 0;
  for (auto&& c : s) {
    sum += c - '0';
  }
  if (sum % 9 == 0) {
    cout << "Yes" << '\n';
  } else {
    cout << "No" << '\n';
  }
  return 0;
}


Measured memory_bytes: 3724
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        long l=sc.nextLong();
        long r=sc.nextLong();
		long min=l*(l+1)%2019;
    
 	if((r-l)>=2018){
    		System.out.println(0);
    	}else if((r-l)<(2019-l%2019)){
     		for(long e=l;e<r;e++){
              for(long f=e+1;f<=r;f++){
            	 min=Math.min(min,e*f%2019);
              }
              if(min==0){break;}
            }
      	System.out.println(min);
   	 }else{

    	System.out.println(0);
    }
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<int,int>
#define lowbit(i) i&-i
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	ull ans=0; For(i,0,5)ans=ans<<15^rand(); return ans;
}
const int N=405;
int a[N][4],ycl[4];
ll yc[N];
map<ll,int> to,t;
ll chu(int a[4]){
	ll ans=0; 
	vector<int> v;
	For(i,0,3)v.pb(a[i]);
	For(i,1,3){
		vector<int> b;
		For(j,0,3)b.pb(a[(i+j)%4]);
		if(b<v)v=b;
	}
	//For(i,0,3)cout<<a[i]<<" "; puts(""); for(auto i:v)wri(i); puts("fjz");
	For(i,0,3)ans+=(ll)v[i]*ycl[i];
	return ans;
}
ll c(int a,int b){
	ll ans=1; 
	for(int i=a;i>a-b;i--)ans*=i;
	//For(i,2,b)ans/=i;
	return ans;
}
int get(ll x){
	auto it=to.find(x);
	if(it!=to.end())return it->second; else return 0;
}
void add(int i,int y){
	to[yc[i]]+=y;
}
int main(){
	int n=read();
	For(i,ycl[0]=1,3)ycl[i]=ycl[i-1]*1000;
	For(i,1,n){
		For(j,0,3){a[i][j]=read();} yc[i]=chu(a[i]); add(i,1);
	}
	ll ans=0;
	For(i,1,n){
		add(i,-1);
		For(j,i+1,n){
			add(j,-1);
			For(k,0,3){
				int q[4],B[4];
				For(l,0,3)B[l]=a[j][3^((l+k)%4)];
				t.clear();
				ll sum=1;
				For(l,0,3){
					q[3]=a[i][l]; q[2]=a[i][(l+1)%4];
					q[0]=B[l]; q[1]=B[(l+1)%4];
					/*if(i==1&&j==5&&k==2){
						For(o,0,3)wri(q[o]); puts("");
					}*/
					if(q[0]==q[2]&&q[1]==q[3]){sum*=2;
					if(q[0]==q[1])sum*=2;}
					//cerr<<sum<<endl;
					t[chu(q)]++;
				}
				for(auto i:t){
					sum=sum*c(get(i.fi),i.se);
				}
				//if(i==1&&j==8&&k==0)cout<<sum<<" "<<t.size()<<endl;
				ans+=sum;
			}
			add(j,1);
		}
		add(i,1);
	}
	cout<<ans/3<<endl;
}

Measured memory_bytes: 256
import sys
import math
n, a, b, c = [int(i) for i in sys.stdin.readline().split()]
l_ls = []
INF = 10 ** 18
def get_4_sinsu(x):
    if x == 0:
        return "0"
    res = ""
    for i in range(math.floor(math.log(x, 4)), -1, -1):
        res += str(x // (4 ** i))
        x %= 4 ** i
    return res

for i in range(n):
    l = int(input())
    l_ls.append(l)
best = INF
for i in range(4 ** n):
    dic = {0 : [], 1 : [], 2 : []}
    _i = get_4_sinsu(i).zfill(n)
    cost = 0
    for k, j in enumerate(_i):
        if j == "3":
            continue
        if j == "0":
            dic[0].append(l_ls[k])
        elif j == "1":
            dic[1].append(l_ls[k])
        else:
            dic[2].append(l_ls[k])
    if any([len(j) == 0 for j in dic.values()]):
        continue
    res = abs(sum(dic[0]) - a) + abs(sum(dic[1]) - b) + abs(sum(dic[2]) - c) + max(0, len(dic[0]) - 1) * 10 + \
                                                                                max(0, len(dic[1]) - 1) * 10 + \
                                                                                 max(0, len(dic[2]) - 1) * 10
    best = min(best, res)
print(best)

Measured memory_bytes: 79960
#include <bits/stdc++.h>
using namespace std;
int n;
string End;
string s[55];
int t[55];
int main() {
	cin >> n;
	for(int i = 1; i <= n; ++i) {
		cin >> s[i] >> t[i];
	}
	cin >> End;
	int ans = 0;
	for(int i = n; i; --i) {
		if(s[i] == End) {
			break;
		}
		ans += t[i];
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
using namespace std;
const ll N=500010;



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

	ll n;
	cin>>n;
	ll ar[n];
	ll ch[n+1]={0};
	for(ll i=0;i<n;++i){
        cin>>ar[i];
        ch[ar[i]]+=1;
	}

	ll ans=0;
	for(ll i=1;i<=n;++i){
        ll c=(ch[i]*(ch[i]-1))/2;
        if(ch[i]>1)
        {ans=ans+c;}
	}

	for(ll i=0;i<n;++i){
        ll x=ar[i];
        ll c,d;
        if(ch[x]>1){
            c=(ch[x]*(ch[x]-1))/2;
            //cout<<c<<" ";
            ans-=c;
        }
        if(ch[x]>2){
            d=((ch[x]-1)*(ch[x]-2))/2;
            //cout<<d<<endl;
            ans+=d;
        }
        cout<<ans<<endl;
        if(ch[x]>2){ans-=d;}
        if(ch[x]>1){
            ans+=c;
        }
	}

	return(0);
}


Measured memory_bytes: 5760
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
    int n;
    long long int base = 1e9 + 7;
    vector<long long int> freq(26, 1);
    string input;
    cin >> n >> input;
    long long int ans = 1;
    for (char a : input) {
        freq[a - 'a']++;
    }
    for (auto e : freq) {
        ans = (ans * e) % base;
    }
    ans = ((ans - 1) % base + base) % base;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);
ll dx[8]={0,0,-1,1,-1,1,-1,1};
ll dy[8]={1,-1,0,0,1,1,-1,-1};
vector<vector<ll> > c(10,vector<ll>(10,0));

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N; cin>>N;
    vector<ll> B(N+1);
    rep1(i,N) cin>>B[i];
    vector<ll> ans;
    
    while(sz(B)>1){
        bool c=false;
        rrep1(i,sz(B)-1){
            //取り除く
            if(i==B[i]){
                c=true;
                ans.pb(i);
                B.erase(B.bg+i,B.bg+i+1);
                break;
            }
        }
        if(!c){
            cout<<-1<<endl;
            return 0;
        }
    }
    
    rrep(i,sz(ans)) cout<<ans[i]<<endl;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
vector<int>a,b;
int c;
int main()
{
	a.pb(1);a.pb(4);a.pb(7);a.pb(9);
	cin>>c;
	b.pb(c);
	cin>>c;
	b.pb(c);
	cin>>c;
	b.pb(c);
	cin>>c;
	b.pb(c);
	sort(b.begin(),b.end());
	cout<<(b==a?"YES\n":"NO\n");
	return 0;
}

Measured memory_bytes: 256
console.log((args=>{
  const [[N],A] = args.trim().split`\n`.map(r=>r.split` `.map(v=>0|v));
  const AA = A.concat(A), B = Array(N+N).fill(0), C = Array(N).fill(0);
  for ( let i = 0; i <N+N;i++ ) B[i+1] = B[i] + ((i&1)?-AA[i]:AA[i]);
  for ( let i = 0; i < N; i++ ) C[i] = (i&1)?B[i]-B[N+i]:B[N+i]-B[i];
  return C.join` `;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));



Measured memory_bytes: 55956
import sys


def _ia(): return map(int, sys.stdin.readline().strip().split())


def main():
    h, w, m = _ia()
    hh = [0] * h
    ww = [0] * w
    f = {}
    for _ in range(m):
        i, j = map(lambda x: x-1, _ia())
        hh[i] += 1
        ww[j] += 1
        f[(i, j)] = 1

    lh = []
    mh = max(hh)
    for i, hi in filter(lambda x: x[1] == mh, enumerate(hh)):
        lh.append(i)

    lw = []
    mw = max(ww)
    for i, wi in filter(lambda x: x[1] == mw, enumerate(ww)):
        lw.append(i)

    ans = mh + mw
    for li in lh:
        for wi in lw:
            if f.get((li, wi), 0) == 0:
                return ans
    return ans - 1


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


Measured memory_bytes: 176732
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
const int maxn = 55;
const int mod = 1000000007;
int n;
char ch[2][maxn];
int num[maxn], cnt;
int f[maxn][3][3];
void work(){
	//f[0][0][0] = f[0][1][1] = f[0][2][2] = 1;
#define FOR(i,l,r) for(int (i) = (l); (i) < (r); (i)++)
	if(num[1] == 1){
		FOR(c,0,3) f[1][c][c] = 1;
	}else if(num[1] == 2){
		FOR(c1,0,3) FOR(c2,0,3) if(c1 != c2) f[1][c1][c2] = 1;
	}
	for(int i = 2; i <= cnt; i++){
		if(num[i] == 2){
			FOR(c1,0,3) FOR(c2,0,3) FOR(j,0,3) FOR(k,0,3) if(c1 != j && c2 != k && c1 != c2){
				f[i][c1][c2] += f[i-1][j][k];
				f[i][c1][c2] %= mod;
			}
		}if(num[i] == 1){
			FOR(c,0,3) FOR(j,0,3) FOR(k,0,3) if(c != j && c != k){
				f[i][c][c] += f[i-1][j][k];
				f[i][c][c] %= mod;
			}
		}
	}
	int ans = 0;
	FOR(c1,0,3) FOR(c2,0,3) {
		ans += f[cnt][c1][c2];
		ans %= mod;
	}
	printf("%d",ans);
}
int main(){
#ifdef __APPLE__
	freopen("main.in","r",stdin);
#endif
	int n; scanf(" %d",&n);
	scanf(" %s", ch[0]+1);
	scanf(" %s", ch[1]+1);
	for(int i = 1; i <= n; i++){
		if(ch[0][i] == ch[1][i]) num[++cnt] = 1;
		else {
			num[++cnt] = 2;
			i++;
		}
	}
	work();
	return 0;
}


Measured memory_bytes: 256
import numpy as np
n,m = map(int,input().split())
l = list(map(int,input().split()))
c = np.cumsum([0]+l).tolist()
lst = [i%m for i in c]
dic = {}
res = 0
for l in lst:
    if l in dic.keys():
        res += dic[l]
        dic[l] = dic[l] + 1
    else:
        dic[l] = 1
print(res)

Measured memory_bytes: 24608
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef long long int lli;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<pll> vop;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define REP(i,a,b) for( int i=a;i<b;i++)
#define REPR(i,a,b) for(int i=a;i>=b;i--)
#define adb(a) for(auto i:a) cout << i << " "; cout << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define endl "\n"
#define mem(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define PI 3.14159265358979323846
const ll N = 200007;

struct LessSecond
{
    template<typename T, typename U>
    bool operator()(const std::pair<T, U> &x, const std::pair<T, U> &y) const
    {
        return x.second < y.second;
    }
};

ll power(ll a, ll b, ll m) { ll ans = 1; a = a % m; while (b) { if (b & 1) ans = (ans * a) % m; b /= 2; a = (a * a) % m; } return ans; }

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

ll modInverse(ll a, ll m) { ll g = __gcd(a, m); return power(a, m - 2, m); }

ll pa[N];
ll pb[N];

int main()
{


    fastIO;
    int test = 1;
    //cin >> test;
    while (test--)
    {
        ll n, m, k;
        cin >> n >> m >> k;
        ll a[n], b[m];
        REP(i, 0, n) cin >> a[i];
        REP(i, 0, m) cin >> b[i];
        mem(pa, 0);
        mem(pb, 0);
        REP(i, 1, n + 1)
        {
            pa[i] = pa[i - 1] + a[i - 1];
        }
        REP(i, 1, m + 1)
        pb[i] = pb[i - 1] + b[i - 1];
        ll l = 0, h = n + m + 1, ans = 0;
        while (l <= h)
        {
            ll mid = (l + h) / 2;
            ll x = mid;
            ll t = 0, flag = 0;
            REP(i, 0, min(n, x) + 1)
            {
                if (x - i > m)
                    continue;
                t = pa[i] + pb[x - i];
                if (t <= k)
                    flag = 1;
            }
            if (flag)
            {
                ans = max(ans, mid);
                l = mid + 1;
            }
            else
                h = mid - 1;
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 9908
#include<stdio.h>

int main()
{
	int length,start,end;
	scanf("%d%d%d",&length,&start,&end);
	int len[length]={0};
	for(int n=1;n<=length;n++){
	for(int m=n+1;m<=length;m++)
		{if(n<=start)
			if(m>=end)
				len[m-n-(end-start-1)]++;
			else
				len[m-n<start-n+1+end-m?m-n:start-n+1+end-m]++;
		 else
		 	if(m>=end)
		 		len[m-n<n-start+1+m-end?m-n:n-start+1+m-end]++;
		 	else
		 		len[m-n<n-start+1+end-m?m-n:n-start+1+end-m]++;
				}		
}
	for(int n=1;n<length;n++)
		printf("%d\n",len[n]);
}


Measured memory_bytes: 128
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

#setrecursionlimit(10**6)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')
MOD = 10**9 + 7

def main():
	n, x, t = rli()
	q, r = divmod(n, x)
	ans = q*t 
	if r > 0:
		ans += t
	print(ans)
	stdout.close()

if __name__ == "__main__":
	main()

Measured memory_bytes: 67312
#include<bits/stdc++.h>
#define ll long long
#define pa pair<int,int>
#define db double
#define mo 1000000007

using namespace std;

struct P{
	db x,y;
}a[105],p[105];
db sqr(db x){
	return x*x;
}
db dis(P a,P b){
	return sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));
}
P operator -(P a,P b){
	return (P){a.x-b.x,a.y-b.y};
}
db operator *(P a,P b){
	return a.x*b.y-b.x*a.y;
}
vector<int> v[105];
int n,ok[105];
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
		scanf("%lf%lf",&p[i].x,&p[i].y),ok[i]=1;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			for (int k=1;k<=n;k++){
				if (i==j||i==k||j==k) continue;
				if ((p[i]-p[j])*(p[i]-p[k])==0){
					if (p[i].x<p[j].x&&p[j].x<p[k].x) ok[j]=0;
					if (p[i].x>p[j].x&&p[j].x>p[k].x) ok[j]=0;
					if (p[i].y<p[j].y&&p[j].y<p[k].y) ok[j]=0;
					if (p[i].y>p[j].y&&p[j].y>p[k].y) ok[j]=0;
				}
			}
	int sum=0;
	for (int i=1;i<=n;i++)
		sum+=ok[i];
	if (n==1){
		puts("1");
		return 0;
	}
	if (n==2){
		puts("0.5");
		puts("0.5");
		return 0;
	}
	for (int i=1;i<=n;i++)
		if (ok[i])
		for (int j=i+1;j<=n;j++){
			if (!ok[j]) continue;
			int tg=0,fl=1;
			for (int k=1;k<=n;k++){
				if (i==k||j==k||!ok[k]) continue;
				db tmp=(p[j]-p[i])*(p[k]-p[i]);
				int v=(tmp>0?1:-1);
				if (fabs(tmp)<1e-6) fl=0; 
				if (tg==0) tg=v;
				else if (tg!=v) fl=0;
			}
			if (!fl) continue;
			v[i].push_back(j);
			v[j].push_back(i);
		}
	for (int i=1;i<=n;i++){
		if (!v[i].size()){
			puts("0");
			continue;
		}
		if (v[i].size()==1&&sum!=2){
			puts("0");
			continue;
		}
		if (sum==2){
			puts("0.5");
			continue;
		}
		int x=v[i][0],y=v[i][1];
		db l1=dis(p[x],p[y]),l2=dis(p[x],p[i]),l3=dis(p[i],p[y]);
		db degi=acos((l2*l2+l3*l3-l1*l1)/(2*l2*l3));
		degi=acos(-1)-degi;
		printf("%.20lf\n",degi/acos(-1)/2);
	}
} 

Measured memory_bytes: 384
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

func input() string {
	sc.Scan()
	return sc.Text()
}

func solve(n, a, b int) int {
	if a > b {
		return 0
	}
	if n == 1 && a != b {
		return 0
	}

	minv := (n - 2) * a
	maxv := (n - 2) * b
	return maxv - minv + 1
}

func main() {
	n, _ := strconv.Atoi(input())
	a, _ := strconv.Atoi(input())
	b, _ := strconv.Atoi(input())
	fmt.Println(solve(n, a, b))
}


Measured memory_bytes: 640
#include <bits/stdc++.h> 
#define ll long long
#define F first
#define FF first.first
#define FS first.second
#define S second
#define pb push_back
using namespace std;
const int N=1000006, INF=1e16;
 
ll n, q=1, m, a[N], b[15], f[N], o, k, t, x, y, X, z, u, h, mx, mn, ans, Ans=INF;
pair<ll,ll> p[N];
string s, S;
vector<int> v[N], V;
 
main(){ios_base::sync_with_stdio(false), cin.tie(0);
   	
//	cin>>q;
   	
   	while(q--){ans=o=0;
   		cin>>n>>m;
   		
   		for (int i=1; i<=n; i++){
   			cin>>a[i];
		}
   		if(m<2*n){x=1;
   			for (int i=1; i<=m; i++)x=a[x];cout<<x;return 0;
		}
		x=1;
		while(!f[x]){
			f[x]=1;
			x=a[x];
		}
		while(f[x]==1){
			f[x]=2;
			x=a[x];
		}
		for (int i=1; i<=n; i++)y+=(f[i]%2),z+=(f[i]/2);
		m-=y;
		m%=z;
		for (int i=1; i<=m; i++){
			x=a[x];
		}
		cout<<x;
	}
	
}

Measured memory_bytes: 30216
def main():
    n = int(input())
    ans = [0] * 201
    cnt = 0
    a = [0] * 201

    for i in range(1,n+1):
        if i % 2 == 0:
            a[i] = a[i-1]
        else:
            cnt = 0
            for j in range(1,i+1):
                if i % j == 0:
                    cnt += 1
            if cnt == 8:
                a[i] = a[i-1] + 1
            else:
                a[i] = a[i-1]

    print(a[n])



if __name__=='__main__':
    main()


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

string S[110];
int main()
{
	int A, B;
	cin >> A >> B;
	A--; B--;
	for (int i = 0; i < 50; i++) {
		for (int j = 0; j < 100; j++) {
			S[i].push_back('#');
		}
	}
	for (int i = 50; i < 100; i++) {
		for (int j = 0; j < 100; j++) {
			S[i].push_back('.');
		}
	}
	int i = 0, j = 0;
	while (A) {
		S[i][j] = '.';
		if (j + 4 <= 99) j += 4;
		else {
			i++;
			if (i % 2 == 0) j = 0;
			else j = 2;
		}
		A--;
	}
	i = 99; j = 0;
	while (B) {
		S[i][j] = '#';
		if (j + 4 <= 99) j += 4;
		else {
			i--;
			if (i % 2 == 1) j = 0;
			else j = 2;
		}
		B--;
	}
	cout << 100 << " " << 100 << endl;
	for (int i = 0; i < 100; i++) {
		cout << S[i] << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <complex>
#include <cctype>
#include <cassert>
#include <sstream>
#include <ctime>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;

#define INF (1<<29)
#define INFL (1ll<<60)
#define EPS (1e-8)
#define PI (acos(-1))32
const ll MOD = 1000000007ll;

int main() {
	string a, b;
	cin >> a >> b;
	
	puts(((a == "D") ^ (b == "H")) ? "H" : "D");
	
	return 0;
}

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



int32_t main(){
        int n,k;cin>>n>>k;
        vector<int>v(n);
        for(auto &i : v) cin>>i;
        vector<int> dp(n,INT_MAX);
        dp[n-1]=0;
        
        for(int i=n-2;i>=0;i--){
            for(int j=1;j<=k;j++) {
                if(i+j>=n) break;
                dp[i]=min(dp[i],abs(v[i+j]-v[i])+dp[i+j]);
            }
        }
        cout<<dp[0]<<"\n";

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <math.h>
#include <cassert>
#include <unordered_map>
using namespace std;
#pragma warning(disable : 4996)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ld PI = 3.14159265358979323846;
const ll MOD = 1e9 + 7;


int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	if (a + b >= k) {
		cout << min(a, k);
	}
	else {
		cout << a - (k - a - b);
	}
}

Measured memory_bytes: 3620
#ABC 103D回答
N,M=map(int,input().split())
A=[]
for i in range(M):
    a,b=map(int,input().split())
    A.append([a,b])
B=sorted(A,key=lambda x:x[1])
#print(B)
if M==0:
    print(0)
else:
    c=B[0][1]
    B.pop(0)
    count=1
    while B!=[]:
        if B[0][0]>=c:
            count=count+1
            c=B[0][1]
        B.pop(0)
        #print(B)
        #print(count)
    print(count)

Measured memory_bytes: 22372
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

	    Scanner scan = new Scanner(System.in);
	    int in = scan.nextInt();
	    System.out.println((in%2==0)? in: in*2);
	    scan.close();
	}

}

Measured memory_bytes: 21972
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
t = list(map(lambda x: int(x)*2, input().split()))
v = list(map(int, input().split()))
s = [None]*n
tmp = 0
for i in range(n):
    tmp += t[i]
    s[i] = tmp
s.insert(0,0)
l1 = [] # (時刻, 速度)
l2 = [(0,0)] # (時刻, 速度)
for i in range(n):
    l1.append((s[i],v[i]))
    l2.append((s[i+1],v[i]))
l1.append((s[-1],0))
vs = [0]*s[-1]
ind = 0
ind1 = 0
ind2= 0
prv = 0
for i in range(s[-1]):
    while ind+1<len(s) and i>=s[ind+1]:
        ind += 1
    while ind1+1<len(l1) and i>=l1[ind1+1][0]:
        ind1 += 1
    while ind2+1<len(l2) and i>=l2[ind2+1][0]:
        ind2 += 1
#     print(i, ind, ind1, ind2)
    vs[i] = min(prv+1, v[ind], min((l1[j][1]+(l1[j][0]-i)*0.5) for j in range(ind1+1,len(l1))),
                   min((l2[j][1]+(i-l2[j][0])*0.5) for j in range(ind2+1)))
    prv = vs[i]
vs.append(0)
ans = 0
for i in range(len(vs)-1):
    ans += (vs[i]+vs[i+1])/2
print(ans/2)

Measured memory_bytes: 75340
h, w = map(int,input().split())

if h == 1 or w == 1:
    count = 1
elif h%2 == 0:
    count = ((w+1)//2 + w//2)*(h//2)
else:
    count = ((w+1)//2 + w//2)*(h//2) + (w+1)//2

print(count)

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

int main() {
  int S;
  int top,under;
  cin >> S;
  top = S / 100;
  under = S - top * 100;
  if(under > 0 && under < 13) {
    if(top > 0 && top < 13){
      cout << "AMBIGUOUS" << endl;
    }
    else {
      cout << "YYMM" << endl;
    }
  }
  else if(top > 0 && top < 13) {
    cout << "MMYY" << endl;
  }
  else{
    cout << "NA" << endl;
  }
}


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


namespace tes
{
	class contest
	{
		static void Main(string[] args)
		{
			 
            string s = Console.ReadLine();

            int count = 0;
            int countS = 0;
            int countT = 0;
            bool S = false;
            for(int i =0; i<s.Length; i++)
            {
                if(s[i] == 'S' && countT == 0)
                {
                    countS++;
                }
                else if(s[i] == 'T' && countS>0)
                {
                    countT++;
                }
                else if (s[i] == 'S' && countT>0 )
                {

                    count += (countS >= countT)? countT*2: countS*2 ;
                    countS = (countS>countT)? countS-countT+1: 1;
                    countT = 0;
                }

                if( i == s.Length - 1 && countS>0 && countT>0)
                {
                    count += (countS >= countT) ? countT * 2 : countS * 2;
                }

            }
            Console.WriteLine(s.Length-count);
		}				 
	}
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<ll>())
#define ll long long
#define rep(i, s, g) for (ll i = (s); i < (g); i++)
#define mod 1000000007
#define vfind(v, target) find(v.begin(), v.end(), target)
#define notFound(v, target) (vfind(v, target) == v.end())

using namespace std;

int main()
{
  ll N, M; cin >> N >> M;
  vector<ll> num(N, 1);
  vector<bool> red(N, false);
  red[0] = true;
  rep(i, 0, M) {
  	ll x, y; cin >> x >> y;
    x--; y--;
    if (red[x]) {
    	red[y] = true;
    }
    num[x]--; num[y]++;
    if (num[x] == 0) {
    	red[x] = false;
    }
  }
  ll ans = 0;
  rep(i, 0, N) {
  	if (red[i]) ans++;
  }
  cout << ans << endl;
}

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

struct obj{
  bool isobj;
  string name;
  string value;
  vector<obj*> ob;
  obj* par;
};
  
int main(){
  string query;
  vector<string> yaml;
  string buf;
  for(int i=0;getline(cin,buf);i++){
    if(i==0){
      query=buf;
    }
    else{
      yaml.push_back(buf);
    }
  }
  


  obj* base=new obj();
  base->isobj=true;
  base->name="#####";
  base->par=nullptr;
  int depth=0;
  obj* now=base;
  vector<int> indent(1,0);
  for(int i=0;i<yaml.size();i++){
    //cout<<i<<endl;
    int tabcnt=0;
    int p=0;
    while(yaml[i][p]==' '){
      tabcnt++;
      p++;
    }

    for(int j=0;j<depth;j++){
      if(indent[j]==tabcnt){
	for(int k=0;k<depth-j;k++){
	  now=now->par;
	}
	depth=j;
	break;
      }
    }
    if(indent.size()<=depth){
      indent.push_back(tabcnt);
    }
    else{
      indent[depth]=tabcnt;
    }
    string name="";
    while(yaml[i][p]!=':'){
      name+=yaml[i][p];
      p++;
    }

    obj *next=new obj();

    next->par=now;
    if(yaml[i].size()==p+1){
      next->isobj=true;
      next->name=name;
      next->value="###";
      (now->ob).push_back(next);
      now=next;
      depth++;
    }
    else{
      string value;
      p+=2;
      while(p<yaml[i].size()){
	value+=yaml[i][p];
	p++;
      }
      next->isobj=false;
      next->name=name;
      next->value=value;
      (now->ob).push_back(next);
    }
    
  }

  obj objec=*base;

  int p=0;
  p++;
  
  auto get_name=[](string &q,int &p){
    string res="";
    while(p<q.size() && q[p]!='.'){
      res+=q[p];
      p++;
    }
    return res;
  };
  
  while(p<query.size()){
    string name=get_name(query,p);

    obj* res=nullptr;
    for(int j=0;j<objec.ob.size();j++){

      if(objec.ob[j]->name==name){
	res=objec.ob[j];
      }
    }
    if(res==nullptr){
      cout<<"no such property"<<endl;
      return 0;
    }
    objec=*res;
    p++;
  }
  
  if(objec.isobj){
    cout<<"object"<<endl;
    return 0;
  }
  else{
    cout<<"string "<<"\""<<objec.value<<"\""<<endl;
    return 0;
  }
  return 0;
}

Measured memory_bytes: 3364
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main() {
  int n;
  cin >> n;

  map<string, int> mp;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    mp[s]++;
  }

  int maxv = 0;
  for (auto& x : mp) {
    if (x.second > maxv) {
      maxv = x.second;
    }
  }

  for (auto & x : mp) {
    if (x.second == maxv) {
      cout << x.first << endl;
    }
  }

}

Measured memory_bytes: 25216
#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define pf printf
#define sf scanf
#define ff first
#define ss second
#define clr clear()
#define sz size()
#define pb push_back
#define mk make_pair
#define pi acos(-1)
#define inf 20000000000000000
#define mod 998244353
#define ull unsigned long long int
#define f(i,k,n) for(i=k;i<n;i++)
#define fr(i,n,k) for(i=n;i>=k;i--)
#define ent(a) scanf("%lld",&a)
#define ent2(a,b) scanf("%lld%lld",&a,&b)
#define ent3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define mem(a) memset(a,0,sizeof(a))
#define vec(v,s) vector<ll>v[s]
#define arr(a,s) ll a[s];
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
//knight and king//
int dr[]= {2,2,-2,-2,1,-1,1,-1};
int dc[]= {1,-1,1,-1,2,2,-2,-2};
int dr1[]= {0,0,1,1,1,-1,-1,-1};
int dc1[]= {1,-1,1,0,-1,0,1,-1};
int dr2[]= {0,0,1,-1};
int dc2[]= {1,-1,0,0};
////////////////////////////
using namespace std;
#define ma 2000005

ll a[ma],b[ma],c[ma];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,i,j,x,y;
    while(cin>>n>>x>>y)
    {
       ll p=y/n-(x-1)/n;
       if(p)cout<<"OK"<<endl;
       else cout<<"NG"<<endl;
    }
    return 0;
}


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)

using LL  = long long;
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    LL x, y;cin >> x >> y;
    LL ans = 0;
    while(x <= y){
        ans++;
        x *= 2LL;
    }
    cout << ans << endl;
    return 0;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  while(cin >> n && n){
    string s;
    ll ans = 0;
    ll T = 1,S = 2,E = 3,W = 4,B = 6,N = 5;
    rep(i,n){
      cin >> s;
      if(s == "North"){
        swap(T,S);
        swap(S,B);
        swap(B,N);
      }
      else if(s == "West"){
        swap(T,E);
        swap(E,B);
        swap(B,W);
      }
      else if(s == "South"){
        swap(T,N);
        swap(N,B);
        swap(B,S);
      }
      else if(s == "Right"){
        swap(S,E);
        swap(E,N);
        swap(N,W);
      }
      else if(s == "Left"){
        swap(S,W);
        swap(W,N);
        swap(N,E);
      }
      else{
        swap(T,W);
        swap(W,B);
        swap(B,E);
      }
//       cout << T << " " << S << " " << E << " " << W <<" " << N << " " <<B<<endl;
      ans += T;
    }
    cout << ans+1 <<endl;
  }
  return 0;
}

Measured memory_bytes: 3008
#include <stdio.h>

int main() {
	int w, h, x, y, r;

	scanf("%d %d %d %d %d", &w ,&h ,&x, &y, &r);

	if (x + r > w) {
		printf("No\n");
	}
	else if (y + r > h ) {
		printf("No\n");
	}
	else if (x - r < 0) {
		printf("No\n");
	}
	else if (y - r < 0) {
		printf("No\n");
	}
	else {
		printf("Yes\n");
	}

	return 0;
}


Measured memory_bytes: 2052
import java.util.*;
import static java.lang.System.*;

public class Main {

	Scanner sc = new Scanner(in);
	
	void run() {
		int n, m;
		boolean[][] map = new boolean[21][21];
		int x, y;
		W:while (true) {
			n = sc.nextInt();
			if (n == 0) break;
			for (int i = 0; i < 21; i++)
				Arrays.fill(map[i], false);
			
			for (int i = 0; i < n; i++)
				map[sc.nextInt()][sc.nextInt()] = true;
			
			m = sc.nextInt();
			x = y = 10;
			for (int i = 0; i < m; i++) {
				String s = sc.next();
				int d = sc.nextInt();
				if (s.equals("N")) {
					for (int j = 0; j < d; j++)
						map[x][++y] = false;
				} else if (s.equals("E")) {
					for (int j = 0; j < d; j++)
						map[++x][y] = false;
				} else if (s.equals("W")) {
					for (int j = 0; j < d; j++)
						map[--x][y] = false;
				} else if (s.equals("S")) {
					for (int j = 0; j < d; j++)
						map[x][--y] = false;
				}
			}
			for (int i = 0; i < 21; i++) {
				for (int j = 0; j < 21; j++) {
					if (map[i][j]) {
						out.println("No");
						continue W;
					}
				}
			}
			out.println("Yes");
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 36076
H1, M1, H2, M2, K = map(int,input().split())

if H2 < H1:
    H2 = H2 + 24
if H1 == H2 and H2 < H1:
    H2 = H2 + 24


time2m = H2 * 60 + M2
time1m = H1 * 60 + M1

study_time = time2m - K - time1m

if study_time <= 0:
    print(0)
else:
    print(study_time)



Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
using ll = long long;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll a, b, c;
	cin >> a >> b >> c;
	cout << max(0ll, a - c) << ' ' << max(0ll, b - (c - (a - max(0ll, a - c))));
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[10000];
		int k = Integer.MIN_VALUE;
		StringTokenizer st = new StringTokenizer(reader.readLine());
		for (int i = 0; i < n; i++) {
			int num = Integer.parseInt(st.nextToken());
			k = Math.max(k, num);
			c[num]++;
			a[i] = num;
		}
		countingSort(a, b, c, k);
		StringBuilder sb = new StringBuilder();
		sb.append(b[0]);
		for (int i = 1; i < n; i++) {
			sb.append(' ').append(b[i]);
		}		
		System.out.println(sb.toString());
	}

	private static void countingSort(int[] a, int[] b, int[] c, int k) {
		for (int i = 1; i <= k; i++) {
			c[i] = c[i] + c[i - 1];
		}
		for (int i = a.length - 1; i >= 0; i--) {
			c[a[i]]--;
			b[c[a[i]]] = a[i];
		}
	}
}



Measured memory_bytes: 168524
"use strict";
    
const main = arg => {
    const X = arg.split("\n")[0].split(" ")[0];
    const Y = arg.split("\n")[0].split(" ")[1];
    
    if(X == Y) {
        console.log("=");
        return;
    }
    
    if(X < Y) {
        console.log("<");
        return;
    }
    
    if(X > Y) {
        console.log(">");
        return;
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
signed main()
{
	int n;
	cin>>n;
	double ans=0;
	for(int i=0;i<n;i++)
	{
		string str;
		double val;
		cin>>val>>str;
		if(str=="BTC")val*=380000;
		ans+=val;
	}
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 256