akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

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

	vector<int> list[30];
	for (auto i = 0; i < s.length(); ++i)
	{
		auto index = (int)(s[i] - 'a');
		list[index].push_back(i + 1);
	}

	auto result = 0ll;
	auto current = 0;
	for (auto i = 0; i < t.length(); ++i)
	{
		auto index = (int)(t[i] - 'a');
		auto& temp = list[index];
		if (temp.size() <= 0)
		{
			result = -1;
			break;
		}
		auto it = upper_bound(temp.begin(), temp.end(), current);
		if (it == temp.end())
		{
			if (i > 0)
			{
				result += s.length() - current;
			}
			current = 0;
			it = temp.begin();
		}
		result += *it - current;
		current = *it;
	}

	cout << result << endl;

	return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int cnd[3];

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	for(int i = 0; i < 3; i++) cin >> cnd[i];
	sort(cnd, cnd + 3);
	cout << ((cnd[2] == cnd[0] + cnd[1]) ? "Yes\n" : "No\n");
	return 0;
}

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

using namespace std;

bool sosanh(int a,int b,int c)
{
    if(c>b && b>a)
    {
        return true;
    }
    else
    {
        return false;
    }
}
//string s="";
//void nhan(int a,int b,int c,int k)
//{
//    if(s!="")
//    {
//        return;
//    }
//    if(sosanh(a,b,c)==true)
//    {
//        s="Yes";
//        return;
//    }
//    if(k==0)
//    {
//        return;
//    }
//    if(c<=a|| c<=b)
//    {
//        c*=2;
//        nhan(a,b,c,k-1);
//        c/=2;
//    }
//    if(b<=a && b*2<c)
//    {
//        b*=2;
//        nhan(a,b,c,k-1);
//        b/=2;
//    }
//}
int a,b,c,k;
int main()
{
    cin>>a>>b>>c>>k;
    while(b<=a)
    {
        b*=2;
        k--;
    }
    while(k>0)
    {
        c*=2;
        k--;
    }
    if(sosanh(a,b,c)==true)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }


}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<P ,ll> P3;
typedef pair<P ,P> PP;
const ll MOD = ll(1e9)+7;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()


int main() {
    ll r, d, x;
    cin >> r >> d >> x;
    REP(i,10){
        x = r*x - d;
        cout << x << endl;
    }
    return 0;
}

Measured memory_bytes: 256
// first second push_back unordered return continue break vector visited check flag bool while iterator begin end lower_bound upper_bound temp true false ll_MAX ll_MIN insert erase clear pop push compare ll64_MAX ll64_MIN  reverse replace stringstream string::npos length substr front priority_queue
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
const ll mod = 1e9 + 7 ;
const ll inf =
 1e9 + 5 ;
 //1e18L + 5;
const ll nax = 2e5 + 5;
void min_self(ll&a , ll b){a=min(a,b);}
void max_self(ll&a , ll b){a=max(a,b);}
void add_self(ll&a , ll b){a=(a+b)%mod;}
//#define (x)  get<0>(x) 
//#define (x)  get<1>(x)
//#define (x)  get<2>(x)
signed main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll n ;cin >> n ;
	vector<ll> arr(n) ; 
	for(ll i = 0 ; i<n ; i++) cin >> arr[i] ; 

	ll mini  = arr[0] ; 
	ll ans = 0 ; 
	for(ll i = 0 ; i<n ; i++){
		if(mini >= arr[i])ans++;
		min_self(mini , arr[i]);
	}

	cout << ans;

	
}

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

int main(int argc, const char * argv[]) {
    
    double x1=0.0, x2=0.0;
    double y1=0.0, y2=0.0;
    double dist=0.0;
    
    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    
    dist = sqrt(pow(x1-x2, 2.0)+pow(y1-y2, 2.0));
    
    printf("%f\n", dist);
    
    return 0;
}


Measured memory_bytes: 2104
n,m,p=map(int,input().split())
A=[]
for i in range(m):
    a,b,c=map(int,input().split())
    A.append((a,b,c-p))

def BellmanFord(edges,num_v,source):
    #グラフの初期化
    inf=float("inf")
    dist=[-inf for i in range(num_v)]
    dist[source-1]=0
  
    #辺の緩和
    buf=0
    for i in range(num_v*2):
        for edge in edges:
            if dist[edge[1]-1] < dist[edge[0]-1] + edge[2]:
                dist[edge[1]-1] = dist[edge[0]-1] + edge[2]
                if i>=num_v:
                    dist[edge[1]-1] =inf
        if i==num_v-1:
            buf=dist[-1]
    if dist[-1]!=buf or dist[-1]==-inf:
        return -1
    return max(dist[-1],0)

x=BellmanFord(A,n,1)
print(x)

