akhauriyash/Code-Regression huggingface dataset:
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;

#pragma endregion

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}

#pragma endregion 




/*****************************************************************************/
signed main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	int h, w,i,j;
	cin >> h >> w;
	vector<vector<string>> a(h, vector<string>(w));
	for (i = 0; i < h; i++)
	{
		for (j = 0; j < w; j++)
		{
			cin >> a[i][j];

		}
	}
	for (i = 0; i < h; i++)
	{
		for (j = 0; j < w; j++)
		{
			if (a[i][j] == "snuke")
			{
				string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

				cout <<s[j]<< i+1;
			}

		}
	}
	return 0;
}

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

int main() {
  while (1) {
    int a, b;
    if (scanf("%d%d", &a, &b) != 2) break;

    int sum = a+b;
    int cnt = 0;
    while (sum > 0) {
      cnt++;
      sum /= 10;
    }

    printf("%d\n", cnt);
  }
}

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

int main(int argc, char const *argv[]) {
  int n, d;
  int out = 0;

  cin >> n >> d;

  int x[n][d];
  for (size_t i = 0; i < n; i++) {
    for (size_t j = 0; j < d; j++) {
      cin >> x[i][j];
    }
  }

  for (size_t i = 0; i < n; i++) {
    for (size_t j = i + 1; j < n; j++) {
      int sum = 0;
      for (size_t k = 0; k < d; k++) sum += pow(x[j][k] - x[i][k], 2);
      int s = (int)sqrt(sum);
      if (sum == s * s) out++;
    }
  }

  cout << out << endl;
  return 0;
}

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

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

typedef long long ll;

using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout<<setprecision(10);
  ll x,y;
  cin>>x>>y;
  int cnt=0;
  while(x<=y)
  {
    x*=2;
    cnt++;
  }
  cout<<cnt<<endl;
  return 0;

}


Measured memory_bytes: 256
N = int(input())
B = list(map(int, input().split()))

sum = 0

for i in range(N):
    if i == 0:
        sum += B[0]
    elif i ==N-1:
        sum += B[-1]
    else:
        if B[i-1] < B[i]:
            sum += B[i-1]
        else:
            sum += B[i]
print(sum)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
const long long INF = 1LL << 60;

string s,t;

int main()
{
  cin >> s >> t;
  cout << t << s << endl;
}

Measured memory_bytes: 3592
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include<set>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
llfor;///////////////////////////////////////////////////////////
int main(){
 ll h,w;sc(h);sc(w);
 ll a=h*w;
 ll ans=cei(a,2);
 if(h==1||w==1)ans=1;
 pr(ans);
return 0;}

Measured memory_bytes: 3588
#include <stdio.h>

#define max(a, b) (((a) > (b)) ? (a) : (b))

int main(void) {
	int i;
	char s[11];
	char ans[11];
	int len;

	scanf("%s", s);

	len = 0;
	for (i = 0; s[i]; i++)
		if (s[i] == 'B')
			len = max(len - 1, 0);
		else
			ans[len++] = s[i];
	ans[len] = '\0';

	puts(ans);

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;

deque<pair<int, int> > deq;

const int MAX = 1000;
/* 配列 a の [left, right) をソートします */
void MergeSort(int a[], int left, int right) {
    if (right - left == 1) return;
    int mid = left + (right - left) / 2;

    // 左半分 [left, mid) をソート
    MergeSort(a, left, mid);

    // 右半分 [mid, right) をソート
    MergeSort(a, mid, right);

    //一旦「左」と「右」のソート結果をコピーしておく (右側は左右反転)
    int buf[1000];
    int index_buf = 0;
    for (int i = left; i < mid; ++i) {
        buf[index_buf++] = a[i];
    }
    for (int i = right-1; i >= mid; --i) {
        buf[index_buf++] = a[i];
    }
    int last_index_buf = --index_buf;

    // マージする
    int iterator_left = 0;                    // 左側のイテレータ
    //int iterator_right = (int)buf.size() - 1; // 右側のイテレータ
    int iterator_right = last_index_buf;
    for (int i = left; i < right; ++i) {
        // 左側採用
        if (buf[iterator_left] <= buf[iterator_right]) {
            a[i] = buf[iterator_left++];
        }
        // 右側採用
        else {
            a[i] = buf[iterator_right--];
        }
    }
}

#include <queue>
#include <stack>

void breadthFirstSearch(Graph& G,const int n,int initVertex,vector<int>& dist){
    //BFS用のデータ構造
    dist.assign(n,-1);//頂点の深さ記録
    queue<int> que;//次の訪問先を記録

    //初期値
    dist[initVertex] = 0;
    que.push(initVertex);

    while(!que.empty()){
        int v = que.front();
        que.pop();

        for(auto next_v:G[v]){
            if(dist[next_v] != -1) continue;
            dist[next_v] = dist[v] + 1;
            que.push(next_v);
        }

    }

}

vector<bool> seen;
vector<int> first_order;
vector<int> last_order;
void dfs(Graph& G,int v,int& first,int& last){
    first_order.push_back(first++);
    seen[v] = true;
    for(auto next_v:G[v]){
        if(seen[next_v]) continue;
        dfs(G,next_v,first,last);
    }

    last_order.push_back(last++);




}



int main() {
    
    
    string a;
    cin >> a;
    
    vector<string> bb;

    int b = a.length();
    string str(b, 'x'); 
    cout << str << endl;


    return 0;
}

Measured memory_bytes: 256
/**
 
coded by - pathakcodes  //revamped
**/


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


int main(){
   int n ;
   cin >> n ;
   vector<vector<int>> dp(n, vector<int>(3,0)) ;
  
   for(int i = 0 ; i < n ; i++){
       int a,b,c ;
       cin >> a >>b >> c ;
       if(i==0){
           dp[i][0]  = a ;
           dp[i][1] = b ;
           dp[i][2] = c ;
       } else {
           dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a ;
           dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b ;
           dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c ;
       }
       
   }
   
   cout << max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2])) << endl ;
   
}

