akhauriyash/Code-Regression huggingface dataset:
using System;
class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine();
        
      switch (input)
      {
        case "SUN":
          Console.WriteLine(7);
          break;
        case "MON":
          Console.WriteLine(6);
          break;
        case "TUE":
          Console.WriteLine(5);
          break;
        case "WED":
          Console.WriteLine(4);
          break;
        case "THU":
          Console.WriteLine(3);
          break;
        case "FRI":
          Console.WriteLine(2);
          break;
        case "SAT":
          Console.WriteLine(1);
          break;
      }
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

ll solve(ll x){
  if(x<=0) return 0;

  ++x;

  ll ans = 0;

  FOR(i,0,50){
    ll loop = 1LL << (i+1);
    ll cnt = (x/loop) * (loop/2);
    cnt += max(0LL,(x%loop) - (loop/2));

    if(cnt%2==1){
      ans += 1LL << i;
    }
  }

  return ans;
}

int main() {
  ll a,b;
  cin >> a >> b;

  ll ansa = solve(a-1);
  ll ansb = solve(b);

  // cout << ansa << " " << ansb << endl;

  cout << (ansa^ansb) << endl;


}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
using lint =                            long long int;
using plint =                           pair<lint, lint>;
#define vli                             vector<lint>
#define pb                              push_back
#define ALL(x)                          begin(x),end(x)
#define inf                             (1LL<63)-1
#define MOD 1000000007
#define SZ(x)                           ((lint)(x).size())
#define                                 FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define                                 IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define                                 REP(i, n) FOR(i,0,n)
#define                                 IREP(i, n) IFOR(i,0,n)
#define                                 f_ip   ios_base::sync_with_stdio(false); cin.tie(NULL);
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T>                    istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }


/*
   -------
         |
    **   |
   -------      
   |
   ------------------------------------------------------------------------------------------------------
*/

void solve(){
   int N;cin>>N;
   vector<int> a(N);
   cin>>a;
   int minm=*min_element(begin(a),end(a));
   int maxm=*max_element(begin(a),end(a));
   int ans=INT_MAX;
   FOR(i,minm,maxm+1){
       int cost = 0;
       REP(j,N){
           cost+= (a[j]-i)*(a[j]-i);
       }
       ans=min(ans,cost);
   }
   cout<<ans<<endl;
}

int main(){   
  
 solve();

 return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (a, b) = getInts()

    if (a > b) {
        repeat(a) { print(b) }
    } else {
        repeat(b) { print(a) }
    }
    println()
}

fun getInt() = readLine()!!.toInt()
fun getInts() = readLine()!!.split(" ").map { it.toInt() }
fun getLong() = readLine()!!.toLong()
fun getLongs() = readLine()!!.split(" ").map { it.toLong() }

Measured memory_bytes: 36204
#include <stdio.h>
int i,j,N;
int count=0;

void Process(int A[ ], int n){
	for(i=0;i<n-1;i++)
		printf("%d ",A[i]);
	printf("%d\n",A[i]);
}



void BubbleSort(int A[ ], int n){
	int j,temp;
		for(i = 0; i < N-1; i++){
			for(j = N-1; j > i; j--)
			if(A[j-1] > A[j]){
				temp = A[j-1];
				A[j-1] = A[j];
				A[j] = temp;
				count++;
			}
			
	}
	

	/*int j,temp,flag;
	j=0;
	do{
		flag=0;
		for(i=0;i<n-1-j;i++)
			if(A[i]>A[i+1]){
				flag=1;
				temp = A[i];
				A[j] = A[i+1];
				A[i+1] = temp;
			}
			j++;
	}while(flag == 1);*/
}



int main(void){
	scanf("%d",&N);
	int A[100];
	for(i=0;i<N;i++)
		scanf("%d",&A[i]);
	
	BubbleSort(A, N);
	Process(A, N);

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


}

Measured memory_bytes: 1852
#include<bits/stdc++.h>
using namespace std;
     
#define int long long
#define ll long long
#define f(i,l,n) for(int i=l;i<n;i++)
#define E "\n"
#define Outerloop int q;cin>>q;while(q--)
#define Mod 1000000007
int dp[55][55][2505];
int n,k,a[500],A;

int solve(int number,int id,int sum)
{
 
	
	
	if(id==0)
	{
		if(number!=0 && sum%number==0 )
		{if(sum/number==A) return 1;
		return 0;}
		else return 0;
	}
		if(dp[number][id][sum]!=-1) return dp[number][id][sum];
	    int temp=0;
		temp+=solve(number+1,id-1,sum+a[id]);
		temp+=solve(number,id-1,sum);
	
	return dp[number][id][sum]=temp;
}

    int32_t main()
    {
    	memset(dp,-1,sizeof dp);
    	
    	
    	cin >> n >> A;
    	
    	f(i,1,n+1) cin >> a[i];
    	
		

	    	cout<<solve(0,n,0)<<E;

    	
    return 0;
    }
    
    
    

Measured memory_bytes: 59392
#include <stdio.h>

int spi(int,int);
int main(void)
{
	int i=0,z=0,a,b;
	int kai[200];
	
	while (scanf("%d%d", &a, &b) != EOF){
		kai[i] = spi(a, b);
		i++;
	}
	
	for (z=0; z<i; z++){
		printf("%d\n", kai[z]);
	}
	
	return 0;
}

int spi(int q, int q2)
{
	int count=0;
	double sum = (double)q+q2;
	double kkk=10.0;
	
	while (1){
		if (sum/kkk < 1){
			count++;
			break;
		}
		else {
			kkk *= 10;
			count++;
		}
	}
	
	return count;
}

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

