akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vector<ll> p(a), q(b), r(c);
    for (int i = 0; i < a; i++) {
        cin >> p[i];
    }
    for (int i = 0; i < b; i++) {
        cin >> q[i];
    }
    for (int i = 0; i < c; i++) {
        cin >> r[i];
    }
    sort(p.rbegin(), p.rend());
    sort(q.rbegin(), q.rend());
    sort(r.rbegin(), r.rend());
    ll ans = 0;
    vector<ll> t;
    for (int i = 0; i < x; i++) {
        t.emplace_back(p[i]);
        ans += p[i];
    }
    for (int i = 0; i < y; i++) {
        t.emplace_back(q[i]);
        ans += q[i];
    }
    sort(t.begin(), t.end());
    for (int i = 0; i < min(x + y, c); i++) {
        if (t[i] < r[i]) {
            ans += r[i] - t[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4852
#include<stdio.h>
#include<vector>
#include<iostream>
#include<algorithm>
#include<iterator>
#include<queue>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

class Graph{
    public:
    typedef struct Edge{
        ll from, to, cost;
        Edge(ll f, ll t, ll c): from(f),to(t),cost(c){}
    } Edge;

    bool isDirected;
    ll INF = 1 << 30;
    ll v; // 頂点数
    std::vector<Edge> edges;  // 辺のリスト
    std::vector<std::vector<std::pair<ll,ll>>> list;  // 隣接リスト
    //std::vector<std::vector<ll>> matrix; // 隣接行列

    Graph(ll n, bool isDirected=false) : isDirected(isDirected) { init(n); }
    void init(ll n){
        v=n;
        edges.clear();
        list.assign(n, std::vector<std::pair<ll,ll>>());
        //matrix.assign(n, std::vector<ll>(n, INF));
    }
    void connect(ll from, ll to){
        con(from, to, 1);
        if(!isDirected) con(to, from, 1);
    }
    void connect(ll from, ll to, ll cost){
        con(from, to, cost);
        if(!isDirected) con(to, from, cost);
    }
    void con(ll from, ll to, ll cost){
        edges.push_back(Edge(from,to,cost));
        list[from].push_back(std::make_pair(to, cost));
        //matrix[from][to] = cost;
    }
};

std::vector<ll> BellmanFord(Graph G, ll start, ll inf){ // 点startから各点への最短経路長
    std::vector<ll> dist(G.v, inf);
    std::vector<bool> negative(G.v, 0);
    dist[start] = 0;

    REP(i, G.v){
        for(auto edge : G.edges){
            if(dist[edge.from]==inf)continue;
            if(dist[edge.to]>dist[edge.from]+edge.cost){
                dist[edge.to] = dist[edge.from] + edge.cost;
            }
        }
    }
    REP(i,G.v){
        for(auto edge : G.edges){
            if(dist[edge.from]==inf)continue;
            if(dist[edge.to] > dist[edge.from]+edge.cost) negative[edge.to]=true;
            if(negative[edge.from]==true)negative[edge.to]=true;
        }
    }
    std::vector<ll> ans = dist;
    REP(i,G.v)if(negative[i]==true) ans[i]=-inf;
    return ans;
}

int main(){
    int v,e,r, s,t,d;
    cin >> v >> e >> r;
    Graph gr(v, true);
    REP(i,e){
        cin >> s >> t >> d;
        gr.connect(s,t,d);
    }
    ll inf = 1<<30;
    std::vector<ll> ans = BellmanFord(gr, r, inf);
    bool negative = false;
    for(auto i : ans) if(i==-inf)negative=true;
    if(negative){cout<< "NEGATIVE CYCLE"<<endl; return 0;}
    for(auto i : ans){
        if(i==inf) cout << "INF" << endl;
        else cout << i << endl;
    }
}


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

using namespace std;

int main(){
    string str;
    cin >> str;
    map<char,int> list;
    for(char i='a';i<='z';i++){
        list[i]=-1;
    }
    bool flag=true;
    for(int i=0;i<str.length();i++){
        if(list[str[i]]!=-1){
            int dis=i-list[str[i]];
            if(dis==1){
                cout << i << " " << i+1 << endl;
                flag=false;
                break;
            }
            else if(dis==2){
                cout << i-1 << " " << i+1 << endl;
                flag=false;
                break;
            }
        }
        list[str[i]]=i;
    }
    if(flag)cout << "-1 -1" << endl;
    return 0;
}


Measured memory_bytes: 512
n, k = map(int, input().split())
x = list(map(int, input().split()))
ans = 10**10
for left in range(n-k+1):
    right = left+k-1
    ans = min(ans, abs(x[left])+abs(x[right]-x[left]), abs(x[right])+abs(x[right]-x[left]))
print(ans)

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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i <= int(r); ++i)
#define ford(i, n) for (int i = int(n)-1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define de(x) cout<<#x<<" = "<<(x)<<endl
#define de2(x,y) cout<<#x<<" = "<<(x) <<' '<< #y<<" = "<<y<<endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());
ll nxt(){ll x;cin>>x;return x;}

const int N=3e3+5;
int dp[N][N];
const int mod=998244353;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	int n,s;
	cin>>n>>s;
	ll ans=0;
	for1(i,n){
		int x;
		cin>>x;
		dp[i][x]=i;
		for(int j=0;j<=s;j++){
			(dp[i][j]+=dp[i-1][j])%=mod;
			if(j-x>=0) (dp[i][j]+=dp[i-1][j-x])%=mod;
		}
		ans=(ans+dp[i][s])%mod;
	}
	cout<<ans;
    return 0;
}



Measured memory_bytes: 35584
from collections import Counter
H, W = map(int, input().split())
count = Counter()
for _ in range(H):
    s = input()
    for j in range(W):
        count[s[j]] += 1
four = int(H/2) * int(W/2)
two = (H%2)*int(W/2) + (W%2)*int(H/2)
one = (H%2) * (W%2)
# print(count)
# print(four, two, one)
for i in range(26):
    alpha = chr(ord("a")+i)
    # 4つ組を使えるかどうか
    while count[alpha] >= 4 and four > 0:
        count[alpha] -= 4
        four -= 1
    while count[alpha] >= 2 and two > 0:
        count[alpha] -= 2
        two -= 1
    while count[alpha] >= 1 and one > 0:
        count[alpha] -= 1
        one -= 1
if four == two == one == 0:
    print("Yes")
else:
    print("No")


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

int main()
{
    int x = -1;
    int i = 1;

    while (true) {
        cin >> x;

        if (x != 0) {
            cout << "Case " << i << ": " << x << endl;
        } else {
            return 0;
        }

        i++;
    }
}

Measured memory_bytes: 1160
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int area = a*b;
		int len = 2 * (a + b);
		System.out.println(area + " " + len);
		
	}

}



