akhauriyash/Code-Regression huggingface dataset:
/****************************
*  Developer : joshi08
*  Date  :  16-06-2020
*  Year  :  2020
****************************/

#include <bits/stdc++.h>

#define lli long long int
#define mod 1000000007
#define fi first
#define se second
#define ii pair<lli, lli>
#define mp make_pair
#define endl '\n'
const double PI = 3.141592653589793238460;
lli gcd(lli a, lli b) { if (a == 0) return b; return gcd(b % a, a);}
lli max(lli a, lli b) {if (a > b) return a; else return b;}
lli min(lli a, lli b) {if (a < b) return a; else return b;}
lli power(lli a,lli b) {lli i,p=1; for(i=0;i<b;i++){p*=a;} return p;}

using namespace std;

int main()
{
    ios::sync_with_stdio(false);

	lli a,b,c,d;
	//long double b,p;
	
	
	scanf("%lld %lld.%lld", &a,&b,&c);
	
	b = b*100;
	
	d = a*(b+c)/100;
	
	cout<<d;

    return 0;
}



Measured memory_bytes: 3712
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int main(){
	int n;
	while (1){
		cin >> n;
		if (n == 0) break;
		int ans = 1;
		int d[7] = { 0, 1, 2, 3, 4, 5, 6 };
		string s;
		rep(i, 0, n){
			cin >> s;
			if (s == "North"){
				swap(d[1], d[2]);
				swap(d[2], d[6]);
				swap(d[6], d[5]);
			}
			else if (s == "East"){
				swap(d[1], d[4]);
				swap(d[4], d[6]);
				swap(d[6], d[3]);
			}
			else if (s == "West"){
				swap(d[1], d[3]);
				swap(d[3], d[6]);
				swap(d[6], d[4]);
			}
			else if (s == "South"){
				swap(d[1], d[5]);
				swap(d[5], d[6]);
				swap(d[6], d[2]);
			}
			else if (s == "Right"){
				swap(d[2], d[3]);
				swap(d[3], d[5]);
				swap(d[5], d[4]);
			}
			else{
				swap(d[2], d[4]);
				swap(d[4], d[5]);
				swap(d[5], d[3]);
			}
			ans += d[1];
		}
		o(ans);
	}
}

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

#define endl "\n"
#define si(a) scanf("%d ",&a);
#define si2(a,b) scanf("%d %d ",&a,&b);
#define si3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sll(a) scanf("%lld ",&a);
#define sll2(a,b) scanf("%lld%lld",&a,&b)
#define sll3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define sf(a) scanf("%f ",&a);
#define sd(a) scanf("%lf ",&a);
#define sc(a) scanf("%c ",&a);
#define ss(a) scanf("%s ",a);
#define sf2(a,b) scanf("%f %f ",&a,&b);
#define sd2(a,b) scanf("%lf %lf ",&a,&b);
#define mp(a,b) make_pair(a,b)
#define pb(x) push_back(x)
#define all(a) a.begin(),a.end()
#define forn(i,n) for(int i=0;i<n;i++)
#define forq(i,q,n) for(int i=q;i<n;i++)
#define form(i,n) for(int i=n;i>=0;i--)
#define forp(i,q,n) for(int i=q;i>=n;i--)
#define fi first
#define se second
#define INF 1000000010
#define MOD 1000000007
#define MAXN
#define LL long long int


using namespace std;

int x , a, b;

void init(){
	si3(x, a, b);
	int fora = abs(x - a);
	int forb = abs(x - b);
	if(fora < forb)
	{
		printf("A\n");
	}
	else 
	{
		printf("B\n");
	}
}

int main(){
	#ifndef ONLINE_JUDGE
		//freopen("input.txt","r",stdin);
		//freopen("output.txt","w",stdout);
	#endif
	init();
	return 0;
}


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

int main() {

    string s;
    
    cin >> s;

    int acount;
    int zcount;

    for (int i = 0; i < s.length(); i++) {
        
        if (s.at(i) == 'A') {
            acount = i;
            break;
        }
        
    }

    for (int i = 0; i < s.length(); i++) {
        
        if (s.at(i) == 'Z') {
            zcount = i;
        }
        
    }

    cout << zcount - acount + 1 << endl;

    return 0;

}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int n, a, b;
bool vis[1<<17];
int x[17];
inline void solve(int k, int l, int r){
	if(k==1){
		printf("%d %d ", l, r);
		return;
	}
	for(int i=0; i<n; ++i)
		if((l&(1<<i))^(r&(1<<i))){
			x[i]=1; int mid=l;
			for(int j=0; j<n; ++j)if(!x[j]){
				mid^=(1<<j); break;
			}
			solve(k-1,l,mid); solve(k-1,mid^(1<<i),r); x[i]=0;
			break;
		}
}
int main(){
	scanf("%d%d%d", &n, &a, &b);
	int cnta=0, cntb=0;
	for(int i=0; i<n; ++i)
		if(a&(1<<i))++cnta;
	for(int i=0; i<n; ++i)
		if(b&(1<<i))++cntb;
	int x=cnta-cntb, up, down;
	if(~x&1){
		puts("NO"); return 0;
	}
	up=((1<<n)-1+x)>>1; down=((1<<n)-1-x)>>1;
	if(down<0||up<0){
		puts("NO"); return 0;
	}
	puts("YES");
	solve(n,a,b);
	return 0;
}

Measured memory_bytes: 1024
n, m = map(int, input().split())
A = [[114514893 for i in range(n)] for j in range(n)]
ans = 0

visited = [0 for i in range(n)]


def dfs(src):
    global ans
    if sum(visited) == n: ans += 1
    for dst in range(n):
        if src == dst: continue
        if visited[dst] or A[src][dst] != 1: continue
        visited[dst] = 1
        dfs(dst)
        visited[dst] = 0


