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

// 22:58-23:05
int main(void){
    int d = 0, n = 0; 
    int ans = 0;

    scanf("%d%d", &d, &n);

    if(n == 100){
        if(d == 0){
            ans = 101;
        }else{
            ans = ans = pow(100, d) * (n+1);
        }
    }else{
        if(d == 0){
            ans = n;
        }else{ 
            ans = pow(100, d) * n;
        }
    }

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

    return 0;

} 


Measured memory_bytes: 384
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-03-15 09:47:30
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

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

  int n, p; cin >> n >> p;
  string s; cin >> s;
  map<int, int> mp;

  int64 ans = 0;

  mp[0] = 1;

  int t = 0;
  int cur = 1;

  auto ModTen = [&](int x) -> int {
    return (x * 10) % p;
  };

  if (p == 2) {
    for (int i = 0; i < n; ++i) {
      if (s[i] == '0' || s[i] == '2' || s[i] == '4' || s[i] == '6' || s[i] == '8') {
        ans += (1 + i);
      }
    }

  } else if (p == 5){
    for (int i = 0; i < n; ++i) {
      if (s[i] == '0' || s[i] == '5') {
        ans += (1 + i);
      }
    }
  } else {
    for (int i = n - 1; i >= 0; --i) {
      int d = s[i] - '0';
      t = (d * cur + t) % p;
      ans += mp[t];
      ++mp[t];
      cur = ModTen(cur);
    }
  }

  cout << ans << endl;

  return 0;
}

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

using namespace std;
int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	string s;
	cin >> s;
	
	int ans = 0;
	char prev = ' ';
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != prev) {
			ans++;
		}
		prev = s[i];
	}
	
	cout << ans << endl;
}

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

int main() {
    int n;
    cin >> n;
    if ( n <= 999 ) cout << "ABC" << endl;
    else cout << "ABD" << endl;
    return 0;
}

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

int n, x, sum;

