akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;

using namespace std;

bool od(char a)
{
    if(a == 'R' || a == 'U' || a == 'D')
        return 1;
    return 0;    
}

bool ev(char a)
{
    if(a == 'L' || a == 'U' || a == 'D')
        return 1;
    return 0;    
}

int main()
{
   FAST/**/
   
   string s;
   cin>>s;
   
   bool pos = 1;
   ll n = s.length();
   for(ll i=0;i<n;i++)
   {
       if(i%2 == 0)
            pos&=od(s[i]);
       else pos&=ev(s[i]);
       
   }
   
   if(pos)
        cout<<"Yes";
   else cout<<"No";        
   
   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<chrono>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
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;
}
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << "\n"; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " <<to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

void solve(){
  ll a,b,k;
  cin>>a>>b>>k;
  bool flag=false;
  if(a<k)flag=true;
  ll kk=k;
  k-=a;
  a=max(a-kk,0LL);
  if(flag){
    b=max(0LL,b-k);
  }
  cout<<a<<" "<<b<<"\n";
}
 
int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}


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

namespace A_ABC129
{
    class MainClass
    {

        static int[] s;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);
            Console.WriteLine(Math.Min(Math.Min(s[0]+s[1],s[1]+s[2]),s[0]+s[2]));
        }
    }
}


Measured memory_bytes: 13268
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

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

    int N;
    cin >> N;
    vector<int> b(N);
    REP(i, N) cin >> b[i];

    vector<int> ans(N);
    RREP(i, N - 1) {
        RREP(j, i) {
            if (b[j] == j + 1) {
                ans[i] = b[j];
                b.erase(b.begin() + j);
                break;
            }
        }
    }

    if (b.size())
        cout << "-1" << endl;
    else
        REP(i, N) cout << ans[i] << '\n';

    return 0;
}

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

using namespace std;
typedef long long ll;
const int INF = numeric_limits<int>::max() / 2;
const int MOD=1000000007;

map<int,int> prime_factor(int n){//素因数分解
    map<int,int> res;
    for(int i=2;i*i<=n;i++){
        while(n%i==0){
            res[i]++;
            n/=i;
        }
    }
    if(n!=1)res[n]=1;
    return res;
}

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

  int divs[2000]={0};

  int n;cin>>n;
  for(int i=2;i<=n;i++){
    map<int,int> tmp=prime_factor(i);
    for(int j=2;j<=n;j++){
        divs[j]+=tmp[j];
    }
  }
  ll ret=1;
  for(int i=2;i<=n;i++){
      if(divs[i]) ret=(ret*(divs[i]+1))%MOD;
  }
  cout<<ret<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  double t,x;
  cin>>t>>x;
  cout<<t/x<<endl;


}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int cost(int above, int n){
  return (above-n+1+above)*n/2;
}
int main(void){
  for(;;){
    long int b;
    cin >> b;
    if(b==0){return 0;}
    int above=b;
    int ansb, ansf;
    for(int n=1;above>=n;n++){
      above=(b/n + (n/2));
      if(cost(above,n)==b){
        ansb=above-n+1;
        ansf=n;
      }
    }
    cout << ansb << " " << ansf << endl;
  }
}



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

namespace ALDS1_3_D
{
    class Program
    {
        static int Main(string[] args)
        {
            var line = Console.ReadLine().Trim();
            //var line = @"\/\\\_/\\//__\/_/\/\__/";

            var stack = new Stack<int>();
            var list = new List<PoolArea>();
            var pool = new List<int>();

            for (int i = 0; i < line.Length; i++)
            {
                switch (line[i])
                {
                    case '\\':
                        stack.Push(i);
                        break;
                    case '/':
                        if (stack.Count > 0)
                        {
                            list.Add(new PoolArea(stack.Pop(), i));
                        }
                        break;
                    default:
                        break;
                }
            }

            Console.WriteLine(list.Select(x => x.AreaSize).Sum());

            if (list.Count == 0)
            {
                Console.WriteLine("0");
                return 0;
            }

            int index = list.Count - 1;
            do
            {
                var poolStart = list[index].Start;
                var poolSize = list[index].AreaSize;
                var nextIndex = -1;
                for (int i = index - 1; i >= 0; i--)
                {
                    if (list[i].Start > poolStart)
                    {
                        poolSize += list[i].AreaSize;
                    }
                    else
                    {
                        nextIndex = i;
                        break;
                    }
                }
                pool.Insert(0,poolSize);
                index = nextIndex;

            } while (index >= 0);

            Console.WriteLine(pool.Count + " " + String.Join(" ", pool.ToArray()));

            return 0;
        }