for i in range(m):
    a, b = map(int, input().split())
    a -= 1;
    b -= 1;
    A[a][b] = 1
    A[b][a] = 1

visited[0] = 1
dfs(0)
print(ans)


Measured memory_bytes: 3064
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int m = sc.nextInt();
      int[] l = new int[m];
      int[] r = new int[m];
      int max = 0;
      int min = 1000000;
      int count = 0;
      for(int i = 0;i < m;i++){
      	l[i] = sc.nextInt();
        max = Math.max(max,l[i]);
        r[i] = sc.nextInt();
        min = Math.min(min,r[i]);
      }
      for(int i = 1;i <= n;i++){
      	if(max <= i && i <= min){
          count++;
        }
      }
      System.out.println(count);
    }
}


Measured memory_bytes: 82572
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>

using namespace std;


int main() {

    int N, M;
    cin >> N >> M;

    vector<int> P(M), Y(M);
    for (int i = 0; i < M; i++) cin >> P[i] >> Y[i];

    vector<vector<pair<int, int>>> PY(N + 1, vector<pair<int, int>>());
    for (int i = 0; i < M; i++) PY[P[i]].push_back(make_pair(Y[i], i));
    for (int i = 0; i < PY.size(); i++) sort(PY[i].begin(), PY[i].end());

    vector<pair<int, int>> ans(M);
    for (int i = 0; i < PY.size(); i++) {
        for (int j = 0; j < PY[i].size(); j++) {
            ans[PY[i][j].second] = make_pair(i, j);
        }
    }

    for (int i = 0; i < M; i++) printf("%06d%06d\n", ans[i].first, ans[i].second + 1);

    return 0;
}













































Measured memory_bytes: 8576
package main

import (
	"fmt"
	"sort"
)

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	ar := []int{a, b, c}
	sort.Ints(ar)
	fmt.Println(ar[2]*10 + ar[1] + ar[0])
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int n;
  cin>>n;
  n=n-1;
  vector<long long int>ans;
  while(n>=26)
  {
    ans.push_back(n);
    n=n/26;
    n=n-1;
  }
  ans.push_back(n);
  for(long long int i=0;i<ans.size();i++)
  {
    ans[i]=ans[i]%26;
  }
  for(long long int i=ans.size()-1;i>=0;i--)
  {
    char temp=ans[i]+97;
    cout<<temp;
  }
}


Measured memory_bytes: 3628
#include <stdio.h>
int main()
{
	int a,b,c,d,e,k;
	scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&k);
	if(b - a <= k && c - a <= k && d - a <= k && e - a <= k
	&& c - b <= k && d - b <= k && e - b <= k &&
	   d - c <= k && e - c <= k && e - d <= k)
		printf("Yay!\n");
	else
		printf(":(\n");
	return 0;	
} 

Measured memory_bytes: 128
r, d, x = map(int, input().split())
ans = [0] * 10

for i in range(10):
    if i == 0:
        calc = r * x - d
        ans[i] = calc
    else:
        calc = r * ans[i-1] - d
        ans[i] = calc

print(*ans, sep='\n')

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

int main(){
	int n;
	cin >> n;
	vector<string> s(n);
	rep(i,n) cin >> s[i];
	rep(i,n){
		rep(j,10){
			sort(s[i].begin(),s[i].end());
		}
	}
	map<string,ll> cnt;
	rep(i,n){
		cnt[s[i]]++;
	}
	ll count  = 0;
	for(auto x : cnt){
		auto k = x.first;
		auto v = x.second;
		if(v == 1) continue;
		count += (ll)v*(ll)(v-1)/2;
	}
	cout << count << endl;
}

// cout << fixed << setprecision(15) <<  << endl;

Measured memory_bytes: 14000
/**
 * @Author:      K C-L
 * @DateTime:    2018-06-03 20:00:40
 * @Description: 
 */
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef stringstream strstm;
#define fi first
#define se second
#define INF 0X3f3f3f3f
#define SZ(x) ((int)(x).size())
#define pb push_back
#define PI acos(-1.0)
#define E 2.718281829459
#define lowbit(x) (x & (-x))
#define DBG(x) cout << (x) <<  << endl;
#define MST(a,b) memset(a,b,sizeof(a));
#define _for(i,a,b) for(int i = (a); i < (b); ++i)
#define _rep(i,a,b) for(int i = (a); i <= (b); ++i)



