akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint A, B, K; cin >> A >> B >> K;
    lint num_from_takahashi = min(A, K);
    lint remaining_K = K - num_from_takahashi;
    lint num_from_aoki = min(B, remaining_K);
    cout << A - num_from_takahashi << " " << B - num_from_aoki << "\n";
}

Measured memory_bytes: 256
#include <cassert>
#include <iostream>
#include <functional>
#include <iomanip>
#include <set>
#include <unordered_map>
#include <queue>
#include <vector>
#include <deque>
#include <algorithm>
#include  <cstring>
#include <string>
#include <cmath> 
using namespace std;
typedef long long LL;
const int MAX = 210000;
const LL base = 1e9 + 7;


struct Node {
	int x, y, w;
};

LL dp[410][410];
LL sum[410][410];
LL za[410];
void solve() {

	LL result = 0;
	int n;

	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> za[i];
		sum[i][i] = za[i];
	}
	for (int g = 1; g < n; ++g) {
		for (int i = 0; i < n - g; ++i) {
			int j = i + g;
			sum[i][j] = sum[i + 1][j] + za[i];
			LL r =  dp[i + 1][j];
			for (int t = i; t < j; ++t) {
				LL tr = dp[i][t] + dp[t+1][j];
				r = min(r, tr);
			}
			dp[i][j] = r + sum[i][j];
		}

	}

	result = dp[0][n - 1];
	cout << result << endl;

}

int main() {
	const int inId = 0;
	const int outId = 0;
	if (inId>0) {
		cerr << "redirect stdin to input " << inId << endl;
		string s = "input";
		s += to_string(inId);
		s += ".txt";
		auto r = freopen(s.c_str(), "r", stdin);	
		if (r == nullptr) {
			cerr<< "invalid input file "<< s;
		}
	}
	if (outId>0) {
		cerr << "redirect stdout to stdout " << outId << endl;
		string s = "stdout";
		s += to_string(outId);
		s += ".txt";
		auto r = freopen(s.c_str(), "w", stdout);
		if (r == nullptr) {
			cerr<< "invalid output file "<< s;
		}		
	}
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // close sync between cout and printf
	cout.precision(10);
	solve();
}
 

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