        class PoolArea
        {
            public PoolArea(int start, int end)
            {
                Start = start;
                End = end;
                AreaSize = End - Start;
            }

            public int AreaSize { get; }
            public int Start { get; }
            public int End { get; }
        }
    }
}



Measured memory_bytes: 18672
A = [int(c) for c in input()]
n = A[0]
cnt1 = 0
for c in A[1:]:
    if c == n:
        cnt1 += 1
    n ^= 1
n = A[0] ^ 1
cnt2 = 1
for c in A[1:]:
    if c == n:
        cnt2 += 1
    n ^= 1

print(min(cnt1, cnt2))



Measured memory_bytes: 4636
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;
using ll = long long;

ll rec( int y, int x, const vector<vector<char>>& a, vector<vector<ll>>& memo )
{
    static const ll MOD = 1000000000 + 7;

    if ( y == 1 && x == 1 ) return 1;
    if ( memo[ y ][ x ] != -1 ) return memo[ y ][ x ];

    ll result = 0;
    if ( y - 2 >= 0 && a[ y - 2 ][ x - 1 ] != '#' )
    {
        result += rec( y - 1, x, a, memo ) % MOD;
    }
    if ( x - 2 >= 0 && a[ y - 1 ][ x - 2 ] != '#' )
    {
        result += rec( y, x - 1, a, memo ) % MOD;
    }
    return memo[ y ][ x ] = result % MOD;
}

int main()
{
    int H;
    cin >> H;

    int W;
    cin >> W;

    vector<vector<char>> a( H, vector<char>( W ) );
    for ( int i = 0; i < H; ++i )
    {
        for ( int j = 0; j < W; ++j )
        {
            cin >> a[ i ][ j ];
        }
    }

    vector<vector<ll>> memo( H + 10, vector<ll>( W + 10, -1 ) );
    cout << rec( H, W, a, memo ) << endl;
}