int main(int argc, char const *argv[]) {
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

	int a,b,ans1 = 0,ans2 = 0,res = INF;
	int n; cin >> n;
	_rep(i,1,n/2+1){
		ans1 = 0; ans2 = 0;
		 a = i; b = n-i;
		 while(a > 0){
		 	ans1 += a%10;
		 	a /= 10;
		 }
		 while(b > 0){
		 	ans2 += b%10;
		 	b /= 10;
		 }
		 res = min(res,ans1+ans2);
	}
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
N,Q = [int(x) for x in input().split()]
s = input()
l = list(s)
rui = [0] * (N+1)
for i in range(2,len(l)+1):
    if l[i-2] == "A" and l[i-1] == "C":
        rui[i] = rui[i-1] + 1
    else:
        rui[i] = rui[i-1]
for i in range(Q):
    a,b = [int(x) for x in input().split()]
    print(rui[b]-rui[a])

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

int n, m; string a, b;
vector<vector<int>> dp;

int main() {
	cin >> a >> b; n = (int)a.size(); m = (int)b.size();
	dp.resize(n + 1, vector<int>(m + 1, 0));
	for(int i = 0; i < n; i++) for (int j = 0; j < m; j++) {
			dp[i][j] = max(i ? dp[i - 1][j] : 0, j ? dp[i][j - 1] : 0);
			if (a[i] == b[j]) { dp[i][j] = max(dp[i][j], 1 + (i && j ? dp[i - 1][j - 1] : 0)); }
		}
	stack<char> s; int i = n - 1, j = m - 1;
	while (i >= 0 && j >= 0 && dp[i][j] != 0) {
		if (a[i] == b[j]) { s.push(a[i]); i--; j--; }
		else (i && (dp[i][j] == dp[i - 1][j])) ? i-- : j--;
	}
	while (!s.empty()) { cout << s.top(); s.pop(); }
	cout << '\n'; cin.ignore(2); return 0;
}


Measured memory_bytes: 38632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll dp[2010][2010];
struct X{
	int pos;
	ll num;
}a[2010];
bool cmp(const X& a,const X& b) {
	return a.num>b.num;
}
ll dfs(int pos,int l,int r) {
//	printf("%d %d %d\n",pos,l,r);
	if(l>r) return 0;
	if(dp[l][r]!=-1) return dp[l][r];
	ll lnum=dfs(pos+1,l+1,r)+a[pos].num*abs(a[pos].pos-l),rnum=dfs(pos+1,l,r-1)+a[pos].num*abs(a[pos].pos-r);
	return dp[l][r]=max(lnum,rnum);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	scanf("%d",&n);
	for(int i=1;i<=n;++i) {
		a[i].pos=i;
		scanf("%lld",&a[i].num);
	}
	sort(a+1,a+n+1,cmp);
	printf("%lld",dfs(1,1,n));
	return 0;
}

Measured memory_bytes: 35444
fn input_vec<T: std::str::FromStr>() ->Vec<T>{
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn input_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    let mut v2 = Vec::new();
    for _ in 0..n {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).ok();
        let v = s.trim().split_whitespace()
            .map(|e| e.parse().ok().unwrap()).collect();
        v2.push(v);
    }
    v2
}

fn main() {
	let input1 = input_vec::<u32>();
	let n = input1[0];
	let d = input1[1];
	let input2 = input_vec2::<i64>(n);
	let mut flag = 0;
	for i in input2{
		let distance = ((i[0].pow(2)+i[1].pow(2))as f64).sqrt();
		if distance<=d as f64{
			flag += 1;
		}
	}
	println!("{}",flag);


    
}


Measured memory_bytes: 12976
import math

A, B, D = map(float, input().split())

r = math.radians(D)
s = A * B * math.sin(r) / 2
l = A + B + (A ** 2 + B ** 2 - 2 * A * B * math.cos(r))** 0.5
h = B * math.sin(r)

print(s)
print(l)
print(h)



Measured memory_bytes: 5700
/* Author haleyk10198 */
/* 作者:  haleyk10198 */
/* CF handle: haleyk100198*/
#include <bits/stdc++.h>

#define MOD 1000000007
#define LINF (1LL<<60)
#define INF 2147483647
#define PI 3.1415926535897932384626433
#define ll long long
#define pii pair<int,int>
#define mp(x,y) make_pair((x),(y))
#define pb(x) push_back((x))
#define vi vector<ll>
#define vvi vector<vi>

using namespace std;

string itos(int x){
	stringstream ss;
	ss << x;
	return ss.str();
}

int n;
ll res;
map<int, int> m1;

vi v;

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin >> n;
	for(int i = 0, x; i < n; i++) cin >> x, m1[x]++;
	for(auto x: m1){
		if(x.second >= 2)
			v.pb(x.first);
		if(x.second >= 4)
			res = 1LL*x.first*x.first;
	}
	if(v.size() >= 2)
		res = max(res, v[v.size()-1]*v[v.size()-2]);
	
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 4992
A, B, K = map(int, input().split())
 
count = 0
index = 0
 
if A >= B:
  for i in reversed(range(1, B+1)):
    if A % i == 0 and B % i == 0:
      index = i
      count = count+1
      if count == K:
        break
elif A < B:
    for i in reversed(range(1,A+1)):
      if A % (i) == 0 and B % (i) == 0:
        index = i
        count = count+1
        if count == K:
          break
  
print(index) 

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

struct UF{
    int par[200000];
    int rank[200000];
    
    void init(int n){
        for(int i=0;i<n;i++){
            par[i]=i;
            rank[i]=0;
        }
    }
    
    int find(int x){
        if(par[x]==x)return x;
        return par[x]=find(par[x]);
    }
    
    void unite(int x, int y){
        x=find(x);
        y=find(y);
        if(x!=y){
            if(rank[x]<rank[y]){
                par[x]=y;
            }else{
                par[y]=x;
                if(rank[x]==rank[y])rank[x]++;
            }
        }
    }
    
    bool same(int x, int y){
        return find(x)==find(y);
    }
};

