akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
typedef pair<int,pair<int, int>> P1;

using Graph = vector<vector<int>>;


signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;
  map<string, int> mp;
  rep(i, n){
    string S;
    cin >> S;
    mp[S]++;
  }
  int maxv = 0;
  for(auto P : mp){
    if(P.second > maxv){
      maxv = P.second;
    }
  }
  for(auto P : mp){
    if(P.second == maxv){
      cout << P.first << endl;
    }
  }
}

Measured memory_bytes: 25728
A,B,M = map(int,input().split())

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

x = []
y = []
c = []

for _ in range(M):
    tmp = list(map(int,input().split()))
    x.append(tmp[0])
    y.append(tmp[1])
    c.append(tmp[2])

ans = min(a) + min(b)

for i in range(M):
    waribiki = a[x[i]-1] + b[y[i]-1] - c[i]
    if waribiki < ans:
        ans = waribiki

print(ans)


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

march = "MARCH"
arr = [0 for i in range(5)]
for i in range(n):
    s = input()
    for j in range(len(march)):
        if s[0] == march[j]:
            arr[j] += 1

ans = 0

ans2 = [arr[x]*arr[y]*arr[z] for x in range(len(march)) for y in range(x+1, len(march)) for z in range(y+1, len(march))]
for i in ans2:
    ans += i

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

int main(void){
    ll n, x;
    cin >> n >> x;

    if(x == 1 || x == 2 * n - 1){
        cout << "No" << endl;
        return 0;
    }else{
        cout << "Yes" << endl;
    }

    if(n == 2){
        cout << 1 << endl << 2 << endl << 3;
    }else{
        vector<ll> a;
        if(x == 2){
            rep(i, 1, 2 * n){
                if(i != x - 1 && i != x && i != x + 1 && i != x + 2){
                    a.push_back(i);
                }
            }
            rep(i, 1, 2 * n){
                if(i != n - 1 && i != n && i != n + 1 && i != n + 2){
                    cout << a.back() << endl;
                    a.pop_back();
                }
                if(i == n - 1){
                    cout << x - 1 << endl;
                }else if(i == n){
                    cout << x << endl;
                }else if(i == n + 1){
                    cout << x + 1 << endl;
                }else if(i == n + 2){
                    cout << x + 2 << endl;
                }
            }

        }else{
            rep(i, 1, 2 * n){
                if(i != x - 1 && i != x && i != x + 1 && i != x - 2){
                    a.push_back(i);
                }
            }
            rep(i, 1, 2 * n){
                if(i != n - 1 && i != n && i != n + 1 && i != n + 2){
                    cout << a.back() << endl;
                    a.pop_back();
                }
                if(i == n - 1){
                    cout << x - 1 << endl;
                }else if(i == n){
                    cout << x << endl;
                }else if(i == n + 1){
                    cout << x + 1 << endl;
                }else if(i == n + 2){
                    cout << x - 2 << endl;
                }
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define FOR(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;
constexpr ll inf = 2e18;

inline auto to_deg (double r)
{
  constexpr auto PI = 3.14159265358979323846264338;
  constexpr auto p = 180.0 / PI;
  return r * p;
}

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  double a, b, x;
  cin >> a >> b >> x;
  auto c = (a * a * b - x) * 2.0 / (a * a);
  auto d = (x * 2.0) / (a * b);
  auto ans1 = to_deg (atan2 (c, a));
  auto ans2 = to_deg (atan2 (b, d));
  auto ans = ans1;
  if (x < a * a * b / 2.0)
  {
    ans = ans2;
  }
  cout << fixed << setprecision (15) << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> u(N - 1), v(N - 1);
  for (int i = 0; i < N - 1; i++){
    cin >> u[i] >> v[i];
    if (v[i] < u[i]){
      swap(u[i], v[i]);
    }
  }
  long long ans = 0;
  for (int i = 1; i <= N; i++){
    ans += (long long) i * (N - i + 1);
  }
  for (int i = 0; i < N - 1; i++){
    ans -= (long long) u[i] * (N - v[i] + 1);
  }
  cout << ans << endl;
}

Measured memory_bytes: 4808
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>
#include <unordered_map>

#define rep(i, a, b) for (ll i = a; i < b; i++)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef unordered_map<string, ll> u_map;

// input
void input() {}
template <class Head, class... Tail>
void input(Head &&a, Tail &&... b)
{
    cin >> a;
    input(forward<Tail>(b)...);
}

template <class V>
void input(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &i) { input(i); });
}

// output
template <class V>
void output(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &x) { cout << x << " "; });
    cout << endl;
}

// math functions
ll mpow(ll a, ll n, ll p)
{
    ll x = 1;
    while (n > 0)
    {
        if (n & 1)
        {
            x = a * x % p;
        }
        a = a * a % p;
        n >>= 1;
    }

    return x;
}

ll mfact(ll n, ll p)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
    {
        res = res * i % p;
    }
    return res;
}