int main(){

    set<int> s;
    rep(i,3){
        int t;
        cin >> t;
        s.insert(t);
    }

    if(s.size()==2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define prique priority_queue
#define Fi first
#define Se second
signed main(){
    int n,m,ans=0;
    cin>>n>>m;
    int l[200000],r[200000];
    vector<int>p(200000,0);
    rep(i,m){
        cin>>l[i]>>r[i];
        p[l[i]]++;
        p[r[i]+1]--;
    }
    for(int i=1;i<=n;i++){
        p[i]+=p[i-1];
        if(p[i]==m)ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4608
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
      	Scanner scan = new Scanner(System.in);
      	String[] nm = scan.nextLine().split(" ");
      	String[] a = scan.nextLine().split(" ");
      	int n = Integer.parseInt(nm[0]);
      	int m = Integer.parseInt(nm[1]);
      	for (int i = 0; i < m; i++) {
      		n -= Integer.parseInt(a[i]);
      	}
      	if (n < 0) {
      		n = -1;
      	}
    	System.out.println(n);
    }
}

Measured memory_bytes: 38904
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class Task {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt(), k = in.nextInt();
            HashSet<Integer> h = new HashSet<>();
            while (k-- > 0) {
                int d = in.nextInt();
                while (d-- > 0) {
                    h.add(in.nextInt());
                }
            }
            out.println(n - h.size());
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 32944
import numpy as np
c = np.array([[int(i) for i in input().split()] for _ in range(3)])
b = np.sum(c) % 3 == 0
b &= np.sum(c[0] - c[1]) % 3 == 0
b &= np.sum(c[0] - c[2]) % 3 == 0
b &= np.sum(c[1] - c[2]) % 3 == 0
c = c.T
b &= np.sum(c[0] - c[1]) % 3 == 0
b &= np.sum(c[0] - c[2]) % 3 == 0
b &= np.sum(c[1] - c[2]) % 3 == 0
print('Yes' if b else 'No')

Measured memory_bytes: 12516
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
import java.util.*;
/**
 *
 * @author arvin
 */
public class Main {
    
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        String s=sc.nextLine();
        String p=sc.nextLine();
        s=' '+s;
        p='1'+p;
        int dp[][]=new int[s.length()][p.length()];
        
        for(int i=1;i<s.length();i++)
        {
            for(int j=1;j<p.length();j++)
            {
                if(s.charAt(i)==p.charAt(j))
                    dp[i][j]=dp[i-1][j-1]+1;
                else
                    dp[i][j]=Math.max(dp[i-1][j],dp[i][j-1]);
                //System.out.print(dp[i][j]+" ");
            }
            //System.out.print("\n");
        }
        int i=s.length()-1;
        int j=p.length()-1;
        String ans="";
        while(i!=0 && j!=0)
        {
            if(dp[i][j]==dp[i-1][j])
                i--;
            else if(dp[i][j]==dp[i][j-1])
                j--;
            else
            {
                ans=s.charAt(i)+ans;
                i--;
                j--;
            }
        }
        System.out.println(ans);
        sc.close();
    }
}


Measured memory_bytes: 86560
n = int(input())
s = list(input())


v = []


stock = 0

for i in s:
    if i=="(":
        stock+=1
        v.append("(")
    else:
        if stock ==0:
            v.insert(0,"(")
            v.append(")")
        else:
            stock -= 1
            v.append(")")

for i in range(stock):
    v.append(")")

print(*v,sep='')


Measured memory_bytes: 3060
with Ada.Text_IO;
with Ada.Integer_Text_IO;
with Ada.Float_Text_IO;
use Ada.Text_IO;
use Ada.Integer_Text_IO;
use Ada.Float_Text_IO;

procedure hoge is
 k: integer;
 x: integer;
begin
 get(k);
 get(x);
 if 500*k>=x then
  put_line("Yes");
 else
  put_line("No");
 end if;
end hoge;

Measured memory_bytes: 3660
import java.util.Scanner;

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

		int count = 0, MAX = 1000000;
		int[] pTable = new int[MAX],sieve = new int[MAX];
		
		pTable[count++] = 2;
		for(int i = 3; i < MAX; i+= 2) {
			if(sieve[i] == 0) {
				pTable[count++] = i;
				for(int j = i * 2; j < MAX; j+= i) sieve[j] = 1;
			}
		}
		
		while(scan.hasNext()) {
			System.out.println(binarySearch(pTable,scan.nextInt(),count - 1));
		}
	}

	static int binarySearch(int[] pTable, int target, int high){
		int low = 0;
		if(target == 0 | target == 1) return 0;
		if(pTable[high] < target ){
			return high + 1;
		}
		while(true){
			int axis  = (high + low)/ 2;
			if(target == pTable[high]) {
				return high + 1;
			} else if(pTable[high - 1] < target & target < pTable[high]) {
				break;
			}
			if(pTable[axis] < target) low = axis;
			else high = axis;
		}
		return high ;
	}
}

Measured memory_bytes: 28612
n,k = map(int,input().split())
mod = 10**9+7

dp = [[0]*(k+1) for i in range(k+1)]
dp[0][0] = 1

for i in range(1,k+1):
    for j in range(1,i+1):
        dp[i][j] = (dp[i-1][j]*(i+j-1)+dp[i-1][j-1]*(n-k-j+2))//i

for i in range(1,k+1):
    print(dp[-1][i]%mod)


Measured memory_bytes: 134128
#include<iostream>

using namespace std;

int main(){
    int l , j = 0,h[20],n,count = 1;
    bool view = false;
    cin >> n;
    while(cin>>l){
        h[j] = l;
        j++;
    }

    for(int i = 1;i< n;i++){
        for(int k = (i-1);k >= 0 ;k--){
            if(h[i] < h[k]){
                view = false;break;
            }else{
                view = true;
            }
        }
        if(view == true)count++;
    }
    printf("%d",count);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Output
template<class T, class S> std::ostream& operator << (std::ostream& os, std::pair<T, S> p)
{
  return os << "(" << p.first << " " << p.second << ")";
}

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::map< T, S > m)
{
  ll i = 0; for (auto p : m){ os << " [" << i << "]" << p.first << "->" << p.second; i++;}
  return os;
}