int hantei(int p) {
	int v = max((int)sqrt(p) * 5, p);
	for (int i = 1; i <= sqrt(p); i++) {
		int a = p - i;
		if (a % (2 * i + 1) == 0 && a >= 1) {
			return 0;
		}
	}
	return 1;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x;
		sum += hantei(x);
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
#define MOD (ll) (1e9+7)
int main()
{
    ll n;
    cin>>n;
    ll ar[n];
    for(int i=0;i<n;i++)
    {
    	cin>>ar[i];
    }
    ll amt = 1000;
    ll stock;
    ll j =0;
    for(ll i=0;i<n-1;i++)
    {
    	if(ar[i]<=ar[i+1])
    	{
    		continue;
    	}
    	else{
    		stock = amt/ar[j];
    		amt = amt-(stock*ar[j]) + (stock*ar[i]);
    		j = i+1;
    	}
    }
    if(j!=n-1)
    {
    	stock = amt/ar[j];
    	amt = amt-(stock*ar[j])+(stock*ar[n-1]);
    }
    cout<<amt<<"\n";
}

Measured memory_bytes: 3604
#include<stdio.h>

int main(){
	int i;
	char str[15];
	int am;
	int pm;
	int amm;
	int pmm;
	for(i = 0; i < 9; i++){
		scanf("%s", str);
		scanf("%d", &am);
		scanf("%d", &pm);
		amm = am * 200;
		pmm = pm * 300;
		printf("%s %d %d\n", str, am + pm, am * 200 + pm * 300);
	}
	return 0;

}

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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long

const int N = 200009, inf = 1000000000000000000;
int n, a[N];
int dp[N][6];

int32_t main() {

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

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

    for(int i = 0; i <= n; ++i) {
        for(int j = 0; j < 6; ++j) {
            dp[i][j] = -inf;
        }
    }
    dp[0][0] = 0;

    for(int i = 0; i < n; ++i) {
        int cur = a[i];
        dp[i+1][0] = dp[i][1];
        dp[i+1][1] = dp[i][0] + cur;
        dp[i+1][2] = max(dp[i][3], dp[i][0]);
        dp[i+1][3] = dp[i][2] + cur;
        dp[i+1][4] = max(dp[i][5], dp[i][2]);
        dp[i+1][5] = dp[i][4] + cur;
    }

    if(n%2) {
        vector<int> cands = {dp[n][2], dp[n][3], dp[n][4], dp[n][5]};
        cout << *max_element(cands.begin(), cands.end()) << '\n';
    } else {
        vector<int> cands = {dp[n][0], dp[n][1], dp[n][2], dp[n][3]};
        cout << *max_element(cands.begin(), cands.end()) << '\n';
    }
    
    return 0;
}


Measured memory_bytes: 14580
#include <bits/stdc++.h>
using namespace std;
 
#define int long long

int H, W;
int dp[301][301];
vector<string> c;
int cost[301][301];

int dfs(int a, int b) {
  if ( a == -1 || b == -1 ) return 0;
  if ( dp[a][b] >= 0 ) return dp[a][b];

  int ret = min(dfs(a-1, b), dfs(a, b-1))+cost[a][b];

  return dp[a][b] = ret;  
}

int solve(int a, int b) {
  fill_n(*cost, 301*301, 0);
  fill_n(*dp, 301*301, -1);
  for ( int i = 0; i < H; i++ ) {
    for ( int j = 0; j < H; j++ ) {
      if ( j+i >= H ) break;      
      if ( j ) cost[j][j+i] += cost[j-1][j+i-1];
      if ( c[a][j] == c[b][j+i] ) cost[j][j+i]++;
    }
  }

  for ( int i = 1; i < H; i++ ) {  
    for ( int j = 0; j < H; j++ ) {
      if ( j+i >= H ) break;      
      if ( j ) cost[j+i][j] += cost[j+i-1][j-1];
      if ( c[a][j+i] == c[b][j] ) cost[j+i][j]++;
    }
  }

  int ret = dfs(H-1, H-1);
  // cout << ret << endl;
  return dfs(H-1, H-1);
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  cin >> H >> W;
  c.resize(W);
  for ( int i = 0; i < W; i++ ) c[i].resize(H);
  
  for ( int i = 0; i < H; i++ ) {
    for ( int j = 0; j < W; j++ ) cin >> c[j][i];
  }

  // for ( int i = 0; i < W; i++ ) cout << c[i] << endl;

  int ans = 0;
  for ( int i = 0; i < W-1; i++ ) {
    ans += solve(i, i+1);    
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main() {
    int n, m;
    cin >> n >> m;
    vector<pii> ab(m);
    for(int i = 0; i < m; i++){
        int a,b;
        cin >> a >> b;
        ab[i] = {a,b};
    }
    sort(ab.begin(),ab.end());
    int cmax = ab[0].second-1;
    int ans = 0;
    for(int i = 1; i < m; i++){
        if(ab[i].first > cmax){
            ans++;
            cmax = ab[i].second-1;
        }
        cmax = min(cmax, ab[i].second-1);
    }
    cout << ans+1 << endl;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
using namespace std;
const int maxn=2e5+5;
int ls;
int nxt[26][maxn],pre[maxn],f[maxn];
char s[maxn],ch[maxn];
int main()
{
	scanf("%s",s+1);
	ls=strlen(s+1);
	for (int i=0;i<26;i++)
	{
	  int j=ls+1,p=ls;
	  while (j>=1)
	  {
	  	while (p>=1&&s[p]-'a'!=i)p--;
	  	while (j>=p+1)nxt[i][j]=p,j--;
	  	p--;
	  }
	}
	memset(f,0x3f,sizeof(f));
	f[ls+1]=0;
	for (int i=ls+1;i>=1;i--){
		for (int j=0;j<26;j++){
			if (f[i]+1<f[nxt[j][i]]){
				f[nxt[j][i]]=f[i]+1;
				pre[nxt[j][i]]=i;
				ch[nxt[j][i]]='a'+j;
			}else{
				if (f[i]+1==f[nxt[j][i]])if (j<ch[nxt[j][i]]-'a'){
					pre[nxt[j][i]]=i;
					ch[nxt[j][i]]='a'+j;
				}else if (s[i]<s[pre[nxt[j][i]]]){
				  pre[nxt[j][i]]=i;
				  ch[nxt[j][i]]='a'+j;
				}
			}
		}
	}
	int p=0;
	printf("%c",ch[0]);
	while (pre[p]!=ls+1)putchar(s[pre[p]]),p=pre[p];
	return 0;
}

Measured memory_bytes: 22400
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define G(n,m) ((LL)fac[(n)+(m)]*ifac[n]%mo*ifac[m]%mo)

const int maxn=8010;
const int base=2010;
const int mo=1e9+7;

int n,m,f[maxn],Ans,fac[maxn],ifac[maxn];

struct Point{
	int x,y;
	Point() {}
	Point(int x,int y):x(x),y(y) {}
	bool operator < (const Point &p) const {return x==p.x?y<p.y:x<p.x;}
}P[400010];

int power(int x,int k)
{
	int res=1;
	while (k)
	{
		if (k&1) res=(LL)res*x%mo;
		x=(LL)x*x%mo;
		k>>=1;
	}
	return res;
}

int main()
{
#ifdef h10
	freopen("E.in","r",stdin);
	freopen("E.out","w",stdout);
#endif
	int i,j;
	fac[0]=1;
	for (i=1;i<=8000;i++)
		fac[i]=(LL)fac[i-1]*i%mo;
	ifac[8000]=power(fac[8000],mo-2);
	for (i=8000;i>=1;i--)
		ifac[i-1]=(LL)ifac[i]*i%mo;
	scanf("%d",&n);
	for (i=1;i<=n;i++)
		scanf("%d%d",&P[i].x,&P[i].y);
	for (i=1;i<=n;i++)
		P[n+i]=Point(-P[i].x,-P[i].y);
	sort(P+1,P+n+n+1);
	int p=1;
	for (i=-2000;i<=2000;i++)
	{
		if (i<0)
			for (;P[p].x==i;p++)
				(f[P[p].y+base]+=1)%=mo;
		for (j=-2000;j<=2000;j++)
			(f[j+base]+=f[j-1+base])%=mo;
		if (i>0)
			for (;P[p].x==i;p++)
				(Ans+=f[P[p].y+base])%=mo;
	}
	for (i=1;i<=n+n;i++)
		if (P[i].x>0) (Ans+=mo-G(2*P[i].x,2*P[i].y))%=mo;
	Ans=(LL)Ans*power(2,mo-2)%mo;
	printf("%d\n",Ans);
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define lli long long int
#define MAX(A,B) ((A)>(B)?(A):(B))
#define MIN(A,B) ((A)<(B)?(A):(B))
#define gcd(A,B) __gcd(A,B)
#define lcm(A,B) A/(__gcd(A,B))*B
#define MP make_pair
#define PB push_back
#define EPS 1e-9
#define ld long double
#define modulo 998244353
#define usecppio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

typedef pair<int,int> pii;
typedef pair<int,string> pis;
typedef pair<int,double> pid;

int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    printf("%d",b%a?b-a:b+a);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
 
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
typedef long long ll;

using edge = pair<int, long long>;
using Graph = vector<vector<edge>>;
Graph G;
int N;
int x[100010], y[100010];
int K;
vector<long long> dir;
int dfs(int v, int p, long long c)
{
    dir[v] = c;
    for (auto np : G[v])
    {
        if(np.first == p)
        {
            continue;
        }
        dfs(np.first,v,c+np.second);
    }

}

int main()

{
    cin >> N;
    G.assign(N, vector<edge>());
    for (int i = 0; i < N-1; i++)
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        G[a].push_back(edge(b, c));
        G[b].push_back(edge(a, c));
    }
    int Q;
    cin >> Q >> K;
    K--;
    for (int i = 0; i < Q; i++)
    {
        cin >> x[i] >> y[i];
        x[i]--,y[i]--;
    }
    dir.assign(N, 0);
    dfs(K, -1, 0);
    for (int i = 0; i < Q; i++)
    {
        cout << dir[x[i]] + dir[y[i]] << endl;
    }


    return 0;
}

Measured memory_bytes: 15104
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

long long dp[1100000][2];

int main() {
	string s; cin >> s;
	int n = s.size();
	for (int i = 0; i <= n; ++i) dp[i][0] = dp[i][1] = 1e18;
	dp[0][0] = 0;
	for (int i = 0; i < n; ++i) {
		int d = s[i] - '0';
		for (int j = 0; j < 2; ++j) {
			dp[i + 1][0] = min(dp[i + 1][0], dp[i][j] + d);
			dp[i + 1][1] = min(dp[i + 1][1], dp[i][j] + (j ? 0 : 1) + 10 - d - j);
		}
	}
	cout << min(dp[n][0], dp[n][1]) << endl;

	return 0;
}

Measured memory_bytes: 17668
import os
import math

def main():
	n,m = map(int, input().split())
	a_list = list(map(int, input().split()))
	total_check = math.ceil(sum(a_list)/(4*m))
	
	a_list.sort(reverse=True)
	flag = True
	for i in range(m):
		if a_list[i] < total_check:
			flag = False
			break
	if flag:
		print("Yes")
	else:
		print("No")


if __name__ == "__main__":
	main()


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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

// #define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}
void _main();
int main(){ cin.tie(0); ios::sync_with_stdio(false); _main(); return 0;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<29;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<59; 

void _main(){
  int N; cin >> N ;
  vl p(N);
  rep(i,N) cin >> p[i] ;
  sort(ALL(p));
  ll s = 0;
  rep(i,N) s+=p[i];
  cout << s-p[N-1]/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
int n,a[1000],b=0;
cin>>n;
for(int i=0;i<n;i++){
  cin>>a[i];
  if(a[i]%2==1&&(i+1)%2==1){
    b+=1;
  }
}
cout<<b;
}

Measured memory_bytes: 3500
N = int(input())
x = 0

for i in range(1,N+1):

    if i%3 == 0:
            print(" %d"%i,end = "");
    else:
        x = i
        while (x):
            if x%10 == 3:
                print(" %d"%i,end = "")
                break
            x //= 10
print()



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

int main() {
  int N,x;
  cin >> N;
  
  x=0;
  
  for (int i=0; i<N ; i++){
    int li,ri;
    cin >> li >> ri; 
    
    x+=ri-li+1;
  }
  cout << x <<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))
#define PRECISION(x) std::fixed << std::setprecision(x)

using namespace std;

using ll = long long;
using VI = std::vector<int>;
using VI2D = std::vector<vector<int>>;
using VLL = std::vector<long long>;
using VLL2D = std::vector<vector<long long>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

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

template <typename T, std::size_t N>
struct make_vector_type {
	using type =
		typename std::vector<typename make_vector_type<T, (N - 1)>::type>;
};

template <typename T>
struct make_vector_type<T, 0> {
	using type = typename std::vector<T>;
};

template <typename T, size_t N>
auto make_vector_impl(const std::vector<std::size_t>& ls, T init_value) {
	if constexpr(N == 0) {
		return std::vector<T>(ls[N], init_value);
	} else {
		return typename make_vector_type<T, N>::type(
			ls[N], make_vector_impl<T, (N - 1)>(ls, init_value));
	}
}

template <typename T, std::size_t N>
auto make_vector(const std::size_t (&ls)[N], T init_value) {
	std::vector<std::size_t> dimensions(N);
	for(int i = 0; i < N; i++) {
		dimensions[N - i - 1] = ls[i];
	}
	return make_vector_impl<T, N - 1>(dimensions, init_value);
}

template <typename T>
std::vector<T> make_vector(std::size_t size, T init_value) {
	return std::vector<T>(size, init_value);
}

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max<T>(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min<T>(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

int main() {
	int n, a;
	cin >> n >> a;
	VI x(n);
	REP(i, n) { cin >> x[i]; }

	int max_x_sum = 50 * n;
	auto dp = make_vector({n + 1, max_x_sum + 1, n + 1}, 0LL);
	REP(i, n + 1) { dp[i][0][0] = 1; }
	REP(i, n) {
		REP(j, max_x_sum + 1) {
			REP(k, i + 1) {
				if(j - x[i] >= 0) {
					dp[i + 1][j][k + 1] = dp[i][j - x[i]][k] + dp[i][j][k + 1];
				} else {
					dp[i + 1][j][k + 1] = dp[i][j][k + 1];
				}
			}
		}
	}

	ll result = 0;
	for(int i = 0; i <= n; i++) {
		result += dp[n][i * a][i];
	}
	result--;
	cout << result << endl;
	return 0;
}


Measured memory_bytes: 59208
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc =new Scanner(System.in);
        int n,m;
        n=sc.nextInt();
        int []x =new int [n];
        for(int j=0;j<x.length;j++){
			x[j]=j+1;
        }
        m=sc.nextInt();

        for(int i=0;i<m;i++){
            String h =sc.next();
            String []s = h.split(",");
            int a =Integer.parseInt(s[0])-1;
            int b =Integer.parseInt(s[1])-1;
            int p;
            p=x[a];
            x[a]=x[b];
            x[b]=p;

        }

        for(int k=0;k<n;k++){
        System.out.println(x[k]);
    }
}
}



Measured memory_bytes: 25736
x,n=map(int,input().split())
if n==0:
  print(x)
  exit()
p=list(map(int,input().split()))
for i in range(102):
  if x-i not in p:
    print(x-i)
    break
  if x+i not in p:
    print(x+i)
    break

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

int main() {
  int n;
  int a = 0;    // R->Wの数
  int b = 0;    // W->Rの数
  int n_change; // 交換する回数
  std::string s;
  
  std::cin >> n >> s;


  for (int i = 0; i < n; i++)
    if (s[i] == 'R') a++; // 赤の数でaを初期化(交換回数は赤の数)

  // 境界を一番左においた時の交換回数
  n_change = std::max(a, b);

  // はじめの完成形はすべて白. 境界を左から右に移動させ左から赤色していく
  for (int i = 0; i < n; i++) {
    if (s[i] == 'R') a--; // a(R->W)が一つ減る
    else b++;             // b(W->R)が増える

    // 最小の交換回数を更新
    int now = std::max(a, b);
    n_change = std::min(now, n_change);
  }

  std::cout << n_change << std::endl;
 
  return 0;
}

Measured memory_bytes: 3756
//実装が重そうな問題はある程度考えてから書く
//初期化を忘れずに（特に二分探索とか）
//コーナーケースを考えて（特に場合分けとか）
#include <bits/stdc++.h>
#define YES "YES"
#define NO "NO"
#define YESNO OUT(three(solve(),YES,NO))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(a);i>=(LL)(b);i--)
#define REP(i,b) FOR(i,zero,b)
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,b,zero)
#define ALL(c) c.begin(),c.end()
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define int LL
#define zero 0LL
using namespace std;
template<typename T> inline void maximize(T &a,T b){a=max(a,b);}
template<typename T> inline void minimize(T &a,T b){a=min(a,b);}
template<typename T> inline bool middle(T a,T b,T c){return b<=a && a<=c;}
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
inline void outputVI(VI x){REP(i,SI(x)){cout << three(i," ","") << x[i];}OUT("");}
const int SIZE1=1e6+1000;
const int SIZE2=5010;
const int SIZE3=400;
const int SIZE=SIZE1;
const LL p=7+1e9;
const LL INF=1LL<<60;
const long double EPS=1e-7;
string s;
ut N,M,K,X,L,Y;
// ut A,B,C,D,E,F,G,H,I,J,O,P,Q,R,T,U;
VI edges[SIZE];
LL vals[SIZE],nums[SIZE],maps[SIZE2][SIZE2],answer=zero;
 
////////////////////////////////////////////////////////////////////////////////////////////
 
////////////////////////////////////////////////////////////////////////////////////////////
void init(){
 	
}
LL solve(){
	cin >> N;
	VI v(N);
	REP(i,N){
		cin >> v[i];
	}
	sort(ALL(v));
	v.erase(unique(ALL(v)),v.end());
	OUT(SI(v));
	return 0;
}
signed main(){
	solve();
	return 0;
}

Measured memory_bytes: 24448
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 600000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000 大きいとワ―シャルフロイドでオーバーフローを起こす
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

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

long long int gcd(long long int a, long long int b) { //最大公約数
	if (b == 0) {
		return a;
	}
	return gcd(b, a%b);
}

long long int lcm(long long int a, long long int b) { //最小公倍数
	long long int g = gcd(a, b);
	return a / g * b;
}


int main(void) {
	
	long long int n, k;

	long long int m;
	long long int first, second;

	cin >> n >> k;

	if (k > (n - 2)*(n - 1) / 2) {
		cout << "-1" << endl;
	}
	else {
		m = ((n - 2)*(n - 1) / 2) + n - k - 1;
		cout << m << endl;
		first = 2;
		second = 3;
		FOR(i, 1, m) {
			if (i <= n - 1) {
				cout << 1 << " " << i + 1 << endl;
			}
			else {
				cout << first << " " << second << endl;
				if (second <= n-1) {
					second++;
				}
				else {
					first++;
					second = first + 1;
				}
			}
		}
	}

	return 0;
}

Measured memory_bytes: 256
fun main(args:Array<String>):Unit{
    val n = readLine()!!.toInt()
    val nums = Array(n){i -> Pair(i, readLine()!!.toInt())}.sortedBy(Pair<Int, Int>::second).toTypedArray()
    var left = 0
    var right = 0
    var max = 0
    while (right + 1 < n){
        if (nums[right].first < nums[right + 1].first){
            ++right
        }else{
            if (max < (right - left + 1)){
                max = (right - left + 1)
            }
            left = ++right
        }
    }
    if (max < (right - left + 1))
        max = (right - left + 1)
    println(n - max)
}

Measured memory_bytes: 59976
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <queue>
#include <sstream>
#include <unordered_map>
#include <cstring>
#include <iomanip>

using namespace std;

typedef long long ll;

const ll INF=1e9+7;

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

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

int main(){
    int W,H,x,y;
    cin>>W>>H>>x>>y;
    double area=double(W)*double(H)/2;
    int check=0;
    if(2*x==W&&2*y==H) check=1;
    cout<<setprecision(50)<<area<<endl<<check<<endl;
    return 0;
}

Measured memory_bytes: 256
# セグメント木
# segment tree
import sys
input = sys.stdin.readline

class segmented_tree:
    X_unit = 0
    X_f = lambda self, a, b: max(a,b)
    def __init__(self, N):
        self.N = N
        self.X = [self.X_unit] * (2*N)
        
    def build(self, seq):
        for i, x in enumerate(seq, self.N):
            self.X[i] = x 
        # 後ろから入れていく
        for i in range(self.N-1, 0, -1):
            self.X[i] = self.X_f(self.X[i<<1], self.X[i<<1|1])

    # 1点更新
    def set_val(self, i, x):
        i += self.N
        self.X[i] = x
        while i > 1:
            i >>= 1
            self.X[i] = self.X_f(self.X[i<<1],self.X[i<<1|1])
    
    # 区間取得
    def fold(self, l, r):
        l += self.N
        r += self.N
        vl = self.X_unit
        vr = self.X_unit
        # 外から決めていく
        while l < r:
            # print(l,r)
            if l & 1:
                vl = self.X_f(vl, self.X[l])
                l += 1
            if r & 1:
                r -= 1
                vr = self.X_f(vr, self.X[r])
            l >>= 1
            r >>= 1
        return self.X_f(vl,vr)

n,k = map(int, input().split())
As = [int(input()) for i in range(n)]

ans = 0
sg = segmented_tree(330000)

for a in As:
    l = max(0,a-k)
    r = min(300000,a+k)

    upd = sg.fold(l,r+1)
    ans = max(ans, upd+1)

    sg.set_val(a, upd+1)
print(ans)



Measured memory_bytes: 118492
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        double dis = sc.nextDouble();
      double time = sc.nextDouble();
      double speed = sc.nextDouble();
      
      double t = dis / speed;
      if(t <= time){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
        
    }
}


Measured memory_bytes: 37272
// B - Multiplication 2
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
	int n; cin>>n;
	vector<ll> A(n), B[n];
	long double count_log = 0.0;
	rep(i, n){
		cin>>A[i];
		if(A[i] == 0){ puts("0"); return 0; }
		count_log += log10l(A[i]);
	}

	if(count_log > 18){ puts("-1"); return 0; }

	ll inf = 1e18;
	ll ans = 1;
	for(ll a:A){
		ans *= a;
		if(ans > inf){ ans = -1; break; }
	}
	cout<< ans <<endl;
}


Measured memory_bytes: 6492
#include <bits/stdc++.h>
#include <string>
using namespace std;
 
int main() {
  int x,y;
  cin >> x >> y;
  if(x == 2 || y == 2){
    cout << "No" << endl;
  }else{
  	if(x == 4 || x == 6 || x == 9 || x == 11){
    	if(y == 4 || y == 6 || y == 9 || y == 11){
        	cout << "Yes" << endl;
        }else{
        	cout << "No" << endl;
        }
    }else{
    	if(y != 4 && y != 6 && y != 9 && y != 11){
        	cout << "Yes" << endl;
        }else{
        	cout << "No" << endl;
        }
    }
  }
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author aps
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        JSushi solver = new JSushi();
        solver.solve(1, in, out);
        out.close();
    }

    static class JSushi {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            double[][][] dp = new double[310][310][310];

            int c1 = 0, c2 = 0, c3 = 0;
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                if (a[i] == 1) c1++;
                else if (a[i] == 2) c2++;
                else c3++;
            }

            for (int k = 0; k < 310; k++) {
                for (int j = 0; j + k < 310; j++) {
                    for (int i = 0; i + j + k < 310; i++) {
                        if (i == 0 && j == 0 && k == 0) continue;

                        dp[i][j][k] += (double) n / (double) (i + j + k);
                        double pi = (double) i / (double) (i + j + k);
                        double pj = (double) j / (double) (i + j + k);
                        double pk = (double) k / (double) (i + j + k);

                        if (i > 0) dp[i][j][k] += (pi * dp[i - 1][j][k]);
                        if (j > 0) dp[i][j][k] += (pj * dp[i + 1][j - 1][k]);
                        if (k > 0) dp[i][j][k] += (pk * dp[i][j + 1][k - 1]);
                    }
                }
            }

            out.println(dp[c1][c2][c3]);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 300368
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  int A, B;
  cin >> A >> B;
  int X = 0;
  if(A == 1) {
    X += 300000;
  }
  if(A == 2) {
    X += 200000;
  }
  if(A == 3) {
    X += 100000;
  }
  if(B == 1) {
    X += 300000;
  }
  if(B == 2) {
    X += 200000;
  }
  if(B == 3) {
    X += 100000;
  }
  if(A == 1 && B == 1) {
    X += 400000;
  }
  cout << X << endl;
}

