akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <vector>
#include <stack>
#include <map>
#define ri register
#define inf 0x7fffffff
#define E (1)
#define mk make_pair
#define int long long
using namespace std; const int N=100010;
inline int read()
{
	int s=0, w=1; ri char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-') w=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar(); return s*w;
}
void print(int x) {if(x<0) x=-x, putchar('-'); if(x>9) print(x/10); putchar(x%10+'0'); }
int n,k;
signed main()
{
	n=read(), k=read();
	if(k==1) {puts("0"); return 0; }
	int p=n%k, q=k-p;
	printf("%lld\n",min(p,q));
	return 0;
}

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

using namespace std;

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

  set<string> s;

  for(auto i = 0; i != n; ++i) {
    string str;
    cin >> str;
    s.insert(str);
  }

  cout << s.size() << endl;
  return 0;
}


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

int main() {
    int n, p, b, c = 0;
    cin >> n >> b;
    for(int i=2;i<=n;i++){
        cin >> p;
        if(b == i-1 || (i == n && p == i)){
            c++;
        }else{
            b = p;
        }
    } cout << c << endl;
	return 0;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc064/tasks/abc064_c
# C - Colorful Leaderboard
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = list(map(int, input().split()))

    etc, red = [], []
    for a in A:
        etc.append(a // 400) if (a // 400) < 8 else red.append(a // 400)

    ma = len(set(etc)) + len(red)
    mi = len(set(etc)) + 0 if len(set(etc)) != 0 else 1
    print(mi, ma)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 3064
//created by Whiplash99
import java.io.*;
import java.util.*;
public class Main
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

        int i,N;

        N=Integer.parseInt(br.readLine().trim());
        int c1=0,c2=0,c3=0,c4=0;
        for(i=0;i<N;i++)
        {
            String s=br.readLine().trim();
            if(s.equals("AC")) c1++;
            else if(s.equals("WA")) c2++;
            else if(s.equals("TLE")) c3++;
            else c4++;
        }

        System.out.println("AC x "+c1);
        System.out.println("WA x "+c2);
        System.out.println("TLE x "+c3);
        System.out.println("RE x "+c4);
    }
}

Measured memory_bytes: 42972
n,k = list(map(int, input().split()))
v = list(map(int, input().split()))

ans = -10**9
for back in range(n+1):
    for left in range(min(k-back+1, n+1)):
        for right in range(min(k-back-left+1, n-left+1)):
            hand = []
            hand.extend(v[:left])
            if right>0:
                hand.extend(v[-right:])
            hand.sort()
            ans = max(ans, sum(hand[back:]))

print(ans)

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

#define INF 1000000000000

int main(){
  string n;
  cin>>n;
  if((n[0]-'0')*1000+(n[1]-'0')*100+(n[2]-'0')*10+(n[3]-'0')>=2019 && (n[5]-'0')*10+(n[6]-'0')>4){cout<<"TBD";}
  else cout<<"Heisei";


}


Measured memory_bytes: 256
#include <iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

typedef struct Node{
    int key;
    Node *prev,*next;
};
Node *nil;

void init(){
    nil = (Node *)malloc(sizeof(Node));
    nil->prev = nil;
    nil->next = nil;
}
void insertv(int key){
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}
Node* ListSearch(int key){
    Node *cur = nil->next;
    while(cur!=nil){
        if(cur->key==key){
            break;
        }
        cur = cur->next;
    }
    return cur;
}

void deleteNode(Node *cur){
    if(cur==nil) return;
    cur->prev->next = cur->next;
    cur->next->prev = cur->prev;
    free(cur);
}
void deletev(int key){
    deleteNode(ListSearch(key));
}
void deleteFirst(){
    deleteNode(nil->next);
}
void deleteLast(){
    deleteNode(nil->prev);
}
void print(){
    Node *cur = nil->next;
    int i=0;
    while(cur!=nil){
        if(i>0){
            printf(" ");
        }
        i++;
        printf("%d",cur->key);
        cur = cur->next;
    }
    printf("\n");
}
int main()
{
     int n;
    scanf("%d",&n);
    init();
    for(int i=0;i<n;i++){
        int key;
        char ch[20];
        scanf("%s", ch);
        string s = ch;
        if(s=="insert"){
            scanf("%d",&key);
            insertv(key);
        }else if(s=="delete"){
            scanf("%d",&key);
            deletev(key);
        }else if(s=="deleteFirst"){
            deleteFirst();
        }else if(s=="deleteLast"){
            deleteLast();
        }
    }
    print();
    return 0;
}