template<class T> std::ostream& operator <<(std::ostream& os, std::vector< std::vector<T> > vv)
{
  for (auto& vec : vv){ os << vec; }
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll X;
  std::cin >> X;

  const ll N = 1000000;
  std::vector<bool> is_prime(N, true);
  is_prime[0] = false;
  is_prime[1] = false;

  // 素数の判定を行っておく
  for (ll i = 2; i < N; i++) {
    if (!is_prime[i]) continue;
    for (ll j = i * 2; j < N; j += i) {
      is_prime[j] = false;
    }
  }

  ll ans = X;

  // X以上の素数を求めたら, break する
  for (ll i = X; i < N; i++) {
    if (is_prime[i]) {
      ans = i;
      break;
    }
  }

  print(ans);
  return 0;
}


Measured memory_bytes: 384
from sys import stdin
import bisect

n = int(stdin.readline().rstrip())
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]
li.sort(key=lambda x:(x[1],x[0]*(-1)))

hiniti = 0

for i in range(n):
    hiniti += li[i][0]
    if hiniti > li[i][1]:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 72536
import sys
import math

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N, K = map(int, readline().split())
    A = list(map(int, readline().split()))

    if K > max(A):
        print("IMPOSSIBLE")
        exit()

    x = A[0]

    for i in range(1, N):
        x = math.gcd(A[i], x)

    if K % x == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")


if __name__ == '__main__':
    main()


Measured memory_bytes: 18792
// When you are hungry for something and you're determined and you're focused 
// and you're committed to something it's hard to surrender, isn't it?

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define setbit(x) __builtin_popcount(x)
#define fff(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
const long double eps = 1.0e-14;      // allowable error
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio
    
    int n;
    cin >> n;
    
    string s;cin>>s;
    if(n%2==1)
    cout <<"No";
    else {
        for(int i=0;i<(n/2);i++) {
            if(s[i]!=s[(n/2)+i]) {
            cout <<"No";
            return 0;
            }
        }
        cout << "Yes";
    }


	return 0;
    
}

Measured memory_bytes: 8832
# coding: utf-8

def get_pow(target: int, base: int):
    ans = 0
    current = base
    for i in range(1, target + 1):
        if current > target:
            break
        ans = i
        current *= base
    return ans


dic = {}


def get_ans(remain: int):
    if remain in dic:
        return dic[remain]
    if remain < 6:
        return max(0, remain)
    ans = remain

    pos9 = get_pow(remain, 9)
    for i in reversed(range(1, pos9 + 1)):
        ret = get_ans(remain - pow(9, i)) + 1
        ans = min(ans, ret)

    pow6 = get_pow(remain, 6)
    for i in reversed(range(1, pow6 + 1)):
        ret = get_ans(remain - pow(6, i)) + 1
        ans = min(ans, ret)

    dic[remain] = ans
    return ans


n = int(input().rstrip())
print(get_ans(n))


Measured memory_bytes: 6124
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func next() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = nextInt()
	}
	return ints
}

func main() {
	scanner.Split(bufio.ScanWords)

	n := nextInt()
	p := nextInts(n)

	var cnt = 0
	for i := 1; i < n-1; i++ {
		if (p[i-1] < p[i] && p[i] < p[i+1]) || (p[i+1] < p[i] && p[i] < p[i-1]) {
			cnt++
		}
	}

	fmt.Println(cnt)
}


Measured memory_bytes: 640
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {
    string S;
    cin >> S;
    int count = 0;
    for (int i = 0; i < S.length() / 2; i++) {
        if (S[i] != S[S.length() - 1 - i]) count++;
    }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#define ull unsigned  long  long
#define int long long int
#define lld long double
#define endl "\n"
#define S second
#define F first
#define pir      pair<int,int>
#define vtr      vector<int>
#define mpp      map<int,int>
#define pb       push_back
#define popb     pop_back()
#define mk       make_pair
#define stc      set<char>
#define st       set<int>
#define stk      stack<int>
#define ctn      continue
#define MOD      1000000007
#define fr(i,a,b)   for(int i=a;i<b;i++)
#define rfr(i,a,b)  for(int i=a-1;i>=b;i--)
#define must        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int gcd(int a, int b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
int lcm(int a, int b)
 {
    return (a*b)/gcd(a, b);
 }

int myfun(int x,int y)
{
    return x*y;
}
void primeFactors(int n)
{
    while (n%2 == 0)
    {
        cout<<2<<endl;
        n = n/2;
    }
    for (int i = 3; i <= sqrt(n); i = i+2)
    {
        while (n%i == 0)
        {
            cout<<i<<endl;
            n = n/i;
        }
    }
    if (n > 2)
        cout<<n<<endl;
}

void fillPrefixSum(int arr[], int N, int prefixSum[])
{
    prefixSum[0] = arr[0];

    for (int i = 1; i < N; i++)
        prefixSum[i] = prefixSum[i-1] + arr[i];
}

int factorial(int n)
{
    return (n==1 || n==0) ? 1: n * factorial(n - 1);
}

int power(int x,  int y, int p){
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
            y = y>>1;
            x = (x*x) % p;
    }
    return res;
}