ans = -1
for i in range(1251, 0, -1):
    av = int(i * 0.08)
    bv = int(i * 0.1)
    # print(i, av, bv)

    if av > 0 and bv > 0:
        if av == A and bv == B:
            ans = i

print(ans)

Measured memory_bytes: 39536
import math
A,B=(int(x) for x in input().split())

a=int(A/0.08 + 0.5)
b=int(B/0.1 + 0.5)
out =0
"print(a,b)"
if a>=b:
    if math.floor(a*0.1) != B:
        out = -1
    else:
        out = int(a)
elif a<b:
    if math.floor(b*0.08) != A:
        out = -1
    else:
        out = int(b)
print(out)

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

int main(){

    int n, k;
    cin >> n >> k;

    double rate = 0.0;

    for(int i=1; i<=n; i++){
        double temp = 1.0/double(n);

        int now = i;
        while(now < k){
            now *= 2;
            temp /= 2.0;
        }
        rate += temp;
    }

    cout << setprecision(15) << rate << endl;

    return 0;
}

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

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pii> vii; 
typedef vector<ll> vl; 
typedef vector<vl> vvl; 

double EPS=1e-9; 
int INF=1000000005; 
long long INFF=1000000000000000005ll; 
double PI=acos(-1); 
int dirx[8]={ -1, 0, 0, 1, -1, -1, 1, 1 }; 
int diry[8]={ 0, 1, -1, 0, -1, 1, -1, 1 }; 
const ll MOD = 1000000007;

#define DEBUG fprintf(stderr, "====TESTING====\n") 
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl 
#define OUT(x) cout << x << endl 
#define OUTH(x) cout << x << " " 
#define debug(...) fprintf(stderr, __VA_ARGS__) 
#define READ(x) for(auto &(z):x) cin >> z;
#define FOR(a, b, c) for (int(a)=(b); (a) < (c); ++(a)) 
#define FORN(a, b, c) for (int(a)=(b); (a) <= (c); ++(a)) 
#define FORD(a, b, c) for (int(a)=(b); (a) >= (c); --(a)) 
#define FORSQ(a, b, c) for (int(a)=(b); (a) * (a) <= (c); ++(a)) 
#define FORC(a, b, c) for (char(a)=(b); (a) <= (c); ++(a)) 
#define EACH(a, b) for (auto&(a) : (b)) 
#define REP(i, n) FOR(i, 0, n) 
#define REPN(i, n) FORN(i, 1, n) 
#define MAX(a, b) a=max(a, b) 
#define MIN(a, b) a=min(a, b) 
#define SQR(x) ((ll)(x) * (x)) 
#define RESET(a, b) memset(a, b, sizeof(a)) 
#define fi first 
#define se second 
#define mp make_pair 
#define pb push_back 
#define ALL(v) v.begin(), v.end() 
#define ALLA(arr, sz) arr, arr + sz 
#define SIZE(v) (int)v.size() 
#define SORT(v) sort(ALL(v)) 
#define REVERSE(v) reverse(ALL(v)) 
#define SORTA(arr, sz) sort(ALLA(arr, sz)) 
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) 
#define PERMUTE next_permutation 
#define TC(t) while (t--) 
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)


void solve() {
    int h, w, cH, cW, dH, dW;
    char ch;
    cin >> h >> w >> cH >> cW >> dH >> dW;
    cH--, cW--, dH--, dW--;
    vector<vector<bool>> g(h, vector<bool>(w)), vis(h, vector<bool>(w)), walk(h, vector<bool>(w));
    set<tuple<int, int, int>> q;
    REP(r, h) {
        REP(c, w) {
            cin >> ch;
            g[r][c] = (ch == '.');
        }
    }
    q.emplace(0, cH, cW);
    while((int)q.size()) {
        auto [cnt, r, c] = *q.begin();
        q.erase(q.begin());
        vis[r][c] = true;
        if(r == dH && c == dW) {
            OUT(cnt);
            return;
        }
        FOR(row, -2, 3) {
            FOR(col, -2, 3) {
                if(!row && !col) continue;
                int rr = r + row, cc = c + col;
                if(rr < 0 || rr >= h || cc < 0 || cc >= w || vis[rr][cc] || !g[rr][cc]) continue;
                if((abs(row) == 1 && !abs(col)) || (abs(col) == 1 && !abs(row))) q.emplace(cnt, rr, cc);
                else q.emplace(cnt + 1, rr, cc);
            }
        }
    }
    OUT(-1);
}

int main()  
{ 
    FAST_INP;
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r", stdin);
    freopen("output.txt","w", stdout);
    #endif
    
    // int tc; cin >> tc;
    // TC(tc) solve();
    solve();

    return 0; 
} 

// xxxxx
// xxxxx
// xxoxx
// xxxxx
// xxxxx

Measured memory_bytes: 5032
var out = function(x) {
  console.log(x);
  return x;
}

var compare = function(a,b) {
  if(a>b){
    return 'a > b';
  }else if(a<b){
    return 'a < b';
  }else if(a==b){
    return 'a == b';
  }
  return 'error!'
}

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(input) {
  var result = input.split(' ').map(Number).reduce(compare);

  out(result);
});

Measured memory_bytes: 7648
n = int(input())
a = sorted(map(int, input().split()))
b = sorted(map(int, input().split()))
c = sorted(map(int, input().split()))

import bisect
ans = 0
for i in b:
    A = bisect.bisect_left(a, i)
    C = n - bisect.bisect_right(c, i)
    ans += A * C
    
print(ans)

