akhauriyash/Code-Regression huggingface dataset:
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include "boost/multi_array.hpp"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) int __VA_ARGS__; in(__VA_ARGS__)
//オーバーフロー対策
#define INL(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#pragma endregion RegionDefs

#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using Bint = boost::multiprecision::checked_cpp_int;
Bint modpow(Bint a, Bint n, Bint mod)
{
    Bint res = 1;
    while (n > 0)
    {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int f(int n)
{
    if (n == 0) return 1;
    return n * f(n-1);
}

const int MAX = 1000000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

void solve()
{
    COMinit();
    IN(x, y);
    if ((x+y) % 3 != 0)
    {
        cout << 0 << endl;
        return;
    }
    int n = (x+y)/3;
    int k = n/2-abs(x-y)/2;
    cout << COM(n, k) << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

 int main(){
   int D, N;
   cin >> D >> N;
   int x;
   if(D == 0)  x = 1;
   else if(D == 1) x = 100;
   else if(D == 2) x = 10000;
   int ans;
   if(N < 100) ans = x * N;
   else if (N == 100) ans = x * 101;
   print(ans); 
 }

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

int main(void){
    int K;
    string S;
    cin >> K;
    cin >> S;
    if(S.size() <= K){
        cout << S << endl;
    }else{
        cout << S.substr(0, K)+"..." << endl; 
    }
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>


int main(void)
{

 int s, a, b, c;

 scanf("%d", &s);

 a = s / 3600;
 b = (s % 3600) / 60;
 c = (s % 3600) % 60; 

 printf("%d:%d:%d\n", a, b, c);

 return 0;
}

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

int main(){
    int a,b,c,res=0;
    scanf("%d%d%d", &a, &b, &c);
    if(a!=b)
        res++;
    if(a!=c)
        res++;
    if(b!=c)
        res++;
    if(res==0)
        res++;
    printf("%d", res);
return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for(int (i)=0;(i)<(n);(i)++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
bool custom1 (pair<int, int> a, pair<int, int> b) {
  return (a.first < b.first);
}
bool custom2(pair<int, int> a, pair<int, int> b) {
  return (a.second < b.second);
}

const int MAX = 200005;
const long long MOD = 1000000007;
const long long MODMOD = 998244353;
const double PI = acos(-1);

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

long long gcd(long long a, long long b) {
  if(a % b == 0) return b;
  else return gcd(b, a % b);
}
int main() {
  int a, b;
  cin >> a >> b;
  int ans = -1;
  rep(i, 10000) {
    int a_exp = floor((double)i * 1.08) - i;
    int b_exp = floor((double)i * 1.10) - i;
    if(a_exp == a && b_exp == b) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define Mini 1
#define Maxes 10000000000

int main(){
  int a,b,c,r;
  scanf("%d %d",&a,&b);

  if(Mini<=a && Maxes>=a){
    if(Mini<=b && Maxes>=b){
      if(a<b){
	c=a;
	a=b;
	b=c;}
      r=a%b;     
      while(r!=0){
	a=b;
	b=r;
	r=a%b;
      }
      printf("%d\n",b);
    }
    else printf("入力範囲外です\n");
  }
  else printf("入力範囲外です\n");
  return 0;
}



Measured memory_bytes: 2140
program sample
    implicit none
    character(1)::s(3)
    integer(8) :: i,j,m,n,p,x,t(4)
    integer(8),allocatable :: y(:)
  
    read(*,*) n
    t(1)=n/1000
    n=n-t(1)*1000
    t(2)=n/100
    n=n-t(2)*100
    t(3)=n/10
    t(4)=n-t(3)*10
    s(:)='+'
    
    do i=0,8
        x=t(1)
        m=i
        if (mod(m,2)==0)then
            s(3)='-'
            x=x-t(4)
        else
            s(3)='+'
            m=i-1
            x=x+t(4)
        end if
        
        if (mod(m,4)==0)then
            s(2)='-'
            x=x-t(3)
        else
            s(2)='+'
            m=m-2
            x=x+t(3)
        end if
        if (mod(m,8)==0)then
            s(1)='-'
            x=x-t(2)
        else
            s(1)='+'
            x=x+t(2)
        end if
        if (x==7)then
            write(*,'(i1.1,a,i1.1,a,i1.1,a,i1.1,a)')t(1),s(1),t(2),s(2),t(3),s(3),t(4),'=7'
            stop
        end if
    end do

    stop
end program sample
  



Measured memory_bytes: 2840
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>

using namespace std;

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  int tmp = 0;
  tmp = a * 100 + b * 10 + c;
  if(tmp % 4 == 0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


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

int main(){
    Init();
    ll n; cin >> n;
    vi a(n+1, 0);
    rep(i, n) cin >> a[i];

    // i番のカードについて、i-1, i, i+1のいずれか2枚でペアを作ることができる。
    ll sum = 0;
    rep(i, n){
        if(a[i] == 0) continue;
        sum += a[i]/2;
        a[i] %= 2;
        if(a[i] == 1 && a[i+1] >= 1) sum++, a[i+1]--;
    }
    cout << sum << endl;
}

Measured memory_bytes: 3972
n,m,k = map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
 
asum=[0]
bsum=[0]
for i in range(n):
    asum.append(asum[i]+a[i]) #机aからi冊読んだ時間の合計
for i in range(m):
    bsum.append(bsum[i]+b[i]) #机bからi冊読んだ時間の合計
 
t=0
for i in range(n+1):
    if asum[i]>k: #机aからi冊読めるか検討
        break
    now=k-asum[i] #机aからi冊読んだ後の残り時間
    while bsum[m]>now:
        m-=1 #机bのm冊の本で何冊削るか検討
    if t<i+m:
        t=i+m #iが増えてもmが変わらないとき
        
print(t)

Measured memory_bytes: 47336
#include<bits/stdc++.h>
using namespace std;
int n,m,l,k,s,t,d[100][100];

void ch(){
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      for(int k=0;k<n;k++)d[j][k]=min(d[j][k],d[j][i]+d[i][k]); 
}

int main(){
  while(cin>>n>>m>>l>>k>>s>>t,n){
    vector<int> v;
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)d[i][j]=(i==j?0:1e9);
    bool e[100]={};
    e[s]=e[t]=1;
    for(int i=0,x;i<l;i++)cin>>x,e[x]=1;
    for(int i=0,x,y,c;i<k;i++)cin>>x>>y>>c,d[x][y]=c,d[y][x]=c;
    ch();
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)
	if(!e[i]||!e[j]||d[i][j]>m)d[i][j]=1e9;
    ch();
    if(d[s][t]==1e9)cout<<"Help!"<<endl;
    else if(d[s][t]<m)cout<<d[s][t]<<endl;
    else cout<<d[s][t]*2-m<<endl;
  }
  return 0;
}


Measured memory_bytes: 3072
#include<bits/stdc++.h>
 
int main()
{
    long long a,b,k;
    std::cin >> a >> b >> k;
    long long aa = a;
    a = std::max((long long)0,a - k);
    if(a == 0){
        b -= k - aa;
        b = std::max((long long)0,b);
    }
    std::cout << a << " " << b << std::endl;
 
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<unsigned long long int>;

int main(void) {
    Int a, b;
    cin >> a >> b;
    if (a % 2 == 1 && b % 2 == 1) {
        cout << "Odd" << endl;
    } else {
        cout << "Even" << endl;
    }
    return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>
#include<stdlib.h>

int main(){
	
	int N,i,ans=1,k=0,A[100010];
	
	scanf("%d",&N);
	
	for(i=1;i<=N;i++){
		scanf("%d",&A[i]);
	}
	
	for(i=1;i<=N-1;i++){
		if(k==0&&A[i+1]!=A[i]){
			k=(A[i+1]-A[i])/abs(A[i+1]-A[i]); //符号//
		}
		
		if(k*(A[i+1]-A[i])<0){
			ans++;
			k=0;
		}
		
		
	}
	
	printf("\n%d\n\n",ans);
	
	
	
	
	return 0;
}

Measured memory_bytes: 512
N, M = map(int, input().split())
a = set(int(input()) for _ in range(M))
dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
    dp[1] = 1

for i in range(2, N + 1):
    for k in [-2, -1]:
        if i + k not in a:
            dp[i] += dp[i+k]
    dp[i] %= 1000000007

print(dp[N])


Measured memory_bytes: 58200
#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
   int n,k,i,j,l=0;
   scanf("%d%d",&n,&k);
   while(n>0){

    n=n/k;
    l++;
    //printf("n=%d l=%d\n", n,l);
   }
   printf("%d",l);

   return 0;

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;

// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;

int main ()
{
  prep();
  string s;
  cin >> s;
  int savedp = 0;
  int points = 0;
  for (int i=0; i<s.size(); i++){
      char cur = s[i];
      if (cur == 'p'){
          if (savedp){
              savedp--;
          }else{
              savedp++;
              points--;
          }
      }else{
          savedp++;
      }
  }
  points += savedp/2;
  cout << points;
  return 0; 
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
using namespace std;
using ll =long long;

int main (void) {
  string s,ans;
  cin >> s;
  for (int i=0; i<s.size(); i++) {
    if(s[i]=='B'){
      if(ans.size()<1) continue;
      else ans.pop_back();
    }
    else {
      ans=ans+s[i];
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a[5];
  for(int i=0;i<3;i++){
    cin>>a[i];
  }
  sort(a,a+3);
  cout<<a[2]-a[1]+a[1]-a[0]<<endl;
  return(0);
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int arr[] = new int[M];
		int sumday = 0;
		for (int i = 0; i < arr.length; i++) {
			arr[i] = sc.nextInt();
			sumday += arr[i];
		}

		if (sumday>N) {
			System.out.println(-1);
		} else {
			System.out.println(N-sumday);
		}
		sc.close();
    }	
		
}

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

using namespace std;
const int qq = 1e5 + 10;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 10;
int num[qq];

#define LL long long
#define mst(a, b)	memset(a, b, sizeof a)

int main() {
	int n;	scanf("%d", &n);
	int cnt1, cnt2;
	cnt1 = cnt2 = 0;
	for(int i = 0; i < n; ++i) {
		scanf("%d", num + i);
		if(num[i] >= 0)	cnt1++;
		else	cnt2++;
	}
	if (cnt1 == n) {
		printf("%d\n", n - 1);
		for(int i = 1; i < n; ++i) {
			printf("%d %d\n", i , i + 1);
		}
		return 0;
	}
	if (cnt2 == n) {
		printf("%d\n", n - 1);
		for(int i = n; i >= 2; --i) {
			printf("%d %d\n", i, i - 1);
		}
		return 0;
	}
	int id1 = max_element(num, num + n) - num;
	int id2 = min_element(num, num + n) - num;
//	printf("%d %d\n", id1, id2);
	printf("%d\n", n - 1 + n - 1);
	if (num[id1] >= -num[id2]) {
		for(int i = 0; i < n; ++i) {
			if(i == id1)	continue;
			printf("%d %d\n", id1 + 1, i + 1);
		}
		for(int i = 1; i < n; ++i) {
			printf("%d %d\n", i, i + 1);
		}
	} else {
		for(int i = 0; i < n; ++i) {
			if(i == id2)	continue;
			printf("%d %d\n", id2 + 1, i + 1);
		}
		for(int i = n; i >= 2; --i) {
			printf("%d %d\n", i, i - 1);
		}
	}
	return 0;
}

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

int kazu(string s, char c){
    int num = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == c)
            num++;
    }
    return (num);
}

int main() {
    int ans;
    string s;
    int r, b;
    cin >> s;
    r = kazu(s, '0');
    b = kazu(s, '1');
    ans = min(r, b) * 2;
    cout << ans << endl;
    return (0);
}


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

int main(void){
    int n;
    cin>>n;
    int ac=0,wa=0,tle=0,re=0;
    for (int i = 0; i < n; i++)
    {
        string s;
        cin>>s;
     if (s=="AC"){ac++;}
     else if (s=="WA"){wa++;}
     else if (s=="TLE"){tle++;}
     else if (s=="RE"){re++;}
    }
     
     cout<<"AC x "<<ac<<endl;
     cout<<"WA x "<<wa<<endl;
     cout<<"TLE x "<<tle<<endl;
     cout<<"RE x "<<re<<endl;
     
     return 0;

}

Measured memory_bytes: 3228
use std::io;
use std::cmp::{min, max};

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let a = v[0];
	let b = v[1];
	let c = v[2];
	let d = v[3];
	let mut pusht = 0;
	if !(c > b || d < a) {
		pusht = min(d, b) - max(a, c);
	}
	println!("{}", pusht);
}

Measured memory_bytes: 4352
import math
import heapq
from collections import Counter

#N,K=map(int, input[].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N=int(input())
cnt=0
for i in range(1,N+1):
    if len(str(i))%2 != 0:
        cnt+=1
        
print(cnt)

Measured memory_bytes: 3316
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n,k,s=gsmi
if s==10**9
  ans=[s]*k+[1]*(n-k)
  putsend ans.join(" ")
end

ans=[s]*k+[10**9]*(n-k)

puts ans.join(" ")

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

int main() {
  int N,s,i,l;
  cin >> N;
  s = N % 10 ;
  l = N;
  for (i=0; i<9; i++){
    N /= 10;
    s += N % 10;
    
  }
  if(l % s == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
  

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String args[]){
		
		Scanner ob = new Scanner(System.in);
		int D = ob.nextInt();
		int T = ob.nextInt();
		int S = ob.nextInt();
		int sum = 0;

		for(int i = 1; i <= T; i++){
			sum += S;
		}

		System.out.println((sum < D) ? "No" : "Yes");
		
		ob.close();
	}
}


Measured memory_bytes: 35860
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n) ; ++i)
#define sz(v) (ll)(v).size()
#define int long long

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int a, b; cin >> a>> b;
        int g = __gcd(a, b);
        int sq = g;
        set<int> st;
        for (int i = 2; i * i <= sq; i++) {
                while ( g % i == 0 ) { st.insert(i); g /= i; }
        }
        if (g > 1) st.insert(g);
        cout << st.size()+1;
return 0;
}


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

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << setprecision(10);

    int k, x;
    cin >> k >> x;
    const int money = 500 * k;
    if (money >= x)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int main()
{
    string s,t;
    cin >> s >> t;
    int c = 0;
    while(s != t && c < 105)
    {
        swap(s[s.length()-1],s[0]);
        for(int i = 1;i < s.length();i++)
            swap(s[i],s[s.length()-1]);
        c++;
    }
    if(c == 105)
        cout << "No";
    else
        cout << "Yes";
}


Measured memory_bytes: 256
# frozen_string_literal: true

def gudge(arr)
  return true if arr.size == 1
  (arr.size - 2).downto(0).each do |idx|
    border = arr[idx] - arr[idx + 1]
    return false if border > 1
    arr[idx] -= 1 if border == 1
  end
  true
end

STDIN.gets
input_h = STDIN.gets.split.map(&:to_i)
puts gudge(input_h) ? 'Yes' : 'No'


Measured memory_bytes: 8580
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
signed main(){
	int n,a,b;
	cin>>n>>a>>b;
	vector<int> pos;
	for(int i=0;i<n;i++){
		int x; cin>>x; pos.pb(x);
	}
	int ans = 0;
	for(int i=1;i<n;i++){
		ans += min( a * (pos[i] - pos[i-1]) , b );
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
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 long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    ll x, y; cin >> x >> y;
    int count = 0;
    while(x <= y)
    {
        x *= 2; //O(log n)
        count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc153/tasks/abc153_c
import java.lang.Math.*
import java.util.*

fun main(args: Array<String>) {
    val scn = Scanner(System.`in`)
    val N = scn.nextInt()
    var K = scn.nextInt()

    if(N<K) K = N

    var H = mutableListOf<Double>()
    for(h in 1..N){
        H.add(scn.nextDouble())
    }

    H.sortDescending()
    for(k in 0..K-1){
        H[k] = 0.0
    }

    var sum = 0.0
    for(i in 0..N-1){
        sum += H[i]
    }

    println(String.format("%.0f",sum))
}

Measured memory_bytes: 125888
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define INF (1LL<<62)
#define MX 100005*3

LL a[MX];
LL ma[MX];
LL mi[MX];

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

    for (int i=1;i<=3*n;i++)
        scanf("%lld",&a[i]);
    priority_queue <LL> Q;
    LL sum = 0;
    for (int i=1;i<=2*n;i++)
    {
        Q.push(-a[i]);
        sum+=a[i];

        if (i>n) sum += Q.top(),Q.pop();
        ma[i]=sum;
    }

    while (!Q.empty()) Q.pop();
    sum=0;
    for (int i=3*n;i>=n+1;i--)
    {
        Q.push(a[i]);
        sum+=a[i];

        if (i<=2*n) sum -= Q.top(),Q.pop();
        mi[i]=sum;
    }

    LL ans = -INF;
    for (int i=n;i<=2*n;i++)
        ans = max (ans, ma[i]-mi[i+1]);
    cout<<ans<<endl;
    return 0;
}


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

#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
#define debug(x) cerr << #x << ": " << x << endl
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1e9, MOD = INF + 9;
 
/////////////////////////////////////////////////////////////////////
 
const int N = 5e1 + 5, SGM = 26;

int CNT[SGM], TMP[SGM];

int main() {
 
	sync;

	int n; cin >> n;
	for (int i = 0; i < SGM; i++) CNT[i] = INF;
	for (int i = 0; i < n; i++) {
		string s; cin >> s;
		for (int i = 0; i < SGM; i++) TMP[i] = 0;
		for (char c : s) TMP[c - 'a']++;
		for (int i = 0; i < SGM; i++) CNT[i] = min(CNT[i], TMP[i]);
	}
	for (int i = 0; i < SGM; i++) for (int j = 0; j < CNT[i]; j++) cout << (char)('a' + i);
	cout << endl;


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(n);++i)

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

  int w[N], v[N];
  rep(i, N) {
    cin >> w[i] >> v[i];
  }
  // dp[i][w] = i番目(1-idx)までで、重さの総和がw以下になるよう入れたときの最大値
  // ぱっと見は「dp[N][W]はちょうど重さがWになるケースしか考慮してない」ように見えるが、
  // ちゃんとWを超えていない場合の最大値になっている
  // 1つ目をつめるときのループを考えると、マージンをとっているので、このdpは正確には
  // 「価値が0、重さが0〜W」の品物も含んでいるのと同値
  // よって、ちゃんと答えが求まる

  ll dp[N+1][W+1];
  rep(i, N+1) rep(w, W+1) dp[i][w] = 0;
  rep(i, N) {
    rep(j, W+1) {
      dp[i+1][j] = dp[i][j];
      if (j >= w[i]) {
        dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]] + v[i]);
      }
    }
  }
  cout << dp[N][W] << endl;

  return 0;
}


Measured memory_bytes: 79104
/*
教练我想打ACM！
*/
#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char c = getchar();
  int x = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
typedef long long ll;
typedef long double ld;

const int inf = 0x3f3f3f3f;
const int maxn = 100000 + 20;

int n, k;
int a[maxn], b[maxn];
vector< pair< int, int > > v;
int main() {
  n = read(); k = read();
  ll ans = 0;
  int x, y;
  for (int i = 0; i < n; ++i) {
    x = read(); y = read();
    v.push_back({x, y});
    if ((x & k) == x) {
      ans += y;
    }
  }
  for (int i = 30; i >= 0; --i) if (1 & (k >> i)) {
    int t = (k ^ (1 << i)) | ((1 << i) - 1);
    ll tmp = 0;
    for (int i = 0; i < n; ++i) {
      if ((v[i].first & t) == v[i].first) {
        tmp += v[i].second;
      }
    }
    ans = max(ans, tmp);
  }
  printf("%lld\n", ans);
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long a, b, n;
  cin >> a >> b >> n;
  long long k = min(b - 1, n);
  long long left = a * k / b;
  long long right = a * (k / b);
  cout << left - right << '\n';
  return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>
#include<stdlib.h>

struct node {
	int val;
	struct node* next;
};
struct node* a[100005];
void insert (int u,int v) {
        struct node* q;
        q=(struct node*)malloc(1*sizeof(struct node));
        q->val=v;
        q->next=NULL;
        if(a[u]==NULL)
                a[u]=q;
        else {
                struct node* p;
                p=a[u];
                q->next=p;
                a[u]=q;
        }
}

int max(int a, int b)
{
    if(a<b)
        return b;
    else
        return a;
}

int main()
{
    int m,n,u,v,visited[100005],arr[1000005],count[100005],count2[100005],j,maxi,i,l,r;
    struct node* p;
    scanf("%d %d",&n,&m);
    for(i=1;i<=n;i++)
    {
        visited[i]=0;
        count[i]=0;
        count2[i]=0;
    }
    for(i=0;i<m;i++)
    {
        scanf("%d %d",&u,&v);
        count2[v]++;
        insert(u,v);
    }
    for(i=1;i<=n;i++)
    {
        l=0,r=-1;
        if(count2[i]==0 && visited[i]==0)
        {
            visited[i]=1;
            p=a[i];
            while(p!=NULL)
            {
                count2[p->val]--;
                if(count2[p->val]==0)
                {
                    arr[++r]=p->val;
                }
                count[p->val]=max(count[p->val],count[i]+1);
                p=p->next;
            }
            while(l<=r)
            {
                j=arr[l];
                visited[j]=1;
                p=a[j];
                while(p!=NULL)
                {
                    count2[p->val]--;
                    if(count2[p->val]==0)
                    {  
                        arr[++r]=p->val;
                    }
                    count[p->val]=max(count[p->val],count[j]+1);
                    p=p->next;
                }
                l++;
            }
        }
    }
    maxi=-1;
    for(i=1;i<=n;i++)
    {
        if(count[i]>maxi)
        {
            maxi=count[i];
        }
    }
    printf("%d\n",maxi);
}

Measured memory_bytes: 7084
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define REPI(i, a, b) for (ll (i) = (a); (i) < (b); (i)++)
#define int long long
using namespace std;
using P = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;

int N;
VI p, x;
VVI child;

vector<P> dist;
int dfs(int v) {
  if (dist[v].first != -1) {
    return dist[v].first;
  }
  if (v == 0) {
    return dist[v].first = 0;
  }
  return dist[v].first = (dfs(p[v]) + 1);
}

void solve() {
  dist = vector<P>(N, {-1, 0});
  REP (i, N) {
    dist[i].second = i;
  }
  REP (i, N) {
    dfs(i);
  }
  sort(dist.begin(), dist.end(), greater<P>());

  VI y(N, 0);
  REP (i, N) {
    int v = dist[i].second;
    VVI dp(child[v].size()+1, VI(x[v]+1, 0));
    dp[0][0] = 1;
    REP (j, child[v].size()) {
      REP (k, x[v]+1) {
        if (k - x[child[v][j]] >= 0 && dp[j][k - x[child[v][j]]]) {
          dp[j+1][k] = 1;
        }
        if (k - y[child[v][j]] >= 0 && dp[j][k - y[child[v][j]]]) {
          dp[j+1][k] = 1;
        }
      }
    }
    int change = -1;
    for (int k = x[v]; k >= 0; k--) {
      if (dp[child[v].size()][k]) {
        change = k;
        break;
      }
    }
    if (change == -1) {
      cout << "IMPOSSIBLE" << endl; return;
    }
    int sum = 0;
    REP (j, child[v].size()) {
      sum += x[child[v][j]];
      sum += y[child[v][j]];
    }
    y[v] = sum - change;
  }
  cout << "POSSIBLE" << endl;
}

signed main() {
  cin >> N;
  p = VI(N); x = VI(N);
  child = VVI(N);
  REP (i, N-1) {
    cin >> p[i+1]; p[i+1]--;
    child[p[i+1]].push_back(i+1);
  }
  REP (i, N) {
    cin >> x[i];
  }

  solve();
}


Measured memory_bytes: 2412
#include <bits/stdc++.h>
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int N;
  string S;
  cin >> N >> S;

  int cnt=0;
  for(int i=0;i<N;i++)  if(S.at(i)=='R')  cnt++;
  int ans=0;
  for(int i=0;i<cnt;i++)  if(S.at(i)=='W')  ans++;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3772
#include <iostream>
//#include <set>
//#include <map>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
#include <vector>
//#include <string>
//#include <list>
//#include <deque>
//#include <unordered_map>
//typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 200100
//#define NIL -1

int main() {
    vector<vector<int>> c(3, vector<int>(3));
    bool ans=true;
    
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            cin >> c[i][j];
        }
    }

    for(int i=1; i<3; i++){
        int tmp1 = c[0][0]-c[i][0];
        for(int j=1; j<3; j++){
            int tmp2 = c[0][j]-c[i][j];
            if(tmp1!=tmp2){
                ans=false;
            }
        }
    }

    for(int i=1; i<3; i++){
        int tmp1 = c[0][0]-c[0][i];
        for(int j=1; j<3; j++){
            int tmp2 = c[j][0]-c[j][i];
            if(tmp1!=tmp2){
                ans=false;
            }
        }
    }

    if(ans==true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.lang.*;
public class Main{	
public static void main(String[] args) throws FileNotFoundException, IOException{
        Scanner s = new Scanner(System.in);
         StringBuilder sb=new StringBuilder();
         BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out));
         int n=s.nextInt();
        int[][] act=new int[n+1][3];
        int[][] dp=new int[n+1][3]; 
        for(int i=1;i<=n;i++){
            act[i][0]=s.nextInt();act[i][1]=s.nextInt();act[i][2]=s.nextInt();
        }
        for(int i=1;i<=n;i++){
                dp[i][0]=Math.max(dp[i][0],dp[i-1][1]+act[i][0]);
                dp[i][0]=Math.max(dp[i][0],dp[i-1][2]+act[i][0]);
                dp[i][1]=Math.max(dp[i][1],dp[i-1][0]+act[i][1]);
                dp[i][1]=Math.max(dp[i][1],dp[i-1][2]+act[i][1]);
                dp[i][2]=Math.max(dp[i][2],dp[i-1][0]+act[i][2]);
                dp[i][2]=Math.max(dp[i][2],dp[i-1][1]+act[i][2]);
        }

        System.out.println(Math.max(dp[n][0],Math.max(dp[n][1],dp[n][2])));
    }
}

Measured memory_bytes: 103568
#include <iostream>
using namespace std;
#define MAX 100005
#define NIL -1

struct Node
{
    int parent, left, right;
};

struct Node T[MAX];
int n, D[MAX];

int rec(int u, int deep)
{
    D[u] = deep;
    if (T[u].right != NIL)
        rec(T[u].right, deep);
    if (T[u].left != NIL)
        rec(T[u].left, deep + 1);
}

void print(int u)
{
    int i, c;
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].parent << ", ";
    cout << "depth = " << D[u] << ", ";

    if (T[u].parent == NIL)
        cout << "root, ";
    else if (T[u].left == NIL)
        cout << "leaf, ";
    else
        cout << "internal node, ";

    cout << "[";
  
    for (i = 0, c = T[u].left; c != NIL; i++, c = T[c].right)
    {
        if (i)
            cout << ", ";
        cout << c;
    }
    cout << "]" << endl;
}

int main()
{
    int i, j, d, v, c, l, r;
    cin >> n;
    for (i = 0; i < n; i++)
        T[i].parent = T[i].left = T[i].right = NIL;

    for (i = 0; i < n; i++)
    {
        cin >> v >> d;
        for (j = 0; j < d; j++)
        {
            cin >> c;
            if (j == 0)
                T[v].left = c;
            else
                T[l].right = c;
            l = c;
            T[c].parent = v;
        }
    }

    for (i = 0; i < n; i++)
        if (T[i].parent == NIL)
            r = i;

    rec(r, 0);

    for (i = 0; i < n; i++)
        print(i);

    return 0;
}


Measured memory_bytes: 7768
/** ３つの整数a b cを読み込みaからbまでの整数の中に、
 * cの約数がいくつあるかを求めるプログラムを作成してください。
 */

/**sucannerクラス使うためにインポート
 */
import java.util.Scanner;

class Main {
	/*
	 * プログラムのエントリポイント
	 */
	public static void main(String[] args) {
		// 入力ストリームの生成
		Scanner sc = new Scanner(System.in);
		// 数字を３つ受け取る
		int inta = sc.nextInt();
		int intb = sc.nextInt();
		int intc = sc.nextInt();
		// 約数の数を決める変数
		int yakusuu = 0;

		//
		for (int i = inta; i <= intb; i++) {

			if (intc % i == 0) {
				yakusuu++;
			}
		}
		System.out.println(yakusuu);
	}
}

Measured memory_bytes: 17232
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
const int inf = 10e9 + 7;
#define int long long
#define rep(i,n) for(int i=1;i<=n;i++)
#define loop(i,m,n) for(int i=m;i<n;i++)
#define endre getchar(); getchar();return 0;
int a[200010], b[200010] = {};
pair<int, int>p[200010];
signed main() {
	int n, m;
	cin >> n >> m;
	rep(i, m) {
		cin >> p[i].first >> p[i].second;
	}
	rep(i, m) {
		if (p[i].first == 1) { b[p[i].second]++; }
		else if (p[i].second == n) { b[p[i].first]++; }
	}
	rep(i, n) {
		if (b[i] == 2) { cout << "POSSIBLE" << endl; endre; }
	}
	cout << "IMPOSSIBLE" << endl;
	endre;
}

Measured memory_bytes: 6400
#include <bits/stdc++.h>
#define ll long long
#define rep(i,j) for(int i=0;i<j;i++)
using namespace std;
int main(void)
{
	ll N;
	int v[50];
	double ans;
  
	cin>>N;
	rep(i,N) cin>>v[i];
  
	sort(v,v+N);
  
	ans=v[0];
	rep(i,N-1){
		ans=(ans+v[i+1])/2.0;
	}
  
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <ctime>
#include <cassert>
#include <unordered_map>
#include <fstream>
#include <random>
#include <cstring>
#include <bitset>
#include <functional>
#include <tuple>
#include <complex>

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;

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

const ll INF = 1e18;

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

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout); 

    
    int n;
    cin >> n;

    vector<ll> a(n);
    vector<ll> pref(n + 1);

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

    int l = 0, r = 2;

    ll ans = INF;

    for (int i = 2; i < n - 1; ++i) {
        while (2 * pref[l] < pref[i]) {
            ++l;
        }

        while (2 * (pref[r] - pref[i]) < pref[n] - pref[i]) {
            ++r;
        }


        for (int x = -1; x <= 0; ++x) {
            for (int y = -1; y <= 0; ++y) {
                l += x;
                r += y;

                if (l != 0 && l != i && i != r && r != n) {
                    // cout << l << " " << i << " " << r << endl;
                    vector<ll> p = {pref[l], pref[i] - pref[l], pref[r] - pref[i], pref[n] - pref[r]};
                    ll maxx = p[0], minn = p[0];
                    for (int j = 1; j < 4; ++j) {
                        maxx = max(maxx, p[j]);
                        minn = min(minn, p[j]);
                    }
                    ans = min(ans, maxx - minn);
                }
                    
                l -= x;
                r -= y;
            }
        }
    }

    cout << ans << endl;
    return 0;
}

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