ll mcomb(ll n, ll r, ll p)
{
    if (n == 0 && r == 0)
    {
        return 1;
    }
    if (n < r || n < 0 || r < 0)
    {
        return 0;
    }

    ll a = mfact(n, p);
    ll b = mfact(n - r, p);
    ll c = mfact(r, p);
    return (((a * mpow(b, p - 2, p)) % p) * mpow(c, p - 2, p)) % p;
}

ll gcd(ll a, ll b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    return b ? gcd(b, a % b) : a;
}

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

int main()
{
    ll N, M;
    input(N, M);

    vector<bool> ac(N + 1, false);
    vector<ll> pena(N + 1, 0);
    ll ans = 0;

    rep(i, 0, M)
    {
        ll p;
        string s;
        input(p, s);

        if (s == "AC")
        {
            if (!ac[p])
            {
                ans++;
                ac[p] = true;
            }
        }
        else
        {
            if (!ac[p])
            {
                pena[p]++;
            }
        }
    }

    ll miss = 0;
    rep(i, 1, N + 1)
    {

        if (ac[i])
        {
            miss += pena[i];
        }
    }

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

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int X;
  cin >> X;
  if(X >= 30){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }



}


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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

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

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

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

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int n;
    cin>>n;

    vector<int> primelist;
    rep1(i,2,n+1){
        bool isprime = true;
        rep1(j,2,i-1){
            if(i%j == 0)isprime=false;
        }
        if(isprime)primelist.eb(i);
    }

    int nP = primelist.size();
    vector<int> exp;

    for(int p:primelist){
        int pf = p;
        int tmp=0;

        while(pf <= n){
            tmp += n/pf;
            pf *= p;
        }
        exp.eb(tmp);
    }


    rep(i,nP)if(exp[i] >= 74)++ans;

    int two=0,thr=0;
    rep(i,nP){
        rep1(j,i+1,nP){
            if(i == j)continue;
            int p = exp[i];
            int q = exp[j];

            if( (p >= 24&&q >= 2) )++two;
            if( (p >= 14&&q >= 4) )++two;
            if( (q >= 24&&p >= 2) )++two;
            if( (q >= 14&&p >= 4) )++two;
        }
    }

    rep(i,nP){
        rep1(j,i+1,nP){
            rep1(k,j+1,nP){
                int p = exp[i];
                int q = exp[j];
                int r = exp[k];

                if(p>=4&&q>=4&&r>=2)++thr;
                if(p>=4&&q>=2&&r>=4)++thr;
                if(p>=2&&q>=4&&r>=4)++thr;
            }
        }
    }
    ans += two + thr;
    cout<<ans<<endl;
    //cout <<fixed<<setprecision(16)<< << endl;
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[1000000];
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
   int t=0;
   while(1)
   {
    if(t==0){c-=b;t=1;}
    else{a-=d;t=0;}
    if(a<=0) {cout<<"No"<<endl;return 0;}
    if(c<=0) {cout<<"Yes"<<endl;return 0;}
   }

    return 0;
}


Measured memory_bytes: 3632
import sys
input = sys.stdin.buffer.readline