Measured memory_bytes: 8812
n = int(input())
num_dict = {}
for i in range(n):
    tmp = input()
    num_dict.setdefault(tmp ,1)
    num_dict[tmp] += 1
    
cnt = 0
for i in num_dict.values():
    if i % 2 == 0:
        cnt += 1
print(cnt)

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

int main()
{
	int s;
	int w,x, y,z;
	cin >> s;
	
		x = s / 3600;
		w = (s - (x * 3600));
		y = w / 60;
		z = w - (y * 60);
	

	cout << x << ":" << y << ":" << z << endl;
    return 0;
}

Measured memory_bytes: 3088
#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())
#define ll int64_t
#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;

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 main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    stack<int> st;

    while(cin>>s){
        if(s[0]!='+'&&s[0]!='-'&&s[0]!='*'){
            st.push(atoi(s.c_str()));
        }
        else{
            if(s[0]=='+'){
                int a=st.top();st.pop();
                int b=st.top();st.pop();
                st.push(a+b);
            }
            if(s[0]=='-'){
                int a=st.top();st.pop();
                int b=st.top();st.pop();
                st.push(b-a);
            }
            if(s[0]=='*'){
                int a=st.top();st.pop();
                int b=st.top();st.pop();
                st.push(a*b);
            }
        }
    }
    cout<<st.top()<<endl;
}


Measured memory_bytes: 3192
#include<iostream>
#include<cassert>
#include<algorithm>
#include<vector>
using namespace std;

int gcd(int x, int y){
  return y ? gcd(y, x%y) : x;
}

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




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

using ll = long long;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	ll n, m, x, a[13][13] = {0};
	cin >> n >> m >> x;
	vector <ll> c(n+1);
	for (int i=1; i<=n; i++) {
		cin >> c[i];
		for (int j=1; j<=m; j++) {
			cin >> a[i][j];
		}
	}
	ll ans = 1e18;
	for (int i=0; i<(1<<n); i++) {
		ll res = 0, cnt = 0, b[13] = {0};
		for (int j=0; j<n; j++) {
			if (!((i>>j)&1)) continue;
			res += c[j+1];
			for (int k=1; k<=m; k++) {
				b[k] += a[j+1][k];
			}
		}
		for (int i=1; i<=m; i++) {
			if (b[i] >= x) cnt ++;
		}
		if (res < ans && cnt == m) {
			ans = res;
		}
	}
	if (ans == 1e18) cout << -1;
	else cout << ans;
	return 0;
}


Measured memory_bytes: 3648
import sys
input = sys.stdin.readline
n = int(input())
A = [int(input()) for i in range(n)]

t = 1
ans = 0
for i in range(n):
    if A[i] == t:
        t += 1
    elif A[i] % t == 0:
        ans += (A[i]-1) // t
    else:
        ans += A[i] // t
    if t == 1:
        t += 1
    # print(ans)
print(ans)

Measured memory_bytes: 44508
#include<stdio.h>
int main(){
int a,b,c,d;
while(1){
scanf("%d %d",&a,&b);
if(a==0&&b==0)
break;
for(c=0;c<a;c++){
for(d=0;d<b;d++){
printf("#");
}
printf("\n");
}
printf("\n");
}
return 0;
}

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