Measured memory_bytes: 23204
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define dump(x)  cerr << #x << " = " << (x) << endl;
using namespace std;
int main(){
  string N;
  cin >> N;
  string n = N.substr(0,1);
  bool flag = false;
  FOR(i,1,N.length()){
    if(N.substr(i,1) != "9") flag = true;
  }
  dump(flag);
  int ans = atoi(n.c_str()) + 9 * (N.length() - 1);
  if(flag) ans--;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for (int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
typedef long long ll;

int main()
{
  string s;
  cin >> s;
  int a, z;
  rep(i, s.size())
  {
    if (s[i] == 'A')
    {
      a = i;
      break;
    }
  }
  rep(i, s.size()) if (s[i] == 'Z') z = i;
  cout << z - a + 1 << endl;
}

Measured memory_bytes: 640
/*+lmake
 * STD = c++14
 * DEFINE += WAAUTOMATON
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#ifdef WAAUTOMATON
#define debug(args...)                                                                             \
    {                                                                                              \
        dbg, args;                                                                                 \
        cerr << endl;                                                                              \
    }
#define massert(x) assert(x)
#else
#define debug(args...) // Just strip off all debug tokens
#define massert(x)
#endif
struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;
#define MAXN 700
#define MAXM MAXN*MAXN
struct Edge
{
	int to,next;
}e[2*MAXM+10];
int head[MAXN+10];
void addEdge(int a,int b)
{
	static int c=0;
	e[++c]=(Edge){b,head[a]};
	head[a]=c;
	e[++c]=(Edge){a,head[b]};
	head[b]=c;
}
bool g[MAXN+10][MAXN+10];
int c[MAXN+10];
int n;
int cnt[3];
void dfs(int now)
{
	++cnt[c[now]];
	for(int i=1; i<=n; ++i) {
		if (now!=i &&!g[now][i]) {
			if (c[i]!=0 && c[i]==c[now]) throw 1;
			if (c[i]!=0) continue;
			c[i]=3-c[now];
			dfs(i);
		}
	}
}
int a[MAXN+10],ca,ans;
bool f[MAXN+10];
void solve(long long N, long long M, vector<long long> A, vector<long long> B){
	n=N;
	for(int	i=0; i<M; ++i) {
		g[A[i]][B[i]]=g[B[i]][A[i]]=true;
	}
	for(int i=1; i<=N; ++i) {
		if (c[i]==0) {
			c[i]=1;
			memset(cnt,0,sizeof(cnt));
			dfs(i);
			if (cnt[1]<cnt[2]) swap(cnt[1],cnt[2]);
			ans+=cnt[2];
			if (cnt[1]!=cnt[2])
			a[++ca]=cnt[1]-cnt[2];
		}
	}
	f[0]=true;
	for(int i=1; i<=ca; ++i) {
		for(int j=N; j>=a[i]; --j) {
			if (f[j-a[i]]) f[j]=true;
		}
	}
	int mn=9999999;
	for(int i=0; i<=N; ++i) {
		if (f[i]) {
			int t=ans+i,t2=N-t;
			assert(t>=0 && t2>=0); 
			mn=min(mn,t*(t-1)/2+t2*(t2-1)/2);
		}
	}
	cout<<mn<<endl;
}

int main(){	
#ifdef WAAUTOMATON
	freopen("./in_E_4.txt","r",stdin);
#endif
	long long M;
	long long N;
	scanf("%lld",&N);
	scanf("%lld",&M);
	vector<long long> A(M-1+1);
	vector<long long> B(M-1+1);
	for(int i = 0 ; i <= M-1 ; i++){
		scanf("%lld",&A[i]);
		scanf("%lld",&B[i]);
	}
	try {
	solve(N, M, A, B);
	}catch(int x)
	{
		debug(x);
		puts("-1");
	}
	return 0;
}



Measured memory_bytes: 8320
#include<iostream>
#include<vector>
#include<array>
#include<algorithm>

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

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;

    if(a <= 8 && b <= 8){
        cout << "Yay!";
    }
    else{
        cout << ":(";
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long
#define pii pair<int,int>
#define pll pair<LL,LL>

using namespace std;

int H,W,d;


int main(){

    cin>>H>>W>>d;
    string col1="";
    string col2="";
    REP(i,d)col1+="R",col2+="G";
    REP(i,d)col1+="Y",col2+="B";
    REP(i,d)col1+="R",col2+="G";

    char ans[H][W];


    for(int j=0;j<=H*W;j+=d){
        string color = (j%(2*d)==0 ? col1:col2);
        int index = 2*d;
        int sj = j;
        REP(i,H){
            REP(k,d){
                if(sj+k>=W||sj+k<0)continue;
                ans[i][sj+k]=color[index+k];
            }
            sj--;
            index -=(d==1 ? 1:2);
            if(index==0)index=2*d;
        }
    }


    REP(i,H){
        REP(j,W)cout<<ans[i][j];
        cout<<endl;
    }

    return 0;
}

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

const int N = 1e5+1;

bool is_prime[N];
int primes[N];

void sieve() {
	is_prime[2] = 1;
	for (int i = 3; i < N; i += 2) is_prime[i] = 1;
	for (int i = 3; i*i < N; i += 2) {
		if (is_prime[i])
			for (int j = i*i; j < N; j += i)
				is_prime[j] = 0;
	}
}

int main () {
	sieve();
	primes[0] = primes[1] = primes[2] = 0;
	for (int i = 3; i < N; i++) 
		primes[i] = primes[i-1] + ((i&1) and is_prime[i] and is_prime[(i+1)/2]);
	
	int q; cin >> q;
	while (q--) {
		int l, r; cin >> l >> r;
		cout << primes[r]-primes[l-1] << endl;
	}

	return 0;
}


Measured memory_bytes: 1152
# include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	long double l;
	cin >> l;
	cout << setprecision(9) << (l / 3) * (l / 3) * (l / 3) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl


signed main(){
    int N,Ans=0;
    int a[3000];
    cin >> N;
    REP(i,N){cin >> a[i];Ans+=a[i];}
    cout << Ans-N << endl;
    return 0;
}      


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <time.h>
#include <stdlib.h>
#include <algorithm>

#include <chrono>

#define INF 1e9
#define LL_INF 1e18

#define nmax 200010

#define fst first
#define snd second
#define pb push_back
#define SZ(x) ((int)(x.size()))

#define MOD 1000000007
#define MOD1 998244353
#define MOD2 666013
#define P1 255
#define P2 2059

using namespace std;

typedef long long int ll;

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

int n, k;
int h[nmax];

int main()
{
    scanf("%d %d", &n, &k);
    
    for (int i = 1; i <= n; i++) scanf("%d", &h[i]);

    sort(h + 1, h + n + 1);

    k = min(n, k);

    ll sum = 0;

    for (int i = 1; i <= n - k; i++) sum += h[i];

    printf("%lld", sum);

    // IMPORTANT!!!!!
    // Are you missing something????
    // check limits, int or ll

    return 0;
}

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

int main(){ 
    int a,b,c,s;
    string res;

    cin >> s;
    while(s>0){
        cin >> a >> b >> c; 
        a = a*a;
        b = b*b;
        c = c*c;
        res = "YES";
        if(a!=(b+c) && b!=(a+c) && c!=(a+b)) res="NO";
        cout << res << endl;
        s--;    
    }
    return 0;
}

Measured memory_bytes: 0
def main():
    N = int(input())
    A = [int(a) for a in input().split()]

    ans = 0
    for i in range(len(A)):
        if (i + 1) % 2 == 1 and A[i] % 2 == 1:
            ans += 1

    print(ans)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 9060
#include<bits/stdc++.h>
using namespace std;
// -----------------<fast IO>------------------
#define IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FLSH             fflush(stdout)
#define fileIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);
#define PRECISION(x)     cout << fixed << setprecision(x);
// -----------------<TypeDef Start>------------------
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
// -----------------<Constants>------------------
const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

const int INF=1e9;

int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
/*ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}*/
// --------------------------------------------------</TEMPLATE>--------------------------------------------------
ll arr[505][505];
ll brr[505][505];
void solve() {
	ll n,w;
	cin>>n>>w;
	vector<pair<ll,ll> > v(n);
	ll s=0;
	for(ll i=0;i<n;i++) {
		cin>>v[i].first>>v[i].second;
		s+=v[i].second;
	}
	ll dp[s+1];
	for(ll i=0;i<s+1;i++)
		dp[i]=INT_MAX;
	dp[0]=0;
	for(ll i=0;i<n;i++) {
		for(ll j=s-v[i].second;j>=0;j--)
			dp[j+v[i].second]=min(dp[j+v[i].second],v[i].first+dp[j]);
	}
	ll ans=0;
	for(ll i=0;i<=s;i++) {
		if(dp[i]<=w)
			ans=max(ans,i);
	}
	cout<<ans<<endl;
}

int main() {
	IOS
	ll t=1;
	//cin>>t;
	while(t--) {
		solve();
	}
	return(0);
}

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

int main(){
	int H, W;
	cin >> H >> W;
	char S[H][W];
	for(int i=0; i<H; i++){
		for(int j=0; j<W; j++){
			cin >> S[i][j];
		}
	}
	for(int i=0; i<H; i++){
		for(int j=0; j<W; j++){
			if(S[i][j]=='#'){
				cout << '#';
			} else if(S[i][j]=='.'){
				int c=0;
					if(0<=i-1&&i-1<H&&0<=j-1&&j-1<W&&S[i-1][j-1]=='#')c++;
					if(0<=i-1&&i-1<H&&0<=j&&j<W&&S[i-1][ j ]=='#')c++;
					if(0<=i-1&&i-1<H&&0<=j+1&&j+1<W&&S[i-1][j+1]=='#')c++;
					if(0<=i&&i<H&&0<=j-1&&j-1<W&&S[ i ][j-1]=='#')c++;
					if(0<=i&&i<H&&0<=j+1&&j+1<W&&S[ i ][j+1]=='#')c++;
					if(0<=i+1&&i+1<H&&0<=j-1&&j-1<W&&S[i+1][j-1]=='#')c++;
					if(0<=i+1&&i+1<H&&0<=j&&j<W&&S[i+1][ j ]=='#')c++;
					if(0<=i+1&&i+1<H&&0<=j+1&&j+1<W&&S[i+1][j+1]=='#')c++;
				cout << c;
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String s2 = sc.next();
        String s3 = sc.next();
        String s4 = sc.next();
        String t = s + s2 + s3 + s4;
        if (t.contains("1") && t.contains("9") && t.contains("7") && t.contains("4")) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

        System.out.println();
    }

}


Measured memory_bytes: 23252
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        
        // to: 隣接リスト
        List<Integer>[] to = new List[n];
        for (int i = 0; i < n; i++) {
            to[i] = new ArrayList<Integer>();
        }
        
        // data: m組の辺i, jのデータ
        int[][] data = new int[m][2];
        for (int i = 0; i < m; i++) {
            int s = sc.nextInt() - 1;
            int t = sc.nextInt() - 1;
            to[s].add(t);
            to[t].add(s);
            data[i][0] = s;
            data[i][1] = t;
        }
        
        // 各辺を封鎖した時、依然連結グラフか調べる
        int count = 0;
        int start = 0;
        for (int i = 0; i < m; i++) {
            // 封鎖する
            int tmps = data[i][0];
            int tmpt = data[i][1];
            
            Queue<Integer> que = new ArrayDeque<Integer>();
            que.add(start);
            
            boolean[] visited = new boolean[n];
            visited[start] = true;
            
            // BFSで各点を訪れる
            while (!que.isEmpty()) {
                int p = que.poll();
                
                for (Integer q : to[p]) {
                    // System.out.println(i + " " + (p+1) + " " + (q+1));
                    if (!visited[q]) {
                        boolean canPass = !((p == tmps && q == tmpt) || (p == tmpt && q == tmps));
                        
                        if (canPass) {
                            que.add(q);
                            visited[q] = true;
                            // System.out.println(q+1);
                        }
                    }
                }
            }
            
            // 全点訪れられなかった
            // -> その辺は不可欠な辺
            for (int j = 0; j < n; j++) {
                if (!visited[j]) {
                    count++;
                    break;
                }
            }
        }
        System.out.println(count);
    }
}

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

#define REPI(x) for(int i=0;i<x;i++)
#define REPJ(x) for(int j=0;j<x;j++)

#define REPISE (s,e) for(int i=s,i<e;i++)
#define REPJSE (s,e) for(int j=s,j<e;j++)

typedef long long ll;

using namespace std;

int main ()
{
  int N,b,st,res,butting,cnt,cP;
  
  cin >> N;
  vector<int> F(N);
  vector<vector<int> > P(N);

  REPI(N)
  {
    st = 0;
    REPJ(10)
    {
      cin >> b;
      st += b;
      st = st << 1;
    }
    F[i] = st >> 1;
  }

  REPI(N)
  {
    REPJ(11)
    {
      cin >> b;
      P[i].push_back(b);
    }
  }
  st = 1;
  
  while (st < 1024)
  {
    cP = 0;
    REPI(N)
    {
      butting = st & F[i];
      cnt = 0;
      while (butting > 0)
      {
        if(butting % 2 == 1)
          cnt++;
        
        butting /= 2;
      }
      cP += P[i][cnt];
    }
    if (st == 1)
    {
      res = cP;
    } else {
      res = max(res,cP);
    }    
    st++;
  }

  cout << res << endl;
  return 0;
}

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

int main()
{
 int n;
 long long tmp=1,ans=0;
 cin >> n;
 vector<string> stlist;
 for(int i=0;i<n;i++){
   char str[10],a;
   cin >> str;
   for(int i=0; i<10; i++){
		for(int j=i+1; j<10; j++){
			if(str[i]>str[j]){
				a = str[i];
				str[i] = str[j];
				str[j] = a;
			}
		}
	}
    stlist.push_back(str);
 }
  sort(stlist.begin(),stlist.end());

  for(int i=0;i<n-1;i++){
    if(stlist[i]==stlist[i+1]) tmp++;
    else{
      if(tmp!=1){
      ans+=tmp*(tmp-1)/2;
      }
      tmp=1;
    }
  }
      if(tmp!=1){
      ans+=tmp*(tmp-1)/2;
      }
  cout<< ans;
  return 0;
}

Measured memory_bytes: 5748
#include <iostream>
#include <sstream>
#include <cstdio>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int find (int w[],int kn,int wn){
  int k[kn],l=0,j,right=10000*100000,left=0,mid;
  while(right-left>1){
    mid=(right+left)/2;
    l=0;
    for(j=0;j<kn;j++){
      k[j]=0;
      while((k[j]+w[l])<=mid&&l<wn){
	k[j]+=w[l];
	l++;
      }
      if(k[j]==0){
	break;
      }
    }
    //cout<<"wn:"<<wn<<" l:"<<l<<" right:"<<right<<" left:"<<left<<" mid:"<<mid<<endl;
    if(l<wn)left=mid;
    else right=mid;
    //cout<<"wn:"<<wn<<" l:"<<l<<" right:"<<right<<" left:"<<left<<" mid:"<<mid<<endl;
  }
  return right;
}
int main(){
  int wn,kn;
  cin>>wn>>kn;
  int w[wn];
  for(int i=0;i<wn;i++){
    scanf("%d",&w[i]);
  }
  cout<<find(w,kn,wn)<<endl;
  return 0;
}



Measured memory_bytes: 3948
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long   ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<ll, ii>  iii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9;
const double PI = acos(-1);
#define tam 120000
#define tam2 200000
#define offset 
const ll MOD= 998244353;
int main()
{
    double r;
    cin>>r;
    printf("%.9lf\n",2*r*PI);
}
// PLUS ULTRA!


Measured memory_bytes: 3784
// Problem : 
// 			B - Making Triangle
// 			
// 		
// Contest : AtCoder - AtCoder Beginner Contest 175
// URL : https://atcoder.jp/contests/abc175/tasks/abc175_b
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 

#include<bits/stdc++.h>
#define ll                    long long int
#define pb                    push_back
#define F                     first
#define S                     second
#define mp                    make_pair
#define MOD                   1000000007
#define vi                    vector<int>
#define vll                   vector<ll>
#define pll                   pair<ll,ll>
#define pii                   pair<int,int>
#define all(p)                p.begin(),p.end()
#define mid(s,e)              (s+(e-s)/2)
#define eb                    emplace_back
#define ull                   unsigned long long
#define bug(x)				  cout<<"  [ "#x<<" = "<<x<<" ]"<<endl;
#define KAMEHAMEHA            ios_base::sync_with_stdio(0);
#define RASENGAN              ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
void solve(){
    int N ;
    cin >> N ;
    vector<int> V(N) ;
    for(auto &x : V){
        cin >> x ;
    }
	for(int i=1;i<=10;i++)
	{
		
	}
    ll ans = 0 ;
    auto get = [](int i , int j , int k){
        if(i == j || j == k || k == i) return 0 ;
        vector<int> v({i,j,k}) ;
        sort(v.begin(),v.end()) ;
        if(v[0] + v[1] > v[2]) return 1 ;
        return 0 ;
    } ;
    for(int i = 0 ; i < N ; i++){
        for(int j = i + 1; j < N ; j++){
            for(int k = j + 1; k < N ; k++){
                ans += get(V[i], V[j] , V[k]) ;
            }
        }
    }
    cout << ans << endl ;
}

int main()
{
    KAMEHAMEHA
	int t=1;
	//cin>>t;
	for(int cn=1;cn<=t;cn++)
	{
		solve();
	}
    return 0;
}



Measured memory_bytes: 3660
using System;
using System.Linq;

namespace ABC152B
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            var a = ab[0];
            var b = ab[1];

            string aStr = "", bStr = "";
            for (var i = 0; i < b; i++) aStr += a.ToString();
            for (var i = 0; i < a; i++) bStr += b.ToString();

            Console.WriteLine(aStr.CompareTo(bStr) < 0 ? aStr : bStr);
        }
    }
}