Measured memory_bytes: 34596
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i(0);i<n;i++)
#define fast  ios_base::sync_with_stdio(0); cin.tie(0);
#define mod 1000000007
#define pb push_back
#define all(v) v.begin(), v.end()

/*int kS(int W, int wt[], int val[], int n){
	int dp[n+1][W+1];

	for(int i(0);i<=n;i++){
		for(int w(0);w<=W;w++){
			if(i == 0|| w==0)dp[i][w];
			else if(wt[i-1] <= w)dp[i][w] = max(val[i-1] + dp[i-1][w-wt[i-1]],  dp[i-1][w]);
			else dp[i][w] = dp[i-1][w];
		}

	}
	return dp[n][W];
}*/
int knapSack(int W, int wt[], int val[], int n) 
{ 
   int i, w; 
   int K[n+1][W+1]; 
  
   // Build table K[][] in bottom up manner 
   for (i = 0; i <= n; i++) 
   { 
       for (w = 0; w <= W; w++) 
       { 
           if (i==0 || w==0) 
               K[i][w] = 0; 
           else if (wt[i-1] <= w) 
                 K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]],  K[i-1][w]); 
           else
                 K[i][w] = K[i-1][w]; 
       } 
   } 
  
   return K[n][W]; 
} 

int32_t main() {
    fast;
    
    
	int n,w;
	cin>>n>>w;
	int wt[n], val[n];
	rep(i,n)cin>>wt[i]>>val[i];
	cout<<knapSack(w, wt, val, n);

	return 0;
}


Measured memory_bytes: 79104
#include <iostream>
#include <cstring>
#define MOD 1000000007
using namespace std;

int kat, n, dp[10010][102];
char arr[10010];


long long int recursive(int konum, int kalan){
	if(konum==n&&kalan==0)return 1;
	if(konum==n)return 0;
	if(dp[konum][kalan]!=-1)return dp[konum][kalan];
	long long int cvp=0;
	for(int i=0;i<10;i++){
		cvp=(cvp+recursive(konum+1, (kalan+i)%kat))%MOD;
	}

	dp[konum][kalan]=cvp;
	return cvp;

}

int kucuk(){
	long long int cvp=0, kalan=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<(arr[i]-'0');j++){
			cvp=(cvp+recursive(i+1, (j+kalan)%kat))%MOD;
		}
		kalan=(arr[i]-'0'+kalan)%kat;
	}
	if(!kalan)cvp=(cvp+1)%MOD;
	return cvp;
}

int main(void){
	cin>>arr;
	cin>>kat;
	memset(dp, -1, sizeof(dp));
	for(int i=0;arr[i];i++)n++;
	cout<<(kucuk()-1+MOD)%MOD;
	return 0;
}


Measured memory_bytes: 4992
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int MAX_N = 100005;

int n;
ll a[MAX_N];
ll b[MAX_N];

int main()
{
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 0; i <= n; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++)
		cin >> b[i];

	ll result = 0;
	for (int i = n - 1; i >= 0; i--)
	{
		ll res = min(a[i + 1], b[i]);
		a[i + 1] -= res;
		b[i] -= res;
		result += res;

		res = min(a[i], b[i]);
		a[i] -= res;
		b[i] -= res;
		result += res;
	}
	cout << result << endl;
}

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


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

	ll t = 1;
	// cin>>t;

	while(t--){
		ll n,d;
		cin>>n>>d;

		double x,y;
		ll ans = 0;
		while(n--){
			cin>>x>>y;
			if(sqrt(x*x + y*y) <= d) ++ans;
		}

		cout<<ans<<"\n";
	}

	return 0;

}


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

