akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        if(i != 0) A[i] += A[i-1];
    }

    ll ans = MAXINF;
    Rep(i, 0, N-1){
        ll l = A[i];
        ll r = A[N-1] - A[i];

        ans = min(ans, abs(r - l));
    }

    pr(ans);
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
using ll = long long;
constexpr ll INF = 10000000000;
const ll MOD = 1000000007;

using namespace std;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	long long g = gcd(a, b);
	return a / g * b;
}

int main() {
	int n; cin >> n;
	
	vector<int>a(n);
	rep(i, n)cin >> a[i];
	rep(i, n)a[i] = a[i] - 1;

	int now = 0;
	int c = 0;
	
	for (;;) {
		if (now == 1) {
			cout << c << endl;
			break;
		}
		else if (c >= n) {
			cout << -1 << endl;
			break;
		}
		now = a[now];
		c++;
	}
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;
typedef vector<vl> v2;
typedef vector<v2> v3;
typedef vector<v3> v4;


const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;

ll n;
mt a;

int main(){
  cin >> n;
  a = mt(n,vl(n));
  for(ll i = 0;i < n;i++){
    for(ll j = i+1;j < n;j++){
      ll x = i^j;
      ll k = 1;
      while(x%2 == 0){
        x /= 2;
        k++;
      }
      a[i][j] = a[j][i] = k;
    }
  }
  for(ll i = 0;i < n;i++){
    for(ll j = i+1;j < n;j++){
      cout << a[i][j] << " ";
    }
    cout << endl;
  }

}


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

/*#ifndef ONLINE_JUDGE
    #include <lol.h>
#endif*/
#define mp make_pair
#define pb push_back
#define pf push_front
#define sz(a) (int)((a).size())
#define fr(i,n) for(ll i=0;i<n;i++)
#define fr1(i,n) for(ll i=1;i<=n;i++)
#define frk(i,k,n) for(ll i=k;i<n;i++)
#define rfr(i,n) for(ll i=n-1;i>=0;i--)
#define foa(i,a,n) for(ll i=0;i<n;i+=a)
#define f first
#define s second
#define mod 1000000007
#define all(x) (x).begin(),(x).end()
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define vsort(x) sort(all(x))
#define debug cout<<"Hey Sweetie, Stop Right Here......"<<endl;

typedef long long int ll;
typedef stack<ll> stll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef set<ll> sll;
typedef multiset<ll> msll;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef map<ll, ll> mll;
typedef unordered_map<ll, ll> umll;
typedef long double ld;
ll modmulti(ll a, ll b, ll m) {
  return ((a % m) * (b % m)) % m;
}
ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}
ll power(ll x, ll y, ll m)
{
  if (y == 0)
    return 1;
  ll p = power(x, y / 2, m) % m;
  p = (p * p) % m;

  return (y % 2 == 0) ? p : (x * p) % m;
}
ll power2(ll x, ll y)
{
  if (y == 0)
    return 1;
  ll p = power2(x, y / 2);
  p = (p * p);

  return (y % 2 == 0) ? p : (x * p);
}
bool cmp(pair<ll, ll>&a, pair<ll, ll>&b) {
  if (a.first == b.first) return (a.second < b.second);
  else return (a.first > b.first);
}

ll bin(vll a, ll left, ll right, ll x) {
  ll mid = left + (right - left) / 2;
  if (a[mid] == x) return mid;
  if (left <= right) {
    if (a[mid] < x) return bin(a, mid + 1, right, x);
    else if (a[mid] > x) return bin(a, left, mid - 1, x);
  }
  return -1;
}
ll findclosest(ll n) {
  ll i;
  for (i = 0; i <= 64; i++) {
    if (power2(2, i) <= n) continue;
    else break;
  }
  return power2(2, i - 1);
}
ll get_signi(ll n) {
  while (n >= 10) {
    n = n / 10;
  }
  return n;
}
ll get_digits(ll n) {
  ll i = 0;
  while (n >= 10) {
    n = n / 10;
    i++;
  }
  return i;
}
bool is_palindrome(string t) {
  for (int i = 0; i < t.size() / 2; i++) {
    if (t[i] != t[t.size() - i - 1]) return false;
  }
  return true;
}
int main() {
  fastio;
  ll n,k;
  cin>>n>>k;
  n=abs(n-(n/k)*k);
  if(n<k){
    n = min(n,abs(n-k));
  }
  cout<<n<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
string S;
  cin>>S;
  ll N=S.size();
  for(ll i=0;i<N;i++) {
    
if(i%2==0&&S[i]=='L') {
cout<<"No"<<endl;
  return 0;
}
    if(i%2!=0&&S[i]=='R') {
cout<<"No"<<endl;
    return 0;
    }
  }
  
  
  
  cout<<"Yes"<<endl;
}


Measured memory_bytes: 3608
str = gets.chomp.to_s
n = gets.to_i

n.times {
  s, a, b, p = gets.split.map(&:to_s)
  a = a.to_i
  b = b.to_i

  if s == "replace"
    str.slice!(a..b)
    str.insert(a, p)
  elsif s == "reverse"
    str2 = str.slice!(a..b).reverse!
    str.insert(a, str2)
  else
    puts str.slice(a..b)
  end
}

Measured memory_bytes: 8676
#include<stdio.h>
int v(int *,int);