Measured memory_bytes: 49772
a,b,c,d,e,f=[int(i) for i in input().split(' ')]
ans = -1.0
maxx = 0
maxy = 0
for i in range(0, 31):
  for j in range(0, 31):
    if i * a * 100 + j * b * 100 > f:
      continue
    for k in range(0, 3001):
      if i * a * 100 + j * b * 100 + k * c > f:
        continue
      for l in range(0, 3001):
        if i * a * 100 + j * b * 100 + k * c + l * d > f:
          continue
        if (i * a + j * b) * e < k * c + l * d:
          continue
        x = 100 * a * i + 100 * b * j
        y = k * c + l * d
        if (not x + y == 0) and (x + y) * ans < y:
          ans = max(ans, y / (x + y))
          maxx = x
          maxy = y
print(maxx + maxy, maxy)

Measured memory_bytes: 44508
#include<stdio.h>

int main(void)
{
	int i;
	char c1,c2;
	scanf("%c",&c1);
	for(i=0;i<3;i++){
		scanf("%c",&c2);
		if(c1==c2){
			printf("Bad");
			return 0;
		}
		c1=c2;
	}
	printf("Good");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
int main(){
	// #ifndef ONLINE_JUDGE	
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll L;
	cin>>L;
	double side=(double)L/3;
	double ans=side*side*side;
	printf("%6f",ans);
}

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

using namespace std;

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    int a[n];
    int j=1,k=0;

    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if (a[i]==j)
            j++;
        else
            k++;
    }
    if (k==n)
        cout<<-1;
    else
        cout<<k;
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
  
using namespace std;
  
int main(){
   int m,f,r;
   char grade;
   while(true){
       scanf("%d %d %d",&m,&f,&r);
       if(m == -1 && f == -1 && r == -1) break;
       if(m == -1 || f == -1){
           grade = 'F';
       }else if(m+f >= 80){
           grade = 'A';
       }else if(m+f >= 65){
           grade = 'B';
       }else if(m+f >= 50){
           grade = 'C';
       }else if(m+f >= 30){
           grade = (r >= 50)? 'C':'D';
       }else{
           grade = 'F';
       }
       printf("%c\n",grade);
   }
}


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

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<long long> a(n);
	vector<vector<long long> > dp(n,vector<long long>(n));
	for(int i = 0; i < n; i++){
		cin >> a[i];
		dp[i][i] = a[i];
	}
	for(int i = 1; i < n; i++){
		for(int j = 0; j < n-i; j++){
			int l = j, r = j + i;
			dp[l][r] = max(-dp[l+1][r] + a[l] , -dp[l][r-1] + a[r]);  
		}
	}
	cout << dp[0][n-1] << "\n";
	return 0;
}


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

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

int main(){
  int a,b;cin>>a>>b;
  int G[100][100]={};
  int cury=0;
  int curx=0;
  while(a>1){
    if(curx==100){
      ++cury;
      rep(i,100)G[cury][i]=1;
      ++cury;curx=0;
    }
    G[cury][curx]=1;
    --a;
    curx+=2;
  }
  while(curx<100)G[cury][curx++]=1;
  ++cury;
  rep(i,100)G[cury][i]=1;
  cury+=2;--b;curx=0;
  while(b>0){
    if(curx==100){
      cury+=2;curx=0;
    }
    G[cury][curx+1]=1;
    --b;curx+=2;
  }
  cout<<100<<" "<<100<<endl;
  rep(i,100){
    rep(j,100)cout<<(G[i][j]?'#':'.');
    cout<<endl;
  }
}
    
    
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define eb emplace_back
#define pb pop_back
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define sz(x) (int)x.size()
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define itn int
#define vpii vector<pii>
#define pdd pair<double,double>
#define vll vector<ll>

typedef long long ll;

using namespace std;


int n, k;