Measured memory_bytes: 9472
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("-Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef int in;
#define int long long
#define pb push_back
#define f first
#define s second
const int MAX=2e5+5;
const int MAAX=1e9;
const int MOD=1e9+7;
int n,a[MAX],idx[MAX];
in main()
{
cin>>n;
for(int i=0;i<n;i++)
{
    cin>>a[i];
    idx[a[i]]=i+1;
}
sort(a,a+n);
for(int i=0;i<n;i++)
{
    cout<<idx[a[i]]<<" \n"[i==n-1];
}

    return 0;
}


Measured memory_bytes: 2432
mod reader {
    use std::fmt::Debug;
    use std::str::FromStr;
    use std::collections::VecDeque;
    use std::io::{self, Read};

    fn _read_line() -> String {
        let mut buf = String::new();
        let _ = io::stdin().read_to_string(&mut buf);
        buf
    }

    fn _read_vec_deque_string() -> VecDeque<String> {
        _read_line()
            .split_whitespace()
            .map(|s| s.to_string())
            .collect()
    }

    pub struct Reader {
        buf: VecDeque<String>,
    }

    #[allow(dead_code)]
    impl Reader {
        pub fn new() -> Reader {
            Reader { buf: VecDeque::new() }
        }

        fn update_buf(&mut self) {
            if self.buf.is_empty() {
                self.buf = _read_vec_deque_string();
            }
        }

        pub fn next<T>(&mut self) -> T
        where
            T: FromStr,
            T::Err: Debug,
        {
            self.update_buf();
            self.buf.pop_front().unwrap().parse::<T>().unwrap()
        }

        pub fn next_n<T>(&mut self, n: usize) -> Vec<T>
        where
            T: FromStr,
            T::Err: Debug,
        {
            let mut vec: Vec<T> = Vec::with_capacity(n);

            for _ in 0..n {
                vec.push(self.next());
            }
            vec
        }
    }
}

fn inside(x: i32, y: i32, r: i32, c: i32) -> bool {
    x > 0 && x < c && y > 0 && y < r
}

fn f(x: i32, y: i32, r: i32, c: i32) -> i32 {
    if y > 0 && x < c {
        x + y
    } else {
        r + c + (r - y) + (c - x)
    }
}

fn main() {
    let mut reader = reader::Reader::new();

    let c = reader.next();
    let r = reader.next();
    let n: i32 = reader.next();

    let mut a: Vec<(i32, i32)> = Vec::new();

    for i in 1..n + 1 {
        let (x1, y1) = (reader.next(), reader.next());
        let (x2, y2) = (reader.next(), reader.next());
        if inside(x1, y1, r, c) || inside(x2, y2, r, c) {
            continue;
        }

        let x1 = f(x1, y1, r, c);
        let x2 = f(x2, y2, r, c);

        a.push((std::cmp::min(x1, x2), i));
        a.push((std::cmp::max(x1, x2), -i));
    }

    a.sort();
    let mut ng = false;
    use std::collections::VecDeque;
    let mut st: VecDeque<(i32, i32)> = VecDeque::new();
    for p in a {
        let i = p.1;
        // println!("{} {}", x, i);
        if i > 0 {
            st.push_back((p));
        } else {
            let i = -i;
            match st.pop_back() {
                Some(p2) => if p2.1 != i {ng = true; break;},
                None => {ng = true; break;},
            }
        }
    }
    println!("{}", if ng { "NO" } else { "YES" });
}

Measured memory_bytes: 21412
#include <bits/stdc++.h>
#define base 1000000007LL
#define ll long long
#define X first
#define Y second
#define pb push_back
#define Scan(a) scanf("%I64d", &a);
#define CLR(a) memset(a,0,sizeof(a))
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORE(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)

using namespace std;

typedef pair<int, int> II;
typedef vector<II> vi;

string s;
int n;

int main()
{
    ios::sync_with_stdio(0);
    //freopen("inp.txt", "r", stdin);
    cin >> s;
    n = s.length();
    if (n < 5) {
        cout << "NO";
        return 0;
    }
    int now = n;
    while (now >= 5) {
        if (now >= 7) {
            string g = s.substr(now-7,7);
            if (g == "dreamer") {
                now -= 7;
                continue;
            }
        }
        if (now >= 6) {
            string g = s.substr(now-6,6);
            if (g == "eraser") {
                now -= 6;
                continue;
            }
        }
        if (now >= 5) {
            string g = s.substr(now-5,5);
            if (g == "erase" || g == "dream") {
                now -= 5;
                continue;
            }
        }
        break;
    }
    if (now == 0) cout << "YES";
    else cout << "NO";
    return 0;
}


Measured memory_bytes: 512
import sys
input = sys.stdin.readline

n = int(input())

dp = [[[[0]*4 for _ in range(4)] for _ in range(4)] for _ in range(n + 1)]
c = [0, 1, 2, 3]
import itertools
pers = itertools.product(c, repeat=3)
for p in pers:
    if p in [(0, 1, 2), (0, 2, 1), (1, 0, 2)]:
        continue
    dp[3][p[0]][p[1]][p[2]] = 1
for i in range(4, n + 1):
    for j in range(4):
        for k in range(4):
            for l in range(4):
                if (j, k, l) in [(0, 1, 2), (0, 2, 1), (1, 0, 2)]:
                    continue
                elif (j == 0 and l == 1) or (j == 0 and k == 1):
                    dp[i][j][k][l] = sum([dp[i - 1][k][l][x] for x in range(4) if x != 2])
                else:
                    dp[i][j][k][l] = sum([dp[i - 1][k][l][x] for x in range(4)])
ans = 0
for j in range(4):
    for k in range(4):
        for l in range(4):
            ans += dp[-1][j][k][l]
print(ans % (10**9 + 7))

Measured memory_bytes: 48192
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X, A = MAP()

print(0 if X < A else 10)

Measured memory_bytes: 5148
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
	public Program() { }

	static void Main(string[] args)
	{
		new Program().prog();
	}
	Scanner cin;
	const int MOD = 1000000007;
	const int INF = int.MaxValue;
	const double EPS = 1e-7;
	const double PI = 3.1415926536;

	void prog()
	{
		cin = new Scanner();
		int[,] dir8 = new int[8, 2] { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } };
		int[,] dir4 = new int[4, 2] { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };

		int N = cin.nextInt();
		int x = cin.nextInt();
		int[] a = new int[N];
		long ans = 0;
		for (int i = 0; i < N; i++)
		{
			a[i] = cin.nextInt();
			ans += a[i];
		}
		long sec = 0;
		int a0 = 0;
		for (int i = 1; i < N; i++)
		{
			sec = (long)i * x;
			a0 = a[0];
			for (int j = 0; j < N - 1; j++)
			{
				a[j] = Math.Min(a[j], a[j + 1]);
				sec += a[j];
			}
			a[N - 1] = Math.Min(a0, a[N - 1]);
			sec += a[N - 1];

			ans = Math.Min(ans, sec);
		}
		Console.WriteLine(ans);
	}
}

class Scanner
{
	string[] s;
	int i;

	char[] cs = new char[] { ' ' };

	public Scanner()
	{
		s = new string[0];
		i = 0;
	}

	public string next()
	{
		if (i < s.Length) return s[i++];
		string st = Console.ReadLine();
		while (st == "") st = Console.ReadLine();
		s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
		i = 0;
		return next();
	}

	public int nextInt()
	{
		return int.Parse(next());
	}

	public long nextLong()
	{
		return long.Parse(next());
	}