void solve()
{
    int n,x,t;
    cin>>n>>x>>t;
    cout<<(int)ceil((double)n/x)*t<<endl;
}



signed main()
{
	must;
    int tt=1;
    //cin >> tt;
	while(tt--)solve();
	return 0;
}


Measured memory_bytes: 3732
#include <iostream>
#include <vector>

using namespace std;
int main()
{
    int N, input;
    cin >> N;
    vector<int> a;
    int res = 0;
    int i = 0;
    while (i++ != N)
    {
        cin >> input;
        a.push_back(input);
    }
    
    for(int i = 0; i < N; ++i)
    {
        if(a[i] % 2 != 0 && (i + 1) % 2 != 0)
        {
            res++;
        }
    }
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 3632
public class Main{
	public static void main(String[] args){
		//
		String input = new java.util.Scanner(System.in).nextLine();
		String[] words = input.split("\\s");
		int a = Integer.parseInt(words[0]);
		int b = Integer.parseInt(words[1]);
		int c = Integer.parseInt(words[2]);
		if( a < b && b < c ){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		//
	}
}

Measured memory_bytes: 26076
n=int(input())
L = list(map(int,input().split()))
#print(L)

ans=0
for i in range(n):
    for j in range(n):
        for k in range(n):
            if i < j and j < k:
                if L[i]+L[j]>L[k] and L[j]+L[k]>L[i] and L[k]+L[i]>L[j]:
                    if L[i]!=L[j] and L[j]!=L[k] and L[k]!=L[i]:
                        ans+=1
                        #print(i,j,k)
print(ans)

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

int64_t A, B, N;

int64_t func(int64_t x) {
    return std::floor(A * x / B) - A * std::floor(x / B);
}

int main() {
    std::cin >> A >> B >> N;
    std::printf("%ld\n", func(std::min(B-1, N)));

    return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(vs) vs.begin(), vs.end()
using ll = long long;
using ii = pair<int, int>;

int32_t main(){
	ios::sync_with_stdio(0);
	int h, w, k;
	cin >> h >> w >> k;
	vector<string> mt(h);
	for(auto &s:mt) cin >> s;
	
	int ans = 0;
	for(int x1=0; x1<(1<<h); ++x1){
		for(int x2=0; x2<(1<<w); ++x2){
			int c = 0;
			for(int i=0; i<h; ++i){
				if(x1&(1<<i)) continue;
				for(int j=0; j<w; ++j){
					if(x2&(1<<j)) continue;
					if(mt[i][j]=='#') ++c;
				}
			}
			if(c==k) ++ans;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3652
import sys
import math
import itertools
import bisect
from copy import copy,deepcopy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(map(int,input().split()))
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

K = i()
if K%2 == 0 or K%5 == 0:
    print(-1)
    exit()
m = 7
for i in range(1,10000000):
    if m%K == 0:
        print(i)
        exit()
    m = (m*10+7)%K
print(K-1)

Measured memory_bytes: 72684
// Aizu Vol-5 0507: Square
// 2017.8.30 bal4u@uu

#include <stdio.h>

int a[31], n;

void combi(int i, int max, int s)
{
	int j;

	if (s >= n) {
		if (s == n) {
			printf("%d", a[0]);
			for (j = 1; j < i; j++) printf(" %d", a[j]);
			putchar('\n');
		}
		return;
	}
	for (j = max; j >= 1; j--) {
		a[i] = j;
		combi(i+1, j, s+j);
	}
}

int main()
{
	while (scanf("%d", &n) && n) combi(0, n, 0);
	return 0;
}

Measured memory_bytes: 600
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt(),T=sc.nextInt(),A=sc.nextInt(),ans=0;
        double min = Double.MAX_VALUE;
        for(int i=0;i<N;i++){
            int a =sc.nextInt();
            double b =Math.abs(A-(T-a*0.006));
            if(b<min){
                ans=i;min=b;
            }
        }
        System.out.println(ans+1);
    }
}

Measured memory_bytes: 25812
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    char X, Y;
    cin >> X >> Y;
    char ans;
    if (X == Y) ans = '=';
    else if (X > Y) ans = '>';
    else ans = '<';
    cout << ans << endl; 
    return 0;
}

Measured memory_bytes: 256
n = int(input())
xyies = [list(map(int,input().split())) for _ in range(n)]
wa = 0
#まず全ての順列を生成します
import itertools
import math
l = [i for i in range(n)]
p = itertools.permutations(l,n)
#距離の和を求めます
for v in p:
    for i in range(n-1):#n個の町の間はn-1個なので
        start = xyies[v[i]]#スタートの座標
        goal = xyies[v[i+1]]#ゴールの座標
        distance_from_i = ((start[0]-goal[0])**2 + (start[1]-goal[1])**2)**(1/2)
        wa += distance_from_i
waa = math.factorial(n)
print(wa/waa)

Measured memory_bytes: 40940
import java.util.*;
public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		long A_hp = sc.nextLong();
		long B_at = sc.nextLong();
		long C_hp = sc.nextLong();
		long D_at = sc.nextLong();
		String ans = "Yes";
		
		while ((A_hp>0)&(C_hp>0)) {
			C_hp=C_hp-B_at;
			if (C_hp>0) {
				A_hp=A_hp-D_at;	
			}
		}

		if (A_hp<=0) {
			ans="No";
		}
		System.out.println(ans);
		//System.out.print(ans);
		

    }
}




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

using namespace std;

const int maxk = 1100;

int n,k,res,T[maxk][maxk],tr,wr;

int main() {
 //   freopen("in.txt","r",stdin);
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n>>k;
     for (int i=0;i<k;i++)
        for (int j=0;j<k;j++) T[i][j]=0;
    for (int i=1;i<=n;i++) {
        int x,y;
        char c;
        cin>>x>>y>>c;
        int val = ((x/k + y/k) % 2) == (c=='W');
      //  cout<<x<<" "<<y<<" "<<c<<" "<<val<<" "<<endl;
        if (val==1) {
            tr++;
            T[x%k][y%k]++;
        } else {
            wr++;
            T[x%k][y%k]--;
        }
       // cout<<x<<" "<<y<<" "<<x%k<<" "<<y%k<<" "<<val<<" "<<T[x%k][y%k]<<endl;
    }
    res=tr;
    //cout<<tr<<" "<<wr<<endl;
    for (int i=0;i<=k;i++)
        for (int j=0;j<=k;j++)
            T[i][j] = T[i][j-1]*(j>0) + T[i-1][j]*(i>0) + T[i][j] - T[i-1][j-1]*((i>0)&&(j>0));
    for (int i=0;i<k;i++)
        for (int j=0;j<k;j++) {
            int diff = T[i][k] + T[k][j] - 2*T[i][j];
            //cout<<T[i][k]<<" "<< T[k][j]<<" "<<T[i][j]<<endl;
            res = max(res,tr-diff);
            res = max(res,wr+diff);
        }
    cout<<res;

}


Measured memory_bytes: 4608
#include <iostream>
#include <string>
#include <vector>

int main()
{
	int N; // num of people
	int K; // num of snack
	std::vector<int> d; 
	std::vector<std::vector<int>> A;
	
	std::cin >> N >> K;

	d.resize(K);
	A.resize(K);
	std::vector<int> sunuke(N, 0);
	for (int i = 0; i < K; i++)
	{
		std::cin >> d[i];
		A[i].resize(d[i]);
		for (int j = 0; j < d[i]; j++)
		{
			std::cin >> A[i][j];
			sunuke[A[i][j]-1] += 1;
		}
	}

	int answer = 0;
	for (int i = 0; i < sunuke.size(); i++)
	{
		if (sunuke[i] == 0)
		{
			answer++;
		}
	}

	std::cout << answer;

	return 0;
}


Measured memory_bytes: 3612
import java.util.Scanner;

class Main{

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

		boolean[] ans = new boolean[31];

		for(int i=0;i<=30;i++){
			ans[i]=false;
		}


		for(int i=1;i<=28;i++){
			ans[scan.nextInt()]=true;
		}
		
		for(int i=1;i<=30;i++){
			if(ans[i]==false){
				System.out.println(i);
			}
		}
			
	}

}