int main() {

  int h,w;
  cin >> h >> w;
  
  vector<vector<char>> s(h+2,vector<char> (w+2,'.'));
  
  for ( int i = 1; i < h+1; i++){
    for ( int j = 1; j < w+1; j++){
      cin >> s[i][j];
    }
  }
  
  for ( int i = 1; i < h+1; i++){
    for ( int j = 1; j < w+1; j++){
      if ( s[i][j] == '#' ){
        if ( s[i-1][j] == '#' ||
             s[i][j-1] == '#' ||
             s[i][j+1] == '#' ||
             s[i+1][j] == '#' ){
          continue;
        }else{
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }
  
  cout << "Yes" << endl;  
  
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define int ll
#define pb push_back
#define sz(i) (int)(i.size())
#define fi first
#define se second
#define ld long double
#define pii pair<int, int>
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = 1e9 + 7;
using namespace std;
#ifndef ONLINE_JUDGE
#define tr(...) {__l(__LINE__);__f(#__VA_ARGS__, __VA_ARGS__);}
inline void __l(int line) { cerr << "#" << line << ": "; }template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << std::endl;}template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define tr(...)
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}
const int N = 100 + 10;
const int K = 1e5 + 10;
// make sure N size is correctttt!!!!!!!!!

int n, a[N], dp[K], k;

int solve(int WT){
   if(WT <= 0){
      return 0;
   }
   int &ans = dp[WT];
   if(ans != -1)
      return ans;
   int LoosingPosition = 0;
   for (int i = 0; i < n; ++i){
      if(WT >= a[i]){
         LoosingPosition |= ((solve(WT-a[i])) == 0);
      }
      // LoosingPosition |= ((solve(WT-a[i])) == 0);
   }
   ans = (int)LoosingPosition;
   return ans;
}

int32_t main(){_

   cin>>n>>k;
   for (int i = 0; i < n; ++i)
   {
      cin>>a[i];
   }

   memset(dp, -1, sizeof dp);
   puts(solve(k)==1 ? "First" : "Second");

   //make sure N size is correct!!!!!!!!!
   return 0;
}

Measured memory_bytes: 4224
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

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

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

// GCC __gcd(long long A, long long B)

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

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


ll calc(ll X, ll C, ll D) {
  return X / C + X / D - X / lcm(C, D);
}

int main() {
  ll A, B, C, D;

  cin >> A >> B >> C >> D;

  cout << (B - A + 1) - (calc(B, C, D) - calc(A-1, C, D)) << endl;;

  return 0;
}


Measured memory_bytes: 256
import math
import itertools
row_length = int(input())
point = {}
for i in range(row_length):
    point[i] = list(map(int, input().split()))
point_list = [point[x] for x in range(len(point))]
pattern_list = list(itertools.permutations(point_list))



def calc_dist(pat_list): #旅程リストを入れた時に、その距離を計算する
    dist = 0
    for i in range(len(pat_list)-1):
        dist += math.sqrt(pow(pat_list[i][0] - pat_list[i+1][0], 2) + pow(pat_list[i][1] - pat_list[i+1][1], 2))
    return dist

ans_dist = 0
for j_list in pattern_list:
    ans_dist += calc_dist(j_list)

print(ans_dist/len(pattern_list))

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

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

  vector<int>ca(a);
  sort(ca.begin(), ca.end());
  set<int> s;
  rep(i, n){
    if(i%2==0)continue;
    s.insert(ca[i]);
  }

  int c=0;
  rep(i, n){
    if(i%2==0)continue;
    if(s.count(a[i])==0)c++;
  }

  cout<<c<<endl;

  return 0;
}

Measured memory_bytes: 6352
#include <stdio.h>

int main()
{
  int i, j, N, k;
  int A[3][3];
  int b[101];
  
  for(i=0; i<3; i++) for(j=0; j<3; j++){
  	scanf("%d", &A[i][j]);
  }
  
  scanf("%d", &N);
  for(k=0; k<N; k++){
  	scanf("%d", &b[k]);
  }
  
   for(i=0; i<3; i++) for(j=0; j<3; j++) for(k=0; k<N; k++){
   	if(A[i][j]==b[k]){ A[i][j]=0; }
   }
   
   for(i=0; i<3; i++) for(k=0; k<N; k++){
   	if( ((A[0][i]==A[1][i])&&(A[1][i]==A[2][i])) || ((A[i][0]==A[i][1])&&(A[i][1]==A[i][2])) ){printf("Yes\n"); return 0;}
   }
   	if( ((A[0][0]==A[1][1])&&(A[1][1]==A[2][2])) || ((A[0][2]==A[1][1])&&(A[1][1]==A[2][0])) ){printf("Yes\n");}
   	else{ printf("No\n"); }
 
 return 0;
}

Measured memory_bytes: 128
process.stdin.resume();
process.stdin.setEncoding('utf8');

process.stdin.on('data', function (chunk) {

var line = chunk.toString().split(' ');
var a = Number(line[0]);
var b = Number(line[1]);

var menseli = a*b;
var nagasa = a*2+b*2;
console.log(menseli+' '+nagasa);
    
});

Measured memory_bytes: 15536
#include <iostream>
#include <algorithm>
#include <array>
#include <atomic>
#include <bitset>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;

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

typedef long long ll;

void result() {
    string s;
    cin >> s;
    vector<char> even(s.size()), odd(s.size());
    rep(0, s.size()-1) {
        if ((i+1) % 2 == 0){
            if (s[i] == 'R') {
                cout << "No" << endl;
                return;
            }
        }
        else{
            if (s[i] == 'L') {
                cout << "No" << endl;
                return;
            }
        }
    }
    cout << "Yes" << endl;
}

int main() {	
    std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
    result();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1<<30;

int main(){
  int x=0, n;cin>>n;
  string s;cin>>s;
  int ans=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='I')x++;
    else x--;
    ans=max(ans, x);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    #n,m,k=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    #n=int(readline())
    s=readline().rstrip()
    t=readline().rstrip()
    ans=0
    for i in range(len(s)):
        if s[i]!=t[i]:
            ans+=1
    print(ans)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

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

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define lp(i, a, b) for (int i=a; i<(b); i++)
#define lpd(i,a,b) for (int i = (b)-1; i >= a; i--)
	
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define mp make_pair
#define pb push_back

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

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    ll a, b;
    cin>>a>>b;
    ll res = 0;
    if (a>0) a--;
    ll n = log2(a) + 1;
    ll m = log2(b) + 1; 
    ll ansa, ansb, ans;

    for (int i=0;i<max(n, m);++i){
        ansa = 0;
        if (a & (1LL<<i)){
            ll tmp = a;
            for (int j=i-1;j>=0;j--){
                tmp |= (1LL<<j);
            }
            ll cnt = tmp - a;
            tmp++;
            ansa += (tmp/2);
            ansa -= cnt;
        }
        else {
            ll tmp = a;
            for (int j=i-1;j>=0;j--){
                tmp &= ~(1LL<<j);
            }
            ansa += (tmp/2);
        }

        ansb = 0;
        if (b & (1LL<<i)){
            ll tmp = b;
            for (int j=i-1;j>=0;j--){
                tmp |= (1LL<<j);
            }
            ll cnt = tmp - b;
            tmp++;
            ansb += (tmp/2);
            ansb -= cnt;
        }
        else {
            ll tmp = b;
            for (int j=i-1;j>=0;j--){
                tmp &= ~(1LL<<j);
            }
            ansb += (tmp/2);
        }
        ans = ansb - ansa;
        debug(i, ans);
        if (ans %2 != 0) res |= (1LL<<i);
    }
    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
#define FF(i,a,b) for (int i=a;i<=b;i++)
#define F(i,b,a)  for (int i=b;i>=a;i--)
#define mes(a,b)  memset(a,b,sizeof(a))
#define INF 0x3f3f3f3f
typedef long long ll;
const int N = 50, M = 20;

int n, ma, mb, a[N], b[N], c[N], dp[N+1][N*M+1][N*M+1], ans;
int main()
{
    cin>>n>>ma>>mb;
    FF(i,1,n) cin>>a[i]>>b[i]>>c[i];
    mes(dp, INF);  dp[1][0][0]=0;
    FF(i,1,n) FF(ca,0,N*M) FF(cb,0,N*M) {
        if(dp[i][ca][cb]==INF) continue;
        dp[i+1][ca][cb]=min(dp[i+1][ca][cb], dp[i][ca][cb]);
        dp[i+1][ca+a[i]][cb+b[i]]=min(dp[i+1][ca+a[i]][cb+b[i]], dp[i][ca][cb]+c[i]);
    }
    ans=INF;
    FF(i,1,N*M) FF(j,1,N*M) if(i*mb==j*ma)
        ans=min(ans, dp[n+1][i][j]);
    if(ans==INF) cout<<-1<<endl;
    else cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 199808
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def pop_cnt(n):
    return bin(n).count('1')


def f(n):
    cnt = 0
    while n != 0:
        n = n % pop_cnt(n)
        cnt += 1
    return cnt
 
n = int(readline())
x2 = list(readline().decode().rstrip())
x10 = int(''.join(x2), 2)

c = x2.count('1')
mod1 = x10 % (c + 1)
mod2 = x10 % (c - 1) if c-1 != 0 else 0

for i in range(n):
    ans = 0
    if x2[i] == '0':
        t = (mod1 + pow(2, n-i-1, c+1)) % (c+1)
    else:
        if c-1 != 0:
            t = (mod2 - pow(2, n-i-1, c-1)) % (c-1)
        else:
            print(0)
            continue
    
    ans = f(t) + 1
    print(ans)

Measured memory_bytes: 10900
#include <stdio.h>
int main(){
	int i,j;
	int n;
	int a[100];
	int count=0;
	int flag=1;
	int tmp;
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	
	for(i=1;i<n;i++){
		for(j=0;j<=n-i-1;j++){
			if(a[j]>a[j+1]){
				tmp=a[j];
				a[j]=a[j+1];
				a[j+1]=tmp;
				count++;
			}
		}
	}
	for(i=0;i<n-1;i++)printf("%d ",a[i]);
	printf("%d\n",a[i]);
	printf("%d\n",count);
return 0;
}

Measured memory_bytes: 600
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	
	while (scanf("%d", &n), n != 0){
		int card[101];
		int card2[101];
		int t, h;
		t = h = n;
		bool taro[202] = {false};
		for (int i = 0; i < n; i++){
			scanf("%d", &card[i]);
			taro[card[i]] = true;
		}
		int cnt = 0;
		for (int i = 1; i <= n * 2; i++){
			if(!taro[i]){
				card2[cnt++] = i;
			}
		}
		
		sort(card, card+n);
		int b = 0;
		while (t != 0 && h != 0){
			int f = b;
			for (int i = 0; i < n; i++){
				if (card[i] != 0 && card[i] > b){
					t--;
					b = card[i];
					card[i] = 0;
					break;
				}
			}
			if(f == b){
				b = 0;
			}
			else {
				f = b;
			}
			if(t == 0) break;
			for (int i = 0; i < n; i++){
				if (card2[i] != 0 && card2[i] > b){
					h--;
					b = card2[i];
					card2[i] = 0;
					break;
				}
			}
			if(f == b){
				b = 0;
			}
			
		}
		printf("%d\n%d\n", h, t);
	}
}

Measured memory_bytes: 1044
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <vector>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if((d>=abs(a-b) && d>=abs(b-c)) || d>=abs(a-c)){
    cout<<"Yes"<<"\n";
  }
  else{
    cout<<"No"<<"\n";
  }
  return 0;
}

Measured memory_bytes: 3624
import numpy as np
import itertools

N = int(input())
P = [0] * N
Q = [0] * N
P = tuple([int(i) for i in input().split()])
Q = tuple([int(i) for i in input().split()])

num_list = [i+1 for i in range(N)]
a = list(itertools.permutations(num_list)).index(P)
b = list(itertools.permutations(num_list)).index(Q)
print(abs(a - b))

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

using namespace std;

#define forn(i, x, n) for (int i = int(x); i <= int(n); ++i)
#define for1(i, n, x) for (int i = int(n); i >= int(x); --i)
#define F first
#define S second
#define pb push_back

typedef long long ll;
typedef pair <int, int> pii;
typedef long double ld;
typedef vector <ll> vi;

const int N = 2e6 + 1;
const ll INF = 1e18 + 9;
const int B = 1e9 + 7;

int main() {
    #ifdef black
    freopen("in", "r", stdin);
    #endif // black
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    ll a, b, c;
    cin >> a >> b >> c;
    ll ans = (a % 2) * b * c;
    ans = min(ans, a * (b % 2) * c);
    ans = min(ans, a * b * (c % 2));
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 256
n,m = map(int, input().split())
while (n!=0 or m!=0):
    vote = [[0, i] for i in range(m)]
    for i in range(n):
        v_l = list(map(int, input().split()))
        for j, v in enumerate(v_l):
            if v == 1:
                vote[j][0] += 1
    vote = sorted(vote, key=lambda x:x[0], reverse=True)
    for i in range(m):
        if i != m-1:
            print("{} ".format(vote[i][1]+1), end="")
        else:
            print("{}".format(vote[i][1]+1), end="")
    print()
    n,m = map(int, input().split())


Measured memory_bytes: 5636
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    map<ll,ll> mp;
    ll sum = 0;
    rep(i, n){
        sum += a[i];
        mp[a[i]]++;
    }

    ll q;
    cin >> q;
    rep(i, q){
        ll f, t;
        cin >> f >> t;
        sum -= f * mp[f];
        sum += t * mp[f];
        mp[t] += mp[f];
        mp[f] = 0;
        cout << sum << endl;
    }
}


Measured memory_bytes: 10084
#include <stdio.h>
#include <string.h>
int main()
{
	char c[120];
	scanf("%s",c);
	int k=strlen(c);
	int s=0;
	for(int i=0;i<k/2;i++)
	  if(c[i]!=c[k-1-i])
	    s++;
	    printf("%d\n",s);
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  int a,b,c,co;
  scanf("%d %d %d",&a,&b,&c);
  if(a>b){
    a=b;
    b=a;
  }
  while(a<=b){
    if(c%a==0){
      co=co+1;
      }
      a=a+1;
    }
  printf("%d\n",co);
  return 0;
  }
    

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 1000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define stp setprecision(15)
#define eps 0.000001
#define endl '\n'
#define mod2 998244353
#define ll lli

using namespace std ;

#define N 200000+5 

typedef tree<lli,null_type,less<lli>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

int main() 
{
/////////////////////////////////////
    
    fastio;
 
/////////////////////////////////////    

    lli n,d;
    cin>>n>>d;

    lli x = 2*d + 1;
    lli ans = n/x;
    if(n%x) ans++;
    cout<<ans;
}



Measured memory_bytes: 256
import sys
from heapq import heappush, heappop
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    V, E, r = map(int, readline().split())
    G = [[] for _ in range(V)]

    for _ in range(E):
        u, v, d = map(int, readline().split())
        G[u].append([v,d])

    dist = [INF] * V
    que = [(0, r)]
    dist[r] = 0
    while que:
        c, v = heappop(que)
        # if dist[v] < c:
        #     continue
        for t, cost in G[v]:
            if dist[v] + cost < dist[t]:
                dist[t] = dist[v] + cost
                heappush(que, (dist[t], t))

    for i in dist:
        print('INF' if i==INF else i)
if __name__ == '__main__':
    main()


Measured memory_bytes: 96940
#include <iostream>
#include <string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<limits.h>
#include<string>
#include<iomanip>
#include<numeric>
#include<queue>
using namespace std;

long long  mod = 1000000007;

long max(long x, long y) {
	return x > y ? x : y;
}

long min(long x, long y) {
	return x < y ? x : y;
}

long factorial(long n) {
	if (n == 1) {
		return 1;
	}
	else {
		return n * factorial(n - 1);
	}
}

long long  fel(long long  n,long long  f) {

		if (f == 1) {
			return n % mod;
		}
		else if (f % 2 == 0) {
			return (fel(n,f / 2) * fel(n,f / 2)) % mod;
		}
		else {
			return ((n  * fel(n,f / 2) %mod) * fel(n,f / 2))% mod;
		}
	

}


int main(){
	
	int a;

	for (int i = 0; i<5;i++) {
		
		cin >> a;
		
		if (a == 0) {
			cout << i + 1;
		}
}

}







Measured memory_bytes: 3100
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for (int i = 0; i < int(n); ++i)
 
#define X real()
#define Y imag()
 
typedef double D;
typedef complex<D> P;
struct L{P a, b;};
typedef vector<P> Pol;
 
const D EPS = 1e-8;
 
int sig(D a, D b = 0) {return a < b - EPS ? -1 : a > b + EPS ? 1 : 0;}
bool near(P a, P b) {return !sig(norm(a - b));}
namespace std {
  bool operator<(P a, P b) {return sig(a.Y, b.Y) ? a.Y < b.Y : a.X < b.X;}
}
 
D sr(D a) {return sqrt(max(a, (D)0));}
 
D det(P a, P b) {return a.X * b.Y - a.Y * b.X;}
 
enum CCW{FRONT = 1, RIGHT = 2, BACK = 4, LEFT = 8, ON = 16};
int ccw(P a, P b, P c) {
  if (near(a, c) || near(b, c)) return ON;
  int s = sig(det(b - a, c - a));
  if (s) return s > 0 ? LEFT : RIGHT;
  return (a < b) == (b < c) ? FRONT : (c < a) == (a < b) ? BACK : ON;
}
 
D arg(P base, P a, P b) {return arg((b - base) / (a - base));}
L sortBase;
bool lessArg(pair<P, int> a, pair<P, int> b) {
  D ang1 = arg(sortBase.a, sortBase.b, a.first);
  D ang2 = arg(sortBase.a, sortBase.b, b.first);
  return sig(ang1, ang2) ? ang1 < ang2 : norm(a.first) < norm(b.first);
}
 
D aTri(D a, D b, D c) {D s = (a + b + c) / 2; return sr(s * (s - a) * (s - b) * (s - c));}
 
int main() {
  int n;
  cin >> n;
  vector<pair<P, int> > vp;
  rep (i, n) {
    D x, y;
    cin >> x >> y;
    vp.push_back(make_pair(P(x, y), i + 1));
  }
  D r[n];
  vector<int> pol[n];
  rep (i, n) r[i] = 1e9;
  rep (i, n) {
    sort(vp.begin(), vp.end());
    sortBase = (L){vp[i].first, vp[i].first + P(0, 1)};
    sort(vp.begin() + i + 1, vp.end(), lessArg);
    D dp[n + 1][n][n];
    int prv[n + 1][n][n];
    rep (j, n + 1) rep (k, n) rep (l, n) dp[j][k][l] = 1e9;
    rep (j, n) if (j > i) {
      dp[0][i][j] = 0;
      prv[0][i][j] = -1;
      rep (k, n) rep (l, j) rep (m, j) if (ccw(vp[l].first, vp[m].first, vp[j].first) == LEFT) {
	D val = dp[k][l][m] + aTri(abs(vp[i].first - vp[m].first), abs(vp[m].first - vp[j].first), abs(vp[j].first - vp[i].first));
	if (val < dp[k + 1][m][j]) {
	  dp[k + 1][m][j] = val;
	  prv[k + 1][m][j] = l;
	  if (r[k + 1] > dp[k + 1][m][j]) {
	    r[k + 1] = dp[k + 1][m][j];
	    vector<int> p;
	    p.push_back(vp[j].second);
	    p.push_back(vp[m].second);
	    int pk = k + 1, pm = m, pj = j;
	    while (pk != 0) {
	      int pl = prv[pk][pm][pj];
	      p.push_back(vp[pl].second);
	      --pk;
	      pj = pm;
	      pm = pl;
	    }
	    reverse(p.begin(), p.end());
	    pol[k + 1] = p;
	  }
	}
      }
    }
  }
  int q;
  cin >> q;
  rep (i, q) {
    int k;
    cin >> k;
    k -= 2;
    if (pol[k].empty()) cout << "NA" << endl;
    rep (j, pol[k].size()) cout << pol[k][j] << (j != (int)pol[k].size() - 1 ? " " : "\n");
  }
}

Measured memory_bytes: 1956
import numpy as np
input1 = list(map(int,input().split()))

N = input1[0]

input2 = []
for i in range(N):
  input2.append(list(map(int,input().split())))


distance = 0

for i in range(N):
  for j in range(i,N):
    distance += np.sqrt((input2[i][0] - input2[j][0])**2 + (input2[i][1] - input2[j][1])**2)

ans = 2*distance/N
print(ans)

Measured memory_bytes: 12508
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;
using namespace boost::multiprecision;

int main() {
  ll N;
  cin >> N;
  ll answer = 0;
  REP(i, N) {
    ll a;
    cin >> a;
    answer += a - 1;
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 3620
n = int(input())
a = [[0 for i in range(n)] for j in range(n)]

for i in range(n):
    v = list(map(int, input().split()))
    u = v[0]
    k = v[1]
    for j in range(k):
        a[u - 1][v[2 + j] - 1] = 1
    print(*a[u - 1])

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

int main()
{
  char n;
  int i,j,first,next;
  bool flag=false;
  
  cin>>n;
  first=n-'1'+1;
  
  for(i=0;i<3;i++){
    if(i){ //1回目は回さない
      cin>>n;
      next=n-'1'+1;

      if(first>next ||(first==next && flag)){
	for(j=0;j<3;j++){
	  cout<<first;
	}cout<<endl;  return 0;

      }

      else if(first==next) flag=true;

      else {
	for(j=0;j<3;j++){//デカい数字より下の数が大きい
	  cout<<first+1;
	}cout<<endl;   return 0;
      }

    }

  }
}


Measured memory_bytes: 256
#include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl


double a[8];

double outer_product(double a[2], double b[2]){
	return a[0]*b[1]-a[1]*b[0];
}

inline double sgn(double x){
	if(x>EPS)return 1;
	else if(abs(x)<EPS)return 0;
	return -1;
}

bool chk(double a[8]){
	double xa[3][2];
	rep(i,3){
		rep(j,2)xa[i][j]=a[i*2+j]-a[6+j];
	}
	double op[3];
	rep(i,3)op[i]=outer_product(xa[i], xa[(i+1)%3]);
	return sgn(op[0])==sgn(op[1]) && sgn(op[1])==sgn(op[2]);
}

int main(){
	while(cin>>a[0]){
		rep(i,7)cin>>a[i+1];
		cout<<(chk(a) ? "YES" : "NO")<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

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

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

vector< vector<int> > Graph;
vector< int > value;



int main(int argc, const char * argv[]) {
    
   

    cin.tie(0);
    ios::sync_with_stdio(false);
   
    
    int n; cin >> n;
    if(n>888) cout << 999 << endl;
    else if(n>777) cout << 888 << endl;
    else if(n>666) cout << 777 << endl;
    else if(n>555) cout << 666 << endl;
    else if(n>444) cout << 555 << endl;
    else if(n>333) cout << 444 << endl;
    else if(n>222) cout << 333 << endl;
    else if(n>111) cout << 222 << endl;
    else cout << 111 << endl;
    
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long

int main() {
    fastio;
    int n;
    cin >> n;
    int* b = new int[n - 1];
    for (int i = 0; i < n - 1; ++i) cin >> b[i];

    int* a = new int[n];

    a[0] = b[0], a[n-1] = b[n-2];
    for (int i = 1; i <= n-2; ++i) {
        a[i] = min(b[i], b[i - 1]);
    }

    cout << accumulate(a, a + n, 0);
    return 0;
}

Measured memory_bytes: 256
N = int(input())
L = []
if not (1 <= N <= 2*(10**5)):
    exit()


for i in range(N):
    d = input()
    # if not (1 <= len(d) <= 10):
    #    exit()
    # if not (d.lower() == d):
    #     exit()
    L.append(d)

print(len(set(L)))

Measured memory_bytes: 35564
#include<iostream>
#include<string>
using namespace std;
int main(void){
  int n,i;
  cin >> n;
  string s1,s2;
  int taro = 0, hanako = 0;
  for(i = 0; i < n; i++){
    cin >> s1 >> s2;
    if(s1.compare(s2)==0) {
      taro++;hanako++;
    }
    else if(s1.compare(s2)>0){
        taro+=3;
    }
    else{
    hanako+=3;
    }
  }
  cout << taro << " " << hanako << endl;
}


Measured memory_bytes: 3160
import sys
input = sys.stdin.readline
from collections import Counter

n, c = map(int, input().split())
d = [list(map(int, input().split())) for _ in range(c)]
a = [list(map(int, input().split())) for _ in range(n)]
zer, one, two = Counter(), Counter(), Counter()
for i, l in enumerate(a):
	for j, x in enumerate(l):
		x -= 1
		if (i + j) % 3 == 0:
			zer[x] += 1
		elif (i + j) % 3 == 1:
			one[x] += 1
		else:
			two[x] += 1
ans = 1 << 30
for f in range(c):
	for s in range(c):
		if f == s:
			continue
		for t in range(c):
			if f == t or s == t:
				continue
			cand = sum(d[k][f] * v for k, v in zer.items()) + sum(d[k][s] * v for k, v in one.items()) + sum(d[k][t] * v for k, v in two.items())
			if ans > cand:
				ans = cand
print(ans)

Measured memory_bytes: 5868
from typing import List, Iterator, Optional, Tuple


def trace_back(sink: int,
               predecessors: List[Optional[Tuple[int, int]]]) -> Iterator[List[int]]:
    p = predecessors[sink]
    while p is not None:
        v, i = p
        yield edges[v][i]
        p = predecessors[v]


def min_cost_flow(source: int, sink: int, required_flow: int) -> int:
    res = 0
    while required_flow:
        dist = [float('inf')] * n
        dist[source] = 0
        predecessors: List[Optional[Tuple[int, int]]] = [None] * n

        while True:
            updated = False
            for v in range(n):
                if dist[v] == float('inf'):
                    continue
                for i, (remain, target, cost, _) in enumerate(edges[v]):
                    new_dist = dist[v] + cost
                    if remain and dist[target] > new_dist:
                        dist[target] = new_dist
                        predecessors[target] = (v, i)
                        updated = True
            if not updated:
                break

        if dist[sink] == float('inf'):
            return -1

        aug = min(required_flow, min(e[0] for e in trace_back(sink, predecessors)))
        required_flow -= aug
        res += int(aug * dist[sink])
        for e in trace_back(sink, predecessors):
            remain, target, cost, idx = e
            e[0] -= aug
            edges[target][idx][0] += aug
    return res


if __name__ == "__main__":
    n, m, f = map(int, input().split())
    edges = [[] for _ in range(n)]  # type: ignore

    for _ in range(m):
        s, t, c, d = map(int, input().split())
        es, et = edges[s], edges[t]
        ls, lt = len(es), len(et)
        es.append([c, t, d, lt])
        et.append([0, s, -d, ls])

    print(min_cost_flow(0, n - 1, f))



Measured memory_bytes: 7420
N = int(input())
A = list(map(int,input().split()))
A.insert(0,0)
A.insert(0,0)
C = {i:0 for i in range(1,N+1)}
for i in range(2,N+1):
    a = A[i]
    C[a] += 1
for i in range(1,N+1):
    print(C[i])

Measured memory_bytes: 121752
#include <queue>
#include <string>
#include <iostream>

using namespace std;

int main()
{
	queue<string> name;
	queue<int> time;

	int n, q;

	cin >> n >> q;

	for (int i = 0; i < n; i++)
	{
		int A; string S1;

		cin >> S1 >> A;

		name.push(S1);
		time.push(A);
	}

	int T = 0;

	while (!time.empty())
	{
		if (time.front() <= q)
		{
			T += time.front();

			cout << name.front() << ' ' << T << endl;

			name.pop();
			time.pop();
		}
		else
		{
			string temp0 = name.front();

			int temp1 = time.front();

			T += q;

			name.pop(); name.push(temp0);
			time.pop(); time.push(temp1 - q);
		}
	}

	return 0;
}

Measured memory_bytes: 4176
S_dash = input()
T = input()

for i in range(len(S_dash)-len(T),-1,-1):
    for j in range(len(T)):
        if S_dash[i+j] != '?' and S_dash[i+j] != T[j]:
            break
    else:
        S = [s for s in S_dash]
        for j in range(len(T)):
            S[i+j] = T[j]
        for i in range(len(S)):
            if S[i] == "?":
                S[i] = "a"
        print("".join(S))
        break
else:
    print("UNRESTORABLE")


Measured memory_bytes: 3064
#include<cstdio>
#include<iomanip>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<cstring>
#include<algorithm>
#include<iostream>
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define rep(i,n) for(int i=1;i<=n;i++)
#define c(ans) cout<<ans<<endl;
using namespace std;
typedef long long ll;
const int MAXN=2e5+10;
ll a[MAXN];
int main(){
	IO;
	ll n, t;
	a[0] = 0;
	cin >>  n;
	for(ll i = 1; i <= n; i++){ 
		cin >> t;
		a[i] = a[i-1] + t;	
	}
	ll ans = 1ll << 50;
	for(ll i = 1; i < n; i++){
		ans = min(ans, abs(a[n] - a[i]*2));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <array>
#include <iostream>
#include <string>

using namespace std;

int main(void) {
  int N;
  cin >> N;
  array<string, 2> in;
  cin >> in[0];
  cin >> in[1];

  uint64_t ans;
  int i;
  bool tate;
  if (in[0][0] == in[1][0]) {
    tate = true;
    ans = 3;
    i = 1;
  } else {
    tate = false;
    ans = 6;
    i = 2;
  }

  while (i < N) {
    if (in[0][i] == in[1][i]) {
      ans *= tate ? 2 : 1;
      i += 1;
      tate = true;
    } else {
      ans *= tate ? 2 : 3;
      i += 2;
      tate = false;
    }
    ans %= 1000000007;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256