int main(){
  int t,i,j,n,a[100],cn=0,flag=1;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  while(flag){
    flag=0;
    for(j=n-1;j>0;j--){
      if(a[j]<a[j-1]){
	t=a[j];
	a[j]=a[j-1];
	a[j-1]=t;
	cn++;
	flag =1;
      }
    }
  }
  v(a,n);
  printf("%d\n",cn);
return 0;
}
int v(int *a,int n){
  int i;
  for(i=0;i<n;i++){
    printf("%d",a[i]);
    if(i==n-1)printf("\n");
    else printf(" ");
  }

}



Measured memory_bytes: 2048
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	    // input N H1 H2 ... Hn
        // i < j なる Hi,Hj について、 Hi >= Hj の関係が連続する最大の個数を出力せよ
        Scanner sc = new Scanner(System.in);
        int numN = sc.nextInt();
        int beforeNum = sc.nextInt();
        int continueNum = 0;
        int maxContinueNum = 0;
        for(int i = 1; i < numN; i++){
            int nextNum = sc.nextInt();
            if(nextNum <= beforeNum){
                continueNum++;
            } else {
                if(maxContinueNum < continueNum){
                    maxContinueNum = continueNum;
                }
                continueNum = 0;
            }
            beforeNum = nextNum;
        }
        if(maxContinueNum < continueNum){
            maxContinueNum = continueNum;
        }
        System.out.println(maxContinueNum);
    }
}


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

using namespace std;

void solve() {
  string s;
  cin >> s;
  for (char& c : s) {
    c = 'x';
  }
  cout << s << endl;
}

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


Measured memory_bytes: 384
a, b, c = raw_input().split()
if a == b and a == c:
    print "1"
elif a == b and a != c:
    print "2"
elif a == c and a != b:
    print "2"
elif b == c and b != a:
    print "2"
elif c == b and c != a:
    print "2"
else:
    print "3"

Measured memory_bytes: 2568
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

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

Measured memory_bytes: 256
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
#define l(i,a,b) for(auto i=a;i<b;i++)
#define lr(i,a,b) for(auto i=a;i>=b;i--)
#define ll long long
#define lli long long int
#define ld long double
#define vec vector<int>
#define mii map<ll,ll>
#define vl vector<long long>
#define se set <long long int>
#define pi pair<long long,long long>
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
#define all(v) v.begin(), v.end()
#define in(x) cin>>x
#define o(x) cout<<x
#define SYNC ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

ll dp[200009];



int main()
{
    SYNC
    ll n,w; in(n)>>w;
    
    l(j,0,n)
    {
        ll W,V; in(W)>>V;
        for(ll i=0; i<=(w-W); i++)
        {
            dp[i]=max(dp[i], dp[W+i] + V);
        }
    }
    o(dp[0])<<endl;
    
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k=0;
	cin>>n;
	int a[n],b[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
		b[i]=a[i];
	}
	sort(b,b+n);
	for(int i=0;i<n;i++)
	if(a[i]!=b[i])
	k++;
	if(k>2)
	cout<<"NO"<<endl;
	else
	cout<<"YES"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pb push_back
#define ll long long int
#define w(t) int t;cin>>t; while(t--)
#define mp make_pair
#define fi first
#define se second
#define fr(n) for(int i=0;i<n;i++)
#define um unordered_map
#define pqm priority_queue <int, vector<int>, greater<int> >
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    string ans="No";
    while(n>0){
    	if(n%10==7){
    		ans="Yes";
    		break;
		}
		n/=10;
	}
	cout<<ans<<endl;
	return 0;
}


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

signed main(void)
{
	int a, b;
	cin >> a >> b;
	if (b % a == 0)
		cout << a + b << endl;
	else
		cout << b - a << endl;
	return 0;
}


Measured memory_bytes: 256
// D - No Need

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int N, K;
int a[5000];
bool dp[5001][5001]; // dp[i][j]: i個目までのaで和をjにできるか

// 不必要ならok
bool is_ok(ll k) {
	if (a[k] >= K) return false;

	//cout << "k = " << k << endl; // **** debug ****
	for (int i=0; i<5001; i++) {
		for (int j=0; j<5001; j++) {
			dp[i][j] = false;
		}
	}

	dp[0][0] = true;

	for (int i=0; i<N; i++) {
		for (int j=0; j<=5000; j++) {
			dp[i+1][j] = dp[i+1][j] || dp[i][j];

			if (i == k) continue;
			if (dp[i][j] == false) continue;

			if (j + a[i] <= 5000) dp[i+1][j + a[i]] = true;
		}
	}

	bool result = true;
	for (int j=K-a[k]; j<K; j++) {
		if (dp[N][j] == true) result = false;
	}

	// **** debug ****
	/*
	for (int i=0; i<=N; i++) {
		for (int j=0; j<=30; j++) {
			cout << dp[i][j];
		}
		cout << endl;
	}
	*/

	//cout << "result: " << result << endl; // **** debug ****

	return result;
}

// 不必要ならok
ll find_max_ok(ll lower, ll upper) {
	if (!is_ok(lower)) return -1; // 存在しない

	ll ok = lower;
	ll ng = upper;

	while(ng - ok > 1) {
		ll trying = (ng + ok) / 2;

		if (is_ok(trying)) {
			ok = trying;
		} else {
			ng = trying;
		}
	}

	return ok;
}

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

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

	sort(a, a+N);

	int ans = find_max_ok(0, N) + 1;

	cout << ans << endl;

	return 0;
}

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