bool cmp(int x) {
	return x >= k;
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> k;
	vi a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	cout << count_if(all(a), cmp);
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
using namespace std;
static const int MaxN=200000;

int main(){
	int R[MaxN],n;
	cin>>n;
	for(int i=0;i<n;++i) cin>>R[i];
	int maxv=-2000000000;           //设置一个足够小的初始值
	int minv=R[0];
	for(int i=1;i<n;++i){
		maxv=max(maxv,R[i]-minv);   //更新最大值
		minv=min(minv,R[i]);        //暂存现阶段的最小值
	}
	cout<<maxv<<endl;
	return 0;
}


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

int main(){	
	int a,b,h,m;
	const long double pi=3.141592653589793238;
	cin>>a>>b>>h>>m;
	long double rad=pi*2*(
		(long double)h/12.0+((long double)m/60.0)/12.0-(long double)m/60.0
	);

	long double rsq=(long double)(a*a+b*b)-(long double)(2*a*b)*cosl(rad);
	cout<<setprecision(20)<<sqrtl(rsq)<<endl;
	return 0;
}

Measured memory_bytes: 4180
#include<stdio.h>

int main(){
	
	int h1,m1,h2,m2,k;
	scanf("%d %d %d %d %d",&h1,&m1,&h2,&m2,&k);
	int minute1,minute2;
	
	minute1 = h1*60 + m1;
	minute2 = h2*60 + m2;
	//printf("Minute 1 : %d\n",minute1);
	//printf("Minute 2 : %d\n",minute2);
	
	printf("%d",(minute2-minute1)-k);
	
	
	
	
	return 0;
}

Measured memory_bytes: 3204
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
S = str(input())
T = str(input())

SS = []
for i in range(len(S)) :
  if i + len(T) <= len(S) :
    cnt = 0
    st = S[0:i]
    for j in range(len(T)) :
      if S[i+j] == T[j] or S[i+j] == "?" :
        cnt += 1
        st += T[j]
    if cnt == len(T) :
      SS.append((st+S[i+len(T):]).replace("?", "a"))
      #SS.append((st+S[i+len(T):]))
#print (SS)
if len(SS) > 0 :
  SS.sort()
  print (SS[0])
else :
  print ("UNRESTORABLE")






Measured memory_bytes: 38384
require 'ripper'

def parse(s)
	raise if s =~ /[-+*]{2,}/
	eval s
	Ripper.sexp(s)[1][0]
end

def calc(se)
	case se[0]
	when :paren
		raise if se[1][0][0] == :paren
		raise if !se[1][0].flatten.include?(:binary)
		calc(se[1][0])
	when :binary
		l, op, r = se[1..-1]
		result = calc(l).send(op, calc(r))
		raise unless (0..1023) === result
		result
	when :@int
		i = se[1].to_i(2)
		raise unless (0..1023) === i
		i
	when :unary
		if se[1] == :-@
			raise if calc(se[2]) == 0
			0
		elsif se[1] == :+@
			calc(se[2])
		end
	end
end

s = gets.chomp
k = s.count(?.)

if k == 0
	begin
		p calc(parse(s))
	rescue Exception
		p -1
	end
else
	 p %w[ ( ) 0 1 + - * ].repeated_permutation(k).map {|perm|
		e = s.gsub(?.){ perm.pop }
		begin
			calc(parse(e))
		rescue Exception
			next -1
		end
	}.max
end

Measured memory_bytes: 11400
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;

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

  int64_t A,B,C;
  int64_t K;
  cin >> A >> B >> C >> K;
  int64_t res = 0;
  if (K > A) {
    res += A;
    K -= A;
  } else {
    res = K;
    K = 0;
    cout << res << endl;
    return 0;
  }

  if (K > B) {
    K -= B;
  } else {
    cout << res << endl;
    return 0;
  }

  res -= K;
  cout << res << endl;
  return 0;
}


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

#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{int x,y,t;};
struct Edge{int to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=1010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(int from,int to,int cost){E[from-1].pb({to-1,cost});}
};
long long mod_div(long long a,long long b){
	long long tmp = MOD - 2,c = b,ret = 1;
	while(tmp > 0){
		if(tmp & 1){
			ret *= c;ret %= MOD;
		}
		c *= c;c %= MOD;tmp >>= 1;
	}
	return a*ret%MOD;
}
 
#define MAX_K 333333
vector<long long> kaijo(MAX_K);
long long combination(long long n, long long r){
    if(n < r || n < 0 || r < 0)
        return 0;
	if(kaijo[0] != 1){
		kaijo[0] = 1;
		for(long long i = 1;i < MAX_K;i++)kaijo[i] = (kaijo[i-1] * i) % MOD;
	}
    long long ret = kaijo[n];
	long long tmp = (kaijo[r] * kaijo[n-r]) % MOD;
    return mod_div(ret,tmp);
}
 
ll dp[3333][2];
 
void modadd(ll &a, ll b){
	a += b;
	a %= MOD;
}
int main(){
  int h,w,n;cin>>h>>w>>n;
  dp[0][0]=1;
  vector<pair<int,int>>kabe(n);
  for(int i=0;i<n;i++){
    int a,b;cin>>a>>b;
    kabe[i]=mp(a,b);
  }
  kabe.pb(mp(1,1));
  kabe.pb(mp(h,w));
  sort(ALL(kabe));
  for(int i=0;i<kabe.size();i++){
    for(int k=0;k<2;k++){
      if(dp[i][k]){
	for(int j=i+1;j<kabe.size();j++){
	  if(kabe[i].F<=kabe[j].F&&kabe[i].S<=kabe[j].S){
	    modadd(dp[j][(k+1)%2],dp[i][k]*combination((kabe[j].F-kabe[i].F)+(kabe[j].S-kabe[i].S),kabe[j].S-kabe[i].S)%MOD);
	  }
	}
      }
    }
  }
  cout<<(dp[n+1][1]-dp[n+1][0]+MOD)%MOD<<endl;
  return 0;
}


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

using namespace std;
#define inf 1000000000
#define unvisited -1
#define visited 1
#define eps 1e-9
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define uint64 unsigned long long
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define debug if(true)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

vector<vi> adj;

int sz[200001];
const int mod = 1e9 + 7;

ll fac[200001], invFac[200001];

map<int,ll> dp[200001];
ll ans[200001];