g_count = 0
k_count = 0

for i in range(1, N+1):
    if i % K == 0:
        g_count += 1
    
    elif i % K == K/2:
        k_count += 1

print(g_count**3 + k_count**3)

Measured memory_bytes: 3060
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    N = I()

    k = int((2*N)**0.5)+1
    if k*(k-1)//2==N:
        ans = [[] for _ in range(k)]
        num = 1
        # 層
        for i in range(k-1):
            for j in range(i+1):
                ans[j].append(num)
                ans[i+1].append(num)
                num += 1
        print('Yes')
        print(k)
        for i in ans:
            print(k-1, *i)
    else:
        print('No')

# N=6のとき
#     (1, 2, 4),
#     (1, 3, 5),
#     (2, 3, 6),
#     (4, 5, 6)

if __name__ == '__main__':
    resolve()

Measured memory_bytes: 9344
import java.util.*;

public class Main {

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

        String x = sc.next();

        StringBuilder sb1 = new StringBuilder();

        for (int i = 0; i < x.length(); i++) {
            if (x.charAt(i) == '?') {
                sb1.append("D");
            } else {
                sb1.append(x.charAt(i));
            }
        }

        System.out.println(sb1);

        sc.close();
    }

}


Measured memory_bytes: 41836
#include<stdio.h>
#include<stdlib.h>

