akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
typedef long long ll;


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

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

  /* input */
  vector<string> w(n);
  string ans = "Yes";
  rep(i, n) {
      cin >> w[i];
      if (i > 0)
      {
          /* a begining word and last word is not same. */
          if (w[i].at(0) != w[i-1].back())
          {
              /* code */
              ans = "No";
          }
        //   cout << w[i].at(0) << w[i-1].back() << endl;
      }
  }

  /* judge */
  rep(i, n) {
      for (int j = i+1; j < n; j++)
      {
          /* code */
          if (w[j] == w[i]) ans = "No";
      }
  }
  cout << ans << endl;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    string S;
    cin >> S;
    int min = 1000;
    REP(i, S.length() - 2)
    {
        int a = S[i] - '0';
        int b = S[i + 1] - '0';
        int c = S[i + 2] - '0';

        int s = a * 100 + b * 10 + c;
        min = std::min(min, abs(753 - s));
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
A, B, C, K = gets.split(" ").map!{|i| i.to_i}
=begin
puts "A：" + A.to_s
puts "B：" + B.to_s
puts "C：" + C.to_s
puts "K：" + K.to_s
=end

if K >= A
  k_rest =  K - A
  a_used = A
  #puts "A使用枚数：" + a_used.to_s #Aを使った枚数
  #puts "残りK枚数：" + k_rest.to_s #残るKの枚数
  a_point = a_used.to_i * 1
  #puts "A使用時のポイント：" + a_point.to_s
else
  k_rest = 0
  a_used = K
  #puts "A使用枚数：" + a_used.to_s #Aを使った枚数
  #puts "残りK枚数：" + k_rest.to_s #残るKの枚数
  a_point = a_used.to_i * 1
  #puts "A使用時のポイント：" + a_point.to_s
end

if k_rest >= 1
  if k_rest >= B
    k_rest =  k_rest - B
    b_used = B
    #puts "B使用枚数：" + b_used.to_s #Bを使った枚数
    #puts "残りK枚数：" + k_rest.to_s #残るKの枚数
    b_point = b_used.to_i * 0
    #puts "B使用時のポイント：" + b_point.to_s
  else
    b_used = k_rest
    k_rest = 0
    #puts "B使用枚数：" + b_used.to_s #Bを使った枚数
    #puts "残りK枚数：" + k_rest.to_s #残るKの枚数
    b_point = b_used.to_i * 1
    #puts "B使用時のポイント：" + b_point.to_s
  end
end

if k_rest >= 1
  if k_rest >= C
    k_rest =  k_rest - C
    c_used = C
    #puts "C使用枚数：" + c_used.to_s #Cを使った枚数
    #puts "残りK枚数：" + k_rest.to_s #残るKの枚数
    c_point = c_used.to_i * -1
    #puts "C使用時のポイント：" + c_point.to_s
  else
    c_used = k_rest
    k_rest = 0
    #puts "C使用枚数：" + c_used.to_s #Cを使った枚数
    #puts "残りK枚数：" + k_rest.to_s #残るKの枚数
    c_point = c_used.to_i * -1
    #puts "C使用時のポイント：" + c_point.to_s
  end
end

ans = a_point.to_i + b_point.to_i + c_point.to_i
puts ans



Measured memory_bytes: 14268
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define srt(x) sort((x).begin(), (x).end());
#define rsrt(x) sort((x).rbegin(), (x).rend());
#define deb(x) cout<<#x<<" = "<<(x)<<" (L"<<LINE<<")"<<endl;
#define vdeb(x) {cout<<#x<<" = { "; rep(i, x.size()) cout<<x[i]<<' '; cout <<'}'<<" (L"<<LINE<<")"<<endl;}
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vivi = vector<vi>;
using vll = vector<long long>;
using vllvll = vector<vll>;
using vs = vector<string>;
using um = unordered_map<long long, long long>;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;

int main()
{
    ll A, B, K;
    ll a, b;
    cin >> A >> B >> K;
    if (K <= A) {
        a = A-K; b = B;
    } else {
        a = 0; b = max(0LL, B-(K-A));
    }
    if (A == 0 and B == 0) {
        a = 0; b = 0;
    }
    cout << a << ' ' << b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef _debug
#define out(i) cout << #i << ' ' << i << ' '
#else 
#define out(i) //
#endif
using ll = long long;
using ull = unsigned long long;
const int maxn = 500001;
int a[maxn], n;
ll k;
int bef[maxn], loo;
void shift(int &i){
	if(++i == n + 1)i = 1, ++loo;
}
vector<int> pos[maxn];
vector<int> bfg(int i){
	memset(bef, 0, sizeof(bef));
	vector<int> res;
	for(;i <= n;++i){
		if(!bef[a[i]])bef[a[i]] = true, res.push_back(a[i]);
		else while(bef[a[i]])--bef[res.back()], res.pop_back();
	}
	return res;
}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n >> k;
	for(int i = 1;i <= n;++i)cin >> a[i];
	for(int i = 1;i <= n;++i)pos[a[i]].push_back(i);
	for(int i = 1;i <= n;++i)if(i == pos[a[i]][0])pos[a[i]].push_back(i);
	for(int i = 1;!bef[i];shift(i)){
		bef[i] = true;
		int next = *upper_bound(pos[a[i]].begin(), pos[a[i]].end()-1, i);
		loo += next <= i;
		i = next;
	}
 	k %= loo;
	if(!k)k += loo;
	int to_make = 1;
	while(k > 1){
		int next = *upper_bound(pos[a[to_make]].begin(), pos[a[to_make]].end()-1, to_make);
		k -= next <= to_make;
		to_make = next;
		if(k == 1){
			++to_make;
		}
		else{
			shift(to_make);
			k -= to_make == 1;			
		}
	}
	for(int &i : bfg(to_make))cout << i << ' ';
}

Measured memory_bytes: 23160
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    string S;
    int Q;
    cin >> S >> Q;
    string Sf = "", Sb = "";
    int cnt = 0;
    for (int i = 0; i < Q; i++) {
        int q; cin >> q;
        if (q == 1) cnt++;
        else {
            int f; string Sin;
            cin >> f >> Sin;
            if (cnt % 2) {
                reverse(Sin.begin(), Sin.end());
                if (f == 1) Sb += Sin;
                else Sf = Sin + Sf;
            }
            else {
                if (f == 1) Sf = Sin + Sf;
                else Sb += Sin;
            }
        }
    }
    if (cnt % 2) {
        reverse(Sb.begin(), Sb.end());
        reverse(S.begin(), S.end());
        reverse(Sf.begin(), Sf.end());
        cout << Sb << S << Sf << '\n';
    }
    else cout << Sf << S << Sb << '\n';
}