	public double nextDouble()
	{
		return double.Parse(next());
	}
}

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

int main() {
    int n; cin >> n;
    string op,des;
    set<string> v;
    while(n--) {
        cin >> op >> des;
        if(op=="insert") {
            v.insert(des);
        } else {
            if(v.count(des)!=0) cout << "yes" << endl;
            else                cout << "no"  << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 32576
from sys import stdin
K = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
#A, B, C = map(int, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]#hの定義を忘れずに
ks = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(ks[K-1])


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

int main(){
    int H,W;
    cin>>H>>W;
    while(!(H==0 && W==0)){
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                cout<<"#";
            }
            cout<<endl;
        }
        cout<<endl;
        cin>>H>>W;
    }
}


Measured memory_bytes: 3104
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main() {
  int n;
  std::string s;
  int count = 0;
  cin >> n >> s;
  for (int i = 0; i < n - 2; i++) {
    if ((s[i] == 'A') & (s[i + 1] == 'B') & (s[i + 2] == 'C')) {
      count++;
	}
  }
  cout << count;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
#include <cctype>

using namespace std;

int main()
{
	double a, b, c;
	int C;

	double S, L, h;
	double rad;

	cin >> a >> b >> C;

	rad = C * M_PI / 180.0;

	S = a * b * sin(rad) / 2;
	c = sqrt( a * a + b * b - 2 * a * b * cos(rad) );
	L = a + b + c;
	h = 2 * S / a;
	printf("%.8f\n%.8f\n%.8f\n", S, L, h);

	return 0;
}

Measured memory_bytes: 1248
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;


void energy_drink_collector()
{
  int n, m;
  cin >> n >> m;
  vector<pair<int,int>> ab(n);
  for (int i = 0; i < n; ++i) cin >> ab[i].first >> ab[i].second;

  sort(ab.begin(), ab.end());

  long long int total_fee = 0;
  for (int i = 0; i < n && m > 0; ++i)
  {
    total_fee += (long long int)ab[i].first * (long long int)min(m, ab[i].second);
    m -= min(m, ab[i].second);
  }

  cout << total_fee << "\n";
}


void get_AC()
{
  int n, q;
  string S;
  cin >> n >> q >> S;

  vector<int> cnt(n + 1);
  for (int i = 0; i < n; ++i)
  {
    if (i + 1 < n && S[i] == 'A' && S[i + 1] == 'C') cnt[i + 1] = cnt[i] + 1;
    else cnt[i + 1] = cnt[i];
  }

  for (int i = 0; i < q; ++i)
  {
    int l, r;
    cin >> l >> r;
    cout << cnt[r - 1] - cnt[l - 1] << "\n";
  }
}


void five_transportations()
{
  long long int n;
  cin >> n;
  long long int v_min = 1000000000000000, tmp;
  for (int i = 0; i < 5; ++i) 
  {
    cin >> tmp;
    v_min = min(v_min, tmp);
  }

  cout << (n - 1)/ v_min + 5;
}


void coloring_colorfully()
{
  string s;
  cin >> s;

  int cnt_01 = 0, cnt_10 = 0;
  for (int i = 0; i < s.size(); ++i)
  {
    if (i % 2 == 0)
    {
      if (s[i] != '0') ++cnt_01;
      else ++cnt_10;
    }
    else
    {
      if (s[i] != '1') ++cnt_01;
      else ++cnt_10;
    }
  }

  cout << min(cnt_01, cnt_10) << "\n";
}


//skip
void gcd_on_blackboard()
{

}


void dice_and_coin()
{
  int n, k;
  cin >> n >> k;

  double res = 0;
  for (int i = 1; i <= n; ++i)
  {
    double tmp = 1.0 / n;
    int point_now = i;
    while (point_now < k)
    {
      point_now *= 2;
      tmp /= 2;
    }
    res += tmp;
  }
  cout << setprecision(10) <<res << "\n";
}

//skip
void prison()
{

}

//skip
void switches()
{

}


void typical_stairs()
{
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0; i < m; ++i) cin >> a[i];

  vector<bool> broken(n);
  for (int i = 0; i < m; ++i) broken[a[i]] = true;

  vector<int> f(n + 1);
  f[0] = 1;
  if (!broken[1]) f[1] = 1;
  for (int i = 0; i < n + 1; ++i)
  {
    if (i == 0 || i == 1) continue;
    if (!broken[i]) f[i] = f[i - 1] + f[i - 2];
    f[i] %= 1000000007;
  }
  cout << f[n] % 1000000007 << "\n";
}


int main()
{
  //energy_drink_collector();
  //get_AC();
  //five_transportations();
  //coloring_colorfully();
  //gcd_on_blackboard();
  //dice_and_coin();
  //prison();
  //switches();
  typical_stairs();
}


Measured memory_bytes: 1024
#include<stdio.h>
#define N 10000
int sum(int a[],int n){
  int i;
  long int sum;
  sum=0;
  for(i=0;i<n;i++){
    sum=sum+a[i];
  }
  return sum;
}

int max(int a[],int n){
  int i,max;
  max=a[0];
  for(i=1;i<n;i++){
    if(max < a[i])
    max=a[i];
  }
  return max;
}
int min(int a[],int n){
  int i,min;
  min=a[0];
  for(i=1;i<n;i++){
    if(min > a[i])
    min=a[i];
  }
  return min;
}

int main(){

int i,n;
int a[N];
scanf("%d",&n);
for(i=0;i<n;i++){
  scanf("%d",&a[i]);
}
printf("%d %d %ld\n",min(a,n),max(a,n),sum(a,n));
return 0;
}



Measured memory_bytes: 1928
#include<stdio.h>
#include<stdlib.h>

int main() {
	int n;
	int i = 0, j = 0, k;
	scanf("%d",&n);

	int** b=malloc(sizeof(int *)*n);
	for ( i = 0; i < n; i++)
	{
		b[i] = malloc(sizeof(int) * 2);
	}
	
	for ( i = 0; i < n; i++){
		scanf("%d %d", &b[i][0], &b[i][1]);
	}
	int sum=0;
	for (i = 0; i < n; i++)
	{
		sum += b[i][1] - b[i][0]+ 1;
	}
	printf("%d", sum);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a>0)cout<<"Positive"<<endl;
    else if(b>=0)cout<<"Zero"<<endl;
    else if((abs(b)-abs(a)+1)%2==0)cout<<"Positive"<<endl;
    else cout<<"Negative"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
#define INF 999999999
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vpii> vvpii;

int main() {
  int N, M, w;
  while (cin >> N, N) {
    bool mp[25][25] = {};
    int sx = 10, sy = 10;
    rep(i, N) {
      int a, b;
      cin >> a >> b;
      mp[b][a] = 1;
    }
    cin >> M;
    char s;
    rep(i, M) {
      cin >> s >> w;
      if (s == 'N') {
        rep(j, w) {
          sy++;
          mp[sy][sx] = 0;
        }
      }
      if (s == 'S') {
        rep(j, w) {
          sy--;
          mp[sy][sx] = 0;
        }
      }
      if (s == 'E') {
        rep(j, w) {
          sx++;
          mp[sy][sx] = 0;
        }
      }
      if (s == 'W') {
        rep(j, w) {
          sx--;
          mp[sy][sx] = 0;
        }
      }
    }
    bool ans = 1;
    rep(i, 25) rep(j, 25) if (mp[i][j]) ans = 0;
    cout << (ans ? "Yes" : "No") << endl;
  }
  return 0;
}
 

Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int>data(N);
  for(int i=0;i<N;i++){
    cin>>data[i];
  }
  long long sum=0;
  for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      sum+=data[i]*data[j];
    }
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f
#define pi 3.1415926535898
using namespace std;
ll n,k;
ll ans;
char a[100050];
int main()
{
    cin>>n>>k;
    cin>>a+1;
    for(int i=1;i<=n;i++)
    {
        if(a[i]=='L'&&a[i-1]=='L')
        {
            ans++;
        }
    }
    for(int i=n;i>=1;i--)
    {
        if(a[i]=='R'&&a[i+1]=='R')
        {
            ans++;
        }
    }
    ans=min(n-1,ans+2*k);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3680
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		TreeSet<Integer> set = new TreeSet<>();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
		    int type = sc.nextInt();
		    int x = sc.nextInt();
		    if (type == 0) {
		        set.add(x);
		        sb.append(set.size()).append("\n");
		    } else if (type == 1) {
		        if (set.contains(x)) {
		            sb.append(1);
		        } else {
		            sb.append(0);
		        }
		        sb.append("\n");
		    } else if (type == 2) {
		        set.remove(x);
		    } else {
		        int y = sc.nextInt();
		        Integer tmp = x - 1;
		        while ((tmp = set.higher(tmp)) != null && tmp <= y) {
		            sb.append(tmp).append("\n");
		        }
		    }
		}
		System.out.print(sb);
	}
}