typedef struct{
  int parent;
  int leftch;
  int rightsib;
}Node;



int main(){

  int n,i,j,id,child,k,r,depth;
  Node *Tree;

  scanf("%d",&n);

  Tree = malloc(sizeof(Node)*n);

  for(i = 0 ; i < n ; i++){
    Tree[i].parent = -1;
    Tree[i].leftch = -1;
    Tree[i].rightsib = -1;
  }

  for(i = 0 ; i < n ; i++){
    scanf("%d%d",&id,&k);

    for(j = 0 ; j < k ; j++){

      scanf("%d",&child);
      Tree[child].parent = id;

      if(j == 0)
	Tree[id].leftch = child;
 else if(j > 0){
          Tree[r].rightsib = child;
        }
        r = child;
      }
    }
  
  

    for(j = 0 ; j < n ; j++){

      depth = 0;

      i = Tree[j].parent;

    while(i != -1){
      i = Tree[i].parent;
      depth++;
    }
    if(depth == 0){
      printf("node %d: parent = %d, depth = %d, root, ",j,Tree[j].parent,depth);
    }
    else if(Tree[j].leftch == -1){
      printf("node %d: parent = %d, depth = %d, leaf, ",j,Tree[j].parent,depth);
    }
    else{
      printf("node %d: parent = %d, depth = %d, internal node, ",j,Tree[j].parent,depth);
    }
  
    i = Tree[j].leftch;
    printf("[");
    if(i != -1){
      printf("%d",i);
    }
    while(i != -1){ 
      i = Tree[i].rightsib;
      
      if(i != -1){
        printf(", %d", i);
      }
    }
    printf("]\n");
    }
    return 0;
}