Measured memory_bytes: 26116
#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
using namespace std;

int main()
{
	int x, y;
	for (; ;) {
		cin >> x >> y;
		if (x == 0 && y == 0) {
			break;
		}
		else {
			if (x > y) cout << y << " " << x << endl;
			else cout << x << " " << y << endl;
		}
	}
}


Measured memory_bytes: 3068
n, a, b = gets.split.map(&:to_i)
s = gets.chomp.split('')
p = a + b
s.each do |ss|
  if ss == 'c'
    puts 'No'
  elsif ss == 'a'
    if p > 0
      p -= 1
      puts "Yes"
    else
      puts 'No'
    end
  elsif
    if p > 0 && b > 0
      p -= 1
      b -= 1
      puts 'Yes'
    else
      puts "No"
      b -= 1
    end
  end
end


Measured memory_bytes: 9852
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<math.h>

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

using namespace std;

typedef pair<int,int> P;

int n;

P data[10010];

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

void solve() {
	rep(i,10010) data[i]=P(0,0);

	rep(i,n-1) {
		int d,n;
		cin>>n>>d;

		data[i+1] = P(data[n].first+dx[d],data[n].second+dy[d]);
	}
	
	int f_min=1000000,f_max=0;
	int s_min=1000000,s_max=0;

	rep(i,n) {
		f_min=min(f_min,data[i].first);
		f_max=max(f_max,data[i].first);
		s_min=min(s_min,data[i].second);
		s_max=max(s_max,data[i].second);
	}

	printf("%d %d\n",f_max-f_min+1,s_max-s_min+1);

}

int main() {

	while (cin>>n)
	{
		if(n==0) return 0;
		solve();
	}

}

Measured memory_bytes: 1220
/**
 *   
 *   Date: 06 July 2020
 *   Time: 20:18:53
**/
#pragma GCC optimize("03")
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pi;
typedef vector<ll> vec;
typedef vector<vector<ll> > matrix;
ll const mod=1000000007;

int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll t,n,d;
	cin>>n;
	d=n/1000;
	if(d*1000 != n)
		d+=1;
	d*=1000;
	d-=n;
	cout<<d<<endl;

return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;

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

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int x,y;
    cin >> x >> y;
    cout << x + y/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define yes(n) cout << ((n) ? "yes" : "no") << endl

using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;
const vector<int> di = {-1,  0, 1, 0};
const vector<int> dj = { 0, -1, 0, 1};

void chmin(int &a, int b) { if (a > b) a = b; }

ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll LCM(ll a, ll b) {
    ll g = GCD(a, b);
    return a / g * b;
}