Measured memory_bytes: 13528
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONGINF 1000000000000000000
int main() {
	int h, w;
	cin >> h >> w;
	int hoge[100][100] = {};
	REP(i, h) {
		string s;
		cin >> s;
		REP(q, w) {
			if (s[q] == '#') {
				hoge[i][q] = 1;
			}
		}
	}
	pair<int, int> basho = make_pair(0, 0);
	if (hoge[0][0] != 0) {
		hoge[0][0] = 0;
		while (true) {
			if (basho.first != h - 1 && hoge[basho.first + 1][basho.second] == 1) {
				hoge[basho.first + 1][basho.second] = 0;
				basho.first++;
			}
			else if (basho.second != w - 1 && hoge[basho.first][basho.second + 1] == 1) {
				hoge[basho.first][basho.second + 1] = 0;
				basho.second++;
			}
			else break;
		}
	}
	for (int i = 0;i < h;++i) {
		for (int q = 0;q < w;++q) {
			if (hoge[i][q] != 0) {
				cout << "Impossible" << endl;
				return 0;
			}
		}
	}
	cout << "Possible" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define v(i) vector<i>
#define FOR(i,a,b) for(i=a;i<b;i++)
#define FORE(i,a,b) for(i=a;i<=b;i++)
#define FORV(i,a,b) for(i=a;i>b;i--)
#define FOREV(i,a,b) for(i=a;i>=b;i--)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define look(v) for(auto c:v) cout<<c<<" "; cout<<"\n";
#define dfdc int i,j,k,m,n,ct=0;string s;
#define ppl(a,st,end) for(i=st;i<=end;i++)cin>>a[i];
#define fz(a) memset(a,0,sizeof a);
#define dp_1(n) int dp[n];fz(dp);
#define dp_2(m,n) int dp[m][n];fz(dp);
#define arpt(a,s,e) for(i=s;i<=e;i++) cout<<a[i]<<" ";cout<<"\n";
#define tk int t;cin>>t;while(t--)
 
using namespace std;
 
typedef long long int ll;
 
 
int main(){
    fastio
    dfdc
    cin>>s;
    if(s[0] == 'R'){
    	if(s[1] == 'R'){
    		if(s[2] == 'R'){
    			cout<<"3\n";
    		}
    		else{
    			cout<<"2\n";
    		}
    	}
    	else{
    		cout<<"1\n";
    	}
    }
    else{
    	if(s[1] == 'R'){
    		if(s[2] == 'R'){
    			cout<<"2\n";
    		}
    		else{
    			cout<<"1\n";
    		}
    	}
    	else{
    		if(s[2] == 'R'){
    			cout<<"1\n";
    		}
    		else{
    			cout<<"0\n";
    		}	
    	}
    }
    return 0;
}

Measured memory_bytes: 3624
import sys

k = int(input())

ans = [0]*(k+1)
ans[0] = 7 % k

if ans[0] == 0:
    print(1)
    
else:
    for i in range(k):
        ans[i+1] = (ans[i]*10 + 7) % k
        
        if ans[i+1] == 0:
            print(i+2)
            sys.exit()
            
    print(-1)

Measured memory_bytes: 71456
import sys

N, M = map(int, input().split())
shop = []
count = 0
money = 0
for i in range(N):
    a, b = map(int, input().split())
    shop.append([a, b])

shop = list(sorted(shop))

for i in range(N):
    buy = min(M, shop[i][1])
    money += buy * shop[i][0]
    M = M - buy
    if M == 0:
        print(money)
        sys.exit()

Measured memory_bytes: 21204
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }



int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(25);

  int n, m;
  cin >> n >> m;
  vector<vector<int>> G(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  vector<vector<int>> dp(n, vector<int>(11, -1));
  int q;
  cin >> q;
  vector<int> c(q);
  rep(i, q) {
    int v, d;
    cin >> v >> d >> c[i];

    v--;
    dp[v][d] = i;
  }
  FORR(j, 10, 1) {
    rep(i, n) {
      if (dp[i][j] == -1) continue;
      chmax(dp[i][j - 1], dp[i][j]);
      for (int v: G[i]) {
        chmax(dp[v][j - 1], dp[i][j]);
      }
    }
  }
  rep(i, n) cout << (dp[i][0] == -1 ? 0 : c[dp[i][0]]) << '\n';


  


  




  
  return 0;
}

Measured memory_bytes: 18040
#include <bits/stdc++.h>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < (n); i++)
#define forr(i,a,b) for (int i = (a); i <= (b); i++)
#define all(v) v.begin(), v.end()
#define pb push_back
 
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ii> vii;

int near (int n) {
	int ans = 1;
	while (ans < n) ans *= 2;
	return ans;
}
 
void fwt (vi & a){
	int n = a.size();
	for(int k = 1; k < n; k <<= 1)
		for(int i = 0; i < n; i += k << 1)
			for(int j = 0; j < k; ++j)
				a[i + j + k] ^= a[i + j];
}