Measured memory_bytes: 1788
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: usize, a: [usize; n]};

    let mut base = a[0];
    let mut sum = 0;

    for &i in a.iter() {
        if base < i {
            base = i;
        } else {
            sum += base - i;
        }
    }

    println!("{}", sum)
}


Measured memory_bytes: 5584
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int h = int.Parse(Console.ReadLine());
            int w = int.Parse(Console.ReadLine());
            Console.WriteLine((n - h + 1) * (n - w+1));
        }
    }
}


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

#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)

static const int COUNTER_CLOCKWISE=1;
static const int CLOCKWISE=-1;
static const int ONLINE_BACK=2;
static const int ONLINE_FRONT=-2;
static const int ON_SEGMENT=0;

class Point {
public:
    double x,y;

    Point(double x=0,double y=0):x(x),y(y) {}
    Point operator + (Point p) {return Point(x+p.x,y+p.y);}
    Point operator - (Point p) {return Point(x-p.x,y-p.y);}
    Point operator * (double a) {return Point(a*x,a*y);}
    Point operator / (double a) {return Point(x/a,y/a);}

    double abs() {return sqrt(norm());}
    double norm() {return x*x+y*y;}

    bool operator<(const Point &p) const {
        return x!=p.x ? x<p.x : y<p.y;
    }
    bool operator==(const Point &p) const {
        return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
    }
};