Measured memory_bytes: 4168
#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--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

ll a[55];
ll p[55];


ll f(int n, ll x){
    if (n == 0){
        if (x <= 0) return 0;
        else return 1;
    }
    else if (x <= a[n - 1] + 1) return f(n - 1, x - 1);
    else return p[n - 1] + 1 + f(n - 1, x - 2 - a[n - 1]);
}

int main(){
    int n;
    ll x;
    cin >> n >> x;
    a[0] = 1;
    p[0] = 1;
    a[1] = 5;
    p[1] = 3;

    for(int i = 1; i <= n; i++){
        a[i+1] = 2 * a[i] + 3;
        p[i+1] = 2 * p[i] + 1;
    }

    cout << f(n, x) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll f(ll n)
{
  return (n*(n+1))/2;
}

int main()
{
  ll n;
  cin>>n;
  ll lo=0,hi=n;
  ll ans;
  while(lo<=hi)
  {
    ll mid=(lo+hi)/2;
    if(f(mid) >= n)
    {
      ans=mid;
      hi=mid-1;
    }
    else
    {
      lo=mid+1;
    }
  }
  cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long bunkai (long long H,long long N){
    long long ans = pow(10,12);
    for(long long i=1;i<=H;i++){
        if(N%i == 0){
            ans =min(ans,i+N/i);
        }
    }
    return ans-2;
}
int main(){
    long long N,Heihou;
    cin >> N;
    Heihou = sqrt(N);
    cout << bunkai(Heihou,N);
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{

  double A,B;

  cin >> A;
  cin >> B;

  if(A > B){
    cout << "GREATER" << endl;
  }
  else if(A < B){
    cout << "LESS" << endl;
  }
  else{
    cout << "EQUAL" << endl;
  }

  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n;i++){
        if(a[i] == a[i+1]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 1792
//
//  main.cpp
//  project for C++
//
//  Created by 伊藤博隆 on 2020/04/17.
//  Copyright © 2020 伊藤博隆. All rights reserved.
//

#include <iostream>
#include<set>
#include<string>
#include <sstream>
#include <algorithm>
#include <math.h>

using namespace std;
long N;
long arr[200000];

int main(){
    cin >> N;
    int a;
    for(int i=1;i<N;i++){
        cin >> a;
    arr[a] += 1;
    }
    for (int i=1; i<=N; i++) {
        cout << arr[i] << endl;
    }
    return 0;
}




Measured memory_bytes: 4716
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

s = input()

i = 0
ans = 0
while s:
    if s[0] == s[-1]:
        s = s[1:-1]
    elif s[0] == 'x':
        s = s[1:]
        ans += 1
    elif s[-1] == 'x':
        s = s[:-1]
        ans += 1
    else:
        print(-1)
        exit()
print(ans)

Measured memory_bytes: 10036
x = int(input())
if 400 <= x <= 599: ans = 8
elif 600 <= x <= 799: ans = 7
elif 800 <= x <= 999: ans = 6
elif 1000 <= x <= 1199: ans = 5
elif 1200 <= x <= 1399: ans = 4
elif 1400 <= x <= 1599: ans = 3
elif 1600 <= x <= 1799: ans = 2
elif 1800 <= x <= 1999: ans = 1
print(ans)

Measured memory_bytes: 9172
#include<stdio.h>
#define N 8
#define FREE -1
#define NOT_FREE 1
 
int row[N],col[N],dpos[2*N-1],dneg[2*N-1],T[N][N];
 
void initialize(){
  int i,j;
  for(i=0;i<N;i++)row[i]=col[i]=FREE;
  for(i=0;i<2*N-1;i++)dpos[i]=dneg[i]=FREE;
}
 
void printBoard(){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(T[i][j]==1){
	if(row[i]!=j)return;
      }
    }
  }
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i]==j)printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}
 
void putQueen(int i){
  int j;
  if(i==N){
    printBoard();
    return;
  }
  for(j=0;j<N;j++){
    if(col[j]==NOT_FREE || dpos[i+j]==NOT_FREE || dneg[i-j+N-1]==NOT_FREE)continue;
    row[i]=j;
    col[j]=dpos[i+j]=dneg[i-j+N-1]=NOT_FREE;
    putQueen(i+1);
    col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
  }
}
 
int main(){
  int i,j,k,r,c;
  initialize();
  for(i=0;i<N;i++)
    for(j=0;j<N;j++)
      T[i][j]=0;
    
  scanf("%d",&k);
  for(i=0;i<k;i++){
    scanf("%d%d",&r,&c);
    T[r][c]=1;
  }
  putQueen(0);
  return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
int N,M;
int L,R;
int ans=0;
int main(){
    cin >> N >> M;
    vector<int> le(M+1);
    vector<int> ri(M+1);
    for(int i=0;i<M;i++){
        cin >> le.at(i) >> ri.at(i);
    }
    L=1;
    R=N;
    for(int i=0;i<M;i++){
    //    if(ri.at(i)>=L || le.at(i)<=R){
            if(L<le.at(i)){
                L=le.at(i);
            }
            if(R>ri.at(i)){
                R=ri.at(i);
            }
        }
    // }
    if(L<=R){
        ans=R-L+1;
    }
    cout << ans;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 105
using namespace std;

struct st{
	string s;
	int p, id;
} a[N];

int n;

bool cmp(st p, st q) {
	if (p.s != q.s) return p.s < q.s;
	return p.p > q.p;
}

int main()
{
	int i;
	cin >> n;
	for (i = 1; i <= n; i++) cin >> a[i].s >> a[i].p, a[i].id = i;
	sort(a + 1, a + n + 1, cmp);
	for (i = 1; i <= n; i++) printf("%d\n", a[i].id);
    return 0;
}

Measured memory_bytes: 256
N = int(input())
lis = [[int(i)for i in input().split()]for _ in range(N)]
def leng(i,j):
    global lis
    return ((lis[i][0]-lis[j][0])**2+(lis[i][1]-lis[j][1])**2)**0.5

ans = 0
for i in range(N):
    for j in range(i+1,N):
        ans += leng(i,j)
print(ans*2/N)

Measured memory_bytes: 3064
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    oa = ord("a")
    n = II()
    mn = [100000] * 26
    for _ in range(n):
        s = SI()
        cnt = [0] * 26
        for c in s:
            cnt[ord(c) - oa] += 1
        for i in range(26):
            if cnt[i] < mn[i]: mn[i] = cnt[i]
    ans = ""
    for i in range(26):
        ans += chr(i + oa) * mn[i]
    print(ans)

main()


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

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

    string s, t;
    cin >> s >> t;

    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<char>());

    bool ans = false;
    if (s < t)
        ans = true;

    if (ans)
        cout << "Yes" << '\n';
    else
        cout << "No" << '\n';
    return 0;
}

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e14
#define MOD 1000000007

ll a,b;

bool sum(ll x)
{

    ll s = 0;
    while(x)
    {

        ll z = x%10;
        s+=z;
        x/=10;
    }
    if(s>=a && s <=b) return true;
    else return false;
}

int main()
{

    ll n, s = 0;
    cin >> n >> a >> b;
    for(ll i = 1; i <= n; i++)
    {

        if(sum(i)) s+=i;
    }
    cout << s;
}


Measured memory_bytes: 256
#include <stdio.h>
int main (void){
	double H, M, S, A;
	int h, m, s;
	scanf("%lf", &S);
	H = S / 3600;
	h = H;
	H = h;
	M = (S - H * 3600) / 60;
	m = M;
	M = m;
	A = (S - H * 3600) - M * 60;
	s = A;
	printf("%d:%d:%d\n", h, m, s);
	return 0;
}



Measured memory_bytes: 2056
import bisect
import math
N, D, A = map(int, input().split())
cusum = [0] * (N+1)
X = []
XH =[]
for i in range(N):
    xi, hi = map(int, input().split())
    X += [xi]
    XH += [(xi, hi)]
X = sorted(X)
XH = sorted(XH)
cusumD = 0
ans = 0
for i, (xi, hi) in enumerate(XH):
    cusumD -= cusum[i]
    hi = max(0, hi-cusumD)
    r = bisect.bisect_right(X, xi+2*D)
    b = int(math.ceil(hi/A))
    d = b * A
    ans += b
    cusumD += d
    cusum[r] += d
    
print(ans)


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

using namespace std;

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

Measured memory_bytes: 4044
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <math.h>
#include <queue>
#include <stack>
using namespace std;
typedef long long int lli;
const long long int MaxN=200005;
const lli mod=1e9+7;
#define fst first
#define snd second
#define mp make_pair
const float pi=3.1415926535897932384626433832795028;
	lli mcd(lli a,lli b){
		if(a==0)return b;
		return mcd(b%a,a);
	}
	lli dp[123][100002]; 
	// dp[ind][llevo]=max(dp[ind-1][llevo],dp[ind-1][llevo-peso[ind]]+valor[ind])
	lli peso[MaxN];
	lli valor[MaxN];
	void solve(){
		lli N,W,i,j,p,q;
		cin>>N>>W;
		for(i=1;i<=N;i++){
			cin>>peso[i]>>valor[i];
		}	
		dp[1][peso[1]]=valor[1];
		for(i=2;i<=N;i++){
			for(j=0;j<=W;j++){
				dp[i][j]=dp[i-1][j];
				if(j-peso[i]>=0)dp[i][j]=max(dp[i][j],dp[i-1][j-peso[i]]+valor[i]);
			}
		}	
		lli res=0;
		for(i=0;i<=W;i++){
			res=max(res,dp[N][i]);
		}
		cout<<res<<"\n";
	}
int main(){
	//cin.tie(0),ios_base::sync_with_stdio(0);
	lli i,j,t;
	t=1;
	for(i=1;i<=t;i++){
		solve();
	}
	
}


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

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

using namespace std;

int main(){
    int ans = 1, n, k; cin >> n >> k;

    REPI(i, n)
        ans = min(ans * 2, ans + k);
    cout << ans;
}


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

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

	set<string> s;
	string str;
	for (int i=0;i<n;++i)
	{
		cin >> str;
		s.insert(str);
	}
	cout << s.size() << endl;
}