ll solve(int node, int parent) {
	int i,j;
	if(dp[node].find(parent) != dp[node].end()) {
		// printf("found dp[%d][%d]: %lld\n",node, parent, dp[node][parent]);
		return dp[node][parent];
	}

	ll jawab = fac[sz[node]-1];
	for(i=0;i<adj[node].size();i++){
		int v = adj[node][i];
		if(v == parent){continue;}
		jawab *= invFac[sz[v]];
		jawab %= mod;
	}

	for(i=0;i<adj[node].size();i++){
		int v = adj[node][i];
		if(v == parent){continue;}
		jawab *= solve(v, node);
		jawab %= mod;
	}
	// printf("assign dp[%d][%d]: %lld\n", node, parent, jawab);

	return dp[node][parent] = jawab;
}

ll modPow(ll a, ll b){
	ll res = 1;
	while(b){
		if(b & 1) {
			res *= a;
			res %= mod;
		}
		a *= a;
		a %= mod;
		b /= 2;
	}
	return res;
}

void reroot(int node, int v) {
	int ukuran = sz[node];
	int szTetangga = sz[v];
	sz[node] = sz[node] - szTetangga;
	sz[v] = ukuran;
}

void dfs(int node, int parent) {
	int i;
	// printf("node: %d parent: %d\n",node, parent);
	if(dp[node].find(-1) == dp[node].end()) {
		// printf("not found node: %d\n",node);
		ll ans = solve(node, -1);
		dp[node][-1] = ans;
	}
	for(i=0;i<adj[node].size();i++){
		int v = adj[node][i];
		if(v == parent){continue;}
		ll ansBaru = dp[node][-1] * modPow(dp[v][node], mod-2); ansBaru %= mod;
		ansBaru *= fac[sz[node] - sz[v] - 1]; ansBaru %= mod;
		ansBaru *= invFac[sz[node] - 1]; ansBaru %= mod;
		ansBaru *= fac[sz[v]]; ansBaru %= mod;

		dp[node][v] = ansBaru; //dp node with the parent = v
		// printf("dp[%d][%d]: %lld\n",node, v, ansBaru);
		reroot(node, v);
		dfs(v, node);

		reroot(v, node);
	}
}

int subtreeSize(int node, int parent) {
	sz[node] = 1;
	for(int i=0;i<adj[node].size();i++){
		int v = adj[node][i];
		if(v == parent){continue;}
		sz[node] += subtreeSize(v, node);
	}
	return sz[node];
}

void processFac() {
	fac[0] = invFac[0] = 1;
	for(int i=1;i<=200000;i++){
		fac[i] = (ll)i*fac[i-1];
		fac[i] %= mod;
		invFac[i] = modPow(fac[i], mod-2);
	}
}

int main(){
	int n, i,j;	

	processFac();
	scanf("%d",&n);
	adj.assign(n+1, vi());
	for(i=0;i<n-1;i++){
		int a,b;
		scanf("%d %d",&a,&b);
		adj[a].pb(b); adj[b].pb(a);
	}

	subtreeSize(1, -1);
	solve(1, -1);
	dfs(1, -1);
	
	for(i=1;i<=n;i++){
		ll ans = dp[i][-1];
		printf("%lld\n",ans);
	}

	return 0;
};

Measured memory_bytes: 64756
program greedy_takahashi
  implicit none
  integer(8) :: a, b, k
  read(*,*) a, b, k
  if (a < k) then
    write(*,'(i0,x,i0)') 0, max(a+b-k,0_8)
  else
    write(*,'(i0,x,i0)') a-k, b
  end if
end program greedy_takahashi

Measured memory_bytes: 512
// B.