int n, cn[255];
string s;

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> n >> s;
	for (int c : s) cn[c - '1']++;

	vi a(near(n));
	for (int i = 0; i < n; i++) {
		if (!cn[1]) a[i] = (s[i] - '1') / 2;
		else a[i] = (s[i] - '1') % 2;
	}

	fwt(a);

	if (!cn[1]) cout << a[n - 1] * 2 << endl;
	else cout << a[n - 1] << endl;

	return 0;
}

Measured memory_bytes: 5404
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

int main(){
    int n,k;
    int dp[100][3][3];
    int a[101];
    memset(dp,0,sizeof(dp));
    memset(a,-1,sizeof(a));
    cin >> n >> k;
    REP(i,k){
	int d,dd;
	cin >> d >> dd;
	a[d-1] = dd-1;
    }
    if(a[0] == -1){
	REP(i,3) dp[0][i][0] = 1;
    }else{
	dp[0][a[0]][0] = 1;
    }
    if(a[1] == -1){
	REP(i,3)REP(j,3)
		dp[1][i][j] += dp[0][j][0];
    }else{
	REP(i,3)
	    dp[1][a[1]][i] += dp[0][i][0];
    }
    FOR(i,1,n-1){
	if(a[i+1] == -1){
	    REP(j,3){
		REP(k,3)REP(l,3){
		    if( !(j == k && j == l) ){
			dp[i+1][j][l] = (dp[i+1][j][l] + dp[i][l][k]) % 10000;
		    }
		}
	    }
	}else{
	    REP(j,3)REP(k,3){
		if( !(j == a[i+1] && a[i+1] == k) ){
		    dp[i+1][a[i+1]][j] = (dp[i+1][a[i+1]][j] + dp[i][j][k]) % 10000;
		}
	    }
	}
    }
    int ans = 0;
    REP(i,3)REP(j,3){
	ans += dp[n-1][i][j]; 
    }
    ans %= 10000;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    string s; 
    cin >> s;
    vector<ll> a(s.size()+1);
    rep(i, s.size()){
        if (s[i] == '<'){
            chmax(a[i+1], a[i]+1);
        }
    }
    for(int i = s.size()-1; i >= 0; i--){
        if (s[i] == '>'){
            chmax(a[i], a[i+1]+1);
        }
    }
    ll ans = 0;
    rep(i, s.size()+1) ans += a[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7716
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int main(void)
{
    string S, T;
    cin >> S >> T;

    string t = T.substr(0, S.size());
    
    if (t == S)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3628
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N + 1];
        A[N] = 1000001;
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }
        Arrays.sort(A);
        sc.close();

        boolean[] check = new boolean[1000001];
        Arrays.fill(check, true);
        int ans = 0;

        // 小さい順に見ていく
        for (int i = 0; i < N; i++) {
            if (A[i + 1] != A[i] && check[A[i]]) {
                ans++;
            }

            for (int j = A[i]; j <= A[N - 1]; j += A[i]) {
                check[j] = false;
            }
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 59948
n = int(input())
a = []
for i in range(n):
    a.append(input().split()) #二重リスト作成

b = 1
for j in a: #レストランの番号をindex2に付与
    j.append(b)
    b += 1

for k in a: #点数をpopで取り出し-1を乗じてinsert→降順にソートするため
    x=k.pop(1)
    k.insert(1,int(x)*-1)

a.sort()

for m in a: #index2を取り出す
    print(m[2]) 

Measured memory_bytes: 3064
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);

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

    bool ret = true;
    for (int i = 0; i < (int)s.size(); i++) {
        if (i % 2) {
            if (s[i] == 'R') {
                ret = false;
                break;
            }
        }
        else {
            if (s[i] == 'L') {
                ret = false;
                break;
            }
        }
    }

    if (ret) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
       Scanner sc = new Scanner(System.in);
     int K = sc.nextInt();sc.nextLine();
     String S =sc.nextLine();
         
       if(S.length() <= K){
           System.out.println(S);
        }else{
            System.out.println(S.substring(0,K)+"...");
        }
        
     }
    
}