typedef Point Vector;
struct Segment {Point p1,p2;};
typedef Segment Line;

class Circle {
public:
    Point c;
    double r;
    Circle(Point c=Point(),double r=0.0): c(c),r(r) {}
};

double dot(Vector a,Vector b) {
    return  a.x*b.x+a.y*b.y;
}

double cross (Vector a,Vector b) {
    return a.x*b.y-a.y*b.x;
}

double getDistance(Point a,Point b) {
    return (a-b).abs();
}

double getDistanceLP(Line l,Point p) {
    return abs(cross(l.p2-l.p1,p-l.p1)/(l.p2-l.p1).abs());
}

double getDistanceSP(Segment s,Point p) {
    if(dot(s.p2-s.p1,p-s.p1)<0.0) return (p-s.p1).abs();
    if(dot(s.p1-s.p2,p-s.p2)<0.0) return (p-s.p2).abs();
    return getDistanceLP(s,p);
}

int ccw(Point p0,Point p1,Point p2) {
    Vector a=p1-p0;
    Vector b=p2-p0;
    if(cross(a,b)>EPS) return COUNTER_CLOCKWISE;
    if(cross(a,b)<-EPS) return CLOCKWISE;
    if(dot(a,b)<-EPS) return ONLINE_BACK;
    if(a.norm()<b.norm()) return ONLINE_FRONT;
    return ON_SEGMENT;
}