Measured memory_bytes: 191912
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
 */
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);
        AStationAndBus solver = new AStationAndBus();
        solver.solve(1, in, out);
        out.close();
    }

    static class AStationAndBus {
        public void solve(int testNumber, FastReader s, PrintWriter out) {
            String str = s.nextString();
            HashSet<Character> set = new HashSet<>();

            for (int i = 0; i < str.length(); i++) {
                set.add(str.charAt(i));
            }

            if (set.size() > 1) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }

    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 String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

        }

    }
}



Measured memory_bytes: 20820
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication14
{
    class Program
    {
        static void Main(string[] args)
        {
            //入力
            string[] msg = Console.ReadLine().Split(' ');
            UInt64 N = UInt64.Parse(msg[0]);
            UInt64 A = UInt64.Parse(msg[1]);
            UInt64 B = UInt64.Parse(msg[2]);
            UInt64[] X = new UInt64[N];
            msg = Console.ReadLine().Split(' ');
            for (UInt64 i = 0; i < N; i++) X[i] = UInt64.Parse(msg[i]);

            UInt64 cost = 0;
            for (UInt64 i = 1; i < N; i++)
            {
                UInt64 XxA = (X[i] - X[i - 1]) * A;
                cost += (XxA > B) ? B : XxA;
            }

            Console.WriteLine(cost.ToString());
            Console.ReadLine();
        }
    }
}


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