Measured memory_bytes: 27068
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define MAX_N 1000005
int prime[MAX_N]; //i番目の素数
bool is_prime[MAX_N+1]; //is_prime[i]==true->iはprime

//n以下の素数の数を返す
void sieve(int n) {
    int p = 0;
    rep(i,n+1) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;
    rep2(i,n+1) {
        if(is_prime[i]) {
            prime[p++] = i;
            for(int j = 2 * i; j<= n; j+= i) is_prime[j] = false;
        }
    }
    return ;
}

map< int64_t, int > prime_factor(int64_t n) {
    map< int64_t, int > ret;
    for(int64_t i = 2; i * i <= n; i++) {
      while(n % i == 0) {
        ret[i]++;
        n /= i;
      }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

int main() {
  ll A, B; cin >> A >> B;
  ll gcd = __gcd(A, B);
  vel part;
  for(auto p : prime_factor(gcd)) while(p.sc--) part.pub(p.fs);
  part.erase(unique(part.begin(),part.end()),part.end());
  cout << part.size() + 1 << endl;
}

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

    ll A, B; cin >> A >> B;
    ll gcd = __gcd(A, B);
    set<ll> v; v.insert(1);
    sieve(gcd);
    for(int i = 1; i * i <= gcd; i++) {
        if(gcd % i == 0 and is_prime[i]) v.insert(i); 
        if(gcd % i == 0 and is_prime[gcd/i]) v.insert(gcd/i);
    }
    cout << v.size() << endl;
    return 0;
}*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int N;

vector<int> p;

int calc(){
  int cnt = 0;
  vector<int> P = p;
  for(int i = 0;i < N - 1;i++){
    cnt += P[i];
    P[i + 1] = max(0,P[i + 1] - P[i]);
  }
  return cnt * 2 + P[N - 1];
}

int main(){
  cin >> N;
  p.resize(N);
  rep(i,0,N - 1) cin >> p[i];
  int ans = calc();
  int before = p[0];
  rep(i,0,before){
    p[0] = i;
    ans = min(ans , calc() + before - i);
  }
  cout << ans << endl;
}



Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define PI 3.141592653589
#define setbits(n) __builtin_popcountll(n)
const ll mod=1e9+7;

const int N=1e5+1;
vector<ll> a[N],in(N,0),dist(N);
vector<bool> vis(N,false);

void dfs(ll v){
    vis[v]=true;
    vector<ll> go;
    for(ll u: a[v]){
        dist[u]=max(dist[u],dist[v]+1);
        in[u]--;
        if(in[u]==0 && !vis[u])
            dfs(u);
    }
}

int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T=clock();
    
    ll n,m;
    cin>>n>>m;
    for(ll i=0;i<m;i++){
        ll u,v;
        cin>>u>>v; u--,v--;
        a[u].pb(v);
        in[v]++;
    }
    ll ans=0;
    for(ll i=0;i<n;i++)
        if(in[i]==0 && !vis[i])
            dfs(i);
    for(ll i=0;i<n;i++)
        ans=max(ans,dist[i]);
    cout<<ans;
    

    

    cerr<<"\n\nTIME: "<<(double)(clock()-T)/CLOCKS_PER_SEC<<" sec\n";
    T = clock();
    return 0;
}

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