int main(void) {
    Point p0,p1;
    cin>>p0.x>>p0.y>>p1.x>>p1.y;
    int q;cin>>q;
    while(q) {
        Point p2;
        cin>>p2.x>>p2.y;
        int ans=ccw(p0,p1,p2);
        if(ans==COUNTER_CLOCKWISE) cout<<"COUNTER_CLOCKWISE"<<endl;
        else if(ans==CLOCKWISE) cout<<"CLOCKWISE"<<endl;
        else if(ans==ONLINE_BACK) cout<<"ONLINE_BACK"<<endl;
        else if(ans==ONLINE_FRONT) cout<<"ONLINE_FRONT"<<endl;
        else cout<<"ON_SEGMENT"<<endl;
        q--;
    }
    return 0;
}

Measured memory_bytes: 3204
///بِسْمِ الّٰلهِ الرَّحْمٰنِ الرَحِيْمِ
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi acos(-1.0)
int main()
{
     ios_base::sync_with_stdio(false);cin.tie(NULL);
     ll int i,n,t,j=0,p,x,a=0,b,l=0,r=0,y,k,c,sum=0,m,d;
     cin>>n>>k;
     string s;
     cin>>s;
     s[k-1]=s[k-1]%65+97;
     cout<<s<<endl;

     return EXIT_SUCCESS;
}