int main()
{
    ll N;
    cin >> N;
    ll cnt[100007] = {};
    ll ans = 0;

    for (ll i = 0; i < N; i++) {
        ll A;
        cin >> A;
        cnt[A]++;
    }

    vector<ll> even_cards;

    for (ll i = 0; i < 100007; i++) {
        if (cnt[i] > 0) {
            if (cnt[i] % 2 == 1) {
                ans += 1;
            } else {
                even_cards.push_back(cnt[i]);
            }
        }
    }

    if (even_cards.size() > 0)
        ans += (even_cards.size() % 2 == 0 ? even_cards.size()
                                           : even_cards.size() - 1);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1152
//2019.7.21 by ljz
//email 573902690@qq.com
//if you find any bug in my code
//please tell me
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define LL long long
#define inf 0x3f3f3f3f
#define INF 1e18+1e9
#define eps 1e-10
#define RG register
#define db double
#define lb long db
#define pc(x) __builtin_popcount(x)
typedef pair<int,int> Pair;
#define mp make_pair
#define fi first
#define se second
#define pi acos(-1.0)
#define pb push_back
#define gc getchar
#define Pi 2.0*acos(-1.0)
//inline char gc() {
//    static char buf[100000],*p1,*p2;
//    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
//}
//inline int read() {
//    res s=0,ch=gc();
//    while(ch<'0'||ch>'9')ch=gc();
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s;
//}
inline int read() {
    res s=0,ch=gc(),w=1;
    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=gc();}
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
    return s*w;
}
//inline LL Read() {
//    RG LL s=0;
//    res ch=gc();
//    while(ch<'0'||ch>'9')ch=gc();
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s;
//}
inline LL Read() {
    RG LL s=0;
    res ch=gc(),w=1;
    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=gc();}
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
    return s*w;
}
//inline void write(RG __int128 x){
//    if(x>10)write(x/10);
//    putchar(x%10+'0');
//}
inline void swap(res &x,res &y) {
    x^=y^=x^=y;
}
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
namespace MAIN{
    inline void MAIN(){
        RG LL S=Read();
        printf("0 0 ");
        RG LL A=(LL)sqrt(S);
        if(A<1000000000)A++;
        RG LL p=A*A-S;
        printf("%lld %lld %lld %lld\n",A,1ll,p,A);
    }
}
int main(){
    MAIN::MAIN();
    return 0;
}

Measured memory_bytes: 256
N = input()

L=len(N)

from itertools import product

check_num=[3,5,7]
check=[]

for l in range(1,L+1):
    for p in product(range(3),repeat=l):
        c=''
        for p_ in p:
            c+=str(check_num[p_])
        if len(set(c))==3 and int(c)<=int(N):
            check.append(int(c))
print(len(check))

Measured memory_bytes: 10192
#include <iostream>
#include <vector>
#include <set>

#include <algorithm>
using namespace std;

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

    
    
   
  

    c = a%500;
     
    if(b>c || b==c){
      cout << "Yes" << endl;
    }else{
      
      cout << "No" << endl;
    }
  
   
   
  
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    int house[n];
    for(int i=0;i<n;i++){
        cin >> house[i];
    }
    int max = 0,min = 10000;
    for(int i=0;i<n;i++){
        if(max < house[i]){
            max = house[i];
        }
        if(min > house[i]){
            min = house[i];
        }
    }
    printf("%d\n",max-min);

}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
int main(){
    int N;  cin>>N;
    vector<long long> L(N+1);
    L[0]=2;
    L[1]=1;
    for(int i=2;i<N+1;++i){
        L[i]=L[i-2]+L[i-1];
    }
    cout<<L[N]<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM 1000000000;
#define mod MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
int main(){
    string x; cin >> x;
    ll s = 0, t = 0;
    for(int i = 0; i < x.size(); i++){
        if(x[i] == 'T' && s > 0){
            s--;
        } else if(x[i] == 'S'){
            s++;
        } else {
            t++;
        }
    }
    cout << s+t << endl;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main() {
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	
	int ans = 0;
	if (a < k) {
		ans += a;
		k -= a;
		
		if (b < k) {
			k -= b;
			
			if (c < k)
				ans -= c;
			else
				ans -= k;
		}
	} else {
		ans += k * 1;
	}
	
	cout << ans << endl;
}

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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 10005;

int n, a[N], vis[N];

int myabs(int a) {
	return a > 0 ? a : -a;
}

bool check(int p) {
	if (a[0] % p) {
		return false;
	}
	static int b[N];
	for (int i = 0; i < p - 1; ++i) {
		b[i] = 0;
	}
	for (int i = 0; i < n; ++i) {
		(b[i % (p - 1)] += a[i]) %= p;
	}
	for (int i = 0; i < p - 1; ++i) {
		if (b[i]) {
			return false;
		}
	}
	return true;
}

int main() {
	read(n), ++n;
	int g = 0;
	for (int i = n - 1; ~i; --i) {
		read(a[i]);
		g = std::__gcd(g, myabs(a[i]));
	}
	for (int i = 2; i <= n; ++i) {
		if (!vis[i]) {
			if (check(i)) {
				print(i);
			}
			for (int j = i + i; j <= n; j += i) {
				vis[j] = 1;
			}
		}
	}
	for (int i = 2; i * i <= g; ++i) {
		if (g % i == 0) {
			if (i > n) {
				print(i);
			}
			while (g % i == 0) {
				g /= i;
			}
		}
	}
	if (g > n) {
		print(g);
	}
}


Measured memory_bytes: 3816
#include<stdio.h>

#define MAX 100005
#define NIL -1

typedef struct node_{
  int p,l,r;

}node;

struct node_ T[MAX];

int n,D[MAX];

void getDepth(int , int);
void printChildren(int);

int main(){
  int i,j,d,v,c,l,r;
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
    T[i].p = NIL;
    T[i].l = NIL;
    T[i].r = NIL;
  };
  for(i=0;i<n;i++)
  {
    scanf("%d%d",&v,&d);
    for(j=0;j<d;j++)
    {
      scanf("%d",&c);
      if(j == 0)   T[v].l = c;
      else T[l].r = c;
      l = c;
      T[c].p =v;

    }
  }
for(i=0;i<n;i++)
{
  if(T[i].p == NIL) r=i;
}
  getDepth(r,0);

  for(i=0;i<n;i++) printChildren(i);
  return 0;
}

void getDepth(int u,int x){
D[u]=x;
  if(T[u].r != NIL) getDepth(T[u].r,x);
  if(T[u].l != NIL) getDepth(T[u].l,x+1);

}

void printChildren(int u){
  int c,i;
printf("node %d: ",u);
printf("parent = %d, ",T[u].p);
printf("depth = %d, ",D[u]);

if(T[u].p == NIL) printf("root, ");
else if(T[u].l == NIL) printf("leaf, ");
else printf("internal node, ");

printf("[");

for(i=0,c=T[u].l; c!=NIL;i++,c=T[c].r)
{
  if(i) printf(", ");
  printf("%d",c);
}
printf("]\n");
}



Measured memory_bytes: 6416
// Problem : A - Calc
// Contest : AtCoder - AtCoder Beginner Contest 172
// URL : https://atcoder.jp/contests/abc172/tasks/abc172_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define int long long
#define fastio                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0);
#define sz(a) (int)((a).size())
#define pb push_back
#define mp make_pair
#define db1(x) cout << #x << "=" << x << endl
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z)                                                       \
  cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define dbp(x) \
  cout << #x << "= {" << (x.first) << ", " << (x.second) << "}" << endl;