int main(void){
    int n,m;
    UF u;
    cin>>n>>m;
    u.init(n+m);
    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        for(int j=0;j<k;j++){
            int l;
            cin>>l;
            u.unite(i, l+n-1);
        }
    }
    
    for(int i=1;i<n;i++){
        if(!u.same(i,0)){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int p[1000005];
 
int getSum(int* BIT,int idx){
	int sum=0;
	while(idx>0){
		sum+=BIT[idx];
		idx-=(idx&-idx);
	}
	return sum;
}
 
void update(int* BIT,int N,int idx,int val){
	while(idx<=N){
		BIT[idx]+=val;
		idx+=(idx&-idx);
	}
	return;
}
 
int main() {
	memset(p,0,sizeof(p));
	
	int N,i;
	scanf("%d",&N);
	int Q;
	scanf("%d",&Q);

	int A[N+1];
	for(i=1;i<=N;i++)
	scanf("%d",&A[i]);
	
	int *BIT=new int[N+1];
	for(i=0;i<=N;i++)
	BIT[i]=0;
	
	
	vector<pair<int,pair<int,int> > > queries(Q);
	for(i=0;i<Q;i++){
		scanf("%d %d",&queries[i].second.first,&queries[i].first);
		queries[i].second.second=i;
	}
	vector<int> ans(Q,0);
	sort(queries.begin(),queries.end());
	int j=0;
	for(i=1;i<=N;i++){
		if(p[A[i]]>0)
		update(BIT,N,p[A[i]],-1);
		p[A[i]]=i;
		update(BIT,N,i,1);
		while(j<Q&&queries[j].first==i){
			ans[queries[j].second.second]=getSum(BIT,i)-getSum(BIT,queries[j].second.first-1);
			++j;
		}
		if(j==Q)
		break;
	}
	
	for(int i=0;i<Q;i++)
	printf("%d\n",ans[i]);
	// your code goes here
	return 0;
} 

Measured memory_bytes: 19336
#include <stdio.h>

int main(void)
{
	int kingaku;
	int oturi;
	int maisuu;
	
	while (1){
		scanf("%d", &kingaku);
		if (kingaku == 0){
			break;
		}
		
		oturi = 1000 - kingaku;
		
		maisuu = 0;
		
		if (oturi >= 500){
			maisuu += (oturi / 500);
			oturi %= 500;
		}
		if (oturi >= 100){
			maisuu += (oturi / 100);
			oturi %= 100;
		}
		if (oturi >= 50){
			maisuu += (oturi / 50);
			oturi %= 50;
		}
		if (oturi >= 10){
			maisuu += (oturi / 10);
			oturi %= 10;
		}
		if (oturi >= 5){
			maisuu += (oturi / 5);
			oturi %= 5;
		}
		if (oturi >= 1){
			maisuu += (oturi / 1);
			oturi %= 1;
		}
		printf("%d\n", maisuu);
	}	
	return (0);
}

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

main(){

  string s;
  cin>>s;

  ll n=s.size();
  vector<ll> Ldx,Rdx;
  rep(i,n){
    if(s[i]=='R')Rdx.push_back(i);
    else Ldx.push_back(i);
  }

  vector<ll> a(n);
  rep(i,n){
    if(s[i]=='R'){
      ll idx=*lower_bound(Ldx.begin(),Ldx.end(),i);
      ll dif=idx-i;
      if(dif&1)a[idx-1]++;
      else a[idx]++;
    }
    else{
      auto itr=lower_bound(Rdx.begin(),Rdx.end(),i);
      itr--;
      ll idx=*itr;
      ll dif=i-idx;
      if(dif&1)a[idx+1]++;
      else a[idx]++;
    }
  }
  for(auto x:a)cout<<x<<" ";cout<<endl;

}

Measured memory_bytes: 2420
#include<stdio.h>
#define ll long long
ll n,i,a[200005],tmp;
int main()
{
	scanf("%lld",&n);
	for (i=1;i<n;++i)
	{
		scanf("%lld",&tmp);
		++a[tmp];
	}
	for (i=1;i<=n;++i) printf("%lld\n",a[i]);
}

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

int main() {
    int N;
    cin >> N;
    set<int> A;
    rep(i, N) {
        int a;
        cin >> a;
        A.insert(a);
    }

    if (A.size() == N) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 9600
N, M = map(int, input().split())
result = 0
array = [[] for _ in range(N)]

for _ in range(M):
    a, b = map(int, input().split())
    array[a-1].append(b)
    array[b-1].append(a)

def search(x, L):
    LL = list(L)
    global result
    LL.append(x)
    if len(LL) == N:
        result += 1
        return
    for i in range(len(array[x-1])):
        if not array[x-1][i] in L:
            search(array[x-1][i], LL)
        
def main():
    L = []
    search(1, L)
    print(result)

main()


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

template<typename T>
struct SegmetTree
{
    int N;
    vector<T> dat;

    SegmetTree(int n) {
        N = 1;
        while (N < n) N *= 2;
        dat.resize(N * 2 - 1, 0);
    }

    void update(int k, T a) {
        k += N - 1;
        dat[k] = a;
        while (k > 0) {
            k = (k - 1) / 2;
            dat[k] = max(dat[k * 2 + 1], dat[k * 2 + 2]);
        }
    }

    T Max(int limit, int k, int l, int r) {
        if (limit <= l) return 0;
        if (r <= limit) return dat[k];
        T vl = Max(limit, k * 2 + 1, l, (r + l) / 2);
        T vr = Max(limit, k * 2 + 2, (r + l) / 2, r);

        return max(vl, vr);
    }
};

int main() {
    long long int N; cin >> N;
    SegmetTree<long long int> st(N + 1);

    for (int i = 0; i < N; i++) {
        int now;
        cin >> now;
        st.update(now, now + st.Max(now, 0, 0, (st.dat.size() + 1) / 2));
    }
    cout << (((N + 1) * N) / 2) - st.dat[0] << endl;

    return 0;
}

Measured memory_bytes: 4960
#include <iostream>

using namespace std;
typedef long long lint;

#define min(a, b) ((a) < (b))? (a):(b)

lint N, T;

int main() {
    cin >> N >> T;
    lint sum = 0;
    lint t_prev; cin >> t_prev;
    for(lint i=0; i<N-1; i++) {
        lint t; cin >> t;
        sum += min(t - t_prev, T);
        t_prev = t;
    }
    cout << sum + T << endl;
}

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

int main()
{
    long long N;
    std::cin >> N;
    long long A;
    std::unordered_map<std::string, int> map;

    bool ans = true;
    for (int i = 0; i < N; i++)
    {
        std::cin >> A;
        std::string A_str = std::to_string(A);

        if (map.count(A_str) == 0)
            map[A_str] = 1;
        else
        {
            ans = false;
        }
    }

    if (ans == true)
        std::cout << "YES" << std::endl;
    else
        std::cout << "NO" << std::endl;

    return 0;
}

Measured memory_bytes: 21064
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000

ll greedy_number(int a,int k){
  if(a<k) return 0;
  if(a%k == 0) return a/k;

  ll dif = ((a/k)+1);
  return greedy_number(a-max((a%k)/dif,(ll)1)*dif,k);

}
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  ll A,K;
  cin>>n;
  int nim=0;
  rep(i,n) {
    cin>>A>>K;
    nim ^= greedy_number(A,K);
  }
  if(nim==0) cout<<"Aoki"<<endl;
  else cout<<"Takahashi"<<endl;

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


Measured memory_bytes: 256
#include <iostream>

int main() {
	int N;
	std::cin >> N;
	for (int i=0;i < 26; ++i) {
		for (int j = 0; j < (100-i*4)/7+1;++j) {
			if (i*4+j*7==N) {
				std::cout << "Yes\n";
				return 0;
			}
		}
	}
	std::cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] s = S.split("");
        int c = 0;
        int max = 0;
        for(int i=0; i<3; i++) {
            if(s[i].equals("R")) {
                c++;
            }else {
                if(max < c) {
                    max = c;
                    c = 0;
                }
            }
        }
        if(c > max) max = c;
        System.out.println(max);
    }
}


Measured memory_bytes: 35564
n = int(input())
h = list(map(int, input().split()))
#高さ。0~n-1でアクセス

#足場Nにたどり着くまでの最小コストを格納。アクセスは[N-1]
dp = [-1] * n

dp[0] = 0
dp[1] = abs(h[0] - h[1])

import sys
sys.setrecursionlimit(10000000)
#足場x（0～n-1）にたどり着くまでの最小コストを返す関数。
def getdp(x):
    global dp #これでいいのか？
    if dp[x] != -1: return dp[x] #0,1の場合と、既に求めた場合は値を返す
    dp[x] = min(getdp(x-2) + abs(h[x]-h[x-2]), getdp(x-1) + abs(h[x]-h[x-1]))
    #2つ左から飛ぶか1つ左から飛ぶかの最小値がxのdp。
    return(dp[x])

print(getdp(n-1))


Measured memory_bytes: 51324
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		String a = stdin.next();
		String b = stdin.next();
		String c = stdin.next();
		System.out.print(a.charAt(0));
		System.out.print(b.charAt(1));
		System.out.println(c.charAt(2));




	}

}