Measured memory_bytes: 3620
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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(void){  
  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;

  if(s[k-1] == 'A') s[k-1] = 'a';
  if(s[k-1] == 'B') s[k-1] = 'b';
  if(s[k-1] == 'C') s[k-1] = 'c';

  cout << s << endl;
  
  return 0;
}


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

#define INF 0x7fffffff;

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> d(k);
  for(int i=0; i<k; i++) cin >> d[i];

  while(true) {
    bool f = true;
    int  m = n;
    while (m > 0) {
      int mm = m % 10;
      m = m / 10;
      for(int i=0; i<k;i++) if (mm == d[i]) f = false;
    }
    if (f) break;
    n++;
  }
  cout << n << endl;
}


Measured memory_bytes: 256
// HE WHO TRAVELS THE FASTEST, TRAVELS ALONE
#include <bits/stdc++.h>
#include <stack>
using namespace std;
#define ORIGAMI ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define pb push_back
#define INF 1e18LL
#define ll long long int

vector<ll> adj[100000];
vector<bool> vis(100000,false);
ll mod = 998244353;

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

ll po(ll a,ll b)
{
	ll mod = 100;
	a%=mod;
	b%=mod;
	ll res=1;
	while(b>0)
	{
		if(b&1)
			res = (res * a) % mod;
		a = a * a % mod;
		b/=2;
	}
	return res;
}