#define dbv(v)                         \
  {                                    \
    cout << #v << " : ";               \
    for (auto x : v) cout << x << ' '; \
    cout << endl;                      \
  }
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rep2(i, a, b) for (int i = a; i >= b; i--)
#define die(x) return cout << x << '\n', 0;

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int32_t main() {
  fastio;
  //  freopen("input.txt", "r", stdin);
  //  freopen("output.txt", "w", stdout);
  int testcases;
  testcases = 1;
  // cin>>testcases;

  while (testcases--) {
    int a;
    cin >> a;
    cout << (a + a * a + a * a * a);
  }

  return 0;
}


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

int main(){
    int R;
    cin >> R;
    if (R < 1200){
        cout << "ABC" << endl;
    }
    else if (1200 <= R  and R < 2800){
        cout << "ARC" << endl;
    }
    else{
        cout << "AGC" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import collections
n = int(input())
a = list(map(int,input().split()))
q = int(input())
k = collections.Counter(a)
nowsum = sum(a)
for i in range(q):
    b , c = map(int,input().split())
    p = k.get(b,0)
    if p != 0:
        k[c] = k.get(c,0) + p
        k[b] = 0
        nowsum = nowsum - b*p + c*p
    print(nowsum)

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


void solve(long long N, long long K){
    if(K==1)cout<<0<<endl;
    else cout<<N-K<<endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


Measured memory_bytes: 256
# 入力をN,A,Bに代入
N,A,B = map(int,input().split())

# 結果変数を0で初期化
result=0

# 1からNまでを一つずつ加算しながらiに代入
for i in range(1,N+1):
    
    # iを文字型化
    i=str(i)
   
    # 各桁を数値化し、リストの要素として追加(内包表記)
    somesums_list=[int(j) for j in i]    #iと言う数字が何桁かは分からないが、それの角桁の数字を１つずつ数値化し、リストに追加した
    # リストの要素を全て合計
    sumlist=sum(somesums_list)
    # リストの合計値がA以上B以下か判定
    if sumlist <= B and  A <= sumlist:  
        # 結果変数にiを加算
        result=result+int(i)#iが文字列になっていたので、足し算するために数値化する
# 結果変数をプリント
print(result)

Measured memory_bytes: 9132
ax,ay,bx,by = map(int,input().split())
path = []
y = int(by-ay)
x = int(bx-ax)
#１
for i in range(y):
    path.append('U')
for i in range(abs(x)):
    path.append('R')
for i in range(y):
    path.append('D')
for i in range(abs(x)):
    path.append('L')
#2
path.append('L')
for i in range(y+1):
    path.append('U')
for i in range(x+1):
    path.append('R')
path.append('D')
path.append('R')
for i in range(y+1):
    path.append('D')
for i in range(x+1):
    path.append('L')
path.append('U')
print(''.join(path))

Measured memory_bytes: 3188
H,W=map(int,input().split())
S=[['.']*(W+2),['.']*(W+2)]
for i in range(H):
    s=list(input())
    s.insert(0,'.')
    s.append('.')
    S.insert(-1,s)
X=[]

for k in range(1,H+1):
    x=[]
    for h in range(1,W+1):
        if S[k][h]=='#':
            x.append('#')
        else:
            a=0
            for g in range(3):
                if S[k-1][h-1+g]=='#':
                    a+=1
            if S[k][h-1]=='#':
                a+=1
            if S[k][h+1]=='#':
                a+=1
            for g in range(3):
                if S[k+1][h-1+g]=='#':
                    a+=1
            x.append(str(a))
    X.append(x)
    
for i in X:
    print(''.join(i))



Measured memory_bytes: 3188
#include <iostream>
#include <string>

using namespace std;

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

    if(a == b){
        cout << a + b << endl;
    }else if(a > b){
        cout << a + (a - 1) << endl;
    }else{
        cout << b + (b - 1) << endl;
    }
    
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    vector<int> vec(3);
    cin >> vec[0] >> vec[1] >> vec[2];
    sort(vec.begin(),vec.end());
    int max=vec[2], med=vec[1], min=vec[0];
    int ans = max-med;
    min += max-med;
    if ((max-min)%2==0) {
        ans += (max-min)/2;
    }
    else
    {
        ans += (max-min)/2+2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef int64_t LL;
typedef uint64_t ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
template<class T, class... U> void DEBUG(const T &head, const U &... tail) { 
#ifdef HOME
    _W('#'); _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...);
#endif
}
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int a[SIZE],b[SIZE];
int main(){
    int N;R(N);
    REP(i,N)R(a[i]);
    REP(i,N)R(b[i]);
    LL v=0,add=0;
    REP(i,N){
        add+=b[i]-a[i];
        if(b[i]>a[i])v+=(b[i]+1-a[i])/2;
    }
    if(add<0||v>add)W("No");
    else W("Yes");
    return 0;
}


Measured memory_bytes: 2304
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

int main(){
    string str;
    cin>>str;
    if(str.size()==2)
        cout << str << endl;
    else
        cout << str[2] << str[1] << str[0] << endl;
    return 0;
}


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

A=[]
for i in range(N):
    A.append(input())

B=sorted(A)

import collections
import itertools

counter = collections.Counter(A)

mode_v = counter.most_common()[0][-1]
it = itertools.takewhile(lambda kv: kv[-1] == mode_v, counter.most_common())

answer=[]
for i in it:
    answer.append(i[0])

answer.sort()
for i in answer:
    print(i)

Measured memory_bytes: 46656
#include <bits/stdc++.h>
using namespace std;
using lint = long long;

// debug
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifndef STOP_DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

template <typename T>
lint gcd(T a, T b) {return b?gcd(b, a%b):a;}

template <typename T>
lint lcm(T a, T b) {return a * b / gcd(a, b);};

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

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

struct IoSetup{
    IoSetup(){
      ios::sync_with_stdio(false);
      cin.tie(0);
      cout << fixed << setprecision(17);
      cerr << fixed << setprecision(17);
    }
} IoSetup;

int main() {
  lint a, b, c;
  cin >> a >> b >> c;
  lint x = max((lint)0, a - c);
  cout << x << " " << max((lint)0, b - max((lint)0, c - a)) << '\n';
}


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

ll fact(ll x){
  return (x>1) ? (x*fact(x-1)) % MOD : 1;
}

int main(){
  ll n, m; cin >> n >> m;
  if(abs(n-m) >= 2){
    cout << 0 << endl;
    return 0;
  }
  ll p = (n==m) ? 2 : 1;
  cout << (fact(n) * fact(m) * p) % MOD << endl;
  return 0;
}

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


int main(){
  int n,m;
  cin >> n >> m;
  vector<vector<int>> A(n);
  rep(i,m){
    int a,b;
    cin >> a >> b;
    a--; b--;
    A[a].push_back(b);
    A[b].push_back(a);
  }

  vector<int> dist(n,-1);
  queue<int> dq;
  int maximum = 0;
  rep(i,n){
    if(dist[i]==-1){
      int cnt = 1;
      dist[i] = 0;
      dq.push(i);
      while(!dq.empty()){
        int v = dq.front();
        dq.pop();
        for(int nv: A[v]){
          if(dist[nv]!=-1)continue;
          dist[nv]=dist[v]+1;
          dq.push(nv);
          cnt++;
        }
      }
      maximum = max(maximum,cnt);
    }

  }
  cout << maximum << endl;
  return 0;
}


Measured memory_bytes: 15408
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    string s;cin >> s;
    int n = s.size();
    int ans = 0;
    for(int i = 0,j;i < n;i = j){
        for(;i < n && s[i] == s[0];i++);
        ans++;
        if(i == n)break;
        for(j = i+1;j < n && s[j]!= s[0];j++);
        ans++;
    }
    cout << ans-1 << endl;
    return 0;
}

Measured memory_bytes: 512
import re

point1 = 0
count1 = 0
point2 = 0
point3 = 0
	
S = input()
l = len(S)
if S[0]=='A':
	point1+=1
for n in range(2,l-1):
	if S[n]=='C':
		count1+=1
if count1==1:
	point2+=1
	
SS = re.sub("A","",S)
SS = re.sub("C","",SS)
if SS.islower():
	point3+=1
	
xx = point1+point2+point3

if xx==3:
	print('AC')
else:
	print('WA')

Measured memory_bytes: 3188
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let mut s = read::<String>().chars().collect::<Vec<char>>();
    s.sort();
    if s[0] == 'a' && s[1] == 'b' && s[2] == 'c' {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include<stdio.h>
int main()
{
int a;
char s[11];
scanf("%d",&a);
scanf("%s",&s);
if(a>=2800&&a<5000)
{
  if(a>=3200)
  {
    printf("%s",s);
  }
  else if(a<3200)
  {
    printf("red");
  }
}
return 0;
}      

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

int main()
{
  ll n, c, k;
  cin >> n >> c >> k;
  vector<ll> t(n);
  for (auto &e : t)
    cin >> e;

  sort(t.begin(), t.end());

  ll cnt = 0;
  ll j = 0;
  for (ll i = 0; i < n; ++i)
  {
    while (j < n && t[j] <= t[i] + k && j - i + 1 <= c)
    {
      j++;
    }
    cnt++;
    i = j - 1;
  }
  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>

using namespace std;

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)
#define REPIT(i,x) for(auto i{(x).begin()}; i != (x).end(); i++)

#define PB push_back
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

typedef int64_t ll;
typedef double dbl;
typedef vector<bool> Vb;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<string> Vs;
typedef vector<vector<int> > VVi;
typedef vector<vector<ll> > VVl;

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

int n, k;
dbl ans;

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

	REP1C(die, n)
	{
		int score = die;
		dbl p = 1;
		while (score < k)
			p /= 2.0, score <<= 1;

		ans += p / n;
	}

	cout << setprecision(12) << ans << endl;
}


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

int main(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	
	while(1){
		c-=b;
		if(c<=0){cout << "Yes";break;}
		a-=d;
		if(a<=0){cout << "No";break;}
	}
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair

const int Z = 8003;
const int N = 2 * Z + 1;
bool dp[2][2][N];
int X, Y;
char s[N];
int n;
int t;

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

	dp[0][0][Z] = dp[1][0][Z] = 1;
	scanf("%s", s);
	n = strlen(s);
	scanf("%d%d", &X, &Y);
	int pos = 0;
	while(pos < n && s[pos] == 'F') {
		pos++;
		X--;
	}
	t = 0;
	while(pos < n) {
		pos++;
		t ^= 1;
		int L = 0;
		while(pos < n && s[pos] == 'F') {
			pos++;
			L++;
		}
		for (int i = 0; i < N; i++)
			dp[t][1][i] = 0;
		for (int i = 0; i < N; i++) {
			if (!dp[t][0][i]) continue;
			dp[t][1][i - L] = dp[t][1][i + L] = 1;
		}
		for (int i = 0; i < N; i++)
			dp[t][0][i] = dp[t][1][i];
	}
	if (dp[0][0][Z + X] && dp[1][0][Z + Y])
		printf("Yes\n");
	else
		printf("No\n");

	return 0;
}


Measured memory_bytes: 3816
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define LL long long 
#define LD long double
LL a,b,c;
int main()
{
	cin>>a>>b>>c;
	if(a+b+c<22)
		puts("win");
	else puts("bust");
}

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

long long N, M, ANS = 0;
vector<long long> P;
vector<vector<long long> > V;
vector<bool> visited;

void DFS(long long X, vector<pair<long long, long long> >& R) {
	R.push_back({ X, P[X] });
	visited[X] = true;
	for (long long NX : V[X]) {
		if (!visited[NX]) DFS(NX, R);
	}
}

int main() {
	cin >> N >> M;
	P.resize(N);
	V.resize(N);
	visited.resize(N);
	for (int i = 0; i < N; i++) cin >> P[i], P[i]--;
	for (int i = 0; i < M; i++) {
		long long X, Y;
		cin >> X >> Y;
		X--, Y--;
		V[X].push_back(Y);
		V[Y].push_back(X);
	}
	for (int i = 0; i < N; i++) {
		if (!visited[i]) {
			vector<pair<long long, long long> > R = {};
			DFS(i, R);
			vector<long long> A;
			for (pair<long long, long long> Q : R) {
				A.push_back(Q.first);
				A.push_back(Q.second);
			}
			sort(A.begin(), A.end());
			A.erase(unique(A.begin(), A.end()), A.end());
			ANS += R.size() * 2 - A.size();
		}
	}
	cout << ANS << endl;
}

Measured memory_bytes: 16240
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 * @throws 
 
	 * @throws NumberFormatException 
	 */
	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		
		int i;
		for(i = 1; i <= n; i *= 2){
			
		}
		System.out.println(i/2);
	}

}