int main(){
  string s;
  cin>>s;
  int scnt=0,sum=0;
  for(int i=0;i<s.size();i++){
    if(scnt>0&&s[i]=='T'){
      scnt--;
      sum+=2;
    }
    if(s[i]=='S')scnt++;
  }
  cout<<s.size()-sum<<endl;
  return 0;
}


Measured memory_bytes: 640
a,b,c = map(int,input().split())
def main(a,b,c):
    if (a+b+c)%2==1:return 'No'
    x=(a+b+c)/2
    if x==a:return 'Yes'
    elif x==b:return 'Yes'
    elif x==c:return 'Yes'
    else:return 'No'

print(main(a,b,c))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template<typename T> void swap(T *t1, T *t2){ T* tmp=t1; t1=t2; t2=tmp;}


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

    Int n;
    Int a[200005], b[200005];
    cin >> n;
    for(Int i=1; i<=n; i++){
        cin >> a[i];
        b[i] = 0;
    }
    Int m = 0;
    for(Int i=n; i>=1; i--){
        Int tmp = 0;
        for(Int j=2; j<=n/i; j++){
            tmp += b[i*j];
        }
        tmp += a[i];
        if(tmp%2 != a[i]){
            b[i] = a[i]==0 ? 1 : 0;
        }else{
            b[i] = a[i];
        }
        m += b[i];
    }
    cout << m << endl;
    for(Int i=1; i<=n; i++){
        if(b[i] == 1){
            cout << i << " ";
        }
    }
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);

const long long MOD = 1e9 + 7;
const int MAXH = 1000 + 5;

struct Pos {
    int x;
    int y;
};

int h, w;
long long dp[MAXH][MAXH];
char board[MAXH][MAXH];

void calc(int x, int y) {
    if (x < 1 || y > w) {
        return;
    }
    if (x - 1 >= 1 && board[x - 1][y] != '#') {
        dp[x][y] = (dp[x][y] + dp[x - 1][y]) % MOD;
    }
    if (y - 1 >= 1 && board[x][y - 1] != '#') {
        dp[x][y] = (dp[x][y] + dp[x][y - 1]) % MOD;
    }
    calc(x - 1, y + 1);
}

void solve(int x, int y) {
    if (y > w) {
        return;
    }
    if (x == h) {
        calc(x, y);
        solve(x, y + 1);
    } else {
        calc(x, y);
        solve(x + 1, y);
    }
}

int main() {
    IOS

    cin >> h >> w;
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            cin >> board[i][j];
        }
    }

    dp[1][1] = 1;
    solve(1, 1);

    cout << dp[h][w] << '\n';
}

Measured memory_bytes: 12376
#include <stdio.h>
#include <stdlib.h>
int	compar(const void *a, const void *b)
{
	return *(int*)b - *(int*)a;
}

int	main()
{
	int	N;
	int	ans = 0;

	scanf("%d", &N);
	int *L;
	L = malloc(N * sizeof(int));
	for (int i = 0; i < N; i++)
	{
		scanf("%d", &L[i]);
	}
	qsort(L, N, sizeof(int), compar);

	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			if (L[i] == L[j])
				continue;
			for (int k = j + 1; k < N; k++)
			{
				if (L[j] == L[k])
					continue;
				if (L[j] + L[k] > L[i])
					ans++;
			}
		}
	}
	printf("%d\n", ans);
	return (0);
}


Measured memory_bytes: 1724
#include<tuple>
#include<iostream>
#include<vector>
#include<set>    // multiset
using namespace std;
#define df 0
#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
typedef long int li;