#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	string s;
	cin >> s;
	int loses = count(s.begin(), s.end(), 'x');
	cout << (loses <= 7 ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
char* myfgets(char *buf,int n,FILE *fp){ //accepts LF/CRLF
	char *ret=fgets(buf,n,fp);
	if(!ret)return NULL;
	if(strlen(buf)&&buf[strlen(buf)-1]=='\n')buf[strlen(buf)-1]=0;
	if(strlen(buf)&&buf[strlen(buf)-1]=='\r')buf[strlen(buf)-1]=0;
	return ret;
}

char Q[24999];
char *q[9];
char L[99999];
int ind[9];
int n;
dfs(depth){
	int cur_ind=0;
	if(!myfgets(L,sizeof(L),stdin)){puts("no such property");exit(0);}
	if(depth){
		for(;L[cur_ind]==' ';cur_ind++);
		if(ind[depth-1]>=cur_ind){puts("no such property");exit(0);}
	}
	char *name=strtok(L+cur_ind,":"),*value=name+strlen(name)+1;
	if(!strcmp(name,q[depth])){
		if(depth==n-1){
			if(*value)
				printf("string \"%s\"\n",value+1),exit(0);
			else
				puts("object"),exit(0);
		}
		ind[depth]=cur_ind;
		dfs(depth+1);
	}
	dfs(depth);
}

main(depth){
	myfgets(Q,sizeof(Q),stdin);
	q[0]=strtok(Q+1,".");
	for(n=1;;n++)if(!(q[n]=strtok(NULL,".")))break;
	dfs(0);
}

Measured memory_bytes: 588
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <set>
#include <iomanip>
#include <vector>
#include <queue>
#include <numeric>
//#include <bits/stdc++.h>

using namespace std;
const int INF = 1 << 30;

int main()
{
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    int a[n+1];
    fill(a,a+n+1,0);
    for(int i = 0; i < m ;++i)
    {
        int x,y;
        cin>>x>>y;
        a[x]++;
        a[y]++;
    }
    for(int i = 1 ; i <= n ;++i)
    {
        cout<<a[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        S = S.replaceAll("BC", "D");
        char[] data = S.toCharArray();
        int length = data.length;
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < length; i++) {
            if (data[i] == 'A') {
                list.add(1);
                continue;
            }
            if (data[i] == 'D') {
                list.add(2);
                continue;
            }
            list.add(3);
        }
        long answer = 0;
        int a = 0;
        for (int x : list) {
            if (x == 1) {
                a += 1;
                continue;
            }
            if (x == 2) {
                answer += a;
                continue;
            }
            if (x == 3) {
                a = 0;
            }
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 36388
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

ll MOD = 998244353;
ll si = 2*1e5+7;
vc<ll> fac(si), finv(si), inv(si);

ll c(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll modpow(ll a, ll b){
    ll x = 1;
    for (; b > 0; b >>= 1){
        if(b & 1) x = (ll)x * a % MOD;
        a = (ll)a * a % MOD;
    }
    return x;
}

int main(){
    cout << fixed << setprecision(20);
    ll n,m,k; cin >> n >> m >> k;
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < si; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
    
    ll ans = 0;
    ll num = (modpow(m-1,n-k-1)*m) % MOD;
    per(i,k+1){
        ans += (num * c(n-1,i)) % MOD;
        ans %= MOD;
        num = (num*(m-1)) % MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7868
def main():
    s = input()
    for i in range(1<<3):
        t = int(s[0])
        op = []
        for j in range(3):
            if 1 & (i>>j):
                t += int(s[j+1])
                op.append('+')
            else:
                t -= int(s[j+1])
                op.append('-')
        if t == 7:
            x = ['{}{}'.format(a,b) for a,b in zip(s, op)]
            print("".join(x) + s[-1] + '=7')
            break

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ALL(a) a.begin(),a.end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,-1,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define INF 1<<29
#define MAX 101010
using namespace std;

int a[MAX];

void solve(){
 int n;
 cin>>n;
 FOR(i,n) cin>>a[i];
 vector<int> seg;
 int l=0;
 for(int i=1;i<n;i++){
  if(a[i]!=a[i-1]) continue;
  seg.pb(i-l);
  l=i;
 }
 seg.pb(n-l);
 int ma=0;
 if(seg.size()==1) ma=seg[0];
 else if(seg.size()==2) ma=seg[0]+seg[1];
 else FOR(i,seg.size()-2) ma=max(ma,seg[i]+seg[i+1]+seg[i+2]);
 cout<<ma<<endl;
}

int main(){
 solve();
 return 0;
}

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

using namespace std;

#define int long long
#define double long double
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CCIN(...)                                                              \
    char __VA_ARGS__;                                                          \
    CIN(__VA_ARGS__)
#define DCIN(...)                                                              \
    double __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Printv(v)                                                              \
    {                                                                          \
        REP(x, v.size()) { cout << v[x] << (x == v.size() - 1 ? "\n" : " "); } \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> PL;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const double PI = atan(1.0) * 4.0;
// const int MOD = 998244353;
const ll LINF = 1e18;
const ll dx[] = {1, 0, -1, 0};
const ll dy[] = {0, 1, 0, -1};

void cinfast() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

ll dp[100001];

signed main() {
    LCIN(N);
    VL h(N);
    VECCIN(h);
    Fill(dp, LINF);
    dp[0] = 0;
    REP(i, N) {
        if(i + 1 < N) dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]));
        if(i + 2 < N) dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]));
    }
    cout << dp[N - 1] << "\n";
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

bool sqrt_ineq(int64_t a, int64_t b, int64_t c) {
  if (a + b > c) {
    return false;
  } else {
    return 2 * ((a * b) + (b * c) + (c * a)) < (a * a) + (b * b) + (c * c);
  }
}

int main() {
  uint64_t a, b, c;
  cin >> a >> b >> c;
  cout << (sqrt_ineq(a, b, c) ? "Yes" : "No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long
#define vi vector <int>
#define pii pair <int, int>
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i,n) for (int i = 0; i < (int) (n); ++ i)
#define foreach(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); ++ it)

inline int read() {
	int x = 0, f = 1, c = getchar();
	for (;!isdigit(c);c = getchar()) if (c == '-') f ^= 1;
	for (; isdigit(c);c = getchar()) x = x * 10 + c - '0';
	return f ? x : -x;
}

#define N 200005
int n, m;
int l[N], r[N];
vi qrys[N];
priority_queue <int, vector <int>, greater <int> > pq;

int main() {
	n = read(), m = read();
	rep(i, n) l[i] = read(), r[i] = read();
	rep(i, n) qrys[l[i]].pb(i);
	vi Rs;
	int L = 1;
	rep(i, m + 1) {
		rep(j, qrys[i].size()) {
			int id = qrys[i][j];
			pq.push(r[id]);
			if (l[id] >= L) ++ L;
			else Rs.pb(pq.top()), pq.pop();
		}
	}
	int R = m;
	sort(Rs.begin(), Rs.end());
	int ans = 0;
	for (int i = (int) Rs.size() - 1; ~i; -- i) {
		if (L <= R && Rs[i] <= R) -- R;
		else ++ ans;
	}
	printf("%d\n", ans);
	return 0;
}

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

const long long MOD = 2;

void solve(long long N, std::vector<long long> A){
    int count = 0;
    bool fg_exit = false;
    while(1){
        for(int i = 0; i < A.size(); ++i){
            if(A[i] % 2 != 0){
                fg_exit = true;
                break;
            }
            if(A[i] % 2 == 0) A[i] = (A[i]/2);
        }
        if(fg_exit) break;
        count ++;
    }
    cout << count << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 256
while True:
    n = int(input())
    if n == 0:
        break
    A_sum = 0
    B_sum = 0
    for i in range(n):
        A, B = map(int, input().split())
        if A > B:
            A_sum += A + B
        elif B > A:
            B_sum += A + B
        else:
            A_sum += A
            B_sum += B
    print(A_sum, B_sum)

Measured memory_bytes: 7544
use std::cmp::max;

fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let a: i32 = read(&mut stdin_lock, &mut buf, b' ');
    let b: i32 = read(&mut stdin_lock, &mut buf, b' ');
    let k: usize = read(&mut stdin_lock, &mut buf, b'\n');

    let ans = (0..(max(a, b) + 1))
        .rev()
        .filter(|n| ((a % n) == 0) && ((b % n) == 0))
        .nth(k - 1)
        .unwrap();
    println!("{}", ans);
}


Measured memory_bytes: 4352
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))
def same(x, y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:
        return x
    else:
        node[x] = root(node[x])
        return node[x]
def unite(x, y):
    x, y = root(x), root(y)
    if x == y:
        return  # 結合不要
    if size[x] < size[y]:
        x, y = y, x
    node[y] = x
    size[x] += size[y]
def return_size(x):
    return size[root(x)]
    

n, m = MI()
ans = [0] * (m + 1)
bridge = [LI() for _ in range(m)]
# union-find
node = [i for i in range(n)]
size = [1 for i in range(n)]
# 辺を追加していない状態
ans[0] = (n * (n - 1)) // 2
i = 0 
for a, b in bridge[::-1]:
    if same(a - 1, b - 1):  # 辺を追加する以前のもともと連結であった
        ans[i + 1] = ans[i]
    else:
        ans[i + 1] = ans[i] - return_size(a - 1) * return_size(b - 1)
    unite(a - 1, b - 1)
    i += 1
for i in ans[:m][::-1]:
    print(i)


Measured memory_bytes: 128984
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
map<ll, ll>ins;
void facterize(ll n) {
	ll a = 2;
	while (n >= a * a) {
		if (n % a == 0) {
			ins[a]++;
			ins[a] = ins[a] % 1000000007;
			n /= a;
		}
		else {
			a++;
		}
	}
	ins[n]++;
}

vector<ll>relation[20], money(20, 1);
char s[110][110];
int dp[110][110];

int keta(int x) {
	int y = 0;
	while (x > 0) {
		y++;
		x /= 10;
	}
	return y;
}

int main() {
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 1;i <= n;i += 2) {
		int target = i;
		int res = 1;
		for (int j = 2;j <= i;++j) {
			if (i % j == 0)res++;
		}
		if (res == 8)ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
/*-----------Author: Araz Jabrayilov---------*/
/*------------@araz17----(~~)#5371-----------*/

#include <bits/stdc++.h>

#define ll long long
#define endl '\n'

using namespace std;

//int a[105];


int main()
{
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    ll n;
    ll m;

    cin >> n >> m;
    n  = n % m;


    cout <<  min(n, m-n) << endl;



    return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

int main() {
	int n, u, k;
	cin >> n; 

	vector<vector<int>> mat(n, vector<int>(n, 0));
	rep(i, n) {
		cin >> u >> k; --u;	
		int v;
		rep(j, k) {
			cin >> v; --v;	
			mat[u][v] = 1;
		}
	}
	
	rep(i, n) {
		rep(j, n) {
			if(j == (n-1)) {
				cout << mat[i][j] << endl;
			} else {
				cout << mat[i][j] << " ";
			}	
		}
	}

	return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  int N, M; cin >> N >> M;
  vector<pair<int, int> > v(M);
  for(int i = 0; i < M; ++i) {
    int a, b; cin >> a >> b;
    v[i].first = b;
    v[i].second = a;
  }
  sort(v.begin(), v.end());
  int x = -1, ans = 0;
  for(int i = 0; i < M; ++i) {
    if(v[i].second <= x && x <= v[i].first) continue;
    else {
      ans++;
      x = v[i].first - 1;
    }
  }
  cout << ans << endl;

  return 0;
}


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

int ans[200010];
int main() {
	int N, x;
	cin >> N >> x;
	if(x==1 || x==2*N-1) cout << "No" << endl;
	else{
	    cout << "Yes" << endl;
	    if(N>2){
	        ans[N-2]=x-1, ans[N-1]=x, ans[N]=x+1;
	        int p;
	        if(x==2*N-2) ans[N+1]=p=x-2;
	        else ans[N-3]=x+2, p=x-1;
	        int T=1;
	        for(int i=0; i<2*N-1; ++i){
	            if(ans[i]>0) cout << ans[i] << endl;
	            else{
	                if(T==p) T += 4;
	                cout << T << endl;
	                ++T;
	            }
	        }
	    }
	    else{
	        cout << 1 << endl;
	        cout << 2 << endl;
	        cout << 3 << endl;
	    }
	}
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

const int N = 1e5 + 5;
char _s[N];

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	string beg = "", nd = "";
	scanf("%s",_s);
	nd = string(_s);
	bool flip = false;
	int q;
	scanf("%d",&q);
	while(q--){
		int t,f;
		char c;
		scanf("%d",&t);
		if(t == 1){
			flip = !flip;	
		}
		else{
			scanf("%d %c",&f,&c);
			--f;
			f = f ^ flip;
			if(f == 0)beg += c;
			else nd += c;	
		}
	}
	reverse(all(beg));
	string ans = beg + nd;
	if(flip)reverse(all(ans));
	printf("%s\n",ans.c_str());
}


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

bool solve() {
    string s;
    cin >> s;
    int len = s.size();
    if (len % 2) return false;
    for (int i = 0; i < len; i += 2)
        if (s[i] != 'h') return false;
    for (int i = 1; i < len; i += 2)
        if (s[i] != 'i') return false;
    return true;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    cout << (solve() ? "Yes" : "No") << endl;
}

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

public class Main {


  private void solve(InputReader in, PrintWriter out) {
    String s = in.next();
    Stack<Character> stack = new Stack<>();
    for (char c : s.toCharArray()){
      if (!stack.isEmpty() && c == 'B'){
        stack.pop();
      }else if (c != 'B'){
        stack.push(c);
      }
    }
    stack.forEach(out::print);
  }


  public static void main(String[] args) {
    new Main().run();
  }

  private void run() {

    try (InputReader in = new InputReader(System.in);
         PrintWriter out = new PrintWriter(System.out)) {
      solve(in, out);
    }
  }


  static class InputReader implements AutoCloseable {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    InputReader(InputStream stream) {
      //reader = new BufferedReader(new FileReader(stream), 32768);
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    @Override
    public void close() {
    }
  }

}


Measured memory_bytes: 28244
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;

int main() {
    ll a;
    long double b;
    cin >> a >> b;
    long double ans = a * b;
    cout << setprecision(30) << floor(ans) << endl;
    return 0;
}


Measured memory_bytes: 3260
import java.util.Scanner;

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

    int H = scanner.nextInt();
    int W = scanner.nextInt();
    char[][] A = new char[H][W];
    for (int i = 0; i < H; i++) {
      A[i] = scanner.next().toCharArray();
    }
    if (possible(H, W, A)) {
      System.out.println("Possible");
    } else {
      System.out.println("Impossible");
    }
  }

  private static boolean possible(int H, int W, char[][] A) {
    int pright = 0;
    for (int i = 0; i < H; i++) {
      int left = -1;
      int right = -1;
      for (int j = 0; j < W; j++) {
        if (A[i][j] == '#') {
          if (left < 0) {
            left = j;
            while (j < W && A[i][j] == '#') j++;
            right = j;
          } else {
            return false;
          }
        }
      }
      if (left != pright) return false;
      pright = right - 1;
    }
    return true;
  }
}


Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
int h, w;
typedef pair<int, int> P;
vector<string> maze(50);
vector<vector<int>> counts(50, vector<int>(50, INF));
queue<P> que;
int dy[4] = {0, 1, 0, -1};
int dx[4] = {1, 0, -1, 0};
int bfs()
{
        counts[0][0] = 0;
        que.push(P(0, 0));
        while (que.size())
        {
                P p = que.front();
                que.pop();
                if (p.first == h - 1 && p.second == w - 1)
                        break;
                for (int i = 0; i < 4; i++)
                {
                        int ny = p.first + dy[i];
                        int nx = p.second + dx[i];
                        if (0 <= nx && nx < w && 0 <= ny && ny < h && maze[ny][nx] == '.' && counts[ny][nx] == INF)
                        {
                                que.push(P(ny, nx));
                                counts[ny][nx] = counts[p.first][p.second] + 1;
                        }
                }
        }
        return counts[h - 1][w - 1];
}

int main()
{
        cin >> h >> w;
        for (int i = 0; i < h; i++)
                cin >> maze[i];
        int white = 0;
        for (int i = 0; i < h; i++)
        {
                for (int j = 0; j < w; j++)
                {
                        if (maze[i][j] == '.')
                                white++;
                }
        }
        int res = bfs();
        if (res == INF)
        {
                cout << -1 << endl;
        }
        else
        {
                cout << white - res - 1 << endl;
        }
}

Measured memory_bytes: 256
import java.io.*;

public class Main{
	public static void main(String args[]) throws IOException{
		BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in));
		
		int result, count =0;
		String str = br.readLine();
		String a[] = str.split(" ",0);
		int N = Integer.parseInt(a[0]);
		int K = Integer.parseInt(a[1]);
		String b = br.readLine();
		String c[] = b.split(" ",0);
		int NG[] = new int[K];
		for(int i = 0; i < K; i++){
			NG[i] = Integer.parseInt(c[i]);
			}
		String d;
		for(int i = N; ; i++){
			d = String.valueOf(i);
			char e[] = d.toCharArray();
			int f[] = new int[e.length];
			for(int j = 0; j < e.length; j++){
				f[j] = e[j] -48;
			}
			count = 0;
			for(int j = 0; j < f.length; j++){
				for(int k = 0; k < NG.length; k++){
					if(f[j] == NG[k]){
						count++;
						continue;
					} else {
					}
				}
				if(count != 0)	continue;
			}
			if(count == 0){
				result = i;
				break;
			}
		}
		System.out.println(result);
	}
}

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

int main(){
	int n, x;
	cin >> n >> x;
	
	int cnt = 1;
	int d = 0;
	rep(i, n){
		int l;
		cin >> l;
		d += l;
		if(d <= x) cnt++;
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
const int MAXN=100000;
int a[MAXN+5];
int n,cnt1,cnt2;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]%2!=0)
			cnt1++;//奇数个数
		else
			cnt2++;//偶数个数
	}
	if(cnt1%2==0)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define nt _int128
#define mod 1000000007
int main()
{
// #ifndef ONLINE_JUDGE
//    	freopen("input.txt","r",stdin);
//     freopen("output.txt","w",stdout);
// #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    // cin >> t;
    t  = 1;
    while(t--)
    {
    	ll n;
    	cin>>n;
    	map<string,ll>mp;
    	for(ll i=1;i<=n;i++)
    	{
    		string s;
    		cin>>s;
    		mp[s]++;
    	}
    	cout<<"AC x "<<mp["AC"]<<endl;
    	cout<<"WA x "<<mp["WA"]<<endl;
    	cout<<"TLE x "<<mp["TLE"]<<endl;
    	cout<<"RE x "<<mp["RE"]<<endl;

    }
    return 0;
}

Measured memory_bytes: 3664
#include<stdio.h>
#include<string.h>

typedef struct process{
	char name[10];
	int time;
}PROC;

PROC list[100000];

int main(void){
	int i,j,n,q,total=0,max=0,temp,count=0;
	char tem[10];
	
	scanf("%d %d",&n,&q);

	for(i=0;i<n;i++){
		scanf("%s %d",list[i].name,&list[i].time);
	}
	for(i=0;i<n;i++){
		if(list[i].time>=max){
			max=list[i].time;
		}
	}

	for(i=0;;i++){
		if(i==n){
			i=0;
			for(j=0;j<n;j++){
				if(list[j].time>0){
					list[count] = list[j];
					count++;
				}
			}
			n=count;
			count=0;
		}
		if(n==0){
			break;
		}
		if(list[i].time<=q){
						total+=list[i].time;
			list[i].time=0;
			printf("%s %d\n",list[i].name,total);
		}else if(list[i].time > q){
			list[i].time-=q;
			total+=q;
		}
	}	

	return 0;
}



Measured memory_bytes: 2488
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    int n,m,x,y,i=0; cin>>n>>m;
    vector< pair<int,int> > adj[n+5];
    for(int i=1;i<=m;i++){
        cin>>x>>y;
        adj[x].push_back(make_pair(y,i));
    }
    for(int i=1;i<=n;i++)sort(adj[i].begin(),adj[i].end());
    vector<pair<int,int> > v[m+5];
    for(int i=1;i<=n;i++){
        for(int j=0;j<adj[i].size();j++){
             x=adj[i][j].second;y=adj[i][j].first;
             v[x].push_back(make_pair(i,j+1));
        }
    }
    for(int i=1;i<=m;i++){
        x=v[i][0].first;
        int c=0;
        while(x!=0){c++; x=x/10;}
        for(int k=0;k<6-c;k++)cout<<0; cout<<v[i][0].first;
        c=0;
        x=v[i][0].second;
        while(x!=0){c++; x=x/10;}
        for(int k=0;k<6-c;k++)cout<<0; cout<<v[i][0].second;
        cout<<endl;
    }

}



Measured memory_bytes: 14488