def main():
    N,A,B = map(int,input().split())
    A -= 1
    B -= 1
    
    ans = [0 for _ in range(N-1)]
    
    for i in range(N):
        for j in range(i+1,N):
            if i < A:
                if j <= A:
                    ans[j-i-1] += 1
                elif A < j <= B:
                    l = min(j-i,(A-i)+1+(B-j))
                    ans[l-1] += 1
                else:
                    ans[(A-i)+(j-B)] += 1
            elif A <= i < B:
                l = min(j-i,(i-A)+1+abs(B-j))
                ans[l-1] += 1
            else:
                ans[j-i-1] += 1
                
    print(*ans,sep="\n")
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define rep(i, n) for(int i=0;i<(int)(n);++i)
template <typename T> lint gcd(T a, T b) {return b?gcd(b, a%b):a;}
template <typename T> lint lcm(T a, T b) {return a * b / gcd(a, b);};
template <typename T> inline void chmin(T &a, const T& b){if(a>b)a=b;}
template <typename T> inline void chmax(T &a, const T& b){if(a<b)a=b;}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> vec(n);
  vector<bool> act(n, false);
  int ac = 0, wa = 0;
  for (int i = 0; i < m; ++i) {
    int p; cin >> p;
    string s; cin >> s;
    if (s == "AC" && !act[p-1]) {
      ++ac;
      wa += vec[p-1];
      act[p-1] = 1;
    } else {
      ++vec[p-1];
    }
  }
  cout << ac << " " << wa << '\n';
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int m,d;
    scanf("%d%d",&m,&d);
    int ans = 0;
    for(int i = 1;i<=m;i++) {
        for(int j = 1;j<=d;j++) {
            if((j/10)>=2 && (j%10) >=2 && (j/10)*(j%10)==i) ans++;
        }
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	int a,b,c,d;
	char str[21];
	while(~scanf("%d %S %d",&a,&str,&b))
	{
		
			if(strcmp(str,"+")==0) cout<<a+b;
			else cout<<a-b;
		
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
# Union Find # 分割はできない
##############
import sys
sys.setrecursionlimit(int(1e9))

class UnionFind():
  def __init__(self):
    self.roots = {}
    self.nums = {}

  def find_root(self, a):
    if a not in self.roots:
      self.nums[a] = 1
      return a
    else:
      self.roots[a] = self.find_root(self.roots[a])
      return self.roots[a]

  def unite(self, a, b):
    root_a = self.find_root(a)
    root_b = self.find_root(b)
    n_a = self.nums[root_a]
    n_b = self.nums[root_b]
    if root_a == root_b:
      return
    else:
      if n_a > n_b: #多い方に合流させる
        self.roots[root_b] = root_a
        self.nums[root_a] = n_a + n_b
        del self.nums[root_b]
      else:
        self.roots[root_a] = root_b
        self.nums[root_b] = n_a + n_b
        del self.nums[root_a]
      return
  
  def is_union(self, a,b):
    return self.find_root(a) == self.find_root(b)
  
  
N , M = list(map(int, input().split()))
XYZ = [list(map(int, input().split())) for _ in range(M)]

uf = UnionFind()

_set = set()

for x,y,z in XYZ:
  uf.unite(x,y)
  _set.add(x)
  _set.add(y)
  
answer = len(set([uf.find_root(i) for i in _set])) + N-len(_set)
print(answer)

    

Measured memory_bytes: 61228
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
typedef long long int ll;

int main(){
  int N,M;
  int K[31];
  int A[31][31];
  scanf("%d%d",&N,&M);
  for(int i=1;i<=N;i++){
    scanf("%d",&K[i]);
    for(int j=1;j<=K[i];j++){
      scanf("%d",&A[i][j]);
    }
  }

  int loved[31];
  for(int i=1;i<=30;i++) loved[i]=0;

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

  int count=0;
  for(int i=1;i<=M;i++){
    if(loved[i]==N) count++;
  }

  printf("%d\n",count);
  return 0;
}

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

signed main(){
	int a,b,c,k; cin>>a>>b>>c>>k;
	while(k--){
		if(b<=a)b*=2;
		else if(c<=b)c*=2;
	}
	if(b>a&&c>b)cout<<"Yes";
	else cout<<"No";
}


Measured memory_bytes: 3608
s = input()

ans = 0

#print(s[0],s[1],s[2])

for i in range(2**(len(s)-1)):
    tmp = i
    #print(tmp,tmp,tmp)
    temp = 0
    for j in range(len(s)-1):
        #print(ans)
        temp += int(s[j])
        #print(temp)
        if tmp % 2 == 0:
            temp = temp * 10
            #print(0)
            #if j == len(s)-2:
                #ans += temp + int(s[j+1])
        else:
            #ans += s[i]
            #print(1)
            ans += temp
            temp = 0
        if j == len(s)-2:
            ans += temp + int(s[j+1])
            #print(1)
        tmp = tmp // 2


if len(s) == 1:
    print(s[0])
    exit()
    
    
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <math.h>


int main(int argc, const char * argv[]){
    double a, b, c, d, e, f;
    double x, y;
    
    while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) != EOF){
        if((-1000 > a || a > 1000) ||
           (-1000 > b || b > 1000) ||
           (-1000 > c || c > 1000) ||
           (-1000 > d || d > 1000) ||
           (-1000 > e || e > 1000) ||
           (-1000 > f || f > 1000)){
            exit(0);
        }
        x = (c * e - b * f)/(a * e - b * d);
        y = (c * d - a * f)/(b * d - a * e);

        printf("%.3lf %.3lf\n", x + 0.0001, y + 0.0001);
    }
    return 0;
}

Measured memory_bytes: 656
N = gets.to_i

six_bank = (1..10).map { |i| 6 ** i }
nine_bank = (1..10).map { |i| 9 ** i }

dp = Array.new(N + 1, Float::INFINITY)
dp[N] = 0

N.downto(1) do |i|
  next if dp[i] == Float::INFINITY

  six_bank.each do |s|
    break if i - s < 0

    t = dp[i] + 1
    dp[i - s] = t if dp[i - s] > t
  end

  nine_bank.each do |n|
    break if i - n < 0

    t = dp[i] + 1
    dp[i - n] = t if dp[i - n] > t
  end

  if i <= 5
    t = dp[i] + 1
    dp[i - 1] = t if dp[i - 1] > t
  end
end

puts dp[0]


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