using namespace std;

#define fcout(d) cout << fixed << setprecision(d)
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rep1(i,n) for(int (i) = 1; (i) <= (n); ++(i))
#define repU(i,bottom,ceiling) for(auto (i) = (bottom); (i) <= (ceiling); ++(i))
#define repD(i,ceiling,bottom) for(auto (i) = (ceiling); (i) >= (bottom); --(i))
#define repS(s,n) for(int (s) = 0; s < 1 << (n); ++(s))
#define repV(i,v) for(auto (i) = begin(v); (i) < end(v); ++(i))
#define all(v)  begin(v),end(v)
#define clr(v) fill(all(v),0)
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define divceil(n,d) ((n)/(d) + ((n)%(d) > 0))
#define parity(a,b) (((a) & 1LL)^((b) & 1LL)^1LL)

typedef long long ll;
typedef unsigned long long ull;
typedef double db;

const pair<int,int> DIR[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int INF = -1 + (1 << 30);
const int MOD = (int)1e9 + 7;

ull next_subset(ull subset){
	ull tem = subset + (subset & -subset);
	ull btm = (~tem & subset) / (subset & -subset) >> 1;
	return btm | tem;
}


ll N,M;

void solve(){
	
	ll cnt = 0;
	
	cnt += max(0LL,N-2) * max(0LL,M-2);
	
	if(N == 1){
		if(M == 1) cnt = 1;
		else cnt += M-2;
	}else{
		if(M == 1) cnt += N-2;
	}
	
	cout<<cnt<<endl;
	
	return;
}

void input(){
	
	cin>>N>>M;
	
	return;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	input();
	solve();
	
	return 0;
}





Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text.RegularExpressions;
namespace AtCoder_Core
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x)).ToArray();
            int A = line[0];
            int B = line[1];
            int H = line[2];
            int M = line[3];
            double H_kaku = (double)(30.0 * H) + (0.5 * (double)M);
            double M_kaku = (double)(6.0 * M);
            double C = 0.0;
            var cs = 0.0;

            if (H_kaku > M_kaku)
            {
                cs = H_kaku - M_kaku;
            }
            else
            {
                cs = M_kaku - H_kaku;
            }
            C = (A * A) + (B * B) - 2 * A * B * Math.Cos(cs * Math.PI / 180);
            C = Math.Sqrt(C);
            Console.WriteLine(C);
        }
    }

}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}

//char->int
int ctoi(char c){
    return c-'0';
}



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

    vector<pair<ll,ll>> p(n);
    ll ans = 0;
    ll g = 0;

    rep(i,n){
        ll x,y;
        cin >> x >> y;

        p[i] = make_pair(x,y);
    }

    sort(p);

    for(int i=0;i<n;i++){
        ans += min(m-g,p[i].second)*p[i].first;
        g += p[i].second;
        if(g>=m){
            break;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    print(x)
    exit()

p.sort()

if x not in p:
    print(x)
    exit()
    
for i in range(len(p)):
    #print(p[i])
    if p[i] == x:
        index = i
        break

right = x + 1
for i in p[index + 1:]:
    if i != right:
        break
    right += 1

left = x - 1
for i in reversed(p[:index]):
    if i != left:
        break
    left -= 1

if x - left <= right - x:
    print(left)
else:
    print(right)

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

int main(){
    int n;
    cin>>n;
    int arr[n];

    for(int i=0; i<n; i++)
        cin>>arr[i];

    int max = 1, len = 1;

    for(int i=1; i<n; i++){
        if(arr[i] <= arr[i-1])
            len++;
        else{
            if(max < len)
                max = len;

            len = 1;
        }
    }

    if(max < len)
        max = len;

    cout<<max-1<<endl;

}


Measured memory_bytes: 640
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int n, s;
ll dp[9][101][1010];

int main(){
	
	rep(i, 101) dp[0][i][i] = 1;
	rep(i, 8) rep(j, 101) rep(k, 1010) if(dp[i][j][k]){
		for(int l = j + 1; l < 101 && l + k < 1010; l++)
		dp[i + 1][l][k + l] += dp[i][j][k];
	}
	
	while(cin >> n >> s, n){
		ll ans = 0;
		rep(i, 101) ans += dp[n - 1][i][s];
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 7140
#include <bits/stdc++.h>
using namespace std;
#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++)
using ll = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using P = pair<int, int>;

int main(){
	string s;
    cin >> s;
    rep(_,s.size()){
        cout << "x";
    }
    cout << endl;
	return 0;
}

Measured memory_bytes: 256
inputs = list(input())
stack = []
L = []
tmp_total = 0
counter = 0
upper = 0
for i,x in enumerate(inputs):
    if(x == '\\'):
        stack.append(i)
    elif(x == '/') and stack:
        tmp = stack.pop()
        total_layer = i-tmp
        if L:
            while L and L[-1][0] > tmp:
                cal = L.pop()
                total_layer += cal[1]
        L.append((i, total_layer))

print(sum([j[1] for j in L]))
if(len(L) != 0):
    print(str(len(L))+ ' ' + ' '.join([str(i[1]) for i in L]))
else:
    print(str(len(L)))



Measured memory_bytes: 6400
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Popularity Estimation
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while (!(line = br.readLine()).equals("0")) {
			int n = Integer.parseInt(line);

			String[] names = new String[n];
			int[][] scenes = new int[n + 1][32];

			StringTokenizer st;
			int m, d;
			for (int i = 0; i < n; i++) {
				st = new StringTokenizer(br.readLine());
				names[i] = st.nextToken();
				m = Integer.parseInt(st.nextToken());
				for (int j = 0; j < m; j++) {
					d = Integer.parseInt(st.nextToken());
					scenes[i][d] = n + 1;
					scenes[n][d]++;
				}
			}
			// 集計
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < 31; j++) {
					if (scenes[i][j] > 0)
						scenes[i][31] += (scenes[i][j] - scenes[n][j]);
				}
			}
			// 出力
			int idx = 0, min = Integer.MAX_VALUE;
			for (int i = 0; i < n; i++) {
				if (scenes[i][31] < min) {
					min = scenes[i][31];
					idx = i;
				} else if (scenes[i][31] == min) {
					if (names[i].compareTo(names[idx]) < 0)
						idx = i;
				}
			}
			System.out.println(scenes[idx][31] + " " + names[idx]);
		}
	}
}