int main() {
    int n; cin >> n;
    vector<int> a(n), b(n), c(n-1);
    rep(i, n) {
        cin >> a[i];
        --a[i];
    }
    rep(i, n) cin >> b[i];
    rep(i, n-1) cin >> c[i];
    int sum = 0;
    int pre = 1000;
    rep(i, n) {
        sum += b[a[i]];
        if (i>0 && a[i] == pre + 1) sum += c[a[i-1]];
        pre = a[i];
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int INF = 1 << 20;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main()
{
    int n,m;
    cin >> n >> m;
    int c[m];
    int dp[50010];
    for(int i = 0; i < m; i++){
        cin >> c[i];
    }
    for(int i = 0; i < 50010; i++){
        dp[i] = INF;
    }
    dp[0] = 0;
    for(int i = 0; i < 50010;i++){
        for(int j = 0; j < m; j++){
            if(i+c[j] <= n){
                dp[i+c[j]] = min(dp[i+c[j]],dp[i]+1);
            }
        }
    }
    cout << dp[n] <<endl;
}


Measured memory_bytes: 3300
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define pp pop_back
#define mp make_pair
#define ff first
#define ss second
#define maxn 1000000007
#define PI 3.14159265358979323846
#define MAX 1000007 
using namespace std; 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
    //cout<<fixed<<setprecision(20);
    ll n,m;
    cin>>n>>m;
    ll a[m][2];
    for (int i = 0; i < m; ++i)
    {
        cin>>a[i][0]>>a[i][1];
    }
    ll c=a[0][0],d=a[0][1];
    for (int i = 1; i < m; ++i)
    {
        c=max(a[i][0],c);
        d=min(a[i][1],d);
    }
    if(c>d)
    {
        cout<<0<<endl;
        return 0;
    }
    cout<<d-c+1<<endl;
    return 0;
}

Measured memory_bytes: 1792
n = int(input())

a = list(map(int, input().split()))

res = 0
cnt = 1

for n in range(1, len(a)):
  if a[n-1] == a[n]:
    cnt += 1
  else:
    res += cnt//2
    cnt = 1
else:
  res += cnt//2

print(res)


Measured memory_bytes: 3060
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


public class Main{
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int pass = 0;
		while(sc.hasNextLine()) {
			String line = sc.nextLine();
			if(line.equals("end")) break;
			pass += sumAll(line);
		}
		System.out.println(pass);
		sc.close();
	}
	
	static int sumAll(String str) {
		List<Integer> begin = new ArrayList<Integer>();
		List<Integer> end = new ArrayList<Integer>();
		
		boolean c = false;
		for(int i = 0; i < str.length(); i++) {
			if(isNum(str.charAt(i))) {
				if(!c) {
					begin.add(i);
					c = true;
				}
			}else {
				if(c) {
					end.add(i);
					c = false;
				}
			}
			if(i == str.length() - 1) {
				if(c) end.add(i+1);
			}
		}
		
		int result = 0;
		for(int i = 0; i < begin.size(); i++) {
			result += Integer.parseInt(str.substring(begin.get(i), end.get(i)));
		}
		return result;
	}
	
	static boolean isNum(char c) {
		if('0' <= c && c <= '9') return true;
		else return false;
	}
}

Measured memory_bytes: 26188
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;

class Program
{
	const int mod = 1000000007;
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		int ans = 0;

		int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int type = A.Distinct().Count();
		if (type % 2 == 0) { ans = type - 1; }
		else { ans = type; }
        
		Console.WriteLine(ans);

	}
}

Measured memory_bytes: 22112
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int n,m;
  cin>>n>>m;
  cout<<n-m+1<<endl;

  return 0;
}


Measured memory_bytes: 764
import itertools
n,m=map(int,input().split())
graph=[[False for h in range(n)] for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    a-=1;b-=1
    graph[a][b]=True
    graph[b][a]=True
l=[i for i in range(1,n)]
ans=0
if n==2:
    print(m)
    exit()
for v in itertools.permutations(l):
    flag=1
    if graph[0][v[0]]==False:continue
    else:
        c=v[0]
        for j in v[1:]:
            if graph[c][j]==False:
                flag=0
                break
            c=j
        ans+=flag
print(ans)


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

const ll MOD  = 998244353;
const int MAX_N = 200010;
int N, K;
ll bit[MAX_N];

ll sum (int i){
    ll s = 0;
    while(i > 0){
        s = (s + bit[i]) % MOD;
        i -= i & -i;
    }
    return s;
}

void add (int i, ll x){
    while(i <= N){
        bit[i] = (bit[i] + x) % MOD;
        i += i & -i;
    }
}

int main(){
    int L[12], R[12];
    cin >> N >> K;
    for (int i = 0; i < K; ++i){
        cin >> L[i] >> R[i];
    }

    for (int i = 1; i < N; ++i){
        ll s = 0;
        for (int j = 0; j < K; ++j){
            s = ( s + sum( max(0, i-L[j]) )) % MOD;
            s = ( s - sum( max(0, i-R[j]-1))) % MOD;
            if (L[j] <= i && i <= R[j]) {
                s = (s + 1) % MOD;
            }
        }
        add(i, (s + MOD) % MOD);
    }

    ll ans = sum(N-1) - sum(N-2);
    ans = ans % MOD;
    ans = ans + MOD;
    ans = ans % MOD;
    cout << ans << endl;
}


Measured memory_bytes: 5204
#include<bits/stdc++.h>
#define FOR0(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define FORl(i,l,n) for(ll i=l;i<n;i++)
using namespace std;
#define pi pair<ll,ll>
#define pb push_back
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<ll>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e14
ll power(ll num,ll g,ll mod){
  if(g==0)return 1;
  if(g%2==1)return (num*power((num*num)%mod,g/2,mod))%mod;
  return power((num*num)%mod,g/2,mod);
}

int main(){
	int n,a,b;
	int dp[2005][2005];
	int mat[2005][2005];

	cin>>n>>a>>b;
	memset(dp,0,sizeof(dp));
	memset(mat,0,sizeof(mat));
	for(int i=1;i<n;i++)
	{
		mat[i][i+1]=1;
		mat[i+1][i]=1;
	}
	mat[a][b]=1;
	mat[b][a]=1;
	for(int i=1;i<n;i++)
	{
		dp[i][i+1]=1;
		dp[i+1][i]=1;
		for(int j=i+2;j<=n;j++)
		{
			dp[i][j]=dp[i][j-1]+1;
			dp[j][i]=dp[i][j];
		}
	}

	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			dp[i][j]=min(dp[i][j],dp[i][a]+dp[b][j]+1);
			dp[i][j]=min(dp[i][j],dp[i][b]+dp[j][a]+1);
		}
	}
	int ans[n+5]={0};
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			ans[dp[i][j]]++;
		}
	}
	for(int i=1;i<n;i++)
	{
		cout<<ans[i]<<endl;
	}

}