Measured memory_bytes: 21076
import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A)
heapq.heapify(A)
BC = []
for _ in range(M):
    BC.append(list(map(int, input().split())))
BC = sorted(BC, key=lambda x: x[1], reverse=True)

card = []
for b, c in BC:
    for _ in range(b):
         my_min = heapq.heappop(A)
         if c > my_min:
             heapq.heappush(A, c)
         else:
              heapq.heappush(A, my_min)
              break

print(sum(A))

Measured memory_bytes: 33768
import heapq

n = int(input())

g = [[] for _ in range(n)]
for i in range(n-1):
    a, b, c = map(int, input().split())

    g[a-1].append((b-1, c))
    g[b-1].append((a-1, c))

q, k = map(int, input().split())

dis = [float("inf")] * n
dis[k-1] = 0
pq = [(0, k-1)]
while pq:
    d, node = heapq.heappop(pq)
    if d > dis[node]: continue

    for nxt, cost in g[node]:
        if d + cost < dis[nxt]:
            dis[nxt] = d + cost
            heapq.heappush(pq, (dis[nxt], nxt))

ans = []
for i in range(q):
    x, y = map(int, input().split())

    ans.append(dis[x-1]+dis[y-1])

print("\n".join(map(str, ans)))


Measured memory_bytes: 55400
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define setp(x) fixed << setprecision(x)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 3e5 + 555; // TL MB
const double PI = acos(-1.0);
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r; 
}
void solve()
{
	string s;
	cin >> s;
	int mx = 0;
	rep(i, sz(s)){
		int cnt = 0;
		rep(j, sz(s)){
			if(i + j < sz(s) && s[(i + j)] == 'R') cnt++;
			else break;
		}
		mx = max(mx, cnt);
	}
	cout << mx;
}
 