Measured memory_bytes: 22404
#include <stdio.h>

int main(void)
{
  long a, b, i;

  while ((scanf("%ld%ld", &a, &b)) != EOF) {
    for (i = 1; i <= a; i++) {
      if (a%i) continue;
      if (!(b%(a/i))) {
        printf("%ld ", a/i);
        break;
      }
    }

    for (i = 1; i < 200000000; i++)
      if (!((a*i)%b)) {
        printf("%ld\n", a*i);
        break;
      }
  }

  return 0;
}

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

const int MAX = 8000;

int main() {
	string s;
	int x, y;
	int ax[MAX], ay[MAX], bx = 0, by = 0, xsum = 0, ysum = 0;
	bool DPX[MAX], DPY[MAX]; // 動的計画法用
	for (int i = 0;i < MAX;i ++) { // 初期化
		ax[i] = 0;
		ay[i] = 0;
		DPX[i] = false;
		DPY[i] = false;
	}
	cin >> s >> x >> y;
	for (int i = 0;i < s.length();i ++) {
		if (s[i] == 'F') x --; // 最初の移動方向だけは固定なので
		else {
			bool directX = false;
			for (int j = i + 1;j < s.length();j ++) {
				if (s[j] == 'T') {
					if (ax[bx])bx ++;
					if (ay[by])by ++;
					directX = !directX;
				}
				else if (directX) ax[bx] ++;
				else ay[by] ++;
			}
			break;
		}
	}
	for (int i = 0;ax[i] != 0;i ++) xsum += ax[i];
	for (int i = 0;ay[i] != 0;i ++) ysum += ay[i];
	DPX[0] = true;
	for (int i = 0;ax[i] != 0;i ++) {
		for (int j = xsum;j >= 0;j --) {
			if (DPX[j]) DPX[j + ax[i]] = true; // Xについての部分和問題
		}
	}
	
	DPY[0] = true;
	for (int i = 0;ay[i] != 0;i ++) {
		for (int j = ysum;j >= 0;j --) {
			if (DPY[j]) DPY[j + ay[i]] = true; // Yについての部分和問題
		}
	}
	if ((xsum + x) < 0 || (xsum + x) % 2 == 1 || (ysum + y) < 0 || (ysum + y) % 2 == 1) cout << "No";
	else if (DPX[(xsum + x) / 2] && DPY[(ysum + y) / 2]) cout << "Yes";
	else cout << "No";
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

まず、x軸方向とy軸方向を独立に考えられることが分かるね
しかも、90度変更ということは任意の距離進むことができる
……これは部分和問題だね
各移動距離に対し、正負を反転させることができて、その和がxかyになれば良い訳だ
部分和問題で調べてくれると分かるけど、動的計画法で解くことができるよ
O(|s|^2)なら通る通る
*/

Measured memory_bytes: 384
#define scanf_s scanf
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 150
int main(void)
{
	int n, now = 0;
	int list[MAX] = { 0 };
	while(scanf_s("%d", &n) != EOF){
		if (n != 0) { list[now] = n; ++now; }
		else { --now; 	printf("%d\n", list[now]);}
	}
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i,s,n) for(int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = 0;
    if(abs(a - b) % 2 == 0) {
        ans += abs(a - b) / 2;
    } else {
        ans += min(a - 1, n - b);
        if(a - ans == 1) {
            a = 1;
            b -= ans;
            b++;
        } else if(b + ans == n) {
            b = n;
            a += ans;
            a--;
        }
        ans += abs(a - b) / 2;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

//State
//dp[a][b][c]: The expceted number of operations so to empty all plates when started with
// "a" number of 1 sushi plates, "b" number of 2 sushi plates, "c" number of 3 sushi plates

//Initialization
//dp[0][0][0] = 0

//Transitions
//dp[a][b][c] =  ((N-(a+b+c))/N)*dp[a][b][c] + (a/N)*dp[a-1][b][c] + (b/N)*dp[a+1][b-1][c] + (c/N)*dp[a][b+1][c-1] + 1
//dp[a][b][c] = N/(a+b+c) + (a/(a+b+c))*dp[a-1][b][c] + (b/(a+b+c))*dp[a+1][b-1][c] + (c/(a+b+c))*dp[a][b+1][c-1]

//Order of evaluation
//Outer Loop: c, Middle Loop: b, Inner Loop: a

//Answer: dp[n1][n2][n3]

//Time complexity: O(n1*n2*n3)

int main(){
    int N;
	cin >> N;
	int A[N+1];
	int ones = 0;
	int twos = 0;
	int threes = 0;
	
	for(int i=1; i<=N; i++){
		cin >> A[i];
		if(A[i] == 1) ones = ones+1;
		if(A[i] == 2) twos = twos+1;
		if(A[i] == 3) threes = threes+1;
	}
	
    //double dp[ones+twos+threes+1][twos+threes+1][threes+1] = {0};
    double dp[305][305][305] = {0};
    dp[0][0][0] = 0;
	for(int c=0; c<=threes; c++){
		for(int b=0; b<=twos+threes; b++){
			for(int a=0; a<= ones+twos+threes; a++){
				if(a!=0||b!=0||c!=0){
					dp[a][b][c] = (double) N/(a+b+c);
					if(a>0){
						dp[a][b][c] += (((double) a)/(a+b+c))*dp[a-1][b][c];
					}
					if(b>0){
						dp[a][b][c] += (((double) b)/(a+b+c))*dp[a+1][b-1][c];
					}
					if(c>0){
						dp[a][b][c] += (((double) c)/(a+b+c))*dp[a][b+1][c-1];
					}
				}
			}
		}
	}

	//cout << dp[ones][twos][threes] << endl;
	//printf("%0.10lf\n", dp[ones][twos][threes]);
	cout << fixed << setprecision(10) << dp[ones][twos][threes] << endl;

}

Measured memory_bytes: 225404
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,ans = 1;
  cin >> n >> m;
  for(int i=m/n;i>0;i--){
    if(m%i == 0 && m/i >= n){
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		
		if(a<b){
			if(b<c){
				System.out.println("Yes");
			}
			else{
				System.out.println("No");
			}
		}
		else{
			System.out.println("No");
		}
	}
}

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

using namespace std;

const int INF = 1e9 + 7;

void solve()
{
    int n, k;
    cin >> n >> k;
    vector<int> v(n, 0), dp(n, 0);
    for(int i = 0; i < n; ++i)
        cin >> v[i];

    dp[0] = 0;
    dp[1] = abs(v[1] - v[0]);

    for(int i = 2; i < n; ++i)
    {
        dp[i] = INF;
        for(int j = 1; j <= k; ++j)
        {
            if(i - j < 0)
                break;
            else
                dp[i] = min(abs(v[i] - v[i - j]) + dp[i - j], dp[i]);
        }
    }

    cout << dp[n - 1] << '\n';
}

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //srand (time(0));

    solve();
}






Measured memory_bytes: 1024
/*input
7
6 7 8
8 8 3
2 5 2
7 8 6
4 6 8
2 3 4
7 5 1
*/
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define input(str) freopen(str,"r",stdin);
#define output(str) freopen(str,"w",stdout);
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define INF  3e16+1
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld\n",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define modd 1000000007
#define len(x) x.size()
#define all(v) (v.begin(),v.end())
#define ll int
#define pi 3.1415926535897932384626
#define ld double
#define endl '\n'
const int N =6e5+5;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
int powmod(int base,int exp,int mod)
{
	int res=1LL;
	while(exp>0)
	{
		if(exp&1LL)
			res=(res*base)%mod;
		exp/=2LL;
		base=(base*base)%mod;
	}
	return res%mod;
}
int dp[N][3];
signed main()
{
	int n;
	cin>>n;
	int a[n+1][3];
	Rep(i,n)
	{
		rep(j,3)
		{
			cin>>a[i][j];
		}
	}
	dp[1][0]=a[1][0];
	dp[1][1]=a[1][1];
	dp[1][2]=a[1][2];
	for(int i=2;i<=n;i++)
	{
		dp[i][0]=a[i][0]+max(dp[i-1][1],dp[i-1][2]);
		dp[i][1]=a[i][1]+max(dp[i-1][2],dp[i-1][0]);
		dp[i][2]=a[i][2]+max(dp[i-1][1],dp[i-1][0]);
	}
	int temp=max(dp[n][0],max(dp[n][1],dp[n][2]));
	cout<<temp<<endl;

}

Measured memory_bytes: 6656
#include<stdio.h>

int main(){
    int x,y,z;
    scanf("%d%d",&x,&y);
    
    if(y>x){
        z = y;
        y = x;
        x = z;
    }
    
    if(x >= 1 && y <= 1000000000){
        while(1){
            z = x % y;
            if(z == 0) break;
            x = y;
            y = z;
        }
    }
    
    printf("%d\n",y);
    
}


Measured memory_bytes: 2084
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= 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;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
int H1, M1, H2, M2, K;

int main() {
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  int h1 = H1 * 60 + M1;
  int h2 = H2 * 60 + M2;
  cout << h2 - h1 - K << endl;
}


Measured memory_bytes: 3564
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int[] a = new int[n];
    for (int i = 0; i < n; i++){
      a[i] = Integer.parseInt(sc.next());
    }
    Arrays.sort(a);
    int ans = 0;
    boolean flag = true;
    for (int i = n-1; i >= 0; i--){
      if (flag == true){ans += a[i];}
      else{ans -= a[i];}
      flag ^= true;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 35520
n = int(input())
x = [0,0,0,0]
y = ["AC","WA","TLE","RE"]
for _ in range(n):
  si = str(input())
  if si == "AC":
    x[0] += 1
  elif si == "WA":
    x[1] += 1
  elif si == "TLE":
    x[2] += 1
  elif si == "RE":
    x[3] += 1
for i in range(4):
  print(y[i],"x",x[i])

Measured memory_bytes: 69920
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int> S(N);
  for(int i=0;i<N;i++){
    cin>>S.at(i);
  }
  int now=0;
  int ans=0;
  for(int i=0;i<N;i++){
    if(now==1){
      cout<<ans<<endl;
      break;
    }
    now=S.at(now)-1;
    ans++;
  }
  if(ans==N) cout<<-1<<endl;
}

Measured memory_bytes: 768
n,m = map(int,input().split())
c = list(map(int,input().split()))

minimum = [50000] * (n+1)
minimum[0] = 0

for i in range(1,n+1):
    for j in range(m):
        if c[j]<=i and minimum[i-c[j]] + 1 < minimum[i]:
            minimum[i] = minimum[i-c[j]]+1

print(minimum[n])

Measured memory_bytes: 9188
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define MAX 10001
#define LONG_MAX (long)100000000
typedef std::pair<long,long> p;
long map[MAX][2*MAX];

int main(void){
  int H,N;
  std::cin >> H >> N;
  std::vector<p> v;
  for(int i=0;i<N;i++){
    long tmpA,tmpB;
    std::cin >> tmpA >> tmpB;
    p tmp(tmpA,tmpB);
    v.push_back(tmp);
  }

  // initialize
  for(int h=0;h<2*MAX;h++){
    // やる方法がないのでinf
    map[0][h] = LONG_MAX;
  }
  // map[0][0] は0
  map[0][0] = 0;
  
  for(int n=0;n<N;n++){
    for(int h=0;h<2*MAX;h++){
      if(v[n].first > h){
	map[n+1][h]= map[n][h];
	//cout << map[n+1][h] << endl;
      }else{
	map[n+1][h] = min(map[n][h],map[n+1][h-v[n].first] + v[n].second);
	//cout << map[n+1][h] << endl;
      }
    }
  }
  long minimum = LONG_MAX;
  for(int i=0;i<MAX;i++){
    long tmp = map[N][H+i];
    if(tmp < minimum && tmp != 0){
      minimum = tmp;
    }
  }
  cout << minimum << endl;
  return 0;
}


Measured memory_bytes: 157952
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;} 
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N;
        cin >> N;
        vll A(N), B(N), C(N-1);
        rep(i, 0, N) cin >> A[i];
        rep(i, 0, N) cin >> B[i];
        rep(i, 0, N-1) cin >> C[i];
        ll ans = 0;
        rep(i, 0, N-1) {
                if (A[i+1] - A[i] == 1) {
                        ans += C[A[i]-1];
                }
        }

        rep(i, 0, N) {
                ans += B[A[i]-1];
        }
        
        cout << ans << endl;
}

Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		if((a*b)%2==1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 22736
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>
#include <queue>

using namespace std;

vector<pair<long, long>> prime_factorization(long n) {
    vector<pair<long, long>> res;

    for (long i = 2; i * i <= n; ++i) {
        if (n % i != 0) {
            continue;
        }

        long ex = 0;

        while (n % i == 0) {
            ex += 1;
            n = n / i;
        }

        res.emplace_back(i, ex);
    }

    if (n != 1) {
        res.emplace_back(n, 1);
    }

    return res;

}

int main() {

    long N;
    cin >> N;

    vector<pair<long, long>> vs = prime_factorization(N);
    
    long res = 0;
    for (int i = 0; i < vs.size(); ++i) {

        long inc = 0;
        long incr = 1;
        long cs = 0;

        while ((cs + incr) <= vs[i].second) {
            cs = cs+incr;
            incr += 1;
            inc += 1;
        }
        res += inc;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3608
S = gets.chomp

b_cnt = 0
w_cnt = 0
prev = ''

S.each_char do |c|
  if c == prev
    next
  end
  if c == 'B'
    b_cnt += 1
  end
  if c == 'W'
    w_cnt += 1
  end
  prev = c
end

# p b_cnt
# p w_cnt

puts (b_cnt + w_cnt) - 1


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

int main()
{
	int length,i;
	cin >> length;
	vector<int>A;
	int element;
	for (int a = 0; a < length; a++)
	{
		cin >> element;
		A.push_back(element);
	}
	int key;
	for (i = 0; i < length; i++)
	{
		key = A[i];
		int j = i - 1;
		int k = i;
		for (; j >= 0; j--)
		{
			if (key < A[j])
			{
				for (; k > j; k--)
					A[k] = A[k - 1];
				A[j] = key;
			}
		}
		for (int a = 0; a < length; a++)
		{
			if (a > 0)
				cout << " ";
			cout << A[a];
		}
		cout << endl;
	}
	return 0;
}

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

class ITP1
{
    static void Main()
    {
            {
                int a = int.Parse(Console.ReadLine());
                string[] num = Console.ReadLine().Split(' ');
                int max=int.Parse(num[0]);
                int min =max;
                long sum =0;
                for(int i=0;i<a;i++){
                int b = int.Parse(num[i]);
                    if(b<min){min=b;}
                    if(b>max){max=b;}
                    sum+=b;
                }
                Console.WriteLine("{0} {1} {2}",min,max,sum);
                }
                
            
    }
}

Measured memory_bytes: 6364
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n,k;
int main(void){
    cin>>n>>k;
    if(k%2==0){
        cout<<(n/k)*(n/k)*(n/k)+((n+k/2)/k)*((n+k/2)/k)*((n+k/2)/k)<<endl;
    }else{
        cout<<(n/k)*(n/k)*(n/k)<<endl;
    }
    
}


Measured memory_bytes: 3612
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let h: usize = read(&mut stdin_lock, &mut buf, b' ');
    let w: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let mut g = vec![vec!['#'; w + 1]; h + 1];
    for i in 1..h + 1 {
        let line: String = read(&mut stdin_lock, &mut buf, b'\n');
        for (jz, c) in line.chars().enumerate() {
            g[i][jz + 1] = c;
        }
    }

    let mut tbl = vec![vec![0i32; w + 1]; h + 1];
    for i in 1..h + 1 {
        for j in 1..w + 1 {
            if i == 1 && j == 1 {
                tbl[i][j] = 1;
            } else {
                tbl[i][j] = (if g[i - 1][j] == '.' { tbl[i - 1][j] } else { 0 }
                    + if g[i][j - 1] == '.' { tbl[i][j - 1] } else { 0 })
                    % 1_000_000_007;
            }
        }
    }
    println!("{}", tbl[h][w]);
}


Measured memory_bytes: 12540
import java.util.*;

class Main
{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        String weather = sc.next();
        
        if (weather.equals("RSS") || weather.equals("SRS") || weather.equals("SSR") || weather.equals("RSR")) {
            System.out.println(1);
        } else if (weather.equals("RRS") || weather.equals("SRR")) {
            System.out.println(2);
        } else if (weather.equals("RRR")) {
            System.out.println(3);
        } else {
            System.out.println(0);
        }
        
    }
}

Measured memory_bytes: 35620
x,y=map(int,input().split())
l1=[1,3,5,7,8,10,12]
l2=[4,6,9,11]
l3=[2]
if (x in l1 and y in l1) or (x in l2 and y in l2) or (x in l1 and y in l1) or (x in l3 and y in l3):
    print("Yes")
else:
    print("No")

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

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

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

  ll ans = 0;
  for(int i = 1; i <= n; ++i){
    if(i % 3 != 0 && i % 5 != 0){
      ans += i;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>

typedef long long int int64;

void run(void){
  int n;
  scanf("%d",&n);
  int64 a[50];
  int i;
  for(i=0;i<n;i++) scanf("%lld",a+i);
  int64 cnt=0;
  while(1){
    int flg=1;
    for(i=0;i<n;i++){
      if(a[i]<n) continue;
      flg=0;
      int64 t=a[i]/n;
      cnt+=t;
      for(int j=0;j<n;j++){
	a[j]+=t;
      }
      a[i]-=t;
      a[i]%=n;
    }
    if(flg) break;
  }
  printf("%lld\n",cnt);
}


int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<cstdint>
#include<unordered_map>
#include<sstream>
#include<boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < ( int)(n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define vi vector<int>
#define vll vector<ll>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pb push_back

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;

bool ps1(const P& element1, const P& element2)
{//first昇順
	return element1.first < element2.first;
}
bool ps2(const P& element1, const P& element2)
{//first降順
	return element1.first > element2.first;
}
bool ps3(const P& element1, const P& element2)
{//second昇順
	return element1.second < element2.second;
}
bool ps4(const P& element1, const P& element2)
{//second降順
	return element1.second > element2.second;
}

ll combination(ll n, ll r) {
	if (r * 2 > n) r = n - r;
	ll dividend = 1;
	ll divisor = 1;
	for (ll i = 1; i <= r; ++i) {
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}

int main()
{
	int n;
	cin >> n;
	vector<ll>a(2*n),x(n);
	ll sumf = 0;

	rep(i, n) {
		cin >> a[i];
		a[i + n]=a[i];
	}
	rep(i, n) {
		if (i % 2 == 0) {
			sumf += a[i];
		}
		else {
			sumf -= a[i];
		}
	}
	rep(i, n) {
		if (i == 0) {
			cout << sumf << " ";
		}
		else {
			sumf += -a[i - 1] - a[i + n-1];
			sumf *= -1;
			cout << sumf ;
			if (i == n - 1) {
				cout << endl;
			}
			else {
				cout << " ";
			}
		}
	}
}


Measured memory_bytes: 3712
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int n = scan.nextInt();

	if(n <= 111){
	    System.out.println(111);
	}else if(n <= 222){
	    System.out.println(222);
	}else if(n <= 333){
	    System.out.println(333);
	}else if(n <= 444){
	    System.out.println(444);
	}else if(n <= 555){
	    System.out.println(555);
	}else if(n <= 666){
	    System.out.println(666);
	}else if(n <= 777){
	    System.out.println(777);
	}else if(n <= 888){
	    System.out.println(888);
	}else{
	    System.out.println(999);
	}
    }
}


Measured memory_bytes: 21844
#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <iomanip>
#include <tuple>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i=a;i<n;++i)
#define repeq(i, a, n) for(int i=a;i<=n;++i)
#define repi(m, itr) for (auto itr = m.begin();itr != m.end();++itr)
#define per(i, a, n) for (int i=n-1; i>=a;--i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()

// 
string S;
int ans = 0;
ll dp[100010][4];
const ll MOD = 1000000007;

void add(ll &a, ll b){
    a += b;
    if(a>=MOD){
        a -= MOD;
    }
}

int main(){
    cin >> S;
    dp[0][0] = 1;

    rep(i, 0, S.size()){
        rep(j, 0, 4){
            if(S[i] != '?'){
                add(dp[i+1][j], dp[i][j]);
            }else{
                add(dp[i+1][j], dp[i][j] * 3LL % MOD);
            }
        }
        if (S[i] == 'A' || S[i] == '?'){
            add(dp[i+1][1], dp[i][0]);
        }
        if (S[i] == 'B' || S[i] == '?'){
            add(dp[i+1][2], dp[i][1]);
        }
        if (S[i] == 'C' || S[i] == '?'){
            add(dp[i+1][3], dp[i][2]);
        }

    }

    cout << dp[S.size()][3] << endl;
    return 0;
    /*
    vector<int> nb;
    rep(i, 0, S.length()){
        int t;
        if(i==0){t=0;}else{t=nb[i-1];}
       nb.push_back(t + ((S[i] == 'B') ? 1 : 0));
    }
    vector<int> nc;
    rep(i, 0, S.length()){
        if(S[i] == 'C'){
            nc.push_back(i);
        }
    }

    rep(i, 0, S.length()){
        if(S[i] == 'A'){
            rep(j, 0, nc.size()){
                if(i<nc[j]){
                    ans += nb[nc[j]] - nb[i];
                }
            }
        }
    }
    */ 
   
}




Measured memory_bytes: 3584
def main():
    N, *AB = map(int, open(0).read().split())
    ans = 0
    for i in range(N - 1, -1, -1):
        a = AB[i * 2 + 0]
        b = AB[i * 2 + 1]
        ans += (b - a - ans) % b
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 25124
N, K = map(int, input().split())
A = list(map(int, input().split()))
for i in range(min(K,300)):
    imos = [0]*(N+1)
    for i, ai in enumerate(A):
        imos[max(0, i-ai)] += 1
        imos[min(N, i+ai+1)] -= 1
    A = [imos[0]]
    for i in range(1, N):
        A += [imos[i]+A[i-1]]
print(' '.join(map(str, A)))

Measured memory_bytes: 190136
n=int(input())
h=list(map(int,input().split()))

maxx=0
cnt=0

for i in range(1,n):
    if h[i-1]>=h[i]:
        cnt=cnt+1
        if i==n-1:
            maxx=max(maxx,cnt)
            break
    else:
        maxx=max(maxx,cnt)
        cnt=0

print(maxx)

Measured memory_bytes: 63984
import numpy as np
H, W = map(int, input().split())
S = np.zeros((H,W))
for i in range(H):
    Si = np.array([int(s == '.') for s in input()])
    S[i] = Si
    
top = S.copy()
bottom = S.copy()
left = S.copy()
right = S.copy()

for i in range(1, H):
    top[i] = (top[i-1] + 1) * S[i]
    bottom[-i-1] = (bottom[-i] + 1) * S[-i-1]

for j in range(1, W):
    left[:,j] = (left[:,j-1] + 1) * S[:,j]
    right[:,-j-1] = (right[:,-j] + 1) * S[:,-j-1]

print(np.max((top + bottom + left + right - 3).astype(np.int)))

Measured memory_bytes: 246324
#include<bits/stdc++.h>
using namespace std;
#define BIG 1000000007
#define ll long long int
int main(){
  int n;
  string s;
  int ans=0,cnt=0;
  int a[26];
  cin>>n>>s;
  for(int i=0;i<n;i++){
    cnt=0;
    for(int j=0;j<26;j++){
      a[j]=0;
    }
    for(int j=0;j<i;j++){
      a[s[j]-97]=1;
    }
    for(int j=i;j<n;j++){
      if(a[s[j]-97]==1){
	cnt++;
	a[s[j]-97]=0;
      }
    }
    ans=max(ans,cnt);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;

class Program
{
    static void Main()
    {
        Scanner cin = new Scanner();
        //Random rnd = new Random();
        //Stopwatch sw = new Stopwatch();
        int A = cin.Nextint;
        int B = cin.Nextint;
        int C = cin.Nextint;


        /** ここに記述 */
        bool result = C >= A && C <= B;
        Console.WriteLine(result ? "Yes" : "No");
        Console.Out.Flush();
    }
}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return Console.ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length)
            {
                return s[i++];
            }
            string st = Console.ReadLine();
            while (st == "")
            {
                st = Console.ReadLine();
            }

            s 
            = st.
                Split
                (cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

Measured memory_bytes: 11092