int main() {
  int n;
  cin>>n;
  vector<long long>a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
    a[i]--;
  }
  for(int i=0;i<n-1;i++){
    if(a[i]> a[i+1]){
      a[i+1]++;
      if(a[i]>a[i+1]){
        cout<<"No"<<endl;
        return 0;
      }
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}

  

    

Measured memory_bytes: 4020
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <limits>
#include <random>
#include <chrono>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template<typename T>
void debug(T var, string label){
    cout << label << " = " << var << '\n';
}
typedef long long ll;
ll rand(ll a, ll b){
    return a + rng() % (b - a + 1);
}
ll a, b, x;
void gen(){
    a = rand(0, ll(1e4));
    b = rand(a, ll(1e5));
    x = rand(1, b);
}
ll sol1(){
    ll ret = 0;
    for(ll i = a; i <= b; ++i){
        if(i % x == 0){
            ret++;
        }
    }
    return ret;
}
ll sol2(){
    cin >> a >> b >> x;
    return (b/x) - ((a-1)/x) + (a==0 && x != 1);
}
void test(){
    while(1){
        gen();
        ll s2 = sol2();
        ll s1 = sol1();
        cout << s1 << " " << s2 << "\n";
        cout << a << " " << b << " " << x << "\n";
        if(s1 != s2)break;
    }
}
void sub(){
    cout << sol2() << '\n';
}
int main(int argv, char **argc){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
    /* test(); */
    sub();
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a[101];
	int n;
	int i,j;
	int m;
	int al=0,bb=0;

	for(i=0;i<=100;i++)
		a[i]=0;

	cin >> n;

	for(i=0;i<n;i++)
		cin >> a[i];

	for(i=0;i<200;i++){
		for(j=0;j<n;j++){
			if(a[j]<a[j+1]){
				m=a[j];
				a[j]=a[j+1];
				a[j+1]=m;
			}
		}
	}

	for(i=0;i<=100;i++){
		if((i%2)==0)
			al += a[i];
		else
			bb += a[i];
	}

	cout << al-bb;

	return 0;
}

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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


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

struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク

    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n); rank.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;
    }

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

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};