void dijkstra(int v,vector<vector<int>>& ans,int n,int l,
	      const vector<vector<pair<int,li>>>& adj){
  if(df)printf("---search from %d---\n",v);
  set<tuple<li,li,int>> que;  // (回数,量,頂点)
  que.insert(make_tuple(0,0,v));
  vector<pair<li,li>> seen(n,make_pair(n+1,0));
  seen.at(v)=make_pair(0,0);
  while(not que.empty()){
    tuple<li,li,int> tpl=*(que.begin());
    if(df)printf("tpl:(%d,%d,%d)\n",get<0>(tpl),get<1>(tpl),get<2>(tpl));
    que.erase(que.begin());
    ans.at(v).at(get<2>(tpl))=get<0>(tpl);
    for(auto x: adj.at(get<2>(tpl))){
      if(df)printf("%d: ",x.first);
      li amnt=get<1>(tpl)+x.second;
      li cnt=get<0>(tpl);
      if(amnt>l){
	amnt=x.second;
	cnt++;
      }
      if(df)printf("(%d,%d) seen:(%d,%d)\n",cnt,amnt,seen.at(x.first).first,seen.at(x.first).second);
      if(amnt>l)continue;
      pair<li,li> upd=make_pair(cnt,amnt);
      if(upd > seen.at(x.first)) continue;
      if(df)printf("update!\n");
      if(seen.at(x.first)!=make_pair((li)n+1,(li)0)){
	tuple<li,li,int> del=make_tuple(seen.at(x.first).first,
					seen.at(x.first).second,x.first);
	que.erase(del);
      }
      que.insert(make_tuple(upd.first,upd.second,x.first));
      seen.at(x.first)=upd;
    }
  }
  if(df){
    rep(i,n){
      printf("%d ",ans.at(v).at(i));
    }
    printf(":%d\n",v);
  }
}

int main(){
  if(df) printf("*debug mode*\n");
  int n,m,l; cin >>n >>m >>l;
  vector<vector<pair<int,li>>> adj(n);
  rep(i,m){
    int u,v,c; cin >>u >>v >>c; u--; v--;
    adj.at(u).push_back(make_pair(v,c));
    adj.at(v).push_back(make_pair(u,c));
  }
  if(df){
    rep(i,n){
      printf("%d:",i);
      for(auto x: adj.at(i)){
	printf("(%d,%d) ",x.first,x.second);
      }
      printf("\n");
    }
  }
  vector<vector<int>> ans(n,vector<int>(n,-1));
  rep(i,n){
    dijkstra(i,ans,n,l,adj);
  }
  int q; cin >>q;
  rep(i,q){
    int a,b; cin >>a >>b;a--;b--;
    printf("%d\n",ans.at(a).at(b));
  }
  
}

/// confirm df==0 ///


Measured memory_bytes: 3200
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)

MOD = 1000000007  # type: int

def get_fraction_mod(numerator, denominator):
    '''
        returns numerator / denominator (mod MOD)
    '''
    inv = pow(denominator, MOD - 2, MOD)
    return numerator * inv % MOD

def make_comb(n, k):
    a = 1
    b = 1
    for i in range(k):
        a = a * (n - i) % MOD
        b = b * (i + 1) % MOD
    ret = get_fraction_mod(a, b)
    return ret


def solve(n: int, a: int, b: int):
    ret = (pow(2, n, MOD) - 1) % MOD
    ret = ret + MOD - make_comb(n, a)
    ret = ret + MOD - make_comb(n, b)
    ret %= MOD
    print(ret)
    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
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    solve(n, a, b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int N;
	cin>>N;
	vector<long long>a(N);
	vector<vector<long long> >dp(N,vector<long long>(N));
	for(int i=0;i<N;i++) cin>>a[i];
	for(int i=0;i<N;i++) dp[i][i]=a[i];
	for(int j=1;j<N;j++)
		for(int i=0;i+j<N;i++)
			dp[i][i+j]=max(a[i]-dp[i+1][i+j],a[i+j]-dp[i][i+j-1]);
	cout<<dp[0][N-1]<<"\n";
	return 0;
}


