akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=j; i<=k; i++)
#define FFOR(i, j, k) for(int i=j; i<k; i++)
#define DFOR(i, j, k) for(int i=j; i>=k; i--)
#define bug(x) cerr<<#x<<" = "<<x<<'\n'
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
template <typename T> inline void read(T &x){
    char c;
    bool nega=0;
    while((!isdigit(c=getchar()))&&(c!='-'));
    if(c=='-'){
        nega=1;
        c=getchar();
    }
    x=c-48;
    while(isdigit(c=getchar())) x=x*10+c-48;
    if(nega) x=-x;
}
template <typename T> inline void writep(T x){
    if(x>9) writep(x/10);
    putchar(x%10+48);
}
template <typename T> inline void write(T x){
    if(x<0){
        putchar('-');
        x=-x;
    }
    writep(x);
}
template <typename T> inline void writeln(T x){
    write(x);
    putchar('\n');
}
#define taskname "D"
int n, m, d;
int smax;
int r[8];
ll c[201][201];
ll f[1<<8][8];
int a, b;
int main(){
    #ifdef Megumin
        if(fopen(taskname".inp", "r"))
            freopen(taskname".inp", "r", stdin);
    #endif // Megumin
    read(n);
    read(m);
    read(d);
    FFOR(i, 0, d) read(r[i]);
    FOR(i, 1, n) FOR(j, 1, n) c[i][j]=1LL<<50;
    while(m--){
        read(a);
        read(b);
        read(c[a][b]);
        c[b][a]=c[a][b];
    }
    FOR(k, 1, n) FOR(i, 1, n) FOR(j, 1, n) c[i][j]=min(c[i][k]+c[k][j], c[i][j]);
    smax=(1<<d)-1;
    FOR(i, 0, smax) FFOR(j, 0, d) f[i][j]=1LL<<50;
    FFOR(i, 0, d) f[1<<i][i]=0;
    FFOR(i, 0, smax) FFOR(j, 0, d){
        FFOR(k, 0, d) f[i|(1<<k)][k]=min(f[i|(1<<k)][k], f[i][j]+c[r[j]][r[k]]);
    }
    ll ans=1LL<<50;
    FFOR(i, 0, d) ans=min(ans, f[smax][i]);
    writeln(ans);
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string sS = Console.ReadLine().Trim();

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iFst = sS.IndexOf("A");
            int iEnd = sS.LastIndexOf("Z");
            int iLen = iEnd - iFst + 1;

            //出力
            Console.WriteLine("{0}", iLen.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


Measured memory_bytes: 14176
s = gets.chomp
if (0 < s[0..1].to_i && s[0..1].to_i < 13 ) && (0 < s[2..3].to_i && s[2..3].to_i < 13 )
  puts "AMBIGUOUS"
elsif (0 < s[0..1].to_i && s[0..1].to_i < 13 ) && (0 == s[2..3].to_i || s[2..3].to_i >= 13 )
  puts "MMYY"
elsif (0 == s[0..1].to_i || s[0..1].to_i >= 13 ) && (0 < s[2..3].to_i && s[2..3].to_i < 13 )
  puts "YYMM"
else
  puts "NA"
end

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int a , b , t;

int main()
{
    _FastIO;
    cin >> a >> b >> t;
    int ans = int(t / a) * b;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N = input()
D_list = list(map(int, input().split()))
lis = sorted(D_list)
lis_plus = lis[::2]
lis_minus = lis[1::2]
lis_plus_all = [0] + lis_plus
lis_minus_all = [0] + lis_minus

if lis_plus:
    lis_minus_all += [24 - lis_plus[-1]]
if lis_minus:
    lis_plus_all += [24 - lis_minus[-1]]

gaps_plus = [lis_plus_all[n + 1] - lis_plus_all[n] for n in range(len(lis_plus_all) - 1)] + [24]
gaps_minus = [lis_minus_all[n + 1] - lis_minus_all[n] for n in range(len(lis_minus_all) - 1)] + [24]

print(min(min(gaps_plus), min(gaps_minus)))


Measured memory_bytes: 3064
s_line = input()
s_list = list(s_line)

t_line = input()
t_list = list(t_line)

result = len(t_list)

for i in range(len(s_list) - len(t_list) + 1):
    temp = len(t_list)
    for j in range(len(t_list)):
        if(s_list[i+j] == t_list[j]):
            temp -= 1
            
    if(temp < result):
        result = temp
        
print(result)

Measured memory_bytes: 9120
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main{
	static final Scanner s=new Scanner(System.in);
	static IntStream REPS(int v){return IntStream.range(0,v);}
	static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
	static IntStream INS(int n){return REPS(n).map(i->getInt());}
	static int getInt(){return Integer.parseInt(s.next());}
	public static void main(String[]$){
		int n=getInt(),
		a[][]=REPS(n).mapToObj(i->INS(3).toArray()).toArray(int[][]::new),
		r[]=new int[n];
		REPS(3).forEach(o->{
			loop:
			for(int i=0;i<n;i++) {
				int v=a[i][o];
				for(int j=0;j<n;j++) if(j!=i){
					if(a[j][o]==v)
						continue loop;
				}
				r[i]+=v;
			}
		});
		Arrays.stream(r).forEach(System.out::println);
	}
}

Measured memory_bytes: 33172
#include <stdio.h>
int main()
{
    long long a,b,sum=0;
    scanf("%lld",&a);
    for(b=1;b<=a;b++)
    {
        if(b%3!=0&&b%5!=0)
            sum=sum+b;
    }
    printf("%lld",sum);
    return 0;
}


Measured memory_bytes: 1732
import sys

targetPrice = int(input())
cakePrice = 4
donutPrice = 7
maxDonutCount = int(targetPrice / 7)

for i in range(maxDonutCount + 1):
    targetCakePrice = targetPrice - (donutPrice * i)
    if targetCakePrice % cakePrice == 0:
        print("Yes")
        sys.exit()
print("No")


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef long double ld ;
#define F first
#define S second
#define pb push_back 
#define mp make_pair
#define vi vector <int>
#define vb vector <bool>
#define vc vector <char>
#define vll vector <ll>
#define vs vector <string>
#define pll pair < ll , ll >
#define pld pair < ld , ld >
#define pii pair < int , int >
#define vpld vector < pld >
#define vpii vector < pii >
#define vpll vector < pll >
#define vvi vector < vector < int > >
#define vvll vector < vector < ll > >
#define vvld vector < vector < ld > >
#define vvb vector < vector < bool > >
#define vvpii vector < vector < pii > >
#define all(v) (v).begin() , (v).end()
#define allrev(v) (v).rbegin() , (v).rend()
#define dist(x1 , y1 , x2 , y2) sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1))
const int MOD = 1e9 + 7 ;
const int infi = INT_MAX ;
const ll infll = LLONG_MAX ;
const int dx4[] = {0 , -1 , 0 , 1} ;
const int dy4[] = {-1 , 0 , 1 , 0} ;
const int dx8[] = {-1 , -1 , -1 , 0 , 1 , 1 , 1 , 0} ;
const int dy8[] = {-1 , 0 , 1 , 1 , 1 , 0 , -1 , -1} ;
const ld PI = 3.1415926535897932384626 ;

///////////////////////////////////////////////////////////////////////////////////////

ll pow_mod (ll a , ll b , ll m) {
	ll ans = 1 ;
	while(b) {
		if (b&1) ans = (ans*a) % m ;
		b /= 2 ;
		a = (a*a) % m ;
	}
	return ans ;
}

bool isprime (ll num) {
    for (ll i = 2 ; i * i <= num ; ++i) {
		if (num % i == 0) return false ;
	}
    return true;
}

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

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

ll cel (ll x1, ll y1) {
    if ((x1) <= 0) return (x1) / (y1) ;
	return (((x1) / (y1)) + (((x1) % (y1)) != 0)) ;
}

///////////////////////////////////////////////////////////////////////////////////////

void solve (int test_case) {
	int n , m , k ;
	cin >> n >> m >> k ;
	vector< vector <char> > g(n , vector<char> (m)) ;
	vector<int> r(n , 0) , c(m , 0) ;
	int cnt = 0 ;
	for (int i = 0 ; i < n ; ++i) {
		for (int j = 0 ; j < m ; ++j) {
			cin >> g[i][j] ;
			if (g[i][j] == '#') {
				++r[i] ;
				++c[j] ;
				++cnt ;
			}
		}
	}
	long long ways = 0 ;
	for (int maskr = 0 ; maskr < (1 << n) ; ++maskr) {
		for (int maskc = 0 ; maskc < (1 << m) ; ++maskc) {
			int sum = 0 ;
			for (int i = 0 ; i < n ; ++i) {
				if (maskr & (1 << i)) {
					sum += r[i] ;
				}
			}
			for (int j = 0 ; j < m ; ++j) {
				if (maskc & (1 << j)) {
					sum += c[j] ;
				}
			}
			for (int i = 0 ; i < n ; ++i) {
				for (int j = 0 ; j < m ; ++j) {
					if ((maskr & (1 << i)) && (maskc & (1 << j)) && g[i][j] == '#') --sum ;
				}
			}
			if (cnt - sum == k) ++ways ;
		}
	}
	cout << ways << "\n" ;
}

int main() {
	ios_base :: sync_with_stdio (false) ;
	cin.tie(0) ;
	cout.tie(0) ;
	int tc = 1 ;
	//cin >> tc ;
	while (tc--) {
		solve (tc) ;
	}
	return 0 ;
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll ZERO = 0;
const ll INF = 1e14;
const ll MOD = 1000000007;
const double PI = 3.1415926535897;

int main() {
    int M;
    cin >> M;
    cout << 48 - M << endl;
}

Measured memory_bytes: 256
Option Strict On

Module Module1
    Sub Main()
        'let'
        Dim R As Long = CLng(Console.ReadLine())

        'var'
        Dim ans As String

        Select Case R
            Case Is < 1200
                ans = "ABC"
            Case Is < 2800
                ans = "ARC"
            Case Else
                ans = "AGC"
        End Select

        Console.WriteLine(ans)

    End Sub


End Module


Measured memory_bytes: 11220
//Be Name Khoda
/*
ID: aminra81
PROG: :)))
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int MOD = (int)1e9 + 7;
const ll inf = (ll)1e18;
const int infint = (int)2e9;
const int MAXN = 1e6 + 7;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	string s;
	cin >> s;
	int del = 0, last = 0;
	for (int i = 0; i < s.size(); i++)
	{
		if(s[i] == 'S')
			last++;
		else
		{
			if(last)
			{
				del += 2;
				last--;
			}
		}
	}
	cout << s.size() - del;
}

Measured memory_bytes: 720
// Selection_Sort.cs

using System;

class Selection_Sort {
	public static void Main() {

		int count = 0;
		string num = Console.ReadLine();
		int n = int.Parse(num);

		int[] a = new int[n]; 
		string numbers_str = Console.ReadLine();
		string[] number_str = numbers_str.Split();
		for(int i = 0; i < n; i++) {
			a[i] = int.Parse(number_str[i]);
		}

		int min;
		int minn = 0;
		for(int i = 0; i < n - 1; i++) {
			min = a[i];
			for(int j = 1 + i; j < n; j++) {

				if(a[j] < min) {
					min = a[j];
					minn = j;
				}
			}
			if(a[i] != min) {
				Swap(ref count,ref a[i], ref a[minn]);
			}

		}

		for(int i = 0; i < n; i++) {
			if(i != n - 1)
			Console.Write(a[i] + " ");
			else
			Console.WriteLine(a[i]);
		}
		Console.WriteLine(count);

	}


	static void Swap(ref int count, ref int x, ref int y) {

		int comp = x;
		x = y;
		y = comp;
		count++;

		return;
	}

}

Measured memory_bytes: 9068
class GE():
    def __init__(self, A, mod):
        self.N = len(A)
        self.M = len(A[0])
        self.A = A[:]
        self.mod = mod
        self.uptri = None
        self.pivot = []
        self.R = None
    def ut(self):
        if self.uptri is not None:
            return self.uptri
        self.uptri = self.A[:]
        
        c = 0
        for i in range(self.N):
            if i + c >= self.M:
                break
            while self.uptri[i][i+c] == 0:
                for j in range(i+1, self.N):
                    if self.uptri[j][i+c]:
                        self.uptri[i], self.uptri[j] = self.uptri[j], self.uptri[i]
                        break
                else:
                    c += 1
                    if i + c == self.M:
                        return self.uptri
            self.pivot.append((i, i+c))
            t = pow(self.uptri[i][i+c], self.mod - 2, self.mod)
            for j in range(i+1, self.N):
                tj = t * self.uptri[j][i+c]
                self.uptri[j][i+c:] = [(aj - tj*ai) % self.mod for ai, aj in zip(self.uptri[i][i+c:], self.uptri[j][i+c:])]
        for pi, pj in self.pivot[::-1]:
            t = pow(self.uptri[pi][pj], self.mod-2, self.mod)
            self.uptri[pi][pj:] = [(ai * t) % self.mod for ai in self.uptri[pi][pj:]]
            for i in range(pi-1, -1, -1):
                ti = self.uptri[i][pj]
                self.uptri[i][pj:] = [(ai - api*ti) % self.mod for ai, api in zip(self.uptri[i][pj:], self.uptri[pi][pj:])]
        
        return self.uptri
    def rank(self):
        if self.R is not None:
            return self.R
        self.ut()
        self.R = len(self.pivot)
        return self.R
N, M = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]
mod = 998244353
T = GE(A, 2)
print((pow(2, N+M-1, mod) - pow(2, N+M-T.rank()-1, mod)) % mod)


Measured memory_bytes: 47324
#include <iostream>

using namespace std;

int r, D, x;

int main(void) {

	scanf("%d %d %d", &r, &D, &x);

	int xi = x;

	for ( int i = 0; i < 10; i++ ) {
		xi = r * xi - D;
		printf("%d\n", xi);
	}

}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int N = scan.nextInt();
			
			String [] S = new String[N];
			Map<String,Integer>map = new HashMap<String,Integer>();
			for(int i = 0;i<N;i++) {
				S[i] = scan.next();
				char a = S[i].charAt(0);
				
				if(a=='M'||a=='A'||a=='R'||a=='C'||a=='H') {
					if(map.containsKey(S[i].substring(0, 1))){
						map.put(S[i].substring(0, 1), map.get(S[i].substring(0, 1))+1);
						}else {
							map.put(S[i].substring(0, 1), 1);
						}
				}
			}
			
			long []shu = new long[map.size()];
			int k = 0;
			for(String key:map.keySet()) {
				shu[k] = map.get(key);
				k++;
			}
			
			long goukei = 0;
			
			if(map.size()<3) {
				System.out.println(0);
				
			}else{
				
				for(int i = 0;i<map.size()-2;i++) {
					for(int j = i+1;j<map.size()-1;j++) {
						for(int z=j+1;z<map.size();z++) {
							
							goukei+=shu[i]*shu[j]*shu[z];
							//System.out.println(shu[i]*shu[j]*shu[z]);
						}
					}
				}
				
				System.out.println(goukei);
				
			}
			
			
			
				
			
		}
		
		
	}
		

}


Measured memory_bytes: 50260
///*
#include<iostream>
using namespace std;

int main() {

	char x;

	cin >> x;

	if (x == 'a' || x == 'i' || x == 'u' || x == 'e' || x == 'o') {
		cout << "vowel";
	}
	else {
		cout << "consonant";
	}
	
	return 0;
}
//*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(int i = K; i < N; i++)
#define ll long long int
using namespace std;

int main() {
ll a, b, c;cin >> a >> b >> c;
if(c - a - b > 0 && 4*a*b < (c - a - b)*(c - a - b))cout << "Yes";
else cout << "No";
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n; i++)

#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
#define endl "\n"
#define F first
#define S second
#define PB push_back
#define MP make_pair
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef long long ll;
//=======================
const int MOD = 1'000'000'007;
const int N = 2e6 + 13;
//=======================
vi g[N];
int a[N];
//=======================

void solve()
{
  int i, k, a, b, c;
  cin >> a >> b >> c;
  cin >> k;
  fo(i, k)
  {
    if (b <= a)
    {
      b <<= 1;
    }
    else if (c <= b)
    {
      c <<= 1;
    }
  }
  if (a < b && b < c)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

int main()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int t = 1;

  // cin >> t;

  while (t--)
  {
    solve();
  }

  return 0;
}

Measured memory_bytes: 50524
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define mod 1000000007

long dp[100005];
int a[100005];

int main(void){
  int N,M,i,d1,d2;
  char str[100],*p;
  
  fgets(str,sizeof(str),stdin);
  p=strtok(str," \n");
  N=atoi(p);
  p=strtok(NULL," \n");
  M=atoi(p);
  
  dp[0]=1;
  
  for(i=0;i<M;i++){
  	fgets(str,sizeof(str),stdin);
    a[i]=atoi(str);
    dp[a[i]]=-1;
  }
  if(dp[1]==-1){
    dp[1]=0;
  }else{
    dp[1]=1;
  }
  for(i=2;i<N+1;i++){
    if(dp[i]==-1){
    }else{
      d1=dp[i-1],d2=dp[i-2];
      if(dp[i-1]==-1) d1=0;
      if(dp[i-2]==-1) d2=0;
      dp[i]=d1+d2;
      dp[i]%=mod;
    }
  }
  
  printf("%ld",dp[N]);
  
  return 0;
}

Measured memory_bytes: 1280
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
 
 
#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;
 
 
 typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
 
#define int         long long
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define mp          make_pair
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
//#define hell          1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
// mp::cpp_int
 
const int hell=998244353;
 
 int power(int a,int b)
 {
  if(b==0)return 1LL;
  if(b==1)return a;
  int t=power(a,b/2);
  t*=t;
  t%=hell;
  if(b&1)return (t*a)%hell;
  else return t;
 }
 int inverse(int a)
 {
    return power(a,hell-2);
 }
 
int pw(int a,int b)
{
  int x=a;
  rep(i,1,b){a=a*x;
    a%=10000000000LL;}
  return a;
}
 
int gcd(int a,int b)
{   
  
  if(b==0)return a;
  return gcd(b-a%b,a%b);
}
 
bool cmp(pii a,pii b)
{
  return a.SS<b.SS;
}
 
 
int solve()
{  


string s;
cin>>s;
int n=s.size();
s+='R';
 
 int l=0,r=0;
 vi a;
rep(i,0,n+1)
{
    if(s[i]=='R')
    {      if(l!=0)
        {
           a.pb(i-1);
        }
        l=0;
         r++;
    }
    else
    {
        if(r!=0)
        {
            a.pb(i-1);
        }
        r=0;
        l++;
    }
    
}

int ans[n]={0};

ans[a[0]]+=(a[0]+2)/2;
ans[a[0]+1]+=(a[0]+1)/2;
ans[a[0]+1]+=(a[1]-a[0]+1)/2;
ans[a[0]]+=(a[1]-a[0])/2;
for(int i=2;i<a.size();i+=2)
{
     ans[a[i]]+=(a[i]-a[i-1]+1)/2;
     ans[a[i]+1]+=(a[i]-a[i-1])/2;
    ans[a[i]+1]+=(a[i+1]-a[i]+1)/2;
    ans[a[i]]+=(a[i+1]-a[i])/2;

} 

rep(i,0,n)cout<<ans[i]<<" ";

return 0;
}
 
signed main()
{  int t=1;
//pri();
 ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
  
   cin.exceptions(cin.failbit);                                                                    

 
  clock_t time_req;
 
    // Without ung pow function
                                                                                                                   
 // cin>>t;
 
    int k=1;
     
   while(t--)
     {
      //cout<<"Case #"<<k<<":"<<" ";k++;
      solve();
     }
        exit(0);
 
         time_req = clock() - time_req;
    cout <<endl<< "Processor time taken is "
      << (double)time_req/CLOCKS_PER_SEC << " seconds" << endl;
 
 
    return 0;
} 

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

int main() {
  int x, y, z;
  cin >> x  >> y >> z;
  swap(x, y);
  swap(x, z);
  cout << x << " " << y << " " << z << endl;
}


Measured memory_bytes: 256
import bisect

n = int(input())
seq = []
for i in range(n):
    seq.append(int(input()))
seq.reverse()
LIS = [seq[0]]
for i in range(1,len(seq)):
    if seq[i] >= LIS[-1]:
        LIS.append(seq[i])
    else:
        LIS[bisect.bisect_right(LIS, seq[i])] = seq[i]

print(len(LIS))

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

using ll = long long;
#define repi(n) for (int i = 0; i < n; i++)
#define repj(n) for (int j = 0; j < n; j++)
#define repk(n) for (int k = 0; j < n; k++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (auto i = a; i < b; i++)
#define repv(itr) for (auto&& v : itr)
const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}

int n, a, b, c, l[10];
int cost(vector<int> vv, int t) {
  int sum = 0;
  repv(vv) sum += v;
  return abs(sum - t) + (vv.size() - 1) * 10;
}
int re(vector<int> v) {
  if ((int)v.size() < n) {
    auto v1 = v, v2 = v, v3 = v, v4 = v;
    v1.push_back(0);
    v2.push_back(1);
    v3.push_back(2);
    v4.push_back(3);
    return min(min(re(v1), re(v4)), min(re(v2), re(v3)));
  }
  vector<int> g[4];
  repi(n) g[v[i]].push_back(l[i]);
  if (g[0].size() * g[1].size() * g[2].size() == 0) return INT_MAX;
  return cost(g[0], a) + cost(g[1], b) + cost(g[2], c);
}
int main() {
  cin >> n >> a >> b >> c;
  repi(n) cin >> l[i];
  vector<int> v;
  cout << re(v) << endl;
}


Measured memory_bytes: 256
n,b,f[50001];main(a){for(;++a<50001;)if(!f[a])for(b=a;b+a<50001;)f[b+=a]=1;for(;scanf("%d",&n),n;printf("%d\n",b))for(b=0,a=1;a++<n/2;)f[a]+f[n-a]||b++;exit(0);}

Measured memory_bytes: 600
a,b,k = map(int,input().split())
L1 = list(range(a,a+k))
L2 = list(range(b-k+1,b+1))
L3 = L1 + L2
ans1 = sorted(set(L3))
if (b-a+1) <= k:
    for i in range(a,b+1):
        print(i)
else:
    for i in range(len(ans1)):
        print(ans1[i])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

ll N, M;

int main() {
    cin >> N >> M;
    if (M > N+1 || N > M+1) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = 1;
    if (N==M) ans=2;
    for (int i = 1; i<=N; i++) {
        ans*=i;
        ans%=MOD;
    }
    for (int i = 1; i<=M; i++) {
        ans*=i;
        ans%=MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

#include <functional>
#include <climits>

//SegmentTree<int> seg(N,[](int a,int b){return min(a,b);},INT_MAX);
template< typename T>
class SegmentTree{
public:

  using F = function<T(T,T)>;

  int n;
  vector<T> tree;
  const F operation;
  const T def;

  SegmentTree(int size,F _operation,T _def):operation(_operation),def(_def){
    n=1;
    while(n<size) n*=2;
    tree.resize(2*n-1,def);
  }

  void initialize(vector<T> v){
    int vSize=v.size();
    n=1;
    while(n<vSize) n*=2;
    tree.resize(2*n-1,def);

    for(int i=0;i<vSize;i++) tree[i+n-1]=v[i];
    for(int i=n-2;i>=0;i--) tree[i]=operation(tree[2*i+1],tree[2*i+2]);
  }

  void update(int index,T value){
    index+=n-1;

    tree[index]=value;
    while(index>0){
      index=(index-1)/2;
      tree[index]=operation(tree[2*index+1],tree[2*index+2]);
    }
  }

  T query(int a,int b,int k=0,int l=0,int r=-1){//[a,b),getMin(a,b,0,0,-1)
    if(r<0) r=n;

    if(r<=a||b<=l) return def;
    else if(a<=l&&r<=b) return tree[k];
    else{
      T lval=query(a,b,2*k+1,l,(l+r)/2);
      T rval=query(a,b,2*k+2,(l+r)/2,r);
      return operation(lval,rval);
    }
  }
};


int N,M;
vector<ll> A;

int main(){
  cin>>N;
  M=(1ll<<N);
  A.resize(M);
  for(int i=0;i<M;i++) cin>>A[i];
  sort(A.begin(),A.end());

  vector<ll> B=A;
  map<ll,int> mp;
  vector<int> cnt(M+1,0);
  int V=1;
  vector<ll> v;
  v.push_back(0);
  for(int i=0;i<B.size();i++){
      if(mp[B[i]]==0){
          mp[B[i]]=V;
          cnt[V]=1;
          V++;
          v.push_back(B[i]);
      }else cnt[mp[B[i]]]++;
  }
  
  SegmentTree<ll> seg(V+1,[](ll a,ll b){return max(a,b);},0ll);
  seg.initialize(v);

  vector<ll> p;
  p.push_back(V);
  for(int i=1;i<=N+1;i++){
      int m=(int)p.size();
      for(int j=0;j<m;j++){
          ll now=p[j];
          ll val=seg.query(0,p[j]);
          if(val==0){
              cout<<"No"<<endl;
              return 0;
          }
          ll tar=mp[val];
          cnt[tar]--;
          if(cnt[tar]==0) seg.update(tar,0);
          if(i==1) p[0]=tar;
          else p.push_back(tar);
      }
  }

  cout<<"Yes"<<endl;

  return 0;
}


Measured memory_bytes: 36972
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().solve(new Scanner(System.in));
	}
	
	public void solve(Scanner sc) {
		String s = sc.next();
		
		int answer = 0;
		for(int i=0; i<4; i++) {
			char symbol = s.charAt(i);
			
			if(symbol == '+') {
				answer++;
			} else {
				answer--;
			}
		}
		
		System.out.println(answer);
	}
}


Measured memory_bytes: 21716
N, A, B = map(int, input().split())
S = input()
passed = 0
foreigner = 0
for s in S:
  if s == "c":
    print("No")
  elif s == "a":
    if passed < A + B:
      print("Yes")
      passed += 1
    else:
      print("No")
  elif s == "b":
    if passed < A + B and foreigner < B:
      print("Yes")
      passed += 1
      foreigner += 1
    else:
      print("No")

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

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

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

const ll mod = 1000000007;
//const ll mod = 998244353;

const int MAX_N = 200010;
ll fact[MAX_N],fact_inv[MAX_N],inv[MAX_N];

ll pow_mod(ll a,ll b) {
    ll ret;
    if (b < 0) ret = pow_mod(a,mod+b-1);
    else if (b == 0) ret = 1;
    else if (b == 1) ret = a;
    else {
        ll c = pow_mod(a,b/2);
        if (b%2) ret = (c*c)%mod*a%mod;
        else ret = c*c%mod;
    }
    return ret;
}

void init(int x) {
    fact[0] = 1;fact[1] = 1;
    for (int i = 2;i <= x;++i) fact[i] = fact[i-1]*i%mod;
    fact_inv[x] = pow_mod(fact[x],-1);
    for (int i = x;i > 0;--i) fact_inv[i-1] = fact_inv[i]*i%mod;
    for (int i = 1;i <= x;++i) inv[i] = fact_inv[i]*fact[i-1]%mod;
}

ll combi(ll a, ll b) {
    return fact[a]*fact_inv[b]%mod*fact_inv[a-b]%mod;
}

int main() {
    init(200000);
    int n;
    cin >> n;
    vector<int> c(n);
    for (int i = 0;i < n;++i) cin >> c[i];
    sort(c.begin(),c.end());
    ll ans = 0;
    /*
    for (int i = 0;i < n;++i) {
        ll sum = 0;
        for (int j = 0;j < n-i;++j) sum += (j+1)*combi(n-i-1,j);
        cout << sum << " ";
    }*/
    for (int i = 0;i < n;++i) (ans += c[n-i-1]*pow_mod(2,n-i-1)%mod*(i+2)%mod*pow_mod(2,i-1)%mod) %= mod;
    cout << ans*pow_mod(2,n)%mod << endl;
}

Measured memory_bytes: 5760
#include <stdio.h>

int main() {
    int n,i,x,flag=0;
    scanf("%d", &n);
    for (i=0;i<n;i++){
     scanf(" %d", &x);
     if(x%2==0){
     if(x%3 && x%5)
          flag=1;
     }
     else{
      continue;   
     }
     
    }
    if (flag == 0)
    printf("APPROVED");
    else
    printf("DENIED");
    return 0;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int to_max = a - b;
  int result = c - to_max;
  if (c - to_max < 0) {
    result = 0;
  }
  cout << result << endl;
}

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

using namespace std;

void solve()
{
	string s;
	cin >> s;
	regex re(".*AC.*");
	cout << (regex_match(s, re) ? "Yes" : "No") << endl;
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


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

using namespace std;

int main(){
	long long ar[1000001];
	ar[0] = 0;
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		int cur;
		if(i % 3 == 0 || i % 5 == 0)
			cur = 0;
		else
			cur = i;
		ar[i] = ar[i - 1] + cur;
	}
	cout << ar[n];
}


Measured memory_bytes: 11380
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
	string S;
	cin>>S;
	int i=0;
	ll ans=0;
	fx(S.size()){
		if(S.at(x)=='W'){
			ans+=x-i;
			i++;
		}
	}
	ce(ans)
	
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main(){
    int D, G, p[11], c[11];
    cin >> D >> G;
    for(int i = 0; i < D; ++i){
        cin >> p[i] >> c[i];
    }
 
    int ans = 1e9;
    for(int mask = 0; mask < (1 << D); ++mask){
        int s = 0, num = 0, rest_max = -1;
        for(int i = 0; i < D; ++i){
            if(mask >> i & 1){
                s += 100 * (i+1) * p[i] + c[i];
                num += p[i];
            }else{
                rest_max = i;
            }
        }
        if(s < G){
            int s1 = 100 * (rest_max + 1);
            int need = (G - s + s1 - 1) / s1;
            if(need >= p[rest_max]){
                continue;
            }
            num += need;
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>

bool calc1(char** arr, int height, int width, int i, int j) {
  if(i < 0 || height <= i || j < 0 || width <= j)
    return false;
  if(i == height - 1 && j == width - 1) {
    if(arr[i][j] =='#')
      return true; 
    else
      return false;
  }
  if(arr[i][j] == '.') return false;
  if(calc1(arr, height, width, i + 1, j)) return true;
  if(calc1(arr, height, width, i, j + 1)) return true;
  return false;
}

int sumup(char* arr, int len) {
  int n = 0;
  for(int i = 0; i < len; i++)
    if(arr[i] == '#') n++;
  return n;
}

int main(void) {
  int h, w;
  std::cin >> h;
  std::cin >> w;
  char** arr = new char*[h];
  for(int i = 0; i < h; i++) {
    arr[i] = new char[w];
  }
  int n = 0;
  for(int i = 0; i < h; i++) {
    std::cin >> arr[i];
    n += sumup(arr[i], w);
  }
  if(n == (h + w - 1) && calc1(arr, h, w, 0, 0))
    std::cout << "Possible\n";
  else
    std::cout << "Impossible\n";
  return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
c=0
flg=False
ans=0
for i in range(1,n):
    if flg:
        if a[i-1]>=a[i]:
            c+=1
        else:
            ans=max(ans,c)
            c=0
            flg=False
    else:
        if a[i-1]>=a[i]:
            flg=True
            c=1
if flg:
    ans=max(ans,c)
print(ans)

Measured memory_bytes: 14228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 21;
char dn[dm], *di = dn, dt;
inline void putint(ll X) {
	int keta = 0;
	char C[20];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--) *di++ = (*(C + i));
	*di++ = '\n';
}

int N;
ll D[100001];
vector<pair<int, int>> E[100001];
void dfs(int A, ll B) {
	*(D + A) = B;
	for (auto p : *(E + A)) if (!(*(D + p.first))) dfs(p.first, B + p.second);
}

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


	int N = getint();
	rep(i, N - 1) {
		int a = getint();
		int b = getint();
		int c = getint();
		(*(E + a)).pb(mp(b, c));
		(*(E + b)).pb(mp(a, c));
	}
	int Q = getint();
	int K = getint();
	dfs(K, 1);
	rep(i, Q) {
		int x = getint();
		int y = getint();
		putint(*(D + x) + *(D + y) - 2);
	}

	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 12928
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define float long double
#define all(c) (c).begin(), (c).end()
#define endl '\n'
#define pi 3.14159265358979323846

ll pow(ll a,ll p,ll m=mod)
{ll res=1;while(p>0){if(p&1)res=(res*a)%m;a=(a*a)%m;p>>=1;}
return res;}


int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
 //    int t;
 //     cin >> t;

 //     while(t--){

 // }

     int n,k;
     cin >> n >> k;
     int arr[n];
     fo(i,0,n)cin >> arr[i];
     fo(i,0,n)arr[i]--;

     int j = 0;
     int i = 0;
     while(j < min(k,n)){
     	i = arr[i];
     	j++;
     }
     if(j == k)cout << i+1 << endl;
     else{
     	k = max(k-n,0ll);
     	set<int>s;
     	int count = 0;
     	while(1){
     		if(s.count(i))break;
     		s.insert(i);
     		i = arr[i];
     		count++;
     	}
     	k = k%count;
     	while(k> 0){
     		i = arr[i];
     		k--;
     	}
     	cout << i+1 << endl;

     } 



return 0;
	
	}




Measured memory_bytes: 10916
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();


int main() {
    int n;
    cin >> n;
    vector<vector<ll>> cnt(10, vector<ll>(10, 0));
    for(int i = 1; i <= n; i++) {
        int head = to_string(i)[0]-'0';
        int tail = i % 10;
        cnt[head][tail] += 1;
    }
    ll ans = 0;
    for(int i = 1; i <= 9; i++) {
        for(int j = 1; j <= 9; j++) {
            ans += cnt[i][j] * cnt[j][i];
        }
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 256
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));
		String line = "";

		boolean[] primes = new boolean[50001];
		Arrays.fill(primes, true);

		primes[0] = false;
		primes[1] = false;
		for (int i = 2; i < 50001; i++) {
			if (primes[i]) {
				for (int j = 2;; j++) {
					if (i * j > 50000) {
						break;
					}
					primes[i * j] = false;
				}
			}
		}

		while (!(line = br.readLine()).equals("0")) {

			int n = Integer.parseInt(line);
			int c = 0;

			for (int i = 2; i <= n / 2; i++) {
				if (primes[i] && primes[n - i]) {
					c++;
				}
			}
			System.out.println(c);
		}

	}

}

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

using namespace std;

int main(int argc, char const *argv[]) {
  string s;
  cin >> s;
  stack<char>st;
  for(auto x: s){
    if(x == '1' || x == '0'){
      st.push(x);
    }else{
      if(!st.empty()){
        st.pop();
      }
    }
  }
  int sz = st.size();
  string ans = "";
  while(sz--){
    char k = st.top();
    st.pop();
    ans+=k;
  }
  for(int i = ans.length()-1;i>=0;i--){
    cout << ans[i];
  }cout << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    string S;
    cin >> S;
    int N = S.size();
    rep(i, N) {
        if ((i + 1) % 2 == 0) {
            if (S[i] == 'R') {
                cout << "No" << endl;
                return 0;
            }
        }
        else {
            if (S[i] == 'L') {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main(){
    int n;
    cin>>n;
    vector<ll> v(n*3);
    for(int i=0; i<3*n; ++i){
        cin>>v[i];
    }
    vector<ll> lsum(n*3, 0);
    ll sum=0;
    multiset<ll> st;

    for(int i=0; i<3*n; ++i){
        st.insert(v[i]);
        sum+=v[i];
        if(st.size()>n){
            auto it=st.begin();
            sum-=*it;
            st.erase(it);
        }
        if(st.size()==n){
            lsum[i]=sum;
        }
    }

    st.clear();
    sum=0;

    vector<ll> rsum(n*3, 0);
    for(int i=3*n-1; i>=0; --i){
        st.insert(v[i]);
        sum+=v[i];
        if(st.size()>n){
            auto it=st.end();
            --it;
            sum-=*it;
            st.erase(it);
        }
        if(st.size()==n){
            rsum[i]=sum;
        }
    }
    ll ans=LLONG_MIN;
    for(int i=n-1; i<2*n; ++i){
        ans=max(ans, lsum[i]-rsum[i+1]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 12020
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  
  vector<int>A(N);
  vector<int>B(N);
  for (int i = 0; i < N; i++){
    A.at(i) = i+1;
    
    while(A.at(i) < K){
      A.at(i) *= 2;
      B.at(i)++;
    }
  }
  vector<double>C(N);
  for(int i = 0; i < N; i++) {
    C.at(i) = pow(0.5,B.at(i));
  }
  double ans = 0;
  for (int i = 0; i < N; i++){
    ans += C.at(i);
  }
  ans = ans / N;
  cout << fixed << setprecision(9) << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#=
B:
- Julia version: 0.5.2
- Author: abap
- Date: 2019-12-29
=#
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

K,X = parseMap(split(readline()))

for i in X-(K-1):X+(K-1)
	print("$i ")
end

println("")

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

bonus = 0
for i in range(n-1):
    if a[i]+1 == a[i+1]:
        bonus += c[a[i]-1]
print(sum(b)+bonus)

Measured memory_bytes: 3064
#include<iostream>
#include <math.h>       /* sin */
using namespace std;


int main() {
	
	int k;
	cin>>k;
	string x;
	cin>>x;

	if(x.length() > k) {
		x = x.substr(0, k);
		x = x + "...";
	}
	cout<<x<<endl;

}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
  int x,y;
  std::vector<std::pair<int, int> > list;
  while(1) {
    std::cin >> x >> y;
    if(x == 0 && y == 0) break;
    if(x > y) list.push_back(std::make_pair(y, x));
    else if(x < y) list.push_back(std::make_pair(x, y));
    else if(x == y) list.push_back(std::make_pair(x, y));
  }
  for(auto e : list) std::cout << e.first << " " << e.second << std::endl;
  return 0;
}



Measured memory_bytes: 3168
n = int(input())
d = {}
for i in range(n):
	c, s = input().split()
	if c not in d:
		d[c] = []
	d[c].append((int(s), i))
for c in sorted(d.keys()):
	for s, i in sorted(d[c], reverse=True):
		print(i + 1)

Measured memory_bytes: 3060
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
int N, ans = 1; ll A[100001], S[100001];
int main() {
  scanf("%d", &N);
  for(int i = 1; i <= N; ++i) scanf("%ld", &A[i]);
  sort(A+1, A+N+1);
  for(int i = 1; i <= N; ++i) S[i] += S[i-1]+A[i];
  for(int i = N-1; i > 0; --i) {
    if(2*S[i] >= A[i+1]) ++ans;
    else break;
  }
  printf("%d\n", ans);
}

Measured memory_bytes: 1792
N,K = map(int,input().split())
S = input()

h = 0
lr = 0
rl = 0
for i in range(1,N):
  if S[i-1] == S[i] :
    h += 1
  elif S[i-1] == 'L' and S[i] == 'R':
    lr += 1
  else:
    rl += 1
#print(h,lr,rl)

while (K>0 and (lr>0 or rl>0)):
  if lr > 0:
    lr -= 1
    h += 1
  if rl > 0:
    rl -= 1
    h += 1
  K -= 1
print(h)

Measured memory_bytes: 39792
//#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;

#define boost ios::sync_with_stdio(0); cin.tie(0)

#define fi first
#define se second

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

const int N = 5000 + 5;
const int MOD = 1e9 + 7;

/***************************************************************************/

vector<int> adj[N];
ll dp[N][N][2];
ll temp[N][2];
int sz[N];
ll fact[N];

void dfs(int v, int p) {
	sz[v] = 1;

	int tt = 1;
	dp[v][1][0] = 1;

	for(auto it : adj[v]) {
		if(it == p) continue;
		dfs(it, v); sz[v] += sz[it];

		for(int i=1; i<=tt; i++) {
			for(int j=1; j<=sz[it]; j++) {

				temp[i][0] = (temp[i][0] + ((dp[v][i][0] * dp[it][j][1]) % MOD) * fact[j]) % MOD;
				temp[i][0] = (temp[i][0] + ((dp[v][i][1] * dp[it][j][0]) % MOD) * fact[j]) % MOD;
				temp[i][1] = (temp[i][1] + ((dp[v][i][0] * dp[it][j][0]) % MOD) * fact[j]) % MOD;
				temp[i][1] = (temp[i][1] + ((dp[v][i][1] * dp[it][j][1]) % MOD) * fact[j]) % MOD;

				temp[i+j][0] = (temp[i+j][0] + dp[v][i][0] * dp[it][j][0]) % MOD;
				temp[i+j][0] = (temp[i+j][0] + dp[v][i][1] * dp[it][j][1]) % MOD;
				temp[i+j][1] = (temp[i+j][1] + dp[v][i][0] * dp[it][j][1]) % MOD;
				temp[i+j][1] = (temp[i+j][1] + dp[v][i][1] * dp[it][j][0]) % MOD;
			}
		}
		tt += sz[it];
		for(int i=1; i<=tt; i++) {
			dp[v][i][0] = temp[i][0]; temp[i][0] = 0;
			dp[v][i][1] = temp[i][1]; temp[i][1] = 0;
		}
	}
}

int main() {

	boost;

	fact[0] = 1;
	for(int i=2; i<N; i+=2) {
		fact[i] = ((i-1) * fact[i-2]) % MOD;
	}

	int n; cin>>n;
	for(int i=1; i<n; i++) {
		int a, b; cin>>a>>b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	dfs(1, 0);

	ll ans = 0;
	for(int i=1; i<=n; i++) {
		ans = (ans + dp[1][i][0] * fact[i]) % MOD;
		ans = (ans - dp[1][i][1] * fact[i]) % MOD;
		if(ans < 0) ans += MOD;
	}
	cout<<ans<<"\n";

	return 0;
}

Measured memory_bytes: 391296
#include "bits/stdc++.h"

using namespace std;
//vector<long long> factors;
#define ll long long

#define pii pair<int,int>
#define pll pair<ll,ll>
#define _ <<'\n'
#define __ << ' '
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
int IT_MAX = 1 << 17;
int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x0f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
#define szz(x) (int)(x).size()
#define IOS ios_base::sync_with_stdio(false); cout.tie(0);cin.tie(0);
#define flush fflush(stdout)

ll mod(ll a, ll m) { return (a + (abs(a) / m) * m + m) % m; }


int main() {
    IOS

    ll n, m;
    cin >> n >> m;
    string st;
    cin >> st;
    vector<pll > dp(202020, {-1, LL_INF});

    dp[0] = {-1, 0};

    for (int i = 0; i <= n; ++i) {
        if (st[i] == '0') {
            for (int j = min<ll>(i + m, st.size() - 1); j > i; --j) {
                if (st[j] == '0') {
                    if (dp[j].first != -1)
                        break;
                    dp[j].first = i;
                    dp[j].second = dp[i].second + 1;
                }
            }
        }
    }

    vector<ll> ans;
    if (dp[n].second >= LL_INF) {
        cout << -1;
        return 0;
    } else {
        ll cur = n;
        while (cur != 0) {
            ans.push_back(cur - dp[cur].first);
            cur = dp[cur].first;
        }
        reverse(all(ans));
        for (auto i : ans) {
            cout << i << ' ';
        }
    }

    return 0;
}

Measured memory_bytes: 4680
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << '\n';
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

//------------------------- Libraries -------------------------//

long long gcd(long long a, long long b){
    if (a < b) swap(a, b);
    return b ? gcd(b, a % b) : a;
}

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

//--------------------------- Solve ---------------------------//

void solve() {
    long long a, b; cin >> a >> b;
    cout << lcm(a, b) << '\n';
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3572