void dfs(ll x)
{
	vis[x] = true;
	cout<<x<<" ";
	for(auto u:adj[x])
	{
		if(!vis[u])
			dfs(u);
	}
}

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

bool solve(ll x)
{
	ll s=1;
	for(int i=x/2;i>1;i--)
	{
		if(x%i==0)
		{
			s+=i;
		}
	}
	if(s==x)
		return true;
	return false;

}


int main()
{
	ORIGAMI
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt","r",stdin);
	// 	freopen("output.txt","w",stdout);
	// #endif
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5])
		cout<<"Yes\n";
	else
		cout<<"No\n";
	return 0;
}

Measured memory_bytes: 2560
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    print((A-1)*(B-1))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


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

int main(){
  int N, num = 0, n;
  
  cin >> N;
  
  n = N;
  
  while(N > 0){
    num += N % 10;
    N /= 10;
  }
  
  if(n % num == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#145c
import math
import itertools

N = int(input()) #N<=8 …8!=40320。総当たりOK

xy_list = [0]

for i in range(N): #8回ループ
    x,y = map(int, input().split())
    xy_list.append((x,y))
    
city_distance_dict = dict() #key = (from,to) , value = distance

for i in range(1,N+1):
    for j in range(1,N+1): #64/2回ループ
        xi = xy_list[i][0]
        yi = xy_list[i][1]
        xj = xy_list[j][0]
        yj = xy_list[j][1]
        distance = math.sqrt((xi - xj)**2 + (yi - yj)**2)
        city_distance_dict[(i,j)] = distance
        city_distance_dict[(j,i)] = distance

sum_distance = 0
route_list = list(itertools.permutations(range(1,N+1)))

for route in route_list: #40320
    distance = 0
    #print(route)
    for i in range(N-1): #7
        from_city = route[i]
        to_city = route[i+1]
        #print(from_city,"→",to_city,":",city_distance_dict[(from_city,to_city)])
        sum_distance += city_distance_dict[(from_city,to_city)]

#print(sum_distance)
#print(len(route_list))
print(sum_distance/len(route_list))

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

int main() {
    
    int n, x[101], y[101], h[101];
    
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i] >> h[i];
    }
    
    for (int cx = 0; cx <= 100; cx++) {
        for (int cy = 0; cy <= 100; cy++) {
            int ch = 0;
            bool this_is_it = true;
            for (int i = 0; i < n; i++) {
                if (h[i] == 0) continue;
                int chv = h[i] + abs(x[i] - cx) + abs(y[i] - cy);
                if (chv < 1 || (ch != 0 && ch != chv)) {
                    this_is_it = false;
                    break;
                }
                if (ch == 0) {
                    ch = chv;
                }
            }
            for (int i = 0; i < n; i++) {
                if (h[i] != 0) continue;
                if (ch - abs(x[i] - cx) - abs(y[i] - cy) > 0) {
                    this_is_it = false;
                    break;
                }
            }
            if (this_is_it) {
                cout << cx << " " << cy << " " << ch << endl;
                return 0;
            }
        }
    }
    
    cout << "nya~n" << endl;
    
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sat May  2 20:55:50 2020

@author: Kanaru Sato
"""

x = int(input())
count = 0
yokin = 100

while yokin < x:
    count += 1
    yokin *= 1.01
    yokin = int(yokin)
    
print(count)

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

int main (){
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++){
		if((i+1)%2==1&&s[i]=='L'){
			puts("No");return 0;
		}
		if(i%2==1&&s[i]=='R'){
		puts("No");return 0;}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
import math
while True:
    x,y,s = map(int,input().split())
    if x==0 and y==0 and s==0:
        break
    maxz = 0
    for i in range(1,s-1):
        for j in range(1,s-1):
            if i+j > s:
                break
            if math.floor(i*(100+x)/100) + math.floor(j*(100+x)/100) == s:
                z = math.floor(i*(100+y)/100) + math.floor(j*(100+y)/100)
                if maxz < z:
                    maxz = z
    print(maxz)


Measured memory_bytes: 5660
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>

using namespace std;

int N, H, W;
static const int MAX = 100;
vector<vector<int> > G(MAX, vector<int>(MAX, 0));
vector<int> a(10001);

int main() {

    cin >> H >> W;
    cin >> N;
    for (int i = 1; i <= N; i++) {
        cin >> a[i];
    }
    
    int row = 0, column = 0;
    bool reverse_loop = false;
    for (int i = 1; i <= N; i++) {
        while(a[i] != 0) {
            a[i]--;
            G[row][column] = i;
            //cout << row << ' ' << column << '\n';
            if (!reverse_loop) {
                column++;
                if (column == W) {
                    column = W-1;
                    row++;
                    reverse_loop = true;
                }
            }
            else {
                column--;
                if (column == -1) {
                    column = 0;
                    row++;
                    reverse_loop = false;
                }
            }
        }
    }

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (j != 0) cout << ' ';
            cout << G[i][j];
        }
        cout << '\n';
    }

}


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

long long i,j,k,z=0,x;
char s[300000];

int main()
{
   cin>>s;
   x=strlen(s);
   for(i=0;i<x;i++)
   {
        if(s[i]=='L'||s[i]=='R')
        {
            if(s[i]=='L'&&(i+1)%2!=0)
                  z=1;
            else if(s[i]=='R'&&(i+1)%2==0)
                  z=1;
        }
        if(z==1)
            break;    
   }
   if(z==1)
      cout<<"No"<<endl;
   else
      cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
k = int(input())

mx = 500

if k <= mx:
    print(k)
    for i in range(1, k + 1):
        print(*([i] * k), sep=" ")
else:
    cv = [[0 for i in range(mx)] for j in range(mx)]
    for i in range(mx):
        for j in range(mx):
            cv[i][(i + j) % mx] = j + 1
            if i % 2 == 1 and j + 1 + mx <= k:
                cv[i][(i + j) % mx] += mx
    
    print(mx)
    for i in range(mx):
        print(*cv[i], sep = " ")

Measured memory_bytes: 12408
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] num = new int[n];
        for (int i = 0; i < n; i++) {
            num[i] = -1;
        }
        for (int i = 0; i < m; i++) {
            int s = sc.nextInt();
            int c = sc.nextInt();
            if (n!=1 &&s == 1 && c == 0) {
                System.out.println(-1);
                return;
            } else if (num[s - 1] > -1 && num[s - 1] != c) {
                System.out.println(-1);
                return;
            } else {
                num[s - 1] = c;
            }
        }
        int ans = 0, digit = 1;
        if(n == 3 && num[0] == -1) num[0] = 1;
        if(n == 2 && num[0] == -1) num[0] = 1;
        for (int i = n - 1; i >= 0; i--) {
//            if(n-1==i && num[n-i-1] == -1) num[n-i-1] = 1;
            if (num[i] == -1) num[i] = 0;

            ans += num[i] * digit;
            digit *= 10;
        }
        System.out.println(ans < 0? -1: ans);
    }
}

Measured memory_bytes: 21844
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    int n;
    cin >> n;
    vector<ll>a(n);
    ll sum = 0;
    rep(i,n){
        cin >> a[i];
        sum += a[i];
    }
    ll tot = (ll)n*(n+1)/2;
    if(sum%tot){
        cout << "NO" << endl;
        return 0;
    }
    ll num = sum/tot;
    vector<ll>b(n);
    rep(i,n){
        b[i] = a[(i+1)%n]-a[i];
        if(-b[i]+num< 0 or (-b[i]+num)%n){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    
}

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

int main(){
  bool one = false, nine = false, seven = false, four = false;
  int n1, n2, n3, n4;
  cin >> n1 >> n2 >> n3 >> n4;

  switch (n1) {
    case 1:
      one = true;
      break;
    case 9:
      nine = true;
      break;
    case 7:
      seven = true;
      break;
    case 4:
      four = true;
      break;
  }

  switch (n2) {
    case 1:
      one = true;
      break;
    case 9:
      nine = true;
      break;
    case 7:
      seven = true;
      break;
    case 4:
      four = true;
      break;
  }

  switch (n3) {
    case 1:
      one = true;
      break;
    case 9:
      nine = true;
      break;
    case 7:
      seven = true;
      break;
    case 4:
      four = true;
      break;
  }

  switch (n4) {
    case 1:
      one = true;
      break;
    case 9:
      nine = true;
      break;
    case 7:
      seven = true;
      break;
    case 4:
      four = true;
      break;
  }

  if(one && nine && seven && four)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int a,b,c;
	int ans=0;
	cin>>a>>b>>c;
	for(int i=a;i<=b;i++){
		if(c%i==0){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3124
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long
#define pb push_back
#define pf push_front
#define Mid ((l+r)/2)
#define pi pair<int,int>
#define pii pair<pi,int>
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int n,k,vis[200];
int main()
{
    go;
    cin>>n>>k;
    int ans=0;
    for(int i=1;i<=k;i++)
    {
        int x;
        cin>>x;
        for(int j=1;j<=x;j++)
        {
            int y;
            cin>>y;
            vis[y]=1;
        }
    }
    for(int i=1;i<=n;i++)
        ans+=(!vis[i]);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3648
package main

import (
	"container/list"
	"fmt"
	"os"
	"bufio"
	"strconv"
)

func main() {

	L := list.New()
	L.PushBack(-100)
	cur := L.Front()
	var n int
	fmt.Scan(&n)
	
	var scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	for i:=0; i<n; i++ {
		
		scanner.Scan()
		query, _ := strconv.Atoi(scanner.Text())

		switch query {
		case 0 :
			scanner.Scan()
			x, _ := strconv.Atoi(scanner.Text())
			if i==0 {
				L.PushFront(x)
				cur = L.Front()
			} else {
				L.InsertBefore(x, cur)
				cur = cur.Prev()
			}
		case 1 :
			scanner.Scan()
			d, _ := strconv.Atoi(scanner.Text())
			if d > 0 {
				for j:=0; (j<d)&&(cur!=L.Back()); j++ {
					cur = cur.Next()		
				}
			} else if d < 0 {
				d = -d
				for j:=0; (j<d)&&(cur!=L.Front()); j++ {
					cur = cur.Prev()
				}
			}
		case 2 :
			if cur!=L.Back() {
				cur = cur.Next()
			} else {
				cur = L.Back()
			}
			_ = L.Remove(cur.Prev())
		}
		//for e:=L.Front(); e!=nil; e=e.Next() {
		//	fmt.Print(e.Value," ")
		//}
		//fmt.Println("  cur:",cur.Value)
	}

	for cur=L.Front(); cur!=L.Back(); cur=cur.Next() {
		fmt.Println(cur.Value)
	}
}




Measured memory_bytes: 34560