Measured memory_bytes: 3592
//------ © daxkofficial™ ------//
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
 
#define ll long long
#define ld long double
#define all(x) (x).begin(), (x).end()
#define srt(x) sort((x).begin(), (x).end());
#define clr(x) memset(x, 0, sizeof(x))
#define mem(a,val) memset(a,val,sizeof(a))
#define trace(x) for(auto it:x) cout<<it<<' '; cout<<"\n";
#define sumv(x, w) for(auto it:x) w+=it;
#define traca(A, n) for(ll i=0; i<n; i++) cout<<A[i]<<' '; cout<<"\n";
#define pll pair<ll,ll>
#define vll vector<ll>
#define vvll vector<vll>
#define vb vector<bool>
#define vc vector<char>
#define vpll vector<pll>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define cy cout<<"YES"<<"\n";
#define cn cout<<"NO"<<"\n";
#define nl cout<<"\n";
#define chk cout<<"*\n";
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

/*-----------------------------Modular Arithmetic---------------------*/
inline ll add(ll x,ll y,ll mod){x+=y; if(x>=mod) return x-mod; return x;}
inline ll sub(ll x,ll y,ll mod){x-=y; if(x<0) return x+mod; return x;}
inline ll mul(ll x,ll y,ll mod){return (x*1ll*y)%mod;}
inline ll power(ll x,ll y,ll mod){ll ans=1; while(y){if(y&1) ans=mul(ans,x,mod); x=mul(x,x,mod); y>>=1;} return ans;}
inline ll inv(ll x,ll mod){return power(x,mod-2,mod);}
 
 
 