int main()
{
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
    Red;
  	int T = 1;
  	// cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}

Measured memory_bytes: 3636
using System.Linq;
using System.Collections.Generic;
using System;

public class Ikisaki
{
    public int basho { get; set; }
    public int getno { get; set; }
}

public class hello
{
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var n = int.Parse(line[0]);
            var m = int.Parse(line[1]);
            if (n == 0 && m == 0) break;
            var totalary = new int[m];
            for (int i = 0; i < n; i++)
            {
                string[] line2 = Console.ReadLine().Trim().Split(' ');
                var a = Array.ConvertAll(line2, int.Parse);
                for (int j = 0; j < m; j++)
                    totalary[j] += a[j];
            }
            var ikisakis = new List<Ikisaki>();
            for (int i = 0; i < m; i++)
                ikisakis.Add(new Ikisaki { basho = i + 1, getno = totalary[i] });
            var ans = ikisakis.OrderByDescending(x => x.getno);
            var count = 1;
            foreach(var x in ans)
            {
                Console.Write(x.basho);
                if (count == m) Console.WriteLine();
                else Console.Write(" ");
                count++;
            }
        }
    }
}

Measured memory_bytes: 10220
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

signed main(){
    int a,b,c;
    cin >> a >> b >>c;
    if(a+b+c<=21){
        cout<<"win"<<endl;
    }
    else{
        cout<<"bust"<<endl;
    }
}


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