Measured memory_bytes: 17252
n, k = map(int, input().split())
x = [0] * n
for _ in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for i in a:
        x[i-1] += 1
ans = 0
for j in x:
    if j == 0:
        ans += 1
print(ans)

Measured memory_bytes: 9184
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

int main() {
  int N;
  cin >> N;
  vvi nums(10,vi(10,0));
  srep(i,1,N+1) {
    string k = to_string(i);
    nums[k[sz(k)-1]-'0'][k[0]-'0']++;
  }
  ll ans = 0;
  srep(a,1,10) {
    srep(b,1,10) {
      ans += 1ll * nums[a][b] * nums[b][a];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;

typedef long long ll;
// constexpr ll MOD = 998244353;
constexpr ll MOD = 1000000007;

// struct UnionFind {
//     vector<int> par;
    
//     UnionFind(int N): par(N) {
//         for (int i=0;i<N;i++) par[i] = i;
//     }

//     int root(int x) {
//         if (par[x] == x) return x;
//         else return par[x] = root(par[x]);
//     }

//     void unite(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         if (rx == ry) return;
//         par[rx] = ry;
//     }

//     bool same(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         return rx == ry;
//     }
// };

int main(void) {
    ll N;
    cin >> N;
    ll a, b, c;
    if (N%4 == 0) {
        a = N/4*3, b = a, c = a;
    } else if (N<4) { // N != 1
        a = 1;
        b = N/(4-N)*2;
        c = b;
    } else {
        a = N/4;
        ll d;
        do {
            a++;
            d = abs(N-a*4);
            b = N*a/d;
            do {
                b++;
                c = N*a*b/(b*d-N*a);
            } while (N*a*b % (b*d-N*a) != 0 && b<c);
        } while (N*a*b % (b*d-N*a) != 0);
    }
    cout << a << " " << b << " " << c << endl;
#ifdef DEBUG
    double x = (double)4.0/N, y = (double)1.0/a + (double)1.0/b + (double)1.0/c;
    cout << "lhs: " << fixed << setprecision(15) << x << endl;
    cout << "rhs: " << fixed << setprecision(15) << y << endl;
    if (fabs(x-y) > 1e-10) cout << "FALSE" << endl;
    else cout << "TRUE" << endl;
#endif

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try (Scanner sc = new Scanner(System.in)) {
           int d = sc.nextInt();
           int t = sc.nextInt();
		   int s = sc.nextInt(); // minutes
		   
		   String ans = "Yes";

		   if (s*t < d) {
			   ans = "No";
		   }



           System.out.println(ans);

		} catch (Exception e) {
			// TODO: handle exception
		}
	}
}


Measured memory_bytes: 35636
a= int(input())
b = input().split()
count = 0
for i in range(a-1):
    if i >= 1:
        if abs(int(b[i-1])-int(b[i])) < abs(int(b[i-1])-int(b[i+1])) and abs(int(b[i+1])-int(b[i])) < abs(int(b[i-1])-int(b[i+1])):
            count += 1
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    string S,T;cin >> S >> T;
    int ans = 0;
    rep(i,3)if(S[i] == T[i])ans++;
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	long long n;
	cin >> n;

	if (n & 1) {
		cout << "0\n";
	} else {
		long long f = 10;
		long long ans = n / f;
		while (n / f > 0) {
			f *= 5;
			ans += n / f;
		}

		cout << ans << "\n";
	}

	return 0;

}

Measured memory_bytes: 256
import sys

# import re
# import math
# import collections
# import decimal
# import bisect
# import itertools
# import fractions
# import functools
# import copy
# import heapq
# import decimal
# import statistics
# import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 10
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    mat = [[0 for _ in range(10)] for _ in range(10)]

    for i in range(1, n + 1):
        s = str(i)
        ss = int(s[0])
        st = int(s[-1])
        mat[ss][st] += 1

    ans=0
    for i in range(1,10):
        for j in range(1,10):
            ans += mat[i][j]*mat[j][i]

    print(ans)




if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <string>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
i64 mod = 1000000007;
//i64 mod = 998244353;
int int_max = 2147483647;
i64 INF = 1e16;
int max_n = 1e5;

int main(int argc, char **argv) {
    i64 n,m;
    cin >> n >> m;

    priority_queue<P, vector<P>, greater<P>> mp;
    priority_queue<i64> q;

    for (i64 i=0; i<n; ++i) {
        i64 a, b;
        cin >> a >> b;
        mp.push(make_pair(a,b));
    }
    i64 ans{0};
    for (i64 i=1; i<=m; ++i) {
        while (! mp.empty()) {
            P p = mp.top();
            if (p.first <= i) {
                mp.pop();
                q.push(p.second);
            } else {
                break;
            }
        }
        if (q.empty()) continue;
        ans += q.top(); q.pop();
    }

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

Measured memory_bytes: 6620
#include "bits/stdc++.h"
using namespace std;
#include "atcoder/all"
using namespace atcoder;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>istream&operator >>(istream&is,vector<T>&vec){for(T&x:vec)is>>x;return is;}
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
template<class T>inline bool CHMIN(T&a,T b){if(a > b){a = b;return true;}return false;}
template<class T>inline bool CHMAX(T&a,T b){if(a < b){a = b;return true;}return false;}
constexpr int INF = 1e18;

struct UF{
	vector<int>par,sz;
	void init(int n){
		par.resize(n);
		sz.resize(n);
		for(int i=0;i<n;i++){
			par[i]=i;
			sz[i]=1;
		}
	}
	int find(int x){
		return x==par[x]?x:par[x]=find(par[x]);
	}
	void unite(int x,int y){
		x=find(x);y=find(y);
		if(x==y)return;
		sz[x]+=sz[y];
		par[y]=x;
	}
	bool same(int x,int y){
		return find(x)==find(y);
	}
	int size(int x){
		return sz[find(x)];
	}
};

signed main(){
	int N, M;
	cin >> N >> M;
	UF uf;
	uf.init(N);
	REP(i, M) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		uf.unite(a, b);
	}
	set<int>st;
	REP(i, N) st.insert(uf.find(i));
	out(st.size() - 1);
}

Measured memory_bytes: 8396
#include <iostream>
#include <vector>
#include <cstdlib>
#include <math.h>
#include <set>

using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const long long INF = 1LL << 60;

#define MOD 1000000007

int main(){

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

    string res = "NG";

    for(int i = A; i <= B; ++i){
        if(i % K == 0){
            res = "OK";
        }
    }

    cout << res;
    
}

Measured memory_bytes: 3600
#include <iostream>
#include <cstdint>
#include <vector>
#include <cassert>

using namespace std;
typedef int64_t i_t;

void read(i_t& N) {
  cin >> N;
}

int solve(i_t N) {
  if( N == 3 || N == 5 || N == 7 ) {
    return 1;
  }
  return 0;
}

void test() {
  {
    assert(solve(3)==1);
  }
  {
    assert(solve(4)==0);
  }
  {
    assert(solve(7)==1);
  }
  cerr << "OK" << endl;
}

int main() {
  i_t N;
  read(N);
  int ans = solve(N);
  cout << (ans ? "YES" : "NO") << endl;
  //test();

  return 0;
}



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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

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

const int INTINF = int(1e9) + 1;
const LL LLINF = LL(1e18) + 1;
long double eps = 1.0E-14;
#define pow10(n) int(1e##n + n)

void solve()
{
    int K;
    cin >> K;
    if (K % 2 == 0)
    {
        cout << K / 2 * K / 2 << endl;
    }
    else
    {
        cout << (K - 1) / 2 * (K + 1) / 2 << endl;
    }
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}


Measured memory_bytes: 256
import itertools

l = list()
for a in range(0, 5):
    l.append(int(input()))

k = int(input())

com = list(itertools.combinations(l, 2))

for a in range(0, len(com)):
    com[a] = list(com[a])
    com[a] = abs(com[a][0] - com[a][1])

ans = 'Yay!'

for a in com:
    if a > k:
        ans = ':('
        break

print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long hxtype;
typedef pair<int,int> pii;
typedef pair<int,ll > pil;
typedef pair<ll ,int> pli;
typedef pair<ll ,ll > pll;
#define pque priority_queue
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
const int N=200005;

int main(){
	ll a,b=0ll;
	scanf("%lld",&a);
	while(a){
		a>>=1;
		b=b<<1|1ll;
	}
	printf("%lld",b);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int MAXN = 1e5  + 10;
int dp[MAXN];
vector <int> g[MAXN];
bool used[MAXN];


void dfs(int x) {
	used[x] = true;
	for (auto to: g[x]) {
		if (!used[to]) {
			dfs(to);
		}
		dp[x] = max(dp[x], dp[to] + 1);
	}
}

int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= m; i++) {
		int x, y;
		cin >> x >> y;
		g[x].push_back(y);
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (!used[i]) {
			dfs(i);
			ans = max(ans, dp[i]);
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 8192
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	int n,k;
	cin >> n >> k;
	string s;
	cin >> s;

	int cnt=0;
	char bef='r';
	for(int i=0;i<n;i++)
	{
		if(s[i]=='l')
		{
			if(bef==s[i])
				;
			else
				cnt++;
		}
		else
		{
			if(i==n-1)
				cnt++;
			else
			{
				if(s[i+1]==s[i])
					;
				else
					cnt++;
			}
		}
	}
	

	cout << n-(max(1,cnt-2*k)) << endl;





}


Measured memory_bytes: 512
X = list(map(int,input().split()))
A = X[0]
B = X[1]
C = X[2]
K = X[3]
score=[1,0,-1]
max_score = 0
nums = []

if (K>=A):
  max_score += 1*A
if (K>=A+B):
  max_score += 0*B
if (K-A-B>0):
  max_score += (-1)*(K-A-B)

if(A>K):
  max_score += 1*K
  
print(max_score)
  

Measured memory_bytes: 9108
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

    int x[5], k;
    rep(i, 5) cin >> x[i];
    cin >> k;

    bool flag = true;
    rep(i, 4){
        FOR(j, i+1, 5){
            //cout << x[j] - x[i] << endl;
            if( k < x[j] - x[i]) flag = false;
        }
    }

    if(flag) cout << "Yay!" << endl;
    else cout << ":(" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 510000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N;
  Vec(P,string,N,"");
  Vec(Q,lli,N,0);
  rep(i,0,N){
    cin >> P[i] >> Q[i];
  }
  cin >> S;
  rep(i,0,N){
    if(flag)sum+=Q[i];
    else if(S==P[i])flag=1;
  }
  Out(sum);
}

Measured memory_bytes: 256
#include<bits//stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i < n;i++)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
ll n, m, k, y,x, q, w = 1, sum = 0, ans = 0; string s;
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
//fac : 階乗 finv
// テーブルを作る前処理
void COMint() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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;
    }
}