/*------------------------ Important Functions ----------------------------*/

ll gcd(ll a , ll b)
{
   if(b==0) return a;
   a%=b;
   return gcd(b,a);
}
 
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}
 
 
 
 
/*------------------------ Trouble begins here ----------------------------*/
 
 
const ll M=1e9+7, M2=998244353;
const ll N=1e5+100;




void solve()
{
    ll n;
    cin>>n;
    cout<<(n+1)%2;
    nl
    return;
}
 
 
 
int main()
{
        
    fastio
 
    ll tc=1;
    //cin>>tc;
    while(tc--)
    {

        //cout<<"ch\n";
        solve();
    }
 
    return 0;
}

Measured memory_bytes: 3652
def abc175_a():
    s = input()
    cnt = 0
    result = 0

    for i in range(len(s)):
        # 雨の日。カウントを増やして、maxを残す。
        if s[i] == 'R':
            cnt += 1
            result = max(result, cnt)
        # 晴れの日。カウンタは初期化。(maxは残っている。)
        else:
            cnt = 0

    print(result)

if __name__ == '__main__':
    abc175_a()

Measured memory_bytes: 9104
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <cassert>
#include <random>
#include <tuple>
#include <cstdint>

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

using namespace std;
typedef long long ll;

const int INF = INT32_MAX;
const int MOD = 1e9 + 7;

int main() {
    int n, k; cin >> n >> k;
    vector<int> h(n); rep(i, n) cin >> h[i];
    vector<int> dp(n+110, INF); dp[0] = 0;
    rep(i, n) rep(j, k) {
        if (i+j+1 < n) dp[i+j+1] = min(dp[i+j+1], dp[i] + abs(h[i] - h[i+j+1]));
    }

    cout << dp[n-1] << endl;


    return 0;
}

Measured memory_bytes: 1024
n=input()
k=int(input())

dp0=[[0]*(k+2) for i in range(len(n)+1)]

dp1=[[0]*(k+2) for i in range(len(n)+1)]
dp1[0][0]=1
# i桁まで見て j個の１から９を使ってn以下確定したもの　dp0[i][j]
#                                  確定していないもの　dp1[i][j]
for i in range(len(n)):
    for j in range(k+1):
        x=int(n[i])
        if x!=0:
            # 0を立てる
            dp0[i+1][j]+=dp0[i][j]+dp1[i][j]
            # 0以外を立てる
            dp0[i+1][j+1]+=dp0[i][j]*9
            if dp1[i][j]!=0:
                dp0[i+1][j+1]+=x-dp1[i][j]
            dp1[i+1][j+1]+=dp1[i][j]
        else:
            # 0を立てる
            dp0[i+1][j]+=dp0[i][j]
            dp1[i+1][j]+=dp1[i][j]
            # 0以外を立てる
            dp0[i+1][j+1]+=dp0[i][j]*9

print(dp0[-1][-2]+dp1[-1][k])

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

int main(){
    int n,odd=0;
    cin >> n;
    int a[n];
    rep(i,n){
        cin >> a[i];
        if(a[i]%2) odd++;
    } 
    if(odd%2==0) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 3964
#include <vector>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <iomanip>

using namespace std;


int main(void){
  
  
  int L;

  cin >> L;

  long double ans;

  ans = (long double)pow(L/3.0,3) ;

  cout << fixed << setprecision(7) << ans << endl;

  return 0;
}



Measured memory_bytes: 512