Measured memory_bytes: 31616
import java.util.Scanner;

public class Main {

    private Scanner in = new Scanner(System.in);

    void solve() {
        for(int i = 0; i < 3; i++){
            System.out.print(in.nextLine().charAt(i));
        }
      System.out.println();
    }
    public static void main(String[] args) {
        new Main().solve();
    }
}


Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<map>
#include<numeric>
//#include <bits/stdc++.h>
#include<cstring>
#include<iostream>
#include<functional>
using namespace std;
int main() {
	int N, A;
	cin >> N >> A;
	cout << (N * N - A) << endl;
	//cin >> A;
	return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ASC(x) sort(ALL((x)))
#define DESC(x) sort(ALL((x)),greater<ll>())
#define pb push_back

int main()
{
    ll X;
    cin >> X;

    bool f = false;
    REP(A,-200,201) {
        REP(B,-200,201) {
            if(A*A*A*A*A - B*B*B*B*B == X) {
                PS(A); PR(B);
                f = true;
                break;
            }
        }
        if(f) break;
    }

    return 0;
}

/*



*/

Measured memory_bytes: 3636
#[allow(unused_macros)]
macro_rules! input_byline {
    ($($r:tt)* ) => {
        let stdin = std::io::stdin();
        let mut q = std::collections::VecDeque::new();
        let mut next = || {
            if q.is_empty() {
                let mut s = String::new();
                stdin.read_line(&mut s);
                for v in s.split_whitespace() {
                    q.push_back(v.to_string());
                }
            }
            q.pop_front().unwrap()
        };
        input_inner!{next, $($r)*}
    };

}

#[allow(unused_macros)]
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

trait Printable {
    fn p(&self);
}

impl<T: std::fmt::Display> Printable for T {
    fn p(&self) {
        println!("{}", self);
    }
}

impl<T: std::fmt::Display> Printable for [T] {
    fn p(&self) {
        for i in 0..self.len() {
            if i != 0 {
                print!(" ");
            }
            print!("{}", self[i]);
        }
        println!("");
    }
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;

fn main() {
    input! {
        n: usize,
        a: [usize; n],
        b: [usize; n],
        c: [usize; n-1],
    }

    let mut sum = b.iter().sum::<usize>();
    for i in 0..n - 1 {
        if a[i] + 1 == a[i + 1] {
            sum += c[a[i] - 1];
        }
    }
    println!("{}", sum);
}


Measured memory_bytes: 4352
import java.awt.*;
import java.awt.geom.*;
import java.io.*;

import java.util.*;
class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] list = new int[3];
		for(int i = 0; i < 3; i++) {
			list[i] = sc.nextInt();
		}
		Arrays.sort(list);
		System.out.print(list[0]);
		for(int i = 1; i < 3; i++) {
			System.out.print(" " + list[i]);
		}
		System.out.println();
	}
}

Measured memory_bytes: 17304
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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


	int X;
	cin >> X;

	int k = X / 100 * 5;
	co(X % 100 <= k);




	Would you please return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define clr(x,i) memset(x,i,sizeof(x))
using namespace std;
const int N=3005,mod=998244353;
inline int read()
{
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9') {x=x*10+ch-'0',ch=getchar();}
    return x*f;
}
int n,m,a[N];
unsigned int f[N][N][3];
inline void add(unsigned int &x,unsigned int y)
{
	x+=y; while(x>=mod) x-=mod;
}
int main()
{
	n=read(); m=read();
	for(int i=1; i<=n; i++) a[i]=read();
	f[0][0][0]=1;
	for(int i=1; i<=n; i++){
		for(int j=0; j<=m; j++){
			add(f[i][j][0], f[i-1][j][0]);
			add(f[i][j][1], f[i-1][j][0]+f[i-1][j][1]);
			add(f[i][j][2], f[i-1][j][0]+f[i-1][j][1]+f[i-1][j][2]);
			if(j>=a[i]){
				add(f[i][j][1], f[i-1][j-a[i]][0]+f[i-1][j-a[i]][1]);
				add(f[i][j][2], f[i-1][j-a[i]][0]+f[i-1][j-a[i]][1]);
			}
		}
	}
	printf("%d\n",f[n][m][2]);
	return 0;
}

Measured memory_bytes: 105856
// I need some holiday
// But I don't wish that everyday is holiday
// Because I didn't bear the pain
// Because it wasn't a true freedom
//         ——『イヤホンと蝉時雨』·Orangestar

