akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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 ll INF = 1LL << 60;


int main() {
    int n, k; cin >> n >> k;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    sort(all(h));
    ll ans = 0;
    rep(i, n-k) {
        ans += h[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4048
#include <iostream>
using namespace std;
int main() 
{
	int A,B,C,D,e,f;
	cin>>A>>B>>C>>D;
	e=A*B;
	f=C*D;
	if(e>=f)
	{cout<<e;
	}
	else
	{cout<<f;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

int a[10]={5,7,5,7,7};

void f(int n){
  string s[100];
  rep(i,n){
    cin>>s[i];
  }

  rep(i,n){
    int k=0;
    int t=0;
    FOR(j,i,n){
      t+=s[j].length();
      if(t==a[k]){
        k++;
        t=0;
      }
    }
    if(k==5){
      cout<<i+1<<endl;
      return;
    }
  }
}



int main(){
  int n;
  while(1){
    cin>>n;
    if(n==0) break;
    f(n);
  }

  return 0;
}


Measured memory_bytes: 3164
#include<stdio.h>

static const int N = 100;

int selectionSort(int A[], int n){
  int i, j, temp, count = 0;
  int min_j;
  for(i = 0; i < n-1 ; i++){
    min_j = i;
    for( j = i ; j < n ; j++){
      if(A[j] < A[min_j]) min_j = j;
    }
    temp = A[i];
    A[i] = A[min_j];
    A[min_j] = temp;
    if(i != min_j) count++;
  }
  return count;
}

int main(){
  int i, n, count;
  int A[N+1];
  scanf("%d", &n);
  for( i = 0 ; i < n; i++){
    scanf("%d", &A[i]);
  }

  count = selectionSort(A, n);

  for(i = 0 ; i < n ; i++){
    if(i > 0) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
  printf("%d\n",count);
}


Measured memory_bytes: 2144
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;

int isComb(int);

int main()
{
	int N;
	cin >> N;
	if (isComb(N) == 0)
	{
		cout << "No" << endl;
	}
	else
	{
		cout << "Yes" << endl;
		int k = isComb(N);
		cout << k << endl;
		vector<vector<int>> S(k);
		int l = 1;
		for (int i = 0; i < k; i++)
		{
			for (int j = i + 1; j < k; j++)
			{
				S[i].push_back(l);
				S[j].push_back(l);
				l++;
			}
		}

		for (int i = 0; i < k; i++)
		{
			cout << S[i].size() << " ";
			for (int j = 0; j < S[i].size(); j++)
			{
				cout << S[i][j] << " ";
			}
			cout << endl;
		}
	}
	return 0;
}

int isComb(int N)
{
	int k = 1;
	int comb = k * (k - 1) / 2;
	while (comb <= N)
	{
		cerr << comb << endl;
		if (comb == N)
		{
			return k;
		}
		k++;
		comb = k * (k - 1) / 2;
	}
	return 0;
}

Measured memory_bytes: 2304
#include <iostream>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	int x[3];
	cin >> x[0] >> x[1] >> x[2];
	sort(begin(x), end(x));
	if (x[0] + x[1] == x[2]) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// Greedy 0に気を付ける
		// シミュレーション
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long ans = 0L;
		long mod = 0;
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			if (a > 0) {
				a += mod;
			}

			ans += a / 2;
			mod = a % 2;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 50472
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.IllegalArgumentException
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val a = Array(n) { sc.nextInt() }
    val ans = mutableListOf<Int>()
    var x = 0
    for (i in 0 until n) {
        x = x xor a[i]
    }
    for (i in 0 until n) {
        ans.add(x xor a[i])
    }
    println(ans.joinToString(" "))
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 70540
def abc175_c_3():
    x, k, d = map(int, input().split())

    def solve(x, k, d):
        """
        https://atcoder.jp/contests/abc175/editorial/52
        """

        x = abs(x)

        straight = int(min(k, x / d))
        k -= straight
        x -= straight * d

        if k % 2 == 0:
            return x
        else:
            return abs(x - d)

    ans = solve(x, k, d)
    print(ans)

if __name__ == '__main__':
    abc175_c_3()

Measured memory_bytes: 9116
#include <cfenv>
#include <cmath>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

void test(double x)
{
  std::feclearexcept(FE_ALL_EXCEPT);
  std::cout << "ceil(" << x << ") = " << std::ceil(x) << '\n';
  std::cout << "FE_INEXACT = " << std::boolalpha << (std::fetestexcept(FE_INEXACT) != 0) << "\n\n";
}

int main(){
double A, B;
  cin >> A >> B;
double count;
  count =(B-1)/(A-1);
  
 // cout << count <<endl;
  cout << ceil( count ) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#define int long long
using namespace std;
int W,H,N,ans,x[1001],y[1001],dx,dy,dpoi;
signed main(){
    cin>>W>>H>>N;
    for(int i=0;i<N;i++){
        cin>>x[i]>>y[i];
    }
    for(int i=0;i<N-1;i++){
        dx=x[i+1]-x[i];
        dy=y[i+1]-y[i];
        if(dx>0&&dy>0){
            dpoi=max(dx,dy)-min(dx,dy);
            ans+=dpoi+(max(dx,dy)-dpoi);
        }
        if(dx<=0&&dy>0)ans+=(dx*-1)+dy;
        if(dx>0&&dy<=0)ans+=(dy*-1)+dx;
        if(dx<=0&&dy<=0){
            dpoi=max(dx*-1,dy*-1)-min(dx*-1,dy*-1);
            ans+=dpoi+(max(dx*-1,dy*-1)-dpoi);
        }
        //cout<<dx<<" "<<dy<<" "<<ans<<endl;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1172
#include "bits/stdc++.h"
using namespace std;

#define ll long long int
#define str string
#define sec .second

ll MOD = 1000000007, INFL = 1ll << 60, INF = 1 << 30;
ll A[1000000] = {}, B[1000000] = {}, weight[1000] = {}, value[1000] = {};
ll dp[10][100002] = {};
int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
vector <ll> v;
ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, n = 0, su = 0, ma = INF, mi = -1;
double ans;
str S;

bool an = true, bn = false;
long long mod = 1e9 + 7;

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;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Code Line
	cin >> n;
	for (int i = 0; i < n; i++)cin >> A[i];

	for (int i = 1; i < n - 1; i++) {
		if (A[i] > A[i + 1] && A[i] < A[i - 1])a++;
		else	if (A[i] < A[i + 1] && A[i] > A[i - 1])a++;
	}
	cout << a << endl;
	
	return 0;
}


Measured memory_bytes: 2304
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int ans;
int A[2][105], N, sum;
int S1[105], S2[105];

int main(void) {
    scanf("%d", &N);
    rep(i, 0, 2) {
        rep(j, 1, N+1) {
            scanf("%d", &A[i][j]);
        }
    }
    rep(i, 1, N+1) {
        S1[i] = S1[i-1] + A[0][i];
        S2[i] = S2[i-1] + A[1][i];
    }

    rep(i, 1, N+1) {
        ans = max(ans, S1[i]+S2[N]-S2[i-1]);
    }
    


   

  
    printf("%d\n", ans);

	  return 0;
}


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

int main(){
  int N;
  cin >> N;
  int ma=0;
  int s=0;
  for(int i=0;i<N;i++){
    int A,B;
    cin >> A >> B;
    if(ma<A){
      ma=A;
      s=B;
    }
  }
  cout << ma+s << endl;
  return 0;
}


Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while (true) {
			String[] strArr = br.readLine().split(" ");
			long[] arr = new long[2];
			arr[0] = Long.parseLong(strArr[0]);
			arr[1] = Long.parseLong(strArr[1]);
			if(arr[0] == 0 && arr[1] == 0)break;
			Arrays.sort(arr);
			System.out.printf("%d %d%n", arr[0], arr[1]);
		}
	}
}

Measured memory_bytes: 34008
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p
p = 10**9 + 7
N = 10**6  # N は必要分だけ用意する
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

X, Y = map(int, input().split())
if (X + Y) % 3 != 0:
    print(0)
    exit()
if (2*Y - X) // 3 < 0 or (2*X - Y) // 3 < 0:
    print(0)
    exit()

n = (2*Y - X) // 3
m = (2*X - Y) // 3
ans = cmb(n + m, min(n, m), p)
print(ans)

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

int n,k,mo,f[305][305],g[305][305],C[305][305];

void work()
{
	scanf("%d %d %d",&n,&k,&mo);
	for (int i=0; i<=300; i++)
		{
			C[i][0]=1;
			for (int j=1; j<=i; j++)
				C[i][j]=(C[i-1][j-1]+C[i-1][j])%mo;
		}
	for (int i=1; i<=k; i++)  f[1][i]=1,g[1][i]=i%mo,g[0][i]=1;
	for (int i=2; i<=n; i++)
		{
			for (int j=1; j<=k; j++)
				f[i][j]=g[i-1][j-1];
			for (int j=1; j<=i; j++)
				{
					int s=0;
					for (int l=1; l<=k; l++)
						s=(s+f[j][l])%mo,g[i][l]=(g[i][l]+1LL*g[i-j][l]*s%mo*C[i-1][j-1])%mo;
				}
		}
	printf("%d",g[n][k]);
}

int main()
{
	work();
	return 0;
}


Measured memory_bytes: 1280
#include<iostream>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int main(){
  int k; cin >>k;
  string s; cin >> s;
  int n=s.size();
  if(n<=k)print(s);
  else{
    rep(i,k) printf("%c",s[i]);
    printf("...\n");
  }
}


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

typedef long long ll;
#define all(x) (x).begin(),(x).end()

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

template<typename T>
T gcd(T a, T b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

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

    vector<vector<pair<int,int>>> A(N, vector<pair<int,int>>());
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        for (int j = 0; j < a; j++) {
            int x, y;
            cin >> x >> y;
            x--;
            A[i].push_back({x, y});
        }
    }

    // for (int i = 0; i < N; i++) {
    //     cout << "i = " << i << endl;
    //     for (auto iter = A[i].begin(); iter != A[i].end(); iter++) {
    //         cout << iter->first << iter->second << endl;
    //     }
    // }

    int ans = 0;
    vector<int> conf(N);
    for (int iter = 0; iter < 1 << N; iter++) {
        for (int j = 0; j < N; j++) {
            conf[j] = (iter >> j) & 1;
        }

        int isvalid = 1;
        for (int i = 0; i < N; i++) {
            if (conf[i] == 0) continue; // 不親切な人は飛ばす
            for (auto p = A[i].begin(); p != A[i].end(); p++) {
                int X = p->first, Y = p->second;
                // cout << X << " " << Y << endl;
                if (Y == 1 && conf[X] == 1) {
                    continue;
                } else if (Y == 0 && conf[X] == 0) {
                    continue;
                } else {
                    // cout << conf[0] << conf[1] << conf[2] << endl;
                    // cout << i << X << Y << endl;
                    isvalid = 0;
                    break;
                }
            }
            if (!isvalid) {
                // cout << "invalid" << endl;
                // for (int iii = 0; iii < N; iii++) {
                //     cout << " " << conf[iii];
                // }
                // cout << endl;
                break;
            }
        }
        if (isvalid) {
            // cout << "valid" << endl;
            //     for (int iii = 0; iii < N; iii++) {
            //         cout << " " << conf[iii];
            //     }
            //     cout << endl;
            int t = 0;
            for (int idx = 0; idx < N; idx++) {
                t += conf[idx];
            }
            ans = max(ans, t);
        }
    }

    cout << ans << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


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

temp = x + [A]

X = max(temp)

m = N * X

dp = [[[0 for s in range(m+1)] for k in range(N+1)] for j in range(N+1)]

dp[0][0][0] = 1

res = 0

for j in range(N):
    for k in range(N):
        for s in range(m):
            if dp[j][k][s]:
                dp[j+1][k][s] += dp[j][k][s]
                dp[j+1][k+1][s+x[j]] += dp[j][k][s]

for k in range(1,N+1):
    res += dp[N][k][k*A]

print(res)


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

int main() {
  int a, b, x;
  cin >> a >> b;
  x = (a + b) / 2;
  if ((a + b) % 2 == 0) {
  	cout << x << endl;
  } else {
  	cout << x + 1 << endl;
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int a[501][501];
void solve(int H, int W, int h) {
    cout << "Yes" << endl;
    rep(y, H) rep(x, W) {
        a[y][x] = -1000;
    }
    for (int y = 0; y < H; y += h) {
        rep(x, W)a[y][x] = 1000 * h - 1001;
    }
}

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

    int H, W, h, w;
    cin >> H >> W >> h >> w;
    if (H%h) {
        solve(H, W, h);
        rep(y, H)rep(x, W) {
            cout << a[y][x] << (x != W - 1 ? ' ' : '\n');
        }
    } else if (W%w) {
        solve(W, H, w);
        rep(y, H)rep(x, W) {
            cout << a[x][y] << (x != W - 1 ? ' ' : '\n');
        }
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 2688
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
int n,t,a;
int main(){
    cin >> n >> t >> a;
    int h;
    int res=0;
    int tmp=1<<30;
    for(int i=1; i<=n; i++){
        cin >> h;
        int d = (t*1000-h*6)-(a*1000);
        if(d<0) d = -d;
        if(tmp > d){
            tmp = d;
            res=i;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
int n,m,dp[1<<12];
int main()
{
    memset(dp,inf,sizeof(dp));
    scanf("%d%d",&n,&m);
    while(m--)
    {
        int c,x,st=0;
        scanf("%d%d",&c,&x);
        while(x--)
        {
            int y;scanf("%d",&y);
            st^=1<<(y-1);
        }
        dp[st]=min(dp[st],c);
    }
    int up=1<<n;
    for(int i=0;i<up;i++)
        for(int j=0;j<up;j++)
        {
            dp[i|j]=min(dp[i|j],dp[i]+dp[j]);
        }
    int ans=dp[up-1];
    if(ans==inf) ans=-1;
    printf("%d\n",ans);
}


Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
int main()
{
    char str[1200],ou[1200]; int i;
    scanf("%[^\n]s",&str);

    for(i=0;i<strlen(str);i++)
    {
        if(str[i] <= 'z' && str[i] >= 'a') ou[i]=str[i]-32;
        else if(str[i] <= 'Z' && str[i] >= 'A') ou[i]=str[i]+32;
        else{ou[i]=str[i];}
        printf("%c",ou[i]);

    }
    
    printf("\n");

}







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

long N;
std::vector<long> as;
std::vector<long> bs;

bool step1(long n) {
  std::string str = std::to_string(n);
  bool res = true;
  for(int i = 0; i < (int)str.size(); ++i) {
    if( str[i] != '2' and str[i] != '8' ) {
      res = false;
      break;
    }
  }
  return res;
}

bool all8(long n) {
  while( n != 0 ) {
    if( n % 10 != 8 ) {
      return false;
    }
    n /= 10;
  }
  return true;
}

void dfs1(int i, long n) {
  if( i == 0 ) {
    if( all8(n) ) return;
    as.push_back(n);
  }
  else {
    dfs1(i - 1, n * 10 + 2);
    dfs1(i - 1, n * 10 + 8);
  }
}

int dfs2(int i, long n) {
  if( i >= (int)bs.size() ) {
    if( n != 1 and not step1(n) ) {
      return -1;
    }
    if( step1(n) ) {
      return 1;
    }
    return 0;
  }
  if( n == 1 ) {
    return 0;
  }
  int res = -1;
  int t2 = dfs2(i + 1, n);
  if( t2 > 0 ) {
    res = std::max(res, t2);
  }
  for(int k = 1; ; ++k) {
    if( n == 0 ) break;
    if( n % bs[i] != 0 ) break;
    n /= bs[i];
    int t = dfs2(i + 1, n);
    if( t != -1 ) {
      res = std::max(res, dfs2(i + 1, n) + k);
    }
  }
  return res;
}

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

  std::cin >> N;
  if( N == 1 ) {
    std::cout << -1 << std::endl;
    return 0;
  }

  for(int i = 1; i <= 11; ++i) {
    dfs1(i, 0);
  }

  for(int i = 0; i < (int)as.size(); ++i) {
    if( N % as[i] == 0 ) {
      bs.push_back(as[i]);
    }
  }

  int t = dfs2(0, N);
  if( t != -1 ) {
    std::cout << t << std::endl;
    return 0;
  }

  if( step1(N) ) {
    std::cout << 1 << std::endl;
    return 0;
  }
  std::cout << -1 << std::endl;  

  return 0;
}

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

using namespace std;
using namespace boost::multiprecision;

#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 RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define ALL(x) (x).begin(),(x).end()

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

  REP(i, n.size()) {
    if(n[i] == '7') {
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;
  return 0;
}


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


int main() {
int a, b;
cin >> a >>b;
if(a==1) a+=13;
if(b==1) b+=13;
if(a>b) cout<<"Alice" << endl;
else if(a==b) cout << "Draw" <<endl;
else if (a<b) cout << "Bob" << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <string>
#include <string_view>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

int64_t read_int() {
    int64_t ret = 0, sgn = 1;
    int ch = getchar_unlocked();
    while (isspace(ch)) { ch = getchar_unlocked(); }
    if (ch == '-') { sgn = -1; ch = getchar_unlocked(); }
    for (; isdigit(ch); ch = getchar_unlocked())
        ret = (ret * 10) + (ch - '0');
    ungetc(ch, stdin);
    return sgn * ret;
}

char read_char() {
    int ch = getchar_unlocked();
    while (isspace(ch)) { ch = getchar_unlocked(); }
    return ch;
}

string read_word() {
    string ret;
    int ch = getchar_unlocked();
    while (isspace(ch)) { ch = getchar_unlocked(); }
    for (; ch != EOF && !isspace(ch); ch = getchar_unlocked())
        ret += ch;
    ungetc(ch, stdin);
    return ret;
}

#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()

template <typename T> inline void assign_min(T& x, const T& value) noexcept { x = min(x, value); }
template <typename T> inline void assign_max(T& x, const T& value) noexcept { x = max(x, value); }

constexpr char LF = '\n';

int main() {
    int N = read_int();
    vector<char> C(N);
    REP(i, N) C[i] = read_char();

    int total_w = 0, total_r = 0;
    REP(i, N) {
        if (C[i] == 'W')
            ++total_w;
        else
            ++total_r;
    }

    // 0~iをすべてRにし、i+1~N-1をWにしたい
    // max(前半のWの数, 後半のRの数)
    auto ans = min(total_w, total_r);
    int n_w = 0, n_r = 0;
    REP(i, N) {
        if (C[i] == 'W')
            ++n_w;
        else
            ++n_r;
        assign_min(ans, max(n_w, total_r - n_r));
    }
    cout << ans << LF;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
main(){
  int n;
  cin>>n;
  vector<int> a(n+1);
  vector<int> b;
  map<int,int> m;
  for(int i=1;i<=n;++i)cin>>a[i];
  for(int i=n;i>n/2;--i)if(a[i]){
    b.push_back(i);
    set<int> div;
    for(int k=1;k*k<=i;++k){
      if(i%k==0){
        div.insert(k);
        if(i%(i/k)==0)div.insert(i/k);
      }
    }
    for(auto p:div)m[p]++;
  }
  for(int i=n/2;i>0;--i){
    if(m[i]%2!=a[i]){
      b.push_back(i);
      set<int> div;
      for(int k=1;k*k<=i;++k){
        if(i%k==0){
          div.insert(k);
          if(i%(i/k)==0)div.insert(i/k);
        }
      }
      for(auto p:div)m[p]++;
    }
  }
  cout<<b.size()<<endl;
  for(int i=0;i<b.size();++i){
    if(i)cout<<" ";
    cout<<b[i];
  }
}

Measured memory_bytes: 10744
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>

using namespace std;
typedef long long ll;
#define inf 0x3f3f3f3f
vector<vector<int>>a;
vector<int>b;
string s;
queue<int>qx;
queue<int>qy;
signed main() {
	std::ios::sync_with_stdio(0); std::cin.tie(0);
	int h, w, k, x1, y1, x2, y2;
	cin >> h >> w >> k;
	cin >> x1 >> y1 >> x2 >> y2;
	--x1, --x2, --y1, --y2;
	int i, j;
	for (i = 0; i < h; ++i) {
		cin >> s;
		for (j = 0; j < w; ++j) {
			if (s[j] == '.')b.push_back(-1);
			else b.push_back(-2);
		}
		a.push_back(b);
		b.clear();
	}
	qx.push(x1), qy.push(y1);
	int cnt = 0, sd = 1, len = 1, x, y;
	a[x1][y1] = 0;
	while (!qx.empty()) {
		for (j = 0; j < len; j++) {
			x = qx.front();
			y = qy.front();
			for (i = 1; i <= k; ++i) {
				if (x - i < 0)break;
				if (a[x - i][y] != -1 && a[x - i][y] != sd)break;
				if (a[x - i][y] == sd)continue;
				a[x - i][y] = sd;
				qx.push(x - i), qy.push(y);
				cnt++;
			}
			for (i = 1; i <= k; ++i) {
				if (x + i >= h)break;
				if (a[x + i][y] != -1 && a[x + i][y] != sd)break;
				if (a[x + i][y] == sd)continue;
				a[x + i][y] = sd;
				qx.push(x + i), qy.push(y);
				cnt++;
			}
			for (i = 1; i <= k; ++i) {
				if (y - i < 0)break;
				if (a[x][y - i] != -1 && a[x][y - i] != sd)break;
				if (a[x][y - i] == sd)continue;
				a[x][y - i] = sd;
				qx.push(x), qy.push(y - i);
				cnt++;
			}
			for (i = 1; i <= k; ++i) {
				if (y + i >= w)break;
				if (a[x][y + i] != -1 && a[x][y + i] != sd)break;
				if (a[x][y + i] == sd)continue;
				a[x][y + i] = sd;
				qx.push(x), qy.push(y + i);
				cnt++;
			}
			if (a[x2][y2] != -1) {
				cout << a[x2][y2] << endl;
				return 0;
			}
			qx.pop();
			qy.pop();
		}
		sd++;
		len = cnt;
		cnt = 0;
	}
	/*for (i = 0; i < h; ++i) {
		for (j = 0; j < w; ++j) {
			cout << a[i][j] << " ";
		}
		cout << endl;
	}*/
	cout << a[x2][y2] << endl;
	return 0;
}

Measured memory_bytes: 12428
#include <bits/stdc++.h>
using namespace std;
int main() {
     string S;
     cin >> S;
     int ans = 700;

     if(S[0] == 'o') ans += 100;
     if(S[1] == 'o') ans += 100;
     if(S[2] == 'o') ans += 100;

     cout << ans << endl;
}

Measured memory_bytes: 256
import math
import sys


def rem(a, b, c):
    if a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        return False
    else:
        return True
def isDouble(a, b, c):
    if (a%1!=0 or b%1!=0 or c%1!=0):
        return False
    else:
        return True
a, b, c = map(int, input().split())
cnt = 0
fa = a
fb = b
fc=c
while True:
    if (cnt != 0 and fa == a and fb == b and fc == c):
        print(-1)
        sys.exit()
    tmp1 = a / 2
    tmp2 = b / 2
    tmp3 = c / 2
    if (not isDouble(tmp1, tmp2, tmp3)):
        break
    cnt += 1
    a = tmp2 + tmp3
    b = tmp1 + tmp3
    c = tmp1 + tmp2
    if (not rem(a, b, c)):
        break
print(cnt)


Measured memory_bytes: 3064
fun trace(a: IntArray) = println(a.joinToString(separator = " "))

fun insertionSort(a: IntArray) {
    trace(a)
    for (i in 1 until a.size) {
        val pivotVal = a[i]
        var pivotIdx = i-1
        while (pivotIdx >= 0 && a[pivotIdx] > pivotVal) {
            a[pivotIdx+1] = a[pivotIdx--]
        }
        a[pivotIdx+1] = pivotVal
        trace(a)
    }
}

fun main(args: Array<String>) {
    readLine()
    readLine()
            ?.split(regex = """\s+""".toRegex())
            ?.map { it.toInt() }
            ?.toIntArray()
            ?.let { insertionSort(it) }
}


Measured memory_bytes: 33632
INF = 10**10
N,M=map(int,input().split())
e=[]
w=[[INF for j in range(N)]for i in range(N)]
for _ in range(M):
    a,b,c = map(int,input().split())
    w[a-1][b-1]=c
    w[b-1][a-1]=c
    e.append((a-1,b-1,c))

class lheapq():
#最小値を取り出す優先度付きキュー
    def __init__(self,p):
        self.l = []
        if p:
            for sp in p:
                self.heappush(sp)

    def heappush(self,a):
        n=len(self.l)
        self.l.append(a)
        t = n
        while t != 0:
            if self.l[t][1] < self.l[(t-1)//2][1]:
                self.l[t],self.l[(t-1)//2] = self.l[(t-1)//2],self.l[t]
                t = (t-1)//2
            else:break

    def heappop(self):
        n=len(self.l)
        if n == 0:
            return (-1,0)
        if n == 1:
            return self.l.pop()
        ret = self.l[0]
        self.l[0] = self.l.pop()
        n -= 1
        t = 0
        while t<n:
            child1 = t*2+1
            child2 = t*2+2
            if child1 >= n:
                break
            elif child2 >= n:
                if self.l[t][1] > self.l[child1][1]:
                    self.l[t],self.l[child1] = self.l[child1],self.l[t]
                    t = child1
                else:break
            else:
                if self.l[child2][1] < self.l[child1][1]:
                    child1,child2 = child2,child1
                if self.l[t][1] > self.l[child1][1]:
                    self.l[t],self.l[child1] = self.l[child1],self.l[t]
                    t = child1
                elif self.l[t][1] > self.l[child2][1]:
                    self.l[t],self.l[child2] = self.l[child2],self.l[t]
                    t = child2
                else:break
        return ret
    
    def isnotblank(self):
        if self.l:return True
        else:return False

def dijkstra(s,g,N,e):
    INF =10**10
    res = [INF for _ in range(N)]
    q=lheapq([(s,0)])
    while q.isnotblank():
        while q.isnotblank():
            des,dis = q.heappop()
            if res[des] == INF:
                res[des] = dis
                break
        for se in e[des]:
            if res[se[0]] == INF:
                q.heappush((se[0],se[1]+res[des]))
    return res[g]

for k in range(N):
    for i in range(N):
        for j in range(N):
            w[i][j] = min(w[i][j],w[i][k]+w[k][j])

res = 0
for i in range(M):
    g=[[] for _ in range(N)]
    for j in range(M):
        if j!=i:
            a,b,c = e[j][0],e[j][1],e[j][2]
            g[a].append((b,c))
            g[b].append((a,c))
    a,b,c = e[i][0],e[i][1],e[i][2]
    if c != w[a][b] and dijkstra(a,b,N,g) == w[a][b]:
        res += 1

print(res)

Measured memory_bytes: 64860
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef long long lli;
lli n,a,b;
vector<pair<lli,lli> > c;
map<pair<lli,lli>,lli> cx;
map<pair<lli,lli>,lli> cy;
vector<pair<lli,lli> > k;
lli d;
vector<lli> counter;
lli ans = 0;

void dfs(lli x){
    pair<lli,lli> o = c[x];
    cx.erase(o);cy.erase(make_pair(o.second,o.first*-1));
    ans += counter[x];
    while(cx.lower_bound(make_pair(o.first-d,o.second-d)) != cx.upper_bound(make_pair(o.first-d,o.second+d-1))){
        dfs(cx.lower_bound(make_pair(o.first-d,o.second-d))->second);
    }
    while(cx.lower_bound(make_pair(o.first+d,o.second-d+1)) != cx.upper_bound(make_pair(o.first+d,o.second+d))){
        dfs(cx.lower_bound(make_pair(o.first+d,o.second-d+1))->second);
    }
    swap(o.first,o.second);o.second*=-1;
    while(cy.lower_bound(make_pair(o.first-d,o.second-d)) != cy.upper_bound(make_pair(o.first-d,o.second+d-1))){
        dfs(cy.lower_bound(make_pair(o.first-d,o.second-d))->second);
    }
    while(cy.lower_bound(make_pair(o.first+d,o.second-d+1)) != cy.upper_bound(make_pair(o.first+d,o.second+d))){
        dfs(cy.lower_bound(make_pair(o.first+d,o.second-d+1))->second);
    }
}
int main(int argc, char const *argv[]) {
    cin >> n >> a >> b;
    c = vector<pair<lli,lli> > (n);
    for(lli i = 0;i < n;i++){
        lli x,y;
        cin >> x >> y;
        c[i].first = x + y;
        c[i].second = x - y;
        cx[c[i]] = i;
        cy[make_pair(c[i].second,c[i].first*-1)] = i;
    }
    a--;b--;
    d = max(abs(c[a].first - c[b].first),abs(c[a].second - c[b].second));
    counter = vector<lli> (n);
    k = c;
    sort(k.begin(),k.end());
    for(lli i = 0;i < n;i++){
        lli t = cx[k[i]];
        counter[t] += lower_bound(k.begin(),k.end(),make_pair(k[i].first-d,k[i].second-d)) - upper_bound(k.begin(),k.end(),make_pair(k[i].first-d,k[i].second+d-1));
        counter[t] += lower_bound(k.begin(),k.end(),make_pair(k[i].first+d,k[i].second-d+1)) - upper_bound(k.begin(),k.end(),make_pair(k[i].first+d,k[i].second+d));
    }
    for(lli i = 0;i < n;i++) swap(k[i].first,k[i].second),k[i].second*=-1;
    sort(k.begin(),k.end());
    for(lli i = 0;i < n;i++){
        lli t = cy[k[i]];
        counter[t] += lower_bound(k.begin(),k.end(),make_pair(k[i].first-d,k[i].second-d)) - upper_bound(k.begin(),k.end(),make_pair(k[i].first-d,k[i].second+d-1));
        counter[t] += lower_bound(k.begin(),k.end(),make_pair(k[i].first+d,k[i].second-d+1)) - upper_bound(k.begin(),k.end(),make_pair(k[i].first+d,k[i].second+d));
    }
    dfs(a);
    cout << -ans/2 << endl;
    return 0;
}


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

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

  vector<int> L(N);
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }

  int output = 0;
  for (int i = 0; i < N - 2; i++) {
    for (int j = i + 1; j < N - 1; j++) {
      for (int k = j + 1; k < N; k++) {
        if (L[i] + L[j] > L[k] && L[k] + L[j] > L[i] && L[i] + L[k] > L[j] &&
            L[i] != L[j] && L[j] != L[k] && L[k] != L[i]) {
          output++;
        }
      }
    }
  }

  cout << output << endl;

  return 0;
}

Measured memory_bytes: 3632
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
cnt = 0
for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            cnt += 1
if cnt == h + w - 1:
    ans = 'Possible'
else:
    ans = 'Impossible'
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	ll x,y,ans=0;

	std::cin >> x >> y;

	ll abs_y = abs(y);
	ll abs_x = abs(x);
	if ((abs_x < abs_y && x < 0)|| (abs_x > abs_y && x > 0)) {
		ans++;
	}

	ans += abs(abs_y - abs_x);


	if ((abs_x < abs_y && y < 0) || (abs_x > abs_y && y > 0) || x*-1==y) {
		ans++;
	}
	outn(ans);
	return 0;

}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.List
import Data.Array.IO

infixr 1 ?
(?) :: Bool -> (a,a) -> a
(?) b t = (if b then fst else snd) t

main = do
  [h,w] <- map read . words <$> getLine :: IO [Int]
  f <- lines <$> getContents

  let
    solve (x,y) =
      if length pre <= 1 then
        if length next == 1 && (x,y) /= (w,h) then solve $ head next
        else if length next == 0 && (x,y) == (w,h) then True
        else False
      else False
      where
        next = filter (\(x1,y1) -> x1<=w && y1<=h && (f!!(y1-1)!!(x1-1) == '#')) [(x+1,y),(x,y+1)]
        pre = filter (\(x1,y1) -> x1>=1 && y1>=1 && (f!!(y1-1)!!(x1-1) == '#')) [(x-1,y),(x,y-1)]

  putStrLn $ (? ("Possible", "Impossible")) (solve (1,1))



Measured memory_bytes: 508
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
//const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main() {
    int a, b; cin >> a >> b;
    if (a <= 2 * b) cout << 0 << endl;
    else cout << a - 2 * b << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=998244353;
int main() {
  ll n,a[100005]={},b[100005]={},ans=1,f=1;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a[i];
    b[a[i]]++;
  }
  if(b[0]!=1) {
    f=0;
  }
  for(int i=1; i<n; i++) {
    ans=(ans*b[a[i]-1])%MOD;
  }
  cout << (f?ans:0) << endl;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define MAX 1005

int A[MAX], n;

int main(void) {
	int i;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> A[i];
	}
	int q, b, e, t;
	cin >> q;
	while (q--) {
		cin >> b >> e >> t;
		swap_ranges(A + b, A + e, A + t);
	}
	for (i = 0; i < n; i++) {
		if (i) cout << " ";
		cout << A[i];
	}
	cout << endl;
}


Measured memory_bytes: 3100
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000001145
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
//typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};

int ans;
int n,k;
int r,s,p;
string t;
signed main(){
	
	cin>>n>>k>>r>>s>>p>>t;
	for(int i=0;i<k;i++){
		int mans=0;
		rep(j,3){
			int cond=j,sum=0;
			if(cond==0 && t[i]=='s')sum=r;
			if(cond==1 && t[i]=='p')sum=s;
			if(cond==2 && t[i]=='r')sum=p;
			for(int m=i+k;m<n;m+=k){
				if(t[m]=='r'){
					if(cond!=2){sum+=p;cond=2;}
					else cond=-1;
				}
				if(t[m]=='s'){
					if(cond!=0){sum+=r;cond=0;}
					else cond=-1;
				}
				if(t[m]=='p'){
					if(cond!=1){sum+=s;cond=1;}
					else cond=-1;
				}
			}
			mans=max(sum,mans);
		}
		ans+=mans;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int a[111111];
int b[111111];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,m,q;cin>>n>>m>>q;
	int amin=int(1e9); int bmin=int(1e9);
	int ans=int(1e9);
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		amin=min(amin,a[i]);
	}
	for(int i=0;i<m;i++)
	{
		cin>>b[i];
		bmin=min(bmin,b[i]);
	}
	ans=amin+bmin;
	for(int i=0;i<q;i++)
	{
		int x,y,c; cin>>x>>y>>c;
		x--; y--;
		ans=min(ans,a[x]+b[y]-c);
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 1024
#include<iostream>
#include<cmath>

using namespace std;

string isEasy(string step){
  int count = 1;
  for (char i : step){
      bool isOdd = count%2 == 1;
      if (isOdd && i == 'L')
        return "No";
      if (!isOdd && i == 'R')
        return "No";
      count++;
  }
  return "Yes";
}

int main(void){
  string step;
  cin >>step;
  cout<<isEasy(step)<<endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    n = int(input().strip())
    v = list(map(int, input().strip().split()))
    m = INF
    ans = 0
    for i in range(n):
        if m >= v[i]:
            ans += 1
            m = v[i]
    print(ans)



if __name__ == '__main__':
    main()


Measured memory_bytes: 71004
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    string s, t; cin >> s >> t;
    bool ans = false;
    s += s;
    rep(i, t.size()){
        if(s.substr(i, t.size()) == t){
            ans = true;
            break;
        }
    }
    (ans) ? Yes() : No();
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<cmath>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int const MAXN = 8;
int N;
int x[MAXN], y[MAXN];

int main() {
  std::cout << std::setprecision(10) << std::fixed;
  std::cin >> N;
  for(int i = 0; i < N; ++i) std::cin >> x[i] >> y[i];
  double d = 0e0;
  for(int i = 0; i < N-1; ++i) for(int j = i+1; j < N; ++j) {
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    d += std::sqrt(dx*dx+dy*dy);
  }
  (d *= 2.0) /= N;
  fin(d);
  return 0;
}


Measured memory_bytes: 256
x,y=gets.split(' ').map(&:to_i)
flag=0
if y>=x && y/x==2 && y%2==0
  flag=1
end
if y>x && y/x==4 && y%4==0
  flag=1
end

if (y-2*x)/2>=0 &&(y-2*x)%2==0 && (y-2*x)/2<x
  flag=1
end

if flag==1
  puts "Yes"
else
  puts "No"
end


Measured memory_bytes: 14416
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
int n;
signed main() {
	cin >> n;
	cout << n << ":";
	for (int i = 2; i <= sqrt(n); i++) {
		while (n % i == 0) {
			n /= i;
			cout << " " << i;
		}
	}
	if (n != 1)cout << " " << n;
	cout << endl;
	return 0;
}


Measured memory_bytes: 3080
N, Q = map(int, input().split())
S = input()

TD = []
for i in range(Q):
    t, d = input().split()
    if d == 'L':
        d = -1
    else:
        d = 1
    TD.append([t, d])

def f(x):
    i = x
    for td in TD:
        if td[0] == S[i]:
            i += td[1]
            if i < 0:
                return -1
            if i >= N:
                return 1
    return 0

def bisectL():
    L = -1
    R = N
    while R - L > 1:
        M = (L + R) // 2
        if f(M) < 0:
            L = M
        else:
            R = M
    return L
    
def bisectR():
    L = -1
    R = N
    while R - L > 1:
        M = (L + R) // 2
        if f(M) > 0:
            R = M
        else:
            L = M
    return R
    
print(bisectR() - bisectL() - 1)

Measured memory_bytes: 23856
import sys
import heapq

def main():
    A, B, C = map(int, input().split())
    K = int(input())

    heap = [-A, -B, -C]
    heapq.heapify(heap)
    for _ in range(K):
        max = heapq.heappop(heap)
        heapq.heappush(heap, max * 2)
    
    sum = 0
    for i in heap:
        sum += i
    print(-sum)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<int> p(N);
    rep(i, N) cin >> p[i];
    int count = 0;
    int ans = 0;
    rep(i, N){
        if(p[i] == i + 1){
            count++;
        }
        else if(p[i] != i + 1){
            if(count % 2 == 0) ans += count / 2;
            else ans += (count+1) / 2;
            count = 0;
        }
        if(i == N-1){
            if(count % 2 == 0) ans += count / 2;
            else ans += (count+1) / 2;
        }
    }
    cout << ans;
}

Measured memory_bytes: 640
# -*- coding: utf-8 -*-

count = 0
backslash_index = []
area_pond = []
pending_area=[]
for index,symbol in enumerate(input()):
	if symbol == "\\":
		backslash_index += [index]
	elif symbol == '/' and backslash_index:
		last_bs_index = backslash_index.pop()
		diff = index - last_bs_index 
		count += diff 
		while area_pond and area_pond[-1] > last_bs_index:
			diff += pending_area.pop()
			area_pond.pop()

		area_pond += [last_bs_index]
		pending_area += [diff]

print(count)
print(len(area_pond),*(pending_area))
#print(len(area_pond), ' '.join(map(str, pending_area)))



Measured memory_bytes: 6384
import java.util.Scanner;

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

        if (a < b && b < c){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}



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

#define int long long
#define pii pair<int, int>
#define pb push_back
string S;
int K;
int const N = 101;
int dp[N][4][2];

int solve(int i, int k, bool d = 1){    
    if(k > K){
        return 0;
    }
    if(i == S.size()){
        return k == K;
    }
    if(dp[i][k][d] != -1){
        return dp[i][k][d];
    }
    int D = S[i] - '0';
    int ans = 0;
    for(int j = (d) ? D : 9; j >= 0; j--){
        ans += solve(i + 1, k + (j > 0), d&(j == D));
    }
    return dp[i][k][d] = ans;
}
signed main(){

    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    memset(dp, -1, sizeof dp);
    cin >> S; cin >> K;
    cout << solve(0,0) << endl;

    return 0;
}

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

int main()
{
    int n;
    scanf("%d", &n);
    int all = pow(3, n);
    //printf("%d\n", all);
    int cur;
    int bad = 1;
    for(int i = 0; i < n; i++){
       scanf("%d", &cur);
       if(!(cur % 2)){
           bad *= 2;
       }
    }
    //printf("%d\n", bad);
    printf("%d", all - bad);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int n, k=0, m=0, x;

int main(){
cin >> n;
for(int i =1; i<=n; i++){
    cin >> x;
    if(x%2==0)k++;
    if(x%4==0)m++;
}
if(2*m+1>=n )return 0*printf("Yes");
if(k-m>=n-2*m)cout << "Yes";
else cout << "No";



return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define all(cont) cont.begin(), cont.end()
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef set<int> si;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef pair<int, pair<int, int>> pipii;
 
const int INF = 1e9+1;
const int MAX_N = 1e8;
const int mod = 1000000007;
 
const double PI = acos(-1);
const double halfC = PI / 180;



void solve(){
	int n;
	cin >> n;
	vi a(n+1);
	for(int i = 1; i <= n; ++i){
		cin >> a[i];
	}
	
	vi dp(n+1, 0);
	dp[2] = abs(a[2]-a[1]);
	for(int i = 3; i <= n; ++i){
		dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]), dp[i-2]+abs(a[i]-a[i-2]));
	}
	cout << dp[n] <<"\n";
}
 
int main(){
	//freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);

	int i = 1, t = 1;
	//cin >> t;
	while(i <= t){
		//cout << "CASE #" << i << ": ";
		solve();
		i++;
	}	
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<math.h>
using namespace std;

int main()
{
	int K;
	cin >> K;
	if (K % 2 == 0) {
		cout << (K / 2) * (K / 2) << endl;
	}
	else {
		cout << (K - 1) / 2 * ((K - 1) / 2 + 1) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
n = int(input())
As = [int(x) for x in input().split()]
flag = False
flag2 = False
for a in As:
    if a == 0:
        flag = True
        break
ans = 1
if not flag:
    for i in range(n):
        ans *= As[i]
        if ans > 1000000000000000000:
            flag2 = True
            break
if flag:
    print(0)
elif flag2:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 21788