int main()
{
    int n, a, b;
    bool p[10000] = {false};

    for( int i = 2; i < 10000; i++ )
    {
        bool judge = true;
        for( int j = 2; j <= sqrt(i); j++ )
            if( i % j == 0 )
                judge = false;
        if( judge == true )
            p[i] = true;
    }

    while( cin >> n )
    {
        if( n == 0 )
            break;

        for( int i = 2; i <= n - 2; i++ )
        {
            if( p[i] == true && p[i+2] == true )
            {
                a = i;
                b = i + 2;
            }
        }
        cout << a << " " << b << endl;
    }
    return 0;
}


Measured memory_bytes: 3020
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
const int maxn=1e3+3;
const int inf=1e9+3;
char s[maxn][maxn];
int dp[maxn][maxn];
int n,m;

int main(){
    cin >> n >> m;
    for (int i=1;i<=n;i++) scanf("%s",s[i]+1);
    for (int i=1;i<=n;i++)
    for (int j=1;j<=m;j++){
        if (i==1&&j==1) {
            dp[i][j]=s[i][j]=='#';
            continue;
        }
        dp[i][j]=inf;
        if (i>1) dp[i][j]=min(dp[i][j],dp[i-1][j]+(s[i-1][j]=='.'&&s[i][j]=='#'));
        if (j>1) dp[i][j]=min(dp[i][j],dp[i][j-1]+(s[i][j-1]=='.'&&s[i][j]=='#'));
    }
    cout << dp[n][m] << endl;
}


Measured memory_bytes: 2688
N = int(input())
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]

ans = -10**15
for i in range(1, 2**10):
    tmp = 0
    for k in range(N):
        c = 0
        for j in range(10):
            if (i >> j) & 1 and F[k][j]:
                c += 1
        tmp += P[k][c]
    ans = max(ans, tmp)
print(ans)

Measured memory_bytes: 41964
#include <stdio.h>

int main(){
    char x;
    x=getchar();

    switch (x)
    {
        case 'A':
            printf("T");
            break;
        case 'T':
            printf("A");
            break;
        case 'G':
            printf("C");
            break;
        case 'C':
            printf("G");
            break;
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<deque>
#include<bitset>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<ll,ll> P;
template<class T> inline bool chmax(T&a , T b){ if(a<b){ a=b; return true; } else{ return false; } }
template<class T> inline bool chmin(T&a , T b){ if(a>b){ a=b; return true; } else{ return false; } } 

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

vector<vector<int> > to;

int main(){
    int n,m;
    cin >> n >> m;
    to.resize(n);
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    rep(i,m){
        int u,v;
        cin >> u >> v;
        u--; v--;
        to[u].push_back(v);
        to[v].push_back(u);
    }

    ll ans=0;
    for(int i=0;i<n;i++){
        bool flag = true;
        for(auto v : to[i]){
            if(h[i]<=h[v]){
                flag = false;
                break;
            }
        }
        if(flag) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 8804