#include <bits/stdc++.h>

using namespace std;

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

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define MP make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline int chkmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline int chkmax(T &a, const T &b) { return b > a ? a = b, 1 : 0; }
template<typename T> inline T sqr(const T &val) { return val * val; }

namespace fastIO
{
	const int MAX_BUFFER_SIZE = 1 << 16;

	char buffer[MAX_BUFFER_SIZE], *cur = buffer, *ed = buffer;

	inline char getc() { return cur == ed && (ed = (cur = buffer) + fread(buffer, 1, MAX_BUFFER_SIZE, stdin), cur == ed) ? EOF : *cur++; }
}
using fastIO::getc;

template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getc());
	for(; !isdigit(ch); ch = getc()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getc()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

inline char *read_str(char *s)
{
	register char ch(getc());
	while(!isgraph(ch)) ch = getc();
	for(; isgraph(ch); ch = getc()) *s++ = ch;
	*s = '\0';
	return s;
}

// END tpl.

const int MAXN = (int) 5e3;

int n, K;

char s[MAXN * 2 + 5];

inline void input()
{
	n = read<int>(), K = read<int>();
	read_str(s + 1);
}

inline void solve()
{
	char mn = *min_element(s + 1, s + n + 1);
	for(int i = 1; i <= n; ++i) s[n + i] = s[i];
	reverse(s + n + 1, s + 2 * n + 1);

	for(int i = 1, j; i <= n; i = j)
	{
		if(s[i] != mn) { j = ++i; continue; }
		for(j = i; j <= n && s[j] == mn; ++j);
		if(K > 30 || (j - i) * (1 << (K - (j <= n))) >= n)
		{
			for(int k = 0; k < n; ++k) putchar(mn);
			puts("");
			return;
		}
	}

	string ans;
	for(int i = 1; i <= n; ++i) ans += s[i];
	for(int i = 1; i <= n + 1; ++i)
	{
		int r = i + n - 1;
		if(s[r] == mn)
		{
			int cnt = 0;
			while(cnt < n && s[r - cnt] == mn) ++cnt;

			string res = "";
			int len = n;
			for(int k = 0; k < cnt * (1 << (K - 1)); ++k) res += mn, --len;
			for(int k = r - cnt; len > 0; --k, --len) res += s[k];
			chkmin(ans, res);
		}
	}
	printf("%s\n", ans.c_str());
}

int main()
{
#ifdef K_ON
	freopen("E.in", "r", stdin);
	freopen("E.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}




Measured memory_bytes: 256
using System;

class Program
{
    static int N;
    static int[] L;

    static void Main(string[] args)
    {
        Console.Write(BBQEasy());
    }

    private static string BBQEasy()
    {
        readData();

        return UseGuzai().ToString();
    }

    /// <summary>
    /// データを読み込む
    /// </summary>
    private static void readData()
    {
        string[] line = Console.ReadLine().Split(' ');

        N = int.Parse(line[0]);

        line = Console.ReadLine().Split(' ');

        L = new int[2*N];

        for (int i = 0; i < line.Length; i++)
        {
            L[i] = int.Parse(line[i]);
        }
    }

    private static int UseGuzai()
    {

        Array.Sort(L);

        int sum = 0;

        for (int i = 0; i < L.Length; i+=2)
        {
            sum += L[i];
        }

        return sum;
    }
}



Measured memory_bytes: 13140
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        var sw = Console.ReadLine().Split().Select(int.Parse).ToArray();

        Console.WriteLine(sw[0] <= sw[1] ? "unsafe" : "safe");
    }
}

Measured memory_bytes: 28000
///cREATED bY BERNARB.01
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef priority_queue<int,vector<int>,greater<int>> pqil;
typedef priority_queue<int> pqig;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef priority_queue<pii> pqiig;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<int, int> mii;
#define mid ((l+r)/2)
#define PB push_back
#define PP pop_back
#define PF push_front
#define DF pop_front
#define F first
#define S second
#define MP make_pair
#define C continue
#define B break
#define R return
#define sz(v) (int)(v).size()
#define len(s) (int)(s).length()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define clr(arr, x) memset((arr), (x), sizeof (arr))
#define loop(n) for(int i=0; i<(n); i++)
#define lop(a, n) for(int i=(a); i<(n); i++)
#define jloop(n) for(ll j=0; j<(n); j++)
#define rloop(n) for(ll i=(n)-1; i>=0; i--)
#define sgm(y) (((y)*((y)+1))/2)
const ll INF = 2e17+423;
const ll mod = 1e9+7; //998244353;
const ld pi = acos(-1.0);
const ld cmpf = 1e-9;
//__int128_t
//      -ASCII-
//a -> z | A -> Z | 0 -> 9
//97 122 | 65  90 | 48  57
#define endl '\n'
ll po(ll,ll);















int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, ans = 0;
  string s;
  cin >> n >> s;
  loop(n-2) if(s.substr(i, 3)=="ABC") ans++;
  cout << ans << endl;
  R 0;
}
/*

*/




























