using namespace std;

int main() {
	string s, t; cin >> s >> t;
	int sn = s.size(), tn = t.size();
	int ans = 1e5;
	for (int i = 0; i <= sn - tn; ++i) {
		int tmp = 0;
		for (int j = 0; j < tn; ++j)
			if (s[i + j] != t[j]) ++tmp;
		ans = min(ans, tmp);
	}
	cout << ans << endl;

	return 0;
}

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

using namespace std;

long long memo[101][100001];

long long knapsack_tab(const int items[][2], const int &N, const int &C){
    for(int n = 0; n <= N; n++)
        memo[n][0] = 0;
    for(int c = 0; c <= C; c++)
        memo[0][c] = 0;
    
    
    for(int n = 1; n <= N; n++){
        for(int c = 0; c <= C; c++){
            if(c - items[n - 1][0] < 0) memo[n][c] = memo[n - 1][c];
            else{
                memo[n][c] = max(items[n - 1][1] + memo[n - 1][c - items[n - 1][0]], memo[n - 1][c]);
            }
        }
    }

    return memo[N][C];
}

int main(){
    int N, C;
    while(scanf("%d %d", &N, &C) != EOF){
        int items[N][2];
        for(int n = 0; n <= N; n++){
            for(int c = 0; c <= C; c++){
                memo[n][c] = -1;
            }
        }
        for(int i = 0; i < N; i++){
            scanf("%d %d", &items[i][0], &items[i][1]);
        }
        printf("%lli\n", knapsack_tab(items, N, C));
    }
    return 0;
}