Measured memory_bytes: 19224
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ss second
#define ff first
#define mk make_pair
#define vec vector<int> 
#define finput ifstream cin;cin.open("in.txt")
#define foutput ofstream cout;cout.open("out.txt")
int main(){
//	finput;
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);


	int n,t,ans=INT_MAX;
	cin>>n>>t;
	pair<int,int> a;
	for(int i=0;i<n;i++){
		cin>>a.ff>>a.ss;
		if(a.ss<=t && a.ff<ans){
			ans=a.ff;
		}
	}
	if(ans!=INT_MAX) {
		cout<<ans<<endl;
		return 0;
	}
	cout<<"TLE";
}

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

using namespace std;

int main() {

    string st;
    cin >> st;
    stack<char> ac; /*stackを用意 */

    int res = 0;
    for(int i = 0; i < st.size(); i++) {
        if(ac.empty() || ac.top() == st[i]){
            ac.push(st[i]);
        } /*stackが空もしくはtopと同じ(=消せない)時はstackに足してく */
        else{
            res += 2;
            ac.pop();
        }
    } /*topと違うものが来たらカウントに2を足して、stackのtopを除く */
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <iostream>
#include <climits>
#include <cstring>
#include <functional>

using namespace std;

//using ll = long long;

#define rep(i, N) for(int i = 0;i < (int)N;i++)
#define LARGE INT_MAX / 2



int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int ans = 0;
	for (int i = a; i <= b; i++) {
		if (c % i == 0) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3108
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Atcoder
{
    class aaaa
    {
        static void Main(string[] args)
        {
            string input1 = Console.ReadLine();
            string input2 = Console.ReadLine();

            if (input1[0] == input2[2] && input1[1] == input2[1] && input1[2] == input2[0]){
                Console.WriteLine("YES");
            }else{
                Console.WriteLine("NO");
            }
        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(i,s,e) for(ll i=s;i<e;i++ )
typedef pair<ll,ll> P;
const ll mod = 1000000007;
const ll INF = 100000000000009;
ll i;

int main(){
    ll A,B;
    cin>>A>>B;
    cout<<max(A,B)+max(max(A,B)-1,min(A,B))<<endl;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String args[]) throws Exception
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String str = sc.next();

        int max = 0;
        int cnt=0;

        for(int i=0;i<str.length();i++){
            char current = str.charAt(i);
            if(current=='I') {
                cnt++;
                max = Math.max(max,cnt);
            }
            else cnt--;
        }

        System.out.print(max);

        sc.close();
    }

}

Measured memory_bytes: 10192
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MOD 1000000007
#define MOD2 998244353
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(x) (ll)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(ll i=a;i<=b;++i)
#define ROF(i,a,b) for(ll i=a;i>=b;--i)
#define trace(x) cerr<<#x<<": "<<x<<'\n';
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
#define T int
#define ordered_set tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
auto clk=clock();
 
ll mexp(ll a, ll b, ll m){
    ll ans=1;
    a%=m;
    while(b){
        if(b&1) ans=ans*a%m;
        b>>=1;
        a=a*a%m;
    }
    return ans;
}

const int N = 100005;

int p[N];

struct DSU
{
    int connected;
    int par[N], sz[N];

    DSU() {} 

    DSU(int n) 
    {
        for(int i=1;i<=n;i++)
        {
            par[i]=i;
            sz[i]=1;
        }
        connected=n;
    }

    int getPar(int k)
    {
        while(k!=par[k])
        {
            par[k]=par[par[k]];
            k=par[k];
        }
        return k;
    }

    int getSize(int k)
    {
        return sz[getPar(k)];
    }

    void unite(int u, int v)
    {
        int par1=getPar(u), par2=getPar(v);

        if(par1==par2)
            return;

        connected--;

        if(sz[par1]>sz[par2])
            swap(par1, par2);

        sz[par2]+=sz[par1];
        sz[par1]=0;
        par[par1]=par[par2];
    }
};

int main(){
    IOS
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    int n, m;
    cin >> n >> m;
    DSU dsu(n);
    FOR(i,1,n){
        cin >> p[i];
    }
    int x, y;
    FOR(i,1,m){
        cin >> x >> y;
        dsu.unite(x,y);
    }
    int cnt;
    FOR(i,1,n){
        if(dsu.getPar(i) == dsu.getPar(p[i])){
            cnt++;
        }
    }
    cout << cnt;



    cerr<<endl<<endl<<"Time: "<<fixed<<setprecision(12)<<(long double)(clock()-clk)/CLOCKS_PER_SEC<<" ms"<<endl<<endl;
 
    return 0;
}

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

class D
{
	static void Main()
	{
		var h = Console.ReadLine().Split().Select(long.Parse).ToArray();
		var g = Gcd(h[0], h[1]);

		var l = new List<long>();
		foreach (var d in Divisors(g).Skip(1)) if (l.TrueForAll(x => d % x != 0)) l.Add(d);
		Console.WriteLine(l.Count + 1);
	}

	static long Gcd(long x, long y) { for (long r; (r = x % y) > 0; x = y, y = r) ; return y; }

	static long[] Divisors(long v)
	{
		var d = new List<long>();
		var c = 0;
		for (long i = 1, j, rv = (long)Math.Sqrt(v); i <= rv; i++)
			if (v % i == 0)
			{
				d.Insert(c, i);
				if ((j = v / i) != i) d.Insert(++c, j);
			}
		return d.ToArray();
	}
}


Measured memory_bytes: 13452
//关于划船问题，从1道n只能转一次船也必须转一次船，
//所以需要有【1，c】，【c，n】两条船，所以只需要保存a=1的值和b=n的值。

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

int arr[N];
int brr[N];
int p=0,q=0;
int n,m;

int main() {
	cin>>n>>m;
	for(int i=0; i<m; i++) {
		int a,b;
		cin>>a>>b;
		if(a==1) {
			arr[p++]=b;
		}
		if(b==n) {
			brr[q++]=a;
		}
	}
	if(p==0||q==0) {
		cout<<"IMPOSSIBLE";
		return 0;
	}
	sort(arr,arr+p);
	sort(brr,brr+q);
	int i,j=1;
	for(i=0; i<p; i++) {
		j--;
		for(j; j<q; j++) {
			if(arr[i]==brr[j]) {
				break;
			}
			if(arr[i]<brr[j])
				break;
		}
		if(arr[i]==brr[j])
			break;
	}
	if(arr[i]==brr[j]&&i!=p)
		cout<<"POSSIBLE";
	else
		cout<<"IMPOSSIBLE";
	return 0;
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

const int N = 600;

int main()
{
	ll D;
	while(~scanf("%lld",&D)){
		ll ans = 0;
		for(int i = 0;i < N;i += D){
			ans += i * i * D;
		}
		printf("%lld\n",ans);
	}

	return 0;
}

Measured memory_bytes: 3224
import math
N=int(input())
ls=[[int(s) for s in input().split()] for i in range(N)]
def d(lsa,lsb):
  val=(lsa[0]-lsb[0])**2+(lsa[1]-lsb[1])**2
  return math.sqrt(val)
x=0
for i in range(N-1):
  for j in range(i+1,N):
    x+=d(ls[i],ls[j])
print(x*2/N)

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

//-----------------------------------------------------------------------------

template< typename T >
struct Edge {
	int from,to;
	T cost;

	Edge(int to,T cost):from(-1),to(to),cost(cost) {}
	Edge(int from,int to,T cost):from(from),to(to),cost(cost) {}
};

template< typename T >
using Edges=vector< Edge<T> >;

template< typename T >
using WeightedGraph=vector< Edges<T> >;

template< typename T >
using Dist=vector<T>;

template< typename T >
vector<T> dijkstra(WeightedGraph<T> &G,int s) {
	const auto INIT=numeric_limits<T>::max();
	vector<T> dist(G.size(),INIT);
	dist[s]=0;

	using P=pair<T,int>;
	priority_queue< P,vector<P>,greater<P> > Q;
	Q.push(P(0,s));
	while(!Q.empty()) {
		P p=Q.top();Q.pop();
		int v=p.second;
		if(dist[v]<p.first) continue;
		for(auto &e:G[v]) {
			if(dist[e.to]<=dist[v]+e.cost) continue;
			dist[e.to]=dist[v]+e.cost;
			Q.push(P(dist[e.to],e.to));
		}
	}
	return dist;
}

using Weight=long long;

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

	int n,m,s;
	cin>>n>>m>>s;
	WeightedGraph<Weight> G(n);
	Dist<Weight> dist(n);
	const auto INIT=numeric_limits<Weight>::max();
	for(int i=0;i<m;i++) {
		int a,b;Weight c;
		cin>>a>>b>>c;
		G[a].emplace_back(b,c);
	}
	dist=dijkstra(G,s);
	REP(i,n) {
		if(dist[i]==INIT) cout<<"INF"<<endl;
		else cout<<dist[i]<<endl;
	}

	return 0;
}



Measured memory_bytes: 20168
#include <iostream>

using namespace std;

int main() {
    string n;
    cin >> n;
    int num = 0;

    for (long long i = 0; i < n.size(); i++) {
        num += n[i] - '0';
        num %= 9;
    }

    if (num % 9 == 0) {
        cout << "Yes" << endl;
    } else
        cout << "No" << endl;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    if(N==2){
        cout<<-1<<endl;
        return 0;
    }
    vector<int> A(N),cnt(N),ans;
    for(int i=0;i<N;i++){
        cin>>A[i];
        A[i]--;
        cnt[A[i]]++;
    }
    
    set<int> rem;
    set<pair<int,int>> SE;
    
    for(int i=0;i<N;i++){
        rem.insert(i);
        SE.insert({cnt[i],i});
    }
    
    while(rem.size()>=6){
        int a=(*SE.rbegin()).first,b=(*SE.rbegin()).second,c=*rem.begin();
        
        int pu=-1;
        
        if(a==rem.size()-1) pu=b;
        else if(ans.size()==0||A[ans.back()]!=c) pu=c;
        else{
            auto it=rem.begin();
            it++;
            pu=*it;
        }
        
        ans.push_back(pu);
        SE.erase({cnt[pu],pu});
        rem.erase(pu);
        
        SE.erase({cnt[A[pu]],A[pu]});
        cnt[A[pu]]--;
        SE.insert({cnt[A[pu]],A[pu]});
    }
    
    vector<int> S;
    for(auto a:rem) S.push_back(a);
    
    do{
        bool ok=true;
        for(int i=0;i+1<S.size();i++){
            if(A[S[i]]==S[i+1]) ok=false;
        }
        if(ok){
            for(int i=0;i<S.size();i++) ans.push_back(S[i]);
            break;
        }
        
    }while(next_permutation(all(S)));
    
    if(ans.size()!=N){
        cout<<-1<<endl;
        return 0;
    }
    
    for(int i=0;i<N;i++){
        cout<<ans[i]+1<<" ";
    }
    cout<<endl;
}


Measured memory_bytes: 13304
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define INF 98765432198765432
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int, int, int, int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
int ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };

int chk[100001];
int cc=1;
Vi v[1000];
int main() {
	int n;
	for(int i=1;;i++)
	{
		int t=i*(i+1)/2;
		if(t>100000)break;
		chk[t]=i+1;
	}
	scanf("%d",&n);
	if(!chk[n])return !printf("No");
	printf("Yes\n%d\n",chk[n]);
	fup(i,1,chk[n],1)
	{
		fup(j,i+1,chk[n],1)
		{
			v[i].pb(cc);
			v[j].pb(cc);
			cc++;
		}
	}
	fup(i,1,chk[n],1)
	{
		printf("%d ",v[i].size());
		for(int x:v[i])printf("%d ",x);
		puts("");
	}
}

Measured memory_bytes: 2688
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#define STR 10
int main(){
    int n,m;
    scanf("%d %d",&n,&m);
    if(n==m){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 128
while True:
    i = input()
    H,W  = map(int, i.split())

    if H == 0 and W == 0:
        break
    
    for i in range(H):
        if i == 0 or i == H-1:
            for i in range(W):
                print('#', end = '')
            print()
        else:
            for i in range(W):
                if i == 0 or i == W-1:
                    print('#', end = '')
                else:
                    print('.', end = '')
            print()
    print()


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
//const ll mod = 1777777777ll;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll ans = -INF64;
  chmax(ans, a*c);
  chmax(ans, a*d);
  chmax(ans, b*c);
  chmax(ans, b*d);

  cout << ans << endl;
}

Measured memory_bytes: 3632
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include "bits/stdc++.h"
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
map<ll,vpll> adj;
map<ll,int> d,color;
void dijkstra(ll st){
	priority_queue<pll> PQ;//辺の長さのオーバーフローに注意！
	d[st]=0;
	color[st]=1;
	PQ.push(mp(0,st));
	while(!PQ.empty()){
		pll f=PQ.top();
		PQ.pop();
		ll u=f.second;
		color[u]=2;
		if(d[u]< -f.first) continue;
		rep(j,adj[u].size()){
			ll v=adj[u][j].first;
			if(color[v]==2) continue;
			if(d[v]>d[u]+adj[u][j].second){
				d[v]=d[u]+adj[u][j].second;
				PQ.push(mp(-d[v],v));
				color[v]=1;
			}
		}
	}
}
int main(){
	ll N,M;
	scan(N>>M);
	set<int> starail[100001];
	rep(i,M){
		int p,q,c;
		scan(p>>q>>c);
		p--; q--; c--;
		adj[p+N*c].push_back({q+N*c,0});
		adj[q+N*c].push_back({p+N*c,0});
		starail[p].insert(c);
		starail[q].insert(c);
		d[p+N*c]=INF;
		d[q+N*c]=INF;
	}
	rep(i,N){
		d[i+N*1000000]=INF;
		if(!starail[i].empty()){
			for(auto c:starail[i]){
				adj[i+N*1000000].push_back({i+N*c,0});
				adj[i+N*c].push_back({i+N*1000000,1});
			}
		}
	}
	dijkstra(N*1000000);
	/*for(auto x:d){
		printf("%lld : %d\n",x.first+1,x.second);
	}*/
	if(d[N-1+N*1000000]!=INF) prin(d[N-1+N*1000000]);
	else prin(-1);

	return 0;
}


Measured memory_bytes: 170256
#include<stdio.h>
int main(void){
    int n,i;
    int min=100000000;
    int max=-100000000;
    long long sum=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        int t;
        scanf("%d",&t);
        if(t<min) min=t;
        if(t>max) max=t;
        sum+=t;
    }
    printf("%d %d %lld\n",min,max,sum);
    return 0;
    
} 


Measured memory_bytes: 2104
// Package main provides ...
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()

	S := strings.Split(scanner.Text(), " ")[0]
	T := strings.Split(scanner.Text(), " ")[1]

	fmt.Println(T+S)
}


Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
using namespace std;
const int MAXN = 105;
int a[MAXN];
int main(){
	int n,k;
	double sum=0;
	int cnt=0;
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;++i){
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	sum/=(4.0*k);
	for(int i=0;i<n;++i){
		if((double)a[i]>=sum)cnt++;
	}
	if(cnt>=k)printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
///*Bismillahir Rahmanir Rahim***///
/***Stay_Home_Stay_Safe***/
///**Author Thasin Sheikh**///
#include<bits/stdc++.h>
using namespace std;
#define MAX 35000
#define MOD 1000000007
#define PI 3.14159265359
#define makefast__  ios_base::sync_with_stdio(false);
using ll=long long int  ;
using dl =double;
const int N = 2e5 + 10;
ll aarray[300000+10];
ll magic[101][101];
vector<ll>primes;
bool prime[1000001];
ll chkbit(ll n,ll k)
{
    return n&(1LL<<k);
}
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    makefast__
    string str;
    ll a,b,c,d,e,f,x,y,k,t,A=0,mod,B=0,L,j,i,l,r,m,n,C=0,ans=0,sum=0,sum1=0;
    vector<ll>v,v1;
    queue<ll>qu;
    cin>>n;
    for(i=0; i<n; i++)
        cin>>aarray[i];
    for(i=0; i<64; i++)
    {
        ll cnt=0;
        for(j=0; j<n; j++)
        {
            if(chkbit(aarray[j],i))
                cnt++;
        }
        ll ad=((cnt*(n-cnt))%MOD)*((1LL<<i)%MOD);
        ans=(ans+ad)%MOD;

    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 5956
#include <bits/stdc++.h>
using namespace std;
int main(void){
  string s = "";
	cin >> s;
  	for(int i=0;i<s.length();i++){
    	  if(count(s.cbegin(), s.cend(), s[i]) != 2){
            cout << "No" << endl;
            return 0;
          }
    }
    
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
# solution
import io
# libraries

data = input()

nim = len(data)

l = 0

for i in range(nim):
    if i%2==0:
        if data[i]=="L":
            l=1
    else:
        if data[i]=="R":
            l=1

if l==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VII;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()

int main(){
  int N,K,Q;
  cin>>N>>K>>Q;
  VI A(Q),X(N);
  rep(i,Q) cin>>A[i];
  rep(i,N) X[i]=K-Q;
  rep(i,Q) X[A[i]-1]+=1;
  rep(i,N){
    if(X[i]>0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}






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

int main()
{
    int inputN, inputA;
    scanf("%d", &inputN);
    int intArray[100];

    for (int i = 0; i < inputN; i++)
    {
        scanf("%d", &inputA);
        intArray[i] = inputA;
    }

    for (int i = 0; i < inputN; i++)
    {
        if (intArray[i] % 2 == 0)
        {
            if (intArray[i] % 5 == 0 || intArray[i] % 3 == 0)
            {
                continue;
            }
            else
            {
                printf("DENIED \n");
                return 0;
            }
        }
    }
    printf("APPROVED \n");

    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>

int main(){
    char b;
    scanf("%s",&b);
    if(b == 'A'){
        puts("T");
    }else if(b == 'T'){
        puts("A");
    }else if(b == 'C'){
        puts("G");
    }else if(b == 'G'){
        puts("C");
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}

int synthe(int idx,vi &org,vi now,vi &nokori) {
  if(idx == sz(nokori)) {
    return abs(org[0]-now[0])+ abs(org[1]-now[1]) + abs(org[2]-now[2]);
  }
  int mp = synthe(idx+1,org,now,nokori);
  // for A
  now[0]+= nokori[idx];
  int ans = synthe(idx+1,org,now,nokori);
  ans += 10;
  mp = min(mp,ans);
  now[0]-= nokori[idx];
  // for B
  now[1]+= nokori[idx];
  ans = synthe(idx+1,org,now,nokori);
  ans += 10;
  mp = min(mp,ans);
  now[1]-= nokori[idx];
  // for C
  now[2]+= nokori[idx];
  ans = synthe(idx+1,org,now,nokori);
  ans += 10;
  mp = min(mp,ans);
  now[2]-= nokori[idx];
  return mp;
}

int main() {
  int N,A,B,C;
  cin >> N >> A >> B >> C;
  vi l(N);
  rep(i,N) {
    cin >> l[i];
  }
  int ans = INF;
  rep(i,N) {
    srep(j,i+1,N) {
      srep(k,j+1,N) {
        int mp = INF;
        vi nokori;
        rep(x,N) {
          if(x!=i&&x!=j&&x!=k) {
            nokori.push_back(l[x]);
          }
        }
        
        vi now{l[i],l[j],l[k]};

        vi org{A,B,C};
        mp = min(mp,synthe(0,org,now,nokori));

        org = vi{B,C,A};
        mp = min(mp,synthe(0,org,now,nokori));

        org = vi{C,A,B};
        mp = min(mp,synthe(0,org,now,nokori));

        org = vi{A,C,B};
        mp = min(mp,synthe(0,org,now,nokori));

        org = vi{B,A,C};
        mp = min(mp,synthe(0,org,now,nokori));

        org = vi{C,B,A};
        mp = min(mp,synthe(0,org,now,nokori));

        ans = min(mp,ans);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop(i,n) for(int i = 0;i < (n);i++)
#define range(i,a,b) for(int i = (a);i <= (b);i++)
#define all(A) A.begin(),A.end()
#define pb push_back
#define mp make_pair
#define sz(A) ((int)A.size())
#define vi vector<int>
#define vl vector<long long>
#define vd vector<double>
#define vp vector<pair<int,int> >
#define ll long long
#define pi pair<int,int>
#define popcnt(x) __builtin_popcount(x)
#define LSOne(x) ((x) & (-(x)))
#define xx first
#define yy second
#define PQ priority_queue
#define print(A,t) cerr << #A << ": "; copy(all(A),ostream_iterator<t>(cerr," " )); cerr << endl
#define prp(p) cerr << "(" << (p).first << " ," << (p).second << ")";
#define prArr(A,n,t)  cerr << #A << ": "; copy(A,A + n,ostream_iterator<t>(cerr," " )); cerr << endl
#define PRESTDIO() cin.tie(0),cerr.tie(0),ios_base::sync_with_stdio(0)
#define what_is(x) cerr << #x << " is " << x << endl
#define bit_lg(x) (assert(x > 0),__builtin_ffsll(x) - 1)
const double PI = acos(-1);
using namespace std;

int cnt[4];
int A[1 << 20];

int main(){
	int n,x; scanf("%d",&n);
	loop(i,n) {
		scanf("%d",&x);
		cnt[x%4]++;
	}
	memset(A,-1,sizeof A);
	for(int i = 1;i < n && cnt[0];i += 2,cnt[0]--)
		A[i] = 0;
	for(int i = 0;i < n && cnt[1] + cnt[3];i += 2)
		if(cnt[1]) A[i] = 1,cnt[1]--;
		else A[i] = 3,cnt[3]--;
	for(int i = n-1;i >= 0 && cnt[2];i--)
		if(A[i] == -1){
			A[i] = 2;
			cnt[2]--;
		}
	loop(i,n-1) if((A[i] * A[i+1])%4) {
		puts("No");
		return 0;
	}
	puts("Yes");
	return 0;
}


Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main() {
	int N; cin >> N;
	int A[N];
	for(int i = 0; i < N; i++) cin >> A[i];
	int res = INF;
	for (int i = 0; i < N; i++)
	{
		int tmp = 0;
		while (A[i] % 2 == 0)
		{
			A[i] /= 2;
			tmp++;
		}
		res = min(res, tmp);
	}
	cout << res << endl;
	return 0;
}


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

const double PI = acos(-1);
double X[105], Y[105], dir[105][105];

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N; cin >> N;
    for(int i=0;i<N;i++) cin >> X[i] >> Y[i];

    cout.precision(10);
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(i==j) continue;
            dir[i][j] = atan2(Y[j]-Y[i], X[j]-X[i]);
            if(dir[i][j]<0) dir[i][j] += 2 * PI;

        }
        sort(dir[i], dir[i]+N);
        dir[i][N] = dir[i][1] + 2 * PI;
        double mx = 0;
        for(int j=1;j<N;j++) if(dir[i][j+1]-dir[i][j]>PI) mx = dir[i][j+1] - dir[i][j] - PI;
        cout << fixed << mx / (2*PI) << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;

int main(void){
  int N;
  long sum = 0,H0=LONG_MIN,H1=0,max = 0;
  cin >> N;
  for (int i = 0;i < N;i++){
    cin >> H1;
    if(H1 <= H0){
      sum++;
    }else{
      if(sum > max){
        max = sum;
      }
      sum = 0;
    }
    H0 = H1;
  }
  if(sum > max){
    max = sum;
  }
  cout << max << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main (void)
{
	int n;
	int a,b,c;
	int i;
	scanf("%d",&n);
	for(i = 0; i < n ;i++)
	{
		scanf("%d %d %d",&a,&b,&c);
		if((c * c) == (a * a) + (b * b))
		{
			printf("YES\n");
		}
		else if((a * a) == (c * c) + (b * b))
		{	
			printf("YES\n");
		}
		else if((b * b) == (a * a) + (c * c))
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int n,a,b;
	cin>>n>>a>>b;
	cout<<min(n*a,b)<<endl;
	return 0;
}



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

int main(){
    int n;
    cin >> n;
    int a[210000];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    int m;
    cin >> m;
    int b[210000];
    for(int i=0; i<m; i++){
        cin >> b[i];
    }
    cout << includes(a, a+n, b, b+m) << endl;
    return 0;
}


Measured memory_bytes: 4656
#include<iostream>


using namespace std;

int main(){
    int A, B, C, X;
    cin >> A >> B >> C >> X;

    int total = 0;
    int comb = 0;
    for(int i = 0; i <= A; i++){
        for(int j=0; j <= B; j++){
            for(int k =0; k <= C; k++){

                total = 500 * i + 100 * j + 50 * k;
                if(total==X){
                    comb++;
                }

            }
        }
    }

    cout << comb << endl;

    return 0;
}

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

using namespace std;

int main()
{
	int Fnum, Snum;
	vector<char> before, after, sent;
	char wk, tk;

	while(cin >> Fnum)
	{
		if(!Fnum) break;

		for(int i = 0; i < Fnum; i++)
		{
			cin >> wk >> tk;
			before.push_back(wk); after.push_back(tk);
		}

		cin >> Snum;

		for(int i = 0; i < Snum; i++)
		{
			cin >> wk;
			sent.push_back(wk);
		}

		for(int i = 0; i < Snum; i++)
		{
			bool ju = true;
			for(int j = 0; j < Fnum; j++)
			{
				if(sent[i] == before[j])
				{
					cout << after[j];
					ju = false;
					break;
				}
			}
			if(ju)
			{
				cout << sent[i];
			}
		}
		cout << endl;
		before.clear(); after.clear(); sent.clear();
	}
}

Measured memory_bytes: 1340