ll po(ll x, ll n){
  if(n==0) R 1;
  ll y = po(x, n/2);
  y = ((y)*(y));
  if(n%2) y = (y*(x));
  R y;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long N;
    cin >>N;
    vector<long long>vec(N);
    for(int i=0;i<N;i++){
        cin >>vec.at(i);
    }
    long long count =0;
    long long ki=vec.at(0);
    for(int i=0;i<N;i++){
       if(ki<vec.at(i)){
          ki=vec.at(i);
          continue;
       }
       else {
           count+=ki-vec.at(i);
       }
    }
    cout <<count <<endl;
}

Measured memory_bytes: 4760
#include <bits/stdc++.h>
using namespace std;
 
typedef long long               ll;
typedef long double             ld;
 
 
#define racecar          ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time_start		 time_t start, end; time(&start); 
#define time_end		 time(&end);double time_taken=double(end-start);cout <<"\n"<< time_taken*1000<<" ms";
#define si(a)            scanf("%d", &a)
#define si2(a,b)         scanf("%d %d", &a,&b)
#define sll(a)           scanf("%I64d",&a)
#define sll2(a,b)        scanf("%I64d %I64d",&a,&b)
#define pb               push_back
#define pi(a)            printf("%d",int(a))
#define pll(a)           printf("%I64d",ll(a))
#define all(x)           (x).begin(),(x).end()
#define rall(x)          (x).rbegin(),(x).rend()
#define ps               printf(" ")
#define nln              printf("\n")
#define ff               first
#define ss               second
#define vi               vector<int>
#define vll              vector<ll>
#define vstr             vector<string>
#define vc               vector<char>
#define pii              pair<int,int>
#define PLL              pair<ll,ll>
#define PI               acos(-1)
#define sq(x)            x*x
#define forr(i,a,b)      for(ll i=ll(a);i<ll(b);i++)
#define forn(i,a,b)      for(ll i=ll(a);i>ll(b);i--)
#define max3(a,b,c)      max(a,max(b,c))
#define max4(a,b,c,d)    max(max3(a,b,c),d)
#define min3(a,b,c)      min(a,min(b,c))
#define mod              1000000007
#define inf              9223372036854775807

///knight moves:
///int dx[] = {-2, -1, 1, 2, -2, -1, 1, 2}; 
///int dy[] = {-1, -2, -2, -1, 1, 2, 2, 1};

 
ll power(ll b,ll n)
{
    if(n==0) return 1;
    else if(n%2) return b*power(b,n/2)*power(b,n/2);
    else return power(b,n/2)*power(b,n/2);
}
 
ld root(ll n,ll r)
{
    ld dif=0.0001;
    ld guess=n/2.0;
    while(abs(pow(guess,r)-n)>=dif)
    {
        ld temp=pow(guess,r)-n;
        ld tmp=r*pow(guess,r-1);
        guess-=temp/tmp;
    }
    return guess;
}
 
void fileio()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}

ll fact(ll n)
{
	if(n==0 || n==1) return 1;
	ll temp=1;
	forr(i,1,n+1) temp*=i;
	return temp;
}



int solve()
{
	ll n;
	sll(n);

	ll four=0;
	ll two=0;
	ll one=0;
	
	forr(i,0,n)
	{
		ll x;
		sll(x);
		if(x%4==0) four++;
		else if(x%2==0) two++;
		else one++;
	}
	
	if(two>=2)
	{
		if(four>=one) printf("Yes");
		else printf("No");
	}
	
	else if(two==1)
	{
		if(four==0) printf("No");
		else if(four>=one) printf("Yes");
		else printf("No");
	}
	
	else
	{
		if(four>=one-1) printf("Yes");
		else printf("No");
	}
		
	
    		
   	return 0;
}
	
 
int main()
{

//    racecar;
//    cout<<fixed<<setprecision(6);
//    fileio();
    solve();

}

 
 
///    Before submission=>
///    ***check for integer overflow,array bounds
///    ***check for n


Measured memory_bytes: 256
c = []
3.times do
    c << gets.chomp.split.map(&:to_i)
end
a=[0,0,0]
b=[0,0,0]
b[0] = c[0][0]
b[1] = c[0][1]
b[2] = c[0][2]
a[1] = c[1][0] - b[0]
a[2] = c[2][0] - b[0]

for i in 0..2
    for j in 0..2
        if c[i][j] != a[i] + b[j]
            puts 'No'
            exit
        end
    end
end 

puts 'Yes'

Measured memory_bytes: 1788
import math

n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]

sum = 0
for i in range(n):
    for j in range(i+1, n):
        sum += math.sqrt((l[i][0]-l[j][0])**2 + (l[i][1]-l[j][1])**2)

ans = sum*2/n

print(ans)

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

using namespace std;
typedef long long ll;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define each(i,mp) for(auto& i:mp)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

int main(){

  ll n,k;cin>>n>>k;
  map<ll,ll>mp;
  rep(i,0,k){
    ll d;cin>>d;
    rep(j,0,d){
      ll a;cin>>a;
      mp[a]++;
    }
  }

  out(n-mp.size());

  return 0;
}