int main(){
  int N,M;
  cin >> N >> M;
  UnionFind uf(N+M);
  int L,K;
  rep(i,N){
    cin >> K;
    rep(j,K){
      cin >> L;
      L--;
      uf.merge(L,i+M);
    }
  }

  FOR(i,1,N){
    if(uf.issame(M, i+M) == false){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;

  return 0;
}


Measured memory_bytes: 1792
class vector(object):
    def __init__(self,a,b):
        self.x=b.x-a.x
        self.y=b.y-a.y
    @staticmethod
    def cross_product(a,b):
        return a.x*b.y-a.y*b.x
class vertex(object):
    def __init__(self,a):
        self.x=a[0]
        self.y=a[1]
class circle(object):
    def __init__(self,p,r):
        self.px=p.x
        self.py=p.y
        self.r=r
class triangle(object):
    def __init__(self,a,b,c):
        self.a=a
        self.b=b
        self.c=c
        import math
        self.ab=math.sqrt((self.a.x-self.b.x)**2+(self.a.y-self.b.y)**2)
        self.bc=math.sqrt((self.b.x-self.c.x)**2+(self.b.y-self.c.y)**2)
        self.ca=math.sqrt((self.c.x-self.a.x)**2+(self.c.y-self.a.y)**2)
        c=self.ab
        a=self.bc
        b=self.ca
        self.cosA=(b**2+c**2-a**2)/(2*b*c)
        self.cosB=(a**2+c**2-b**2)/(2*a*c)
        self.cosC=(b**2+a**2-c**2)/(2*b*a)
        self.sinA=math.sqrt(1-self.cosA**2)
        self.sinB=math.sqrt(1-self.cosB**2)
        self.sinC=math.sqrt(1-self.cosC**2)
        self.sin2A=2*self.sinA*self.cosA
        self.sin2B=2*self.sinB*self.cosB
        self.sin2C=2*self.sinC*self.cosC
    def area(self):
        import math
        s=(self.ab+self.bc+self.ca)/2
        S=math.sqrt(s*(s-self.ab)*(s-self.bc)*(s-self.ca))
        return S
    def circumscribed(self):
        R=self.ab/(2*self.sinC)
        px=(self.sin2A*self.a.x+self.sin2B*self.b.x+self.sin2C*self.c.x)/(self.sin2A+self.sin2B+self.sin2C)
        py=(self.sin2A*self.a.y+self.sin2B*self.b.y+self.sin2C*self.c.y)/(self.sin2A+self.sin2B+self.sin2C)
        px=round(px,3)
        py=round(py,3)
        R=round(R,3)
        p=vertex((px,py))
        return circle(p,R)
    def isin(self,p):
        AB=vector(self.a,self.b)
        BC=vector(self.b,self.c)
        CA=vector(self.c,self.a)
        AP=vector(self.a,p)
        BP=vector(self.b,p)
        CP=vector(self.c,p)
        if (vector.cross_product(AB,AP)>0 and vector.cross_product(BC,BP)>0 and vector.cross_product(CA,CP)>0)or(vector.cross_product(AB,AP)<0 and vector.cross_product(BC,BP)<0 and vector.cross_product(CA,CP)<0):
            return 'YES'
        else:return 'NO'
A=[]
B=[]
C=[]
p=[]
import sys
for line in sys.stdin:
    a,b,c,d,e,f,g,h=list(map(float,line.split()))
    A.append(vertex((a,b)))
    B.append(vertex((c,d)))
    C.append(vertex((e,f)))
    p.append(vertex((g,h)))
for i in range(len(A)):
    Triangle=triangle(A[i],B[i],C[i])
    print(Triangle.isin(p[i]))

Measured memory_bytes: 7744
from collections import defaultdict


def read():
    N = int(input())
    return N,


def sieve(n):
    """
    n以下の素数を昇順に列挙する
    """
    is_prime = [True for i in range(n+1)]
    primes = []
    for i in range(2, n+1):
        if is_prime[i]:
            primes.append(i)
            for j in range(i+i, n+1, i):
                is_prime[j] = False
    return primes


def prime_factorization(n, primes):
    """
    nの素因数分解を求める
    """
    prime_factors = defaultdict(int)
    if n < 2:
        return prime_factors
    for p in primes:
        if p * p > n:
            break
        while n % p == 0:
            prime_factors[p] += 1
            n //= p
    if n > 1:
        prime_factors[n] = 1
    return prime_factors


def divisor(n, primes):
    d = []
    for i in range(1, n+1):
        if i * i > n:
            break
        if n % i == 0:
            d.append(i)
            if i != n // i:
                d.append(n // i)
    return list(sorted(d))


def solve(N):
    primes = sieve(N)
    factors = defaultdict(int)
    for x in range(1, N+1):
        pf = prime_factorization(x, primes)
        for p, v in pf.items():
            factors[p] += v
    V = [v for v in factors.values()]
    
    c = defaultdict(int)
    for v in V:
        for x in [3, 5, 15, 25, 75]:
            if v+1 >= x:
                c[x] += 1
    count = 0
    # (75) 
    count += c[75]
    # (25, 3)
    count += c[25] * (c[3]-1)
    # (15, 5)
    count += c[15] * (c[5]-1)
    # (5, 5, 3)
    count += (c[5] * (c[5]-1) // 2) * (c[3]-2)

    return count

if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))


Measured memory_bytes: 3316
using System;
using System.Collections.Generic;
using System.Text;

class Program
{
    public void Proc()
    {
        int numberCount = int.Parse(Console.ReadLine());
        string[] inpt = Console.ReadLine().Split(' ');
        int[] sort = new int[numberCount];
        for(int i=0; i<inpt.Length; i++)
        {
            sort[i] = int.Parse(inpt[i]);
        }
        Console.WriteLine(ArrayJoin(sort));
        // ???????????????
        for(int i = 1; i<sort.Length; i++)
        {
            int v = sort[i];
            int j = i - 1;
            while(j>=0 && sort[j] > v)
            {
                sort[j + 1] = sort[j];
                j--;
            }
            sort[j + 1] = v;
            Console.WriteLine(ArrayJoin(sort));
        }
    }


    private string ArrayJoin(int[] arr)
    {
        StringBuilder sb = new StringBuilder();
        for(int i=0; i<arr.Length; i++)
        {
            if(sb.Length > 0)
            {
                sb.Append(" ");
            }
            sb.Append(arr[i]);
        }
        return sb.ToString();
    }

    static void Main(string[] args)

    {

        Program prg = new Program();
        prg.Proc();

    }
}

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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n,x;
cin>>n>>x;
vector<int> a(n);
rep(i,n)cin>>a[i];
sort(a.begin(),a.end());
int cnt=0;
rep(i,n){
    x-=a[i];
    cnt++;
    if(x<0){
        cnt--;
        break;
    }
}
if(x>0){
    cnt--;
}
cout<<cnt<<endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
const int MOD = 1e9 + 7;
using pii=std::pair<int,int>;
using namespace std;

const int maxn = 405;

int n, c, a[maxn], b[maxn], apow[maxn][maxn], dp[maxn][maxn];  // dp[pos][candies used] = product sum
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> c;
    for(int i = 0; i < n; i++)
        cin >> a[i];
    for(int i = 0; i < n; i++)
        cin >> b[i];
    dp[0][0] = 1;
    for(int i = 0; i < n; i++)
        for(int k = a[i]; k <= b[i]; k++)
        {
            int cur = 1;
            apow[i][0] += cur;
            apow[i][0] %= MOD;
            for(int j = 1; j <= c; j++)
            {
                cur *= k;
                cur %= MOD;
                apow[i][j] += cur;
                apow[i][j] %= MOD;
            }
        }
    for(int i = 0; i < n; i++)
        for(int j = 0; j <= c; j++)
            if(dp[i][j])
                for(int k = 0; j + k <= c; k++)
                {
                    dp[i + 1][j + k] += (dp[i][j] * apow[i][k]) % MOD;
                    dp[i + 1][j + k] %= MOD;
                }
    cout << dp[n][c] << "\n";
    return 0;
}

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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

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

const char newl = '\n';

int main() {
    ll n;
    cin >> n;
    string ans;
    while (n) {
        n--;
        ans += n%26+'a';
        n /= 26;
    }
    reverse(ans.begin(),ans.end());
    cout << ans << newl;
}

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

int main(){
    long long n;
    cin >> n;
    long long h[n];

    for(long long i = 0; i < n; i++){
        cin >> h[i];
    }

    bool flag = true;
    for(long long i = 0; i <= n-1; i++){
        if(i>0){
            if(h[i-1] == h[i] + 1){
                h[i]++;
            }
            else if(h[i-1] > h[i] + 1){
                flag = false;
                break;
            }
        }
    }

    if(flag == true){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 1024
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iostream>
# include <vector>
# include <queue>
# include <stack>
# include <map>
# include <bitset>
# include <set>
# include <cmath>
# include <algorithm>
using namespace std;
# define lowbit(x) ((x)&(-x))
# define pi acos(-1.0)
# define eps 1e-8
# define MOD 30031
# define INF 1000000000
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(int i=a; i<=n; ++i)
# define FO(i,a,n) for(int i=a; i<n; ++i)
# define bug puts("H");
# define lch p<<1,l,mid
# define rch p<<1|1,mid+1,r
# define mp make_pair
# define pb push_back
typedef pair<int,int> PII;
typedef vector<int> VI;
# pragma comment(linker, "/STACK:1024000000,1024000000")
typedef long long LL;
int Scan() {
    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;
}
const int N=20005;
//Code begin...

LL s[5];

int main ()
{
    int a, b;
    LL ans;
    scanf("%d%d",&a,&b);
    if (a%3==0||b%3==0) {puts("0"); return 0;}
    ans=min(a,b);
    s[0]=(a/3+1)*b; s[1]=(a-a/3-1)*(b/2); s[2]=(a-a/3-1)*(b-b/2);
    sort(s,s+3); ans=min(ans,s[2]-s[0]);
    s[0]=(b/3+1)*a; s[1]=(b-b/3-1)*(a/2); s[2]=(b-b/3-1)*(a-a/2);
    sort(s,s+3); ans=min(ans,s[2]-s[0]);
    s[0]=(a/3)*b; s[1]=(a-a/3)*(b/2); s[2]=(a-a/3)*(b-b/2);
    sort(s,s+3); ans=min(ans,s[2]-s[0]);
    s[0]=(b/3)*a; s[1]=(b-b/3)*(a/2); s[2]=(b-b/3)*(a-a/2);
    sort(s,s+3); ans=min(ans,s[2]-s[0]);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256
module Main where

import Data.List
import Control.Monad
import Debug.Trace
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)
import qualified Data.Set as S


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine
    
solve :: [(Int, Int)] -> Int -> Int
solve lrs n = let
    ls = fst <$> lrs
    rs = snd <$> lrs
    in
        max 0 $ minimum rs - maximum ls + 1


main = do
    (n, m) <- readTuple2
    lrs <- replicateM m readTuple2
    print $ solve lrs n




Measured memory_bytes: 40316
# ABC088C - Takahashi's Information
def main():
    arr = [list(map(int, input().rstrip().split())) for _ in range(3)]
    memo = []
    for i, j, k in arr:
        memo += [(i - j, j - k)]
    flg = True if memo[0] == memo[1] and memo[1] == memo[2] else False

    print("Yes" if flg else "No")


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
public class Main {


  private static void solve() {
    char[] k = ns();
    int d = ni();
    
    int len = k.length;
    long[][][] dp = new long[len + 1][d][2];
    dp[len][0][1] = 1;
    int mod = 1000000000 + 7;

    for (int i = len; i > 0; i --) {
      int kd = k[len - i] - '0';
      for (int s = 0; s < d; s ++) {
        for (int t = 0; t < 10; t ++) {
          dp[i - 1][(s + t) % d][0] += dp[i][s][0];
          
          if (t < kd) {
            dp[i - 1][(s + t) % d][0] += dp[i][s][1];
          }
          dp[i - 1][(s + t) % d][0] %= mod;
        }
        dp[i - 1][(s + kd) % d][1] += dp[i][s][1];
      }
    }
    
    System.out.println((dp[0][0][0] + dp[0][0][1] - 1 + mod) % mod);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

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

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 88784
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

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

    int ans = 1e9;
    if(T.front() != T.back()){
        ans = T.length() - 1;
    }else if(T.length() == 1){
        ans = 0;
    }else {
        ans = T.length() - 1;
    }
    cout << ans << endl;
}   

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int N, M, C;
	cin >> N >> M >> C;

	vector<int> B(M);
	int A[N][M];
	
	for(int i=0; i < M; i++)
	{
		cin >> B[i];
	}
	
	for(int n=0; n < N; n++)
	{
		for (int m=0; m < M; m++)
		{
			cin >> A[n][m];
		}
	}

	int count = 0;
	for(int n=0; n < N; n++)
	{
		int row_result = C; 
		for (int m=0; m < M; m++)
		{
			row_result += A[n][m]*B[m];
		}
		if (row_result > 0)
			count += 1;
	}
	cout << count <<endl;

	return 0;
	
}


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

using namespace std;

using ull = unsigned long long;

int main() {
    int K, X;
    cin >> K >> X;
    for(int i = -1000000; i < 1000000; ++i) {
        if(X-K < i && i < X+K){
            cout << i << " ";
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#綺麗にかけない
N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]
dic_s = {}
for i in set(s):
    dic_s[i] = s.count(i) 
dic_t = {}
for i in set(t):
    dic_t[i] = t.count(i)
ss=set(s)
ts=set(t)
if(ss & ts == set()):
    print(max(dic_s.values()))
else:
    dic_c = {}
    for i in ss&ts:
        dic_c[i] = dic_s[i] - dic_t[i]
    if(not (ss & (ss^ts) == set())):
        for i in ss & (ss^ts):
            dic_c[i] = dic_s[i]
    if(max(dic_c.values()) < 0):
        print(0)
    else:
        print(max(dic_c.values()))

Measured memory_bytes: 9092
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

struct edge{
  int to,cost,from;
  edge(int f, int t, int c){
    from = f;
    to = t;
    cost = c;
  }
};
vector<ll> d;
vector<bool> is_pass;
vector<edge> edges;
int V,E,r;
ll INF = 5000000000;

bool berm(){
  for(int ct=0;ct<V;ct++){
    for(int i=0;i<E;i++){
      int v = edges[i].to;
      int u = edges[i].from;
      int c = edges[i].cost;
      if(is_pass[u])is_pass[v] = is_pass[u];
      if(d[u] + c < d[v]){
	d[v] = d[u] + c;
	if(ct == V-1&&is_pass[u]){
	  return false;
	  }
      }
    }
  }
  return true;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> V >> E >> r;//V is number of edgent,E is number of hen,r is defedgent
  d.resize(V,INF);
  is_pass.resize(V,false);
  is_pass[r] = true;
  d[r] = 0;
  edges.resize(E,edge(0,0,0));
  REP(i,E){
    int from,to,cost;
    cin >> from >> to >> cost;
    edges[i] = edge(from,to,cost);
  }
  if(berm()){
    REP(i,V)
      if(!is_pass[i])cout << "INF" << endl;
      else cout << d[i] << endl;
  }else{
    cout << "NEGATIVE CYCLE" << endl;
  }
  return 0;
}

Measured memory_bytes: 3232
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t N;
int64_t A[100000];
int64_t B[100000];
int64_t D[100000];

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> N;
	for (size_t i = 0; i < N; i++)
	{
		in >> A[i];
	}
	for (size_t i = 0; i < N; i++)
	{
		in >> B[i];
	}

	for (size_t i = 0; i < N; i++)
	{
		D[i] = A[i] - B[i];
	}
	std::sort(D, D + N);

	int32_t count = 0;
	int32_t end = N;
	int64_t rem = 0;
	for (size_t i = 0; i < end; i++)
	{
		if (D[i] < 0) {
			++count;
			rem += D[i];
			while(rem < 0){
				--end;
				++count;
				if (end <= i) { count = -1; break; }
				rem += D[end];
			}
		}
	}
	out << count << endl;

	return 0;
}
#endif


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll gcd(ll a,ll b){
	if(b == 0) return a;
	return gcd(b,a%b);
}

ll lcm(ll a,ll b){
	ll g = gcd(a,b);
	return a / g * b; // Be careful not to overflow
}

int main(void) {
	int N;
	cin >> N;

	ll ans = 1LL;

	for (int i = 0; i < N; ++i) {
		ll T;
		cin >> T;
		ans = lcm(ans, T);
	}

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

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
import Data.Maybe
strToInt s = (read :: String -> Int) s
strToInteger s = (read :: String -> Integer) s
strToDouble s = (read :: String -> Double) s

main :: IO ()
main = do
    -- 文字列の入力
    s <- reverse <$> getLine
    -- 出力
    putStrLn $ if solve s then "YES" else "NO"

solve :: String -> Bool
solve [] = True
solve xs = case take 2 xs of
    "re" -> if (reverse $ take 6 xs) == "eraser"
                then solve $ drop 6 xs
                else if (reverse $ take 7 xs) == "dreamer" then solve $ drop 7 xs
                     else False
    "es" -> if (reverse $ take 5 xs) == "erase"
                then solve $ drop 5 xs
                else False
    "ma" -> if (reverse $ take 5 xs) == "dream"
                then solve $ drop 5 xs
                else False
    otherwise -> False


Measured memory_bytes: 7548
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func min(a, b int) int {
	if a <= b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a >= b {
		return a
	}
	return b
}

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func printansStr(result bool, a, b string) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func printansInt(result bool, a, b int) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func main() {
	defer write.Flush()

	var s string
	fmt.Fscan(read, &s)

	var even, odd []rune
	for i, c := range s {
		if i%2 == 1 {
			even = append(even, c)
		} else {
			odd = append(odd, c)
		}
	}

	if strings.Count(string(even), "R") == 0 && strings.Count(string(odd), "L") == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}


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

int main(void){
    int X,Y,Z;
    cin >> X >> Y >> Z;
    cout << Z <<' '<< X <<' '<< Y << endl;
    return 0;
}

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL<<60;
const ll mod =1000000007;


struct UnionFind {
	vector<int> par;
	int cnt;
	UnionFind(int size_) : par(size_, -1), cnt(size_) { }
	bool unite(int x, int y) {
		x = find(x); y = find(y);
		if (x != y) {
			if (par[y] < par[x]) swap(x, y);
			par[x] += par[y]; par[y] = x;
			cnt--;
		}
		return x != y;
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	int find(int x) {
		return par[x] < 0 ? x : par[x] = find(par[x]);
	}
	int size(int x) {
		return -par[find(x)];
	}
	int size() {
		return cnt;
	}
};

int main() {

	int n, m;
	cin >> n >> m;
	UnionFind uf(n);
	REP(i, m) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		uf.unite(a, b);
	}

	cout << uf.size() << endl;

}

Measured memory_bytes: 640
#include <stdio.h>

int main( void ){
  int A, B, add, sub, mult;
  
  scanf("%d %d", &A, &B);

  add = A + B;
  sub = A - B;
  mult = A * B;

  if(add > sub){
    if(add > mult){
      printf("%d\n", add);
    }else{
      printf("%d\n", mult);
    }
  }else{
    if(sub > mult){
      printf("%d\n", sub);
    }else{
      printf("%d\n", mult);
    }
  }

  return 0;
}



Measured memory_bytes: 128
//#if 1
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
//#endif
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main() {
	string a, b, c;
	int d;
	cin >> a >> b;
	c = a + b;
	d = atoi(c.c_str());
	for (int i = 0; d >= i*i; i++) {
		if (d == pow(i, 2)) {
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	
	return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mem(a, b) memset(a, (b), sizeof(a))
#define fore(i,a) for(int i=0;i<a;i++)
#define fore1(i,j,a) for(int i=j;i<a;i++)
#define print(ar) for(int i=0;i<ar.size();i++)cout<<ar[i]<<" ";
#define END cout<<'\n'
const double pi=acos(-1.0);
 
typedef pair<int, int> PII;
 
typedef vector<long long> VI;
 
typedef vector<string> VS;
 
typedef vector<PII> VII;
 
typedef vector<VI> VVI;
 
typedef map<int,int> MPII;
 
typedef set<int> SETI;
 
typedef multiset<int> MSETI;
 
typedef long int li;
 
typedef unsigned long int uli;
 
typedef long long int ll;
 
typedef unsigned long long int  ull;
ll fastexp (ll a, ll b, ll n) {
  ll res = 1;
  while (b) {
      if (b & 1) res = res*a%n;
      a = a*a%n;
      b >>= 1;
  }
  return res;
}
void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int main()
 {  fast();
  ll a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k<=a+b){
      if(k>a)cout<<a<<endl;
      else cout<<k<<endl;
  }
  else 
  cout<<a-(k-(a+b))<<endl;}
	  
	

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define endl "\n"
#define FASTIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define f first
#define s second
typedef long long int ll;
const int INF = 1e9;

using namespace std;

void solve()
{
    ll i, j, n;
}
 
int main()
{
    FASTIO
    int t, ans, case_no, S, W;
    case_no=1;
    cin>>S>>W;
    if(W>=S)cout<<"unsafe\n";
    else cout<<"safe\n";
    return 0;
}

Measured memory_bytes: 3640
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($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")
    };
}

use std::io::*;
use std::str::FromStr;

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

#[allow(dead_code)]
fn readu() -> usize {
    read::<usize>()
}

#[allow(dead_code)]
fn readi() -> i32 {
    read::<i32>()
}

fn main() {
    input! {
        s: usize
    }
    let l = s % 100;
    let u = s / 100;

    let mut l_valid = false;
    let mut u_valid = false;

    if 1 <= l && l <= 12 {
        l_valid = true;
    }
    if 1 <= u && u <= 12 {
        u_valid = true;
    }
    if l_valid && u_valid {
        println!("AMBIGUOUS");
    } else if l_valid {
        println!("YYMM");
    } else if u_valid {
        println!("MMYY");
    } else {
        println!("NA");
    }
}

Measured memory_bytes: 4352