// 二項係数計算
long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long PER(int n, int m) {
    if (n < m) return 0;
    if (n < 0 || m < 0) return 0;
}
vector<vector<int>> Gragh;
int main(void) {
    COMint();
	cin >> n >> k; vector<int> a(n);
	rep(i, n) cin >> a[i];
	sort(ALL(a));
    ll mi = 0, mx = 0;
    for (int i = 1; i <= n; i++) {
        mi += a[i - 1] * COM(n - i, k - 1);
        mi =(mi+ MOD)%MOD;
    }reverse(ALL(a));
    for (int i = 1; i <= n; i++) {
        mx += a[i - 1] * COM(n - i, k - 1);
        mx = (mx+ MOD) %MOD;;
    }
    cout << (mx - mi+MOD) % MOD << endl;
}

Measured memory_bytes: 15636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
	    String S = scanner.next();
	    
	    int x = S.length();
	    String ans="";
	    
	    for(int i=0; i<x; i++) {
	    	ans = ans.concat("x");
	    }
	    System.out.println(ans);
	}

}

Measured memory_bytes: 35304
import java.util.Scanner;

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

		int N = scan.nextInt();
		int[] A = new int[N+1];

		for(int i=2;i<=N;i++) {
			A[i] = scan.nextInt();
		}

		int[] answer = new int[N+1];

		for(int i=1;i<=N;i++) {
			answer[A[i]] += 1;
		}

		for(int i=1;i<=N;i++) {
			System.out.println(answer[i]);
		}

		scan.close();
	}

}


Measured memory_bytes: 61804
/*********************
*  Author: xuziyuan  * 
*********************/

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

LL n,a[200010],dp[200010],lstc[200010],lst[200010];

int main()
{
	cin>>n;
	rep(i,n) cin>>a[i];
	rep(i,200005) lstc[i]=-1;
	rep(i,n)
	{
		if(lstc[a[i]]==-1)
		{
			lstc[a[i]]=i;
			lst[i]=-1;
		}
		else
		{
			lst[i]=lstc[a[i]];
			lstc[a[i]]=i;
		}
	}
	dp[0]=1;
	repn(i,n-1)
	{
		int pos=lst[i];
		if(pos==-1||pos==i-1) dp[i]=dp[i-1];
		else dp[i]=(dp[i-1]+dp[pos])%MOD;
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 6528