Measured memory_bytes: 21840
import numpy as np
N = int(input())
if N==1 or N==2:
    print(0)
elif N==3:
    print(2)
else:
    ans = N-1
    num = np.arange(2, np.sqrt(N), dtype=int)
    mask = (N%num==0)
    check = np.array(N/num[mask], dtype=int)
    num = np.concatenate([num, check])
    mask2 = N%(num-1) == N//(num-1)
    ans += int(np.sum(num[mask2])-np.sum(mask2))
    print(ans)


Measured memory_bytes: 44600
use std::io::*;
use std::str::FromStr;
use std::cmp::min;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("faild to read char") as char)
        .take_while(|c| !c.is_whitespace())
        .collect();
    token
        .parse()
        .ok()
        .expect("faild to parse token")
}

fn main(){
    let a: u64 = read();
    let b: u64 = read();
    let c: u64 = read();
    println!("{} {} {}", c, a, b);
}



Measured memory_bytes: 4352
#define _GLIBCXX_DEBUG

#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>

#include <cmath>

#define int long long

using namespace std;

signed main() {
  int M, D;
  cin >> M >> D;

  int ans = 0;

  for (int m = 1; m <= M; m++) {
    for (int d = 1; d <= D; d++) {
      int d1 = d % 10;
      int d10 = d / 10;

      if (d1 >= 2 && d10 >= 2 && (m == (d1 * d10))) {
        ans++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 768
import java.util.Scanner;

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

        int n = sc.nextInt(), k = sc.nextInt();

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

        int[] dp = new int[n];
        dp[1] = Math.abs(num[0] - num[1]);

        for (int i = 2; i < n; i++) {
            dp[i] = Integer.MAX_VALUE;
            for (int j = 1; j <= k; j++) {
                if (i >= j)
                    dp[i] = Math.min(dp[i], dp[i - j] + Math.abs(num[i] - num[i - j]));
            }

        }

        System.out.println(dp[n - 1]);


    }
}


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

int main()
{
    int N,D;
    cin >> N >> D;

    vector<vector<int>> A(N,vector<int>(D));

    for(int i = 0; i < N; i++)
    {
        for(int j = 0; j < D; j++)
        {
            cin >> A.at(i).at(j);
        }
    }
    int d = 0;
    int dsum = 0;
    int count = 0;
    for(int i = 0; i < N; i++)
    {
        for(int j = i+1; j < N; j++)
        {
            for(int k = 0; k < D; k++)
            {
                d = A.at(i).at(k) - A.at(j).at(k);
                dsum += d*d;
            }

            for(int i = 0; i < pow(dsum,0.5)+1; i++)
            {
                if(dsum == i*i)count++;
            }
            dsum = 0;
        }
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define nl '\n'
#define print(vec,l,r) for(int i = (l); i < (r); i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (b)-1; i >= (a); i--)
#define input(vec,N) for(int i = 0; i < (N); i++) cin >> vec[i];
#define debug(x) cerr << #x << " = " << (x) << endl;

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int , int> pi;

void solve()
{
	int d, t, s;
	cin>>d>>t>>s;
	if(t*s >= d) cout<<"Yes\n";
	else cout<<"No\n";
}

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


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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

const ll mod=1000000007;

typedef valarray<ll> vec;
typedef valarray<vec> mat;


mat mul(mat a,mat b){
	mat c(vec(0LL,2),2);
	for(int i=0;i<2;++i)
		for(int k=0;k<2;++k)
			for(int j=0;j<2;++j)
				c[i][j]=(c[i][j]+a[i][k]*b[k][j]%mod)%mod;
	return c;
}

mat power(mat a,ll n){
	mat b(vec(0LL,2),2);
	b[0][0]=b[1][1]=1LL;
	while(n){
		if(n&1) b=mul(b,a);
		a=mul(a,a);
		n>>=1;
	}
	return b;
}

ll fib(ll n){
	mat a(vec(0LL,2),2);
	a[0][0]=1LL,a[0][1]=1LL;
	a[1][0]=1LL,a[1][1]=0LL;
	a=power(a,n);
	return (a[1][0]+a[1][1])%mod;
}

int main(void){
	ll k;
	cin >> k;

	ll l=0,r=10e9;
	while(r-l>1){
		ll m=(l+r)/2;
		if(m*(m+1)<k)
			l=m;
		else
			r=m;
	}
	ll a=2LL*l+1,b=0;
	ll index=k-l*(l+1);

	if(index>r) index-=r,a++;

	if(index<=(r+1)/2){
		b=1+2*(index-1);
		a-=(b-1);
	}else{
		b=2+2*(r-index);
		a-=(b-1);
	}

	cout << fib(a)*fib(b)%mod << endl;
	return 0;
}


/*
  1    2    3    5    8   13   21   34   55   89
  2    4    6   10   16   26   42   68  110  178
  3    6    9   15   24   39   63  102  165  267
  5   10   15   25   40   65  105  170  275  445
  8   16   24   40   64  104  168  272  440  712
 13   26   39   65  104  169  273  442  715 1157
 21   42   63  105  168  273  441  714 1155 1869
 34   68  102  170  272  442  714 1156 1870 3026
 55  110  165  275  440  715 1155 1870 3025 4895
 89  178  267  445  712 1157 1869 3026 4895 7921
 */

Measured memory_bytes: 1200
#include <stdio.h>
 
using namespace std;
 
int main(){
    int a,b;
    while(true){
        scanf("%d %d",&a,&b);
        if(a == 0 && b == 0) break;
        if(a > b) printf("%d %d\n",b,a);
        else{
            printf("%d %d\n",a,b);
        }
    }
}


Measured memory_bytes: 2572
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use std::mem::*;
#[allow(unused_imports)]
use std::str::*;
#[allow(unused_imports)]
use std::usize;

#[allow(unused_macros)]
macro_rules! read_cols {
    ($($t:ty),+) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();

        let mut it = line.trim()
            .split_whitespace();

        ($(
            it.next().unwrap().parse::<$t>().ok().unwrap()
        ),+)
    }}
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();
    line.trim().to_string().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();

    line.trim()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

fn main() {
    let n = read::<usize>();

    let a = read_vec::<i64>();
    let b = read_vec::<i64>();
    let c = read_vec::<i64>();

    assert_eq!(a.len(), n);
    assert_eq!(b.len(), n);
    assert_eq!(c.len(), n);

    let v = {
        let mut v = a
            .into_iter()
            .map(|v| (v, 2))
            .chain(b.into_iter().map(|v| (v, 1)))
            .chain(c.into_iter().map(|v| (v, 0)))
            .collect::<Vec<_>>();
        v.sort();
        v
    };

    let ans = v.iter().fold(vec![0usize, 0usize, 0usize, 1usize], |mut dp, p| {
        dp[p.1] += dp[p.1 + 1];
        dp
    })[0];

    println!("{}", ans);
}


Measured memory_bytes: 18676
n,s = map(int,input().split())
mod = 998244353
A = list(map(int,input().split()))
dp = [0 for _ in range(s+1)]
p = 0
F = {0}
for i in range(n):
    dp[0] += 1
    x = [[j,dp[j]] for j in F]
    for j in x:
        if j[0] + A[i] <= s:
            dp[j[0] + A[i]] += j[1]
            dp[j[0] + A[i]] %= mod
            F.add(j[0] + A[i])
    p += dp[s]
    p %= mod
print(p)

Measured memory_bytes: 114164
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;


int main(void){
    int N, M;
    long long K;
    vector<long long>A;
    vector<long long>B;

    long long value;

    cin >> N >> M >> K;

    A.push_back(0);
    B.push_back(0);
    for(int i = 0; i < N; ++i){
        cin >> value;
        A.push_back(value + A[i]);
    }
    for(int i = 0; i < M; ++i){
        cin >> value;
        B.push_back(value + B[i]);
    }

    int ans = 0;
    int i, j;
    i = 0;
    j = M;
    while(i < N + 1){
        if(A[i] > K){
            break;
        }
        while(B[j] > K - A[i]){
            --j;
        }
        ans = max(ans, i + j);
        ++i;
    }

    cout << ans << endl;
    
}

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

signed main(void){
  
  int a,b,c,k; cin >> a >> b >> c >> k;
  if( k <= a ){ cout << k << endl;}
  else if( a < k && k <= a+b ){ 
    cout << a << endl;
  }
  else{
    cout << a-(k-a-b) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include<string>
#include<utility>
#include<iterator>
#include<regex>
#include<math.h>

#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(lli i=0;i<j;i++)
#define rep1(i,j) for(lli i=1;i<=j;i++)
#define rep0d(i,j) for(lli i=j-1;i>=0;i--)
#define MAX 1000000007
typedef struct tree Tree;

using namespace std;

bool cmpf(pair<lli, lli> left, pair<lli, lli> right) {
	return left.first < right.first;
}
bool cmp(pair<lli, lli> left, pair<lli, lli> right) {
	if (left.first != right.first)return left.first < right.first;
	else return left.second < right.second;
}
int main() {
	lli n, temp, sn=0;
	cin >> n;
	temp = n;
	while (temp != 0) {
		sn += temp % 10;
		temp /= 10;
	}
	if (n % sn==0) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main(){
    int n; cin >> n;
    vi tri(5001);
    rep3(i, 1, 5000){
        tri[i] = tri[i-1] + i;
    }
    
    vi ans;
    while(n){
        int i = lower_bound(all(tri), n) - tri.begin(); 
        ans.pb(i);
        n -= i;
    }
    for(auto i : ans) cout << i << endl;
    return;
}

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 3588
package main

import "fmt"

func main() {
	var x, y int
	fmt.Scanf("%d %d", &x, &y)

	add := x + y
	sub := x - y
	mul := x * y

	if add > sub {
		if add > mul {
			fmt.Printf("%d\n", add)
		} else {
			fmt.Printf("%d\n", mul)
		}
	} else {
		if sub > mul {
			fmt.Printf("%d\n", sub)
		} else {
			fmt.Printf("%d\n", mul)
		}
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int l,len,i,j,mid,k,r,n,m;
string s[1001];

int main(){
   cin>>n>>m;
   for(i=1;i<=n;i++)cin>>s[i];
   sort(s+1,s+n+1);
   for(i=1;i<=n;i++)cout<<s[i]; 
   cout<<"\n";  
    return 0;
} 

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

int main(void) {
	char s[101] = {0}, t[101] = {0};
	int cnt = 0;
	
	scanf("%s", &s[0]);
	scanf("%s", &t[0]);
	
	for (int i = 0; i < strlen(s); i++) {
		if (s[0] == t[i]) {
			cnt++;
			for (int j = 1; j < strlen(t); j++) {
				if (s[j] == t[(i+j)%strlen(t)])
					cnt++;
			}
			if (cnt == strlen(s))
				goto end;
			else
				cnt = 0;
		}
	}
	
	end:
	printf(cnt == strlen(s) ? "Yes" : "No");
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n;
    cin >> n;
    vector<ll> d(n), c(n);
    REP(i, n) cin >> d[i] >> c[i];

    ll sum = 0;
    REP(i, n) sum += c[i] * d[i];

    ll ret = (sum-1) / 9;
    REP(i, n) ret += c[i];
    ret--;

    cout << ret << endl;

    return 0;
}

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

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

using ll = long long;

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

int main() {
  int N;
  cin>>N;
  vector<vector<int>> red(N,vector<int>(2));
  vector<vector<int>> blu(N,vector<int>(2));
  for(int i = 0; i < N; i++)cin>>red[i][1]>>red[i][0];
  for(int i = 0; i < N; i++)cin>>blu[i][0]>>blu[i][1];
  sort(blu.begin(),blu.end());
  sort(red.begin(),red.end());
  reverse(red.begin(),red.end());
  int cnt = 0;
  for(int i = 0; i < N; i++){
    for(int j = 0; j < (int)red.size(); j++){
      if(blu[i][0]>red[j][1]&&blu[i][1]>red[j][0]){
        cnt++;
        red.erase(red.begin()+j);
        break;
      }
    }
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
S = input()[::-1]
n = len(S)
count = 0
flag = True

while count<n:
    if S[count:count+5] == "dream"[::-1]:
        count += 5
    elif S[count:count+7] == "dreamer"[::-1]:
        count += 7
    elif S[count:count+5] == "erase"[::-1]:
        count += 5
    elif S[count:count+6] == "eraser"[::-1]:
        count += 6
    else:
        flag = False
        break

print("YES") if flag else print("NO")

Measured memory_bytes: 40560
N, Y = map(int, input().split())
def otoshidama(n,y):
  No = -1
  for b in range(n+1):
    if b == 0:
      total = 10000*n
      if total == y:
        print('{} 0 0'.format(n))
        return
    for a in range(0, b+1):
      total = 1000*a + 5000*(b-a) + 10000*(n-b)
      if total == y:
        print(n-b,b-a,a)
        return
  print('-1 -1 -1')
  return
otoshidama(N,Y)

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


int main() {
    int x,y;
    cin >> x >> y;
    int n = x;
    for(int i = 0;i<=n;i++){
        for(int j = 0; j <= n-i;j++){
            int k = n-i-j;
            if(10000*i + 5000*j + 1000*k == y){
                cout << i << " "  << j <<" " << k << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << "\n";
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
import sys

s = input()

for i in range(len(s)):
    if i%2 == 0:
        if s[i] == "L":
            print("No")
            sys.exit()
            
    else:
        if s[i] == "R":
            print("No")
            sys.exit()
print("Yes")



    
        
      


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,a,b,tt=0,c;
	cin>>a>>b;
	for(i=1;i<=b;i++)
	{
		cin>>c;
		tt+=c;
	}
	if(a>=tt)
		cout<<a-tt;
	else
		cout<<"-1";
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> P;
int n, d[10000], s[10000];
vector<int> v[10000];
long long cal(int x, int y){
    int z;
    long long r = 0;
    for(int i=0;i<v[x].size();i++){
        z = v[x][i];
        if(z != y){
            r += min(d[x], d[z]);
            r += cal(z, x);
        }

    }

    return r;
}
int main(void){
    long long ans;
    int a, b, c[10000];
    priority_queue<P, vector<P>, greater<P> > q;
    cin >> n;
    for(int i=0;i<n-1;i++){
        cin >> a >> b;
        a--;
        b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    for(int i=0;i<n;i++){
        cin >> c[i];
        d[i] = -1;
        s[i] = v[i].size();
        q.push(P(s[i], i));
    }
    sort(c, c+n);
    for(int i=0;i<n;i++){
        int x, y;
        P p;
        do{
            p = q.top();
            q.pop();
            x = p.second;
        }while(d[x] != -1 && !q.empty());

        if(d[x] == -1){
            d[x] = c[i];
            for(int i=0;i<v[x].size();i++){
                y = v[x][i];
                q.push(P(--s[y], y));
            }
        }
    }
    ans = cal(0, -1);
    cout << ans << endl;
    for(int i=0;i<n;i++){
        cout << d[i];
        if(i<n-1)cout << " ";
        else cout << endl;
    }
}


Measured memory_bytes: 1920
n,m = map(int,input().split())
first_list = []
last_lsit = []
for i in range(m):
    a,b = map(int,input().split())
    first_list.append(a)
    last_lsit.append(b)
tmp = min(last_lsit)- max(first_list)+1
if tmp >= 0:
    print(tmp)
else:
    print(0)

Measured memory_bytes: 11020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N, M;
ll a[100005], b[100005];
ll c[100005];
bool flag = true;
int main(){
  cin.sync_with_stdio(false);
  cin >> N >> M;
  for(int i = 0; i < N; i++){
    c[i] = 0;
  }
  for(int i = 0; i < M; i++){
    cin >> a[i] >> b[i];
    c[a[i]] += 1;
    c[b[i]] += 1;

  }

  for(int i = 0; i < N; i++){
    if(c[i] % 2 != 0){
      cout << "NO" << endl;
      flag = false;
      break;
    }
  }
  if(flag){
    cout << "YES" << endl;
  }






}

Measured memory_bytes: 2560
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws IOException {

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	int N = Integer.parseInt(br.readLine());

	switch (N % 10) {
	case 0:
	case 1:
	case 6:
	case 8:
	    System.out.println("pon");
	    break;
	case 3:
	    System.out.println("bon");
	    break;
	default:
	    System.out.println("hon");
	}
    }
}


Measured memory_bytes: 32400
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std; 
int main(){
	int N,H,a=0,b[100000],ans=0;
	scanf("%d%d",&N,&H);
	for(int i=0;i<N;i++){
		scanf("%d",b+i);
		a=max(a,b[i]);
		scanf("%d",b+i);
	}
	vector<int> v;
	for(int i=0;i<N;i++)
		if(b[i]>a)
			v.push_back(b[i]);
	sort(v.begin(),v.end());
	for(int i=v.size()-1;i>=0;i--){
		H-=v[i];
		ans++;
		if(H<=0){
			printf("%d",ans);
			return 0;
		}
	}
	printf("%d",ans+H/a+(bool)(H%a));
}

Measured memory_bytes: 1276
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# define MOD 1000000000+7
# define INF 1000000000
using namespace std;


int main() {
	int n, m;
	cin >> n >> m;
	string s;
	char map[100][100], serch[100][100];
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < 100; j++) {
			map[i][j] = serch[i][j] = 'w';
		}
	}
	for (int i = 0; i < n; i++) {
		cin >> s;
		for (int j = 0; j < n; j++) {
			map[i][j] = s[j];
		}
	}
	for (int i = 0; i < m; i++) {
		cin >> s;
		for (int j = 0; j < m; j++) {
			serch[i][j] = s[j];
		}
	}
	bool ans = false;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			int c = 0;
			for (int h = 0; h < m; h++) {
				for (int w = 0; w < m; w++) {
					if (map[i + h][j + w] == serch[h][w]) {
						c++;
					}
				}
			}
			if (c == m*m) {
				ans = true;
			}
		}
	}
	if (ans) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e16;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll N; cin >> N;
    vl a(N), b(N); ll suma = 0, sumb = 0;
    REP(i, N) {cin >> a[i]; suma += a[i];};
    REP(i, N) {cin >> b[i]; sumb += b[i];};
    ll cnt = sumb - suma;
    if(cnt < 0){
        cout << "No" << endl; return 0;
    }
    
    ll c = 0;
    REP(i, N){
        ll ax = a[i], bx = b[i];
        if(ax - bx > 0){
            c += ax-bx;
            if(c > cnt){
                cout << "No" << endl; return 0;
            }
        }
    }
    
    ll d = cnt-c; // >= 0
    REP(i, N){
        ll v = b[i] - a[i];
        if(v > 0){
            if(v % 2 == 0) continue;
            else{
                d--;
                if(d < 0){
                    cout << "No" << endl; return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 384
#--Echo

N = int(input())
S = list(input())

number = len(S)
harf = int(N / 2)

if(number % 2 != 0):
  print("No")
else:
  if(S[0:harf] == S[harf:N]):
    print("Yes")
  else:
    print("No")



Measured memory_bytes: 2940
#include<bits/stdc++.h>
#include<chrono>
using namespace std;
using namespace std::chrono;
#define int long long int
int gcd(int a,int b){
	if(b==0) return a;
	return gcd(b,a%b);

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

signed main(){

   
    int a,b;
    cin>>a>>b;
    int ans = lcm(a,b);
    int ans1 = gcd(a,b);
    
    if(ans1 == 1){ 
      cout<<a*b;
                 }
    else cout<<ans;

    return 0;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

using ll = long long;
using ull = unsigned long long;

int dp[10001];

int main() {
    int h, n, a, b;
    cin >> h >> n;
    fill(dp, dp + h + 1, INF);
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a >> b;
        for (int j = 0; j <= h; ++j) {
            if (dp[j] < INF) {
                dp[min(j + a, h)] = min(dp[min(j + a, h)], dp[j] + b);
            }
        }
    }
    cout << dp[h] << endl;

    return 0;
}

// 単純なdp

Measured memory_bytes: 256