Measured memory_bytes: 3636
//I am so vegetable
//#define err
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB push_back
#define IN insert
#define ER erase
#define CT count
#define EP empty
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const double eps = 1e-6;
const double pi = acos(-1.0);
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; }return ans; }
ll qpow(ll x, ll y, int MOD) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans = ans*x%MOD; x = x*x%MOD; }return ans; }
void exgcd(ll a,ll b,ll &x,ll &y){
    if(!b){x=1;y=0;return;}
    exgcd(b,a%b,x,y);
    ll X=x;
    x=y; y=X-a/b*y;
}
ll inv(ll x, int mod = MOD) { return qpow(x, mod - 2) % mod; }
ll m_m(ll a){ return (a%MOD+MOD)%MOD; }


int main() {
	//ofstream cout("E:\\acm dream\\out.txt",ios::out);
	FIO;
    #ifdef err
	double be = clock();
    #endif
    int ans  =0;
    string a,b;cin>>a>>b;
    _for(i,0,a.size()){
        if(a[i]!=b[i])++ans;
    }
    cout<<ans;
    #ifdef err
	double en = clock();
    cout<<"time: "<<fixed<<setprecision(8)<<en-be;
    #endif
	return 0;
}

Measured memory_bytes: 3812
#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main(void){
  char b[3][3];
  char tmp;
  char ret;
  string str;

  while(getline(cin,str)){
    istringstream iss(str);

    for(int i=0;i<3;i++){
      for(int j=0;j<3;j++){
	iss >> tmp;
	b[i][j] = tmp;
      }
    }
    
    if(b[0][0] == b[0][1] && b[0][1] == b[0][2] && b[0][0] != 's'){
      ret = b[0][0];
    }else if(b[1][0] == b[1][1] && b[1][1] == b[1][2] && b[1][0] != 's'){
      ret = b[1][0];
    }else if(b[2][0] == b[2][1] && b[2][1] == b[2][2] && b[2][0] != 's'){
      ret = b[2][0];
    }else if(b[0][0] == b[1][0] && b[1][0] == b[2][0] && b[0][0] != 's'){
      ret = b[0][0];
    }else if(b[0][1] == b[1][1] && b[1][1] == b[2][1] && b[0][1] != 's'){
      ret = b[0][1];
    }else if(b[0][2] == b[1][2] && b[1][2] == b[2][2] && b[0][2] != 's'){
      ret = b[0][2];
    }else if(b[0][0] == b[1][1] && b[1][1] == b[2][2] && b[0][0] != 's'){
      ret = b[0][0];
    }else if(b[0][2] == b[1][1] && b[1][1] == b[2][0] && b[0][2] != 's'){
      ret = b[0][2];
    }else{
      ret = 'd';
    }
    cout << ret << endl;
  }
}

Measured memory_bytes: 0
import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc =  new Scanner(System.in);
    String[] S = sc.nextLine().split(" ");
    int N = Integer.parseInt(S[0]);
    int K = Integer.parseInt(S[1]);
    if(N>=K){
      System.out.println(0);
      return;
    }
    
    List<Integer> list1 = new ArrayList<>();
    String[] T = sc.nextLine().split(" ");
    for(int i = 0; i < K; i++){
      list1.add(Integer.parseInt(T[i]));
    }
    Collections.sort(list1);
    
    List<Integer> list2 = new ArrayList<>();
    int ans = 0;
    for(int i = 0; i < K-1; i++){
      int n = list1.get(i+1)-list1.get(i);
      list2.add(n);
      ans += n;
    }
    Collections.sort(list2, Collections.reverseOrder());
    
    for(int i = 0; i < N-1 && list2.size() > 0; i++){
      ans -=  list2.get(i);
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 48780
#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	int ans=0;
	for(int i=1;i<n;i++){
		int cnt=0;
		for(char c='a';c<='z';c++){
			bool left=0,right=0;
			for(int j=0;j<i;j++)
				if(s[j]==c){
					left=1;
					break;
				}
			for(int j=i;j<n;j++)
				if(s[j]==c){
					right=1;
					break;
				}
			if(left&&right)
				cnt++;
		}
		if(ans<cnt)
			ans=cnt;
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const ll INF=1e9;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,n){cout<<arr[i][j]<<" ";}cout<<endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    string s;
    cin>>s;
    n=s.length();
    bool flag = true;
    rep(i,n){
        if(i%2==0){
            if(s[i]==*"L"){
                flag =false;
            }
        }else{
            if(s[i]==*"R"){
                flag =false;
            }
        }

    }
    Yes(flag);
    return  0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();

    if (a * b > c * d) {
      System.out.println(a * b);
    } else {
      System.out.println(c * d);
    }
  }
}


Measured memory_bytes: 21844
red,green,blue = list(map(int,input().split()))
K = int(input())

while red >= green and K > 0:
  green = green * 2
  K -= 1
  

while green >= blue and K > 0:
  blue = blue * 2
  K -= 1
  
if red < green and blue > green:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 61804
#!/usr/bin/env python3
import sys
from collections import deque
INF = float("inf")


# 有効グラフを仮定する。
class Graph(object):
    def __init__(self, N):
        self.N = N
        self.V = list(range(N))
        self.E = [[] for _ in range(N)]

    def add_edge(self, edge):
        """辺を加える。edgeは(始点, 終点、重み)からなるリスト
        重みがなければ、重み1とする。
        """
        if len(edge) == 2:
            edge.append(1)
        elif len(edge) != 3:
            print("error in add_edge")
            pass

        s, t, w = edge
        self.E[s].append([t, w])

        pass