Measured memory_bytes: 82588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
// const ll MOD=998244353;

char A[1010][1010];
int sum[4040][4040];
int MW=4040,MH=4040;

int main(){
  int H,W; cin>>H>>W;
  rep(i,H) rep(j,W) cin>>A[i][j];
  int flag=1;
  rep(i,H) rep(j,W) if(A[i][j]=='.') flag=0;
  if(flag){
    cout<<0<<endl;
    return 0;
  }
  int ok=2020, ng=0;
  while(abs(ok-ng)>1){
    int mid=(ok+ng)/2;
    rep(i,MH) rep(j,MW) sum[i][j]=0;
    rep(i,H) rep(j,W){
      if(A[i][j]=='#'){
        int ii=i+j+MH/2, jj=i-j+MW/2;
        sum[max(0,ii-mid)][max(0,jj-mid)]++;
        sum[max(0,ii-mid)][min(MW-1,jj+mid+1)]--;
        sum[min(MH-1,ii+mid+1)][max(0,jj-mid)]--;
        sum[min(MH-1,ii+mid+1)][min(MW-1,jj+mid+1)]++;
      }
    }
    rep(i,MH) rep(j,MW-1) sum[i][j+1]+=sum[i][j];
    rep(i,MW) rep(j,MH-1) sum[j+1][i]+=sum[j][i];
    int flagflag=1;
    rep(i,H){
      rep(j,W){
        int ii=i+j+MH/2,jj=i-j+MW/2;
        if(sum[ii][jj]<=0) flagflag=0;
      }
    }
    if(flagflag) ok=mid;
    else ng=mid;
  }
  cout<<ok<<endl;
  return 0;
}


Measured memory_bytes: 65024
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s, t;
  cin >> s;
  cin >> t;
  int ans = 0;
  for(int i = 0; i < s.size(); i++) {
    if(s.at(i) != t.at(i)) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3788
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

void err(){
  std::cout << "Impossible" << '\n';
  exit(0);
}
int main(int argc, char const *argv[]) {
  ll n, m;std::cin >> n >> m;
  vll a(m), b;
  ll o = 0;
  for(int i=0;i<m;i++){
    scanf("%lld", &a[i]);
    if(a[i]%2) o++;
  }
  if((n%2&&o>=2)||(n%2==0&&o>2)) err();

  sort(all(a), [](ll x, ll y){ // 奇数を右に
    if(x%2) return false;
    if(y%2) return true;
    return x < y;
  });

  if(m==1&&a[0]==1) b = vll{1};
  else if(m==1) b = vll{1, a[0]-1};
  else{
    if(o==2) swap(a[0], a[m-2]);
    for(int i=0;i<m;i++){
      ll x = 0;
      if(i==0) x = -1;
      if(i==m-1) x = 1;
      if(a[i]+x!=0) b.push_back(a[i]+x);
    }
  }
  re(i, m) std::cout << a[i] << (i==m-1?"\n":" ");
  std::cout << b.size() << '\n';
  re(i, b.size()) std::cout << b[i] << (i==b.size()-1?"\n":" ");
  return 0;
}


Measured memory_bytes: 256
import Data.Maybe
import Data.List

main :: IO ()
main = do
  input <- getContents
  putStrLn $ trim (solve (trim input))

--処理
solve :: String -> String
solve = fmap f

f :: Char -> Char
f ',' = ' '
f s   = s

trimHead :: String -> String
trimHead = dropWhile (\s -> isJust (elemIndex s [' ', '\t', '\n', '\r']))

trim :: String -> String
trim = reverse . trimHead . reverse . trimHead

Measured memory_bytes: 380