Measured memory_bytes: 73604
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int main()
{
    char a[101],b[101],c[202];
    int n,i,j,m;
    cin>>n;
    cin>>a>>b;
    for(i=0,j=0;i<n,j<2*n;i++)
    {
        c[j]=a[i];
        j=j+2;
    }
    for(i=0,j=1;i<n,j<2*n;i++)
    {
        c[j]=b[i];
        j=j+2;
    }
    c[2*n]='\0';
    cout<<c<<endl;
    return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i, n) cin >> p[i];

    int ans = 0;
    int m = inf;

    rep(i, n) {
        m = min(m, p[i]);
        if(m == p[i]) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4036
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var s = Console.ReadLine();
            var a = 0;
            var b = 0;
            var c = 0;
            for (var i = 0; i < s.Length; i++)
            {
                switch (s[i])
                {
                    case 'a': a++; break;
                    case 'b': b++; break;
                    case 'c': c++; break;
                }
            }
            Console.WriteLine(a == 1 && b == 1 && c == 1 ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 11092
/*"Everything in the universe is balanced. Every disappointment
   you face in life will be balanced by something good for you!
                Keep going, never give up."            */

#include "bits/stdc++.h"
using namespace std;

#define ll long long
const ll N=1e6+9;
const ll mod=1e9+7;

ll a[N];

void solve()
{    
    ll n, m ;
    cin >> n;
    vector<double> v(n);
    cout<<fixed<<setprecision(10);
    for(int i = 0 ; i < n ; i ++ )cin >> v[i];
    vector<vector<double>> dp(n+1, vector<double> (n+1,0)) ;

	
	dp[0][0]=1;
	for(int i=1; i<=n; i++){
		for(int j=0; j<=i; j++){
			dp[i][j+1] += dp[i-1][j]*v[i-1];
		}
		for(int j=0; j<=i; j++){
			dp[i][j] += dp[i-1][j]*(1-v[i-1]);
		}
	}/*
	for(int i = 0 ;i<=n;i++){
		for(int j=0;j<=n;j++){
			cout<<dp[i][j]<<" ";
		}
		cout<<"\n";
	}*/
	double ans = 0 ;
	int nn = (n+1)/2;
	for(int i = n; i+nn-1>=n; i-- ){
		//cout<<i<<"<<";
		ans+=dp[n][i];
	}
	cout<<ans;

}

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll t=1;
    //pre();
    //cin>>t;
    while(t--)
    {
      solve();
    }  
}


// Xorawar

Measured memory_bytes: 73752
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		int c = saori.saori_hayami();
		System.out.println(a*b/2);
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 22100
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.nextLine();
		String p = scan.nextLine();
		s += s;
		int check = s.indexOf(p);
		if (check != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}

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

int main(int argc, char const *argv[]) {
  int n;
  double ans = 0.0;
  cin >> n;
  vector<double> x(n);
  vector<string> u(n);
  for (size_t i = 0; i < n; i++) cin >> x[i] >> u[i];

  for (size_t i = 0; i < n; i++) {
    if (u[i] == "BTC")
      ans += x[i] * 380000.0;
    else if (u[i] == "JPY")
      ans += x[i];
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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

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

int H ,W ,D , A ;
int Q ,L , R ;
int px [90001] , py[90001];
int d[90001];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    if(n==1&&m==1) cout<<1<<endl;
    else if(n>1&& m>1) cout<<(n-2)*(m-2)<<endl;
    else cout<<max(n,m)-2<<endl;
}


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

public class Main {
    public static void main(String[] args) throws Exception {
        // Here your code !
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] P_E = br.readLine().split(" ");

        int PlayerNum = Integer.parseInt(P_E[0]);
        int EventNum = Integer.parseInt(P_E[1]);
        
        int[] Fishes = new int[PlayerNum + 1];
        Arrays.fill(Fishes, 0);
        
        int TopPlayerID = 0;
        int TopPlayersFishes = 0;
        
        for(int i = 0; i < EventNum; i++){
            String[] P_G = br.readLine().split(" ");
            int PlayerID = Integer.parseInt(P_G[0]);
            int GetFishNum = Integer.parseInt(P_G[1]);
            Fishes[PlayerID] += GetFishNum;
            
            if(TopPlayersFishes < Fishes[PlayerID]){
                TopPlayerID = PlayerID;
                TopPlayersFishes = Fishes[PlayerID];
            }
            else if(TopPlayersFishes == Fishes[PlayerID]){
                TopPlayerID = PlayerID < TopPlayerID ? PlayerID : TopPlayerID;
            }
            else{
                if(TopPlayerID == PlayerID){
                    int MaxFishes = 0;
                    for(int p = 0; p < Fishes.length; p++){
                        if(MaxFishes < Fishes[p]){
                            MaxFishes = Fishes[p];
                            TopPlayerID = p;
                        }
                        else if(MaxFishes == Fishes[p]){
                            TopPlayerID = p < TopPlayerID ? p : TopPlayerID;
                        }
                    }
                    TopPlayersFishes = MaxFishes;
                }
            }
            
            System.out.println(TopPlayerID + " " + TopPlayersFishes);
        }
    }
}

class TopPlayer {
    public int PlayerID;
    public int Fishes;
    TopPlayer(int InputID, int InputFishes){
        PlayerID = InputID;
        Fishes = InputFishes;
    }
}

Measured memory_bytes: 69008