def BellmanFord(g: Graph, s):
    """ベルマンフォード法による最短経路
    """
    N = g.N
    dist = [INF]*N
    dist[s] = 0
    prev = [None]*N

    # 辺の緩和
    for _ in range(N):
        for from_ in range(N):      # ここの２重ループはO(M)
            for to_, weight in g.E[from_]:
                if dist[to_] > dist[from_] + weight:
                    dist[to_] = dist[from_] + weight
                    prev[to_] = from_
    # 負の重みの閉路がないかチェック
    for from_ in range(N):
        for to_, weight in g.E[from_]:
            if dist[from_]+weight < dist[to_]:
                return None, None

    return dist, prev


def solve(N: int, M: int, P: int, A: "List[int]", B: "List[int]", C: "List[int]"):
    for i in range(M):
        C[i] = P - C[i]

    rev_g = Graph(N)
    for a, b, c in zip(A, B, C):
        rev_g.add_edge([b-1, a-1, c])

    # Nに到達できないノードは除く
    visitable = [False]*N
    visitable[N-1] = True
    q = deque()
    q.append(N-1)
    while len(q) > 0:
        curr = q.popleft()
        for t_, w in rev_g.E[curr]:
            if not visitable[t_]:
                visitable[t_] = True
                q.append(t_)

    g = Graph(N)
    for a, b, c in zip(A, B, C):
        if visitable[a-1] and visitable[b-1]:
            g.add_edge([a-1, b-1, c])

    dist, prev = BellmanFord(g, 0)
    if dist is None:
        print(-1)
    else:
        print(max(-dist[-1], 0))

    # print(longest)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    P = int(next(tokens))  # type: int
    A = [int()] * (M)  # type: "List[int]"
    B = [int()] * (M)  # type: "List[int]"
    C = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
        C[i] = int(next(tokens))
    solve(N, M, P, A, B, C)


if __name__ == '__main__':
    main()


Measured memory_bytes: 53468
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
  ll n;
  cin >> n;
  vi h(n);
  ll top = 0;
  ll count = 0;
  rep(i, n){
    cin >> h[i];
    if(h[i]>=top){
      count++;
    }
    chmax(top, h[i]);
  }
  print(count);
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)

int H, A[MAX + 1];


void maxHeap(int i) {
	int l, r, large;
	l = 2 * i;
	r = 2 * i + 1;

	if (l <= H&&A[l] > A[i]) {
		large = l;
	}
	else {
		large = i;
	}
	if (r <= H&&A[r] > A[large]) {
		large = r;
	}
	if (large != i) {
		swap(A[large], A[i]);
		maxHeap(large);
	}
}

int extract() {
	int maxv;
	if (H < 1) return -INFTY;
	maxv = A[1];
	A[1] = A[H--];
	maxHeap(1);
	return maxv;
}
void increasekey(int i, int key) {
	if (key < A[i]) return;
	A[i] = key;
	while (i > 1 && A[i / 2] < A[i]) {
		swap(A[i], A[i / 2]);
		i = i / 2;
	}
}

int insert(int key) {
	H++;
	A[H] = -INFTY;
	increasekey(H, key);
}

int main()
{
	int key;
	char com[10];
	while (1) {
		cin >> com;
		if (com[0]=='e'&&com[1]=='n') break;
		if (com[0] == 'i') {
			cin >> key;
			insert(key);
		}
		else {
			cout << extract()<<endl;
		}
	}
    return 0;
}

Measured memory_bytes: 6932
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<long long,long long> pll;

int main() {
    fastIO;
    int x, k;
    cin >> k >> x;
    for(int i = x-k+1; i <= x+k-1; i++){
        if(i != x+k-1) cout << i << " ";
        else cout << i << endl;
    }
    return 0;
}



Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  cin>>a[i];
  int dp[n];
  dp[0]=0;
  dp[1]=abs(a[1]-a[0]);
  for(int i=2;i<n;i++)
  {
    dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
  }
  cout<<dp[n-1]<<endl;
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  if (N % 2 == 0) {
    cout << 0.5 << endl;
  }
  else {
    double x;
    x = (N + 1) / 2.0 / N;
    cout << x << endl;
  }

}

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

int main()
{
  int N;
  cin >>N;
  
  int nAC=0;
  int nWA=0;
  int nTL=0;
  int nRE=0;
  
  for(int i=0;i<N;i++)
  {
    string s;
    cin >> s;
    if(s[0]=='A'){nAC++;}
    if(s[0]=='W'){nWA++;}
    if(s[0]=='T'){nTL++;}
    if(s[0]=='R'){nRE++;}
  }
  
  cout << "AC x " << nAC << endl;
  cout << "WA x " << nWA << endl;
  cout << "TLE x " << nTL << endl;
  cout << "RE x " << nRE << endl;
    
      
      return 0;
  
  
}

Measured memory_bytes: 3620
import java.util.*;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		String s=sc.next();
		
		if(a>=3200){
			System.out.println(s);
		}
		else{
			System.out.println("red");
		}
	}
}

Measured memory_bytes: 19796