akhauriyash/Code-Regression huggingface dataset:
//package code;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 *
 * @author Milo
 */
public class Main {
    
    static FastReader in = new FastReader();
    public static void main(String[] args) {
        int t = 1; //in.nextInt();
        while (t-- > 0)
            solve();
    }
 
    public static void solve() {
        int k = in.nextInt();
        String s = in.next();
        int l = s.length();
        if(l <= k){
            System.out.println(s);
        }else{
            System.out.println(s.substring(0, k) + "...");
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt() {
            return Integer.parseInt(next());
        }
 
        long nextLong() {
            return Long.parseLong(next());
        }
 
        double nextDouble() {
            return Double.parseDouble(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
 
    public static int max(int a, int b) {
        return a > b ? a : b;
    }
 
    public static int min(int a, int b) {
        return a < b ? a : b;
    }
 
    public static int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, (a % b));
    }
}


Measured memory_bytes: 36512
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    ll a,b,c,d;
    for(int i=0;i<n;i++){
    	cin>>a>>b;
    	if(i==0){
    		c=a;
    	    d=b;
    		continue;
    	}
    	ll num=((d+b-1)/b)*b;
    	ll m=(num/b)*a;
    	ll maki=((m+c-1)/m);
    	num*=maki;
    	m*=maki;
    	ll f=num,g=m;
    	num=((c+a-1)/a)*a;
    	m=(num/a)*b;
    	maki=((m+d-1)/m);
    	num*=maki;
    	m*=maki;
    	if(g>num){
    		c=num;
    		d=m;
    	}else{
    		d=f;
    		c=g;
    	}
    
    }
    cout << c+d<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
#define P 1000000007;

int main(){
    unsigned long long m,n,total=1;
    cin >> m >> n;
    m;
    while(n!=1){
        if(n%2) total=total*m%P;
        m=m*m%P;
        n=n/2;
    }
    total=total*m%P
    cout << total << endl;

    return 0;
}



Measured memory_bytes: 3120
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;
constexpr int64_t kMod1 = 1000000007LL;
constexpr int64_t kMod2 = 998244353LL;
constexpr int64_t kMod3 = 3571L;

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

  constexpr int64_t kN = 26;
  int64_t D;
  cin >> D;
  vector<int64_t> C(kN + 1, 0);
  for (int64_t c = 1; c <= kN; ++c) {
    cin >> C[c];
  }
  vector<vector<int64_t>> S(D + 1, vector<int64_t>(kN + 1));
  for (int64_t d = 1; d <= D; ++d) {
    for (int64_t c = 1; c <= kN; ++c) {
      cin >> S[d][c];
    }
  }
  vector<vector<int64_t>> last(D + 1, vector<int64_t>(kN + 1, 0));
  vector<int64_t> contests(D + 1);
  for (int64_t d = 1; d <= D; ++d) {
    cin >> contests[d];
  }

  auto Score = [&](const int64_t day) -> int64_t {
    int64_t score = 0;
    for (int64_t d = 1; d <= day; ++d) {
      last[d] = last[d - 1];
      last[d][contests[d]] = d;
      score += S[d][contests[d]];
      for (int64_t c = 1; c <= kN; ++c) {
        score -= C[c] * (d - last[d][c]);
      }
    }
    return score;
  };

  auto OutputResults = [&]() {
    for (int64_t d = 1; d <= D; ++d) {
      cout << contests[d] << endl;
    }
  };

  for (int64_t d = 1; d <= D; ++d) {
    int64_t best_score = INT64_MIN;
    int64_t best_conte = -1;
    for (int64_t c = 1; c <= kN; ++c) {
      contests[d] = c;
      int64_t temp_score = Score(d);
      if (temp_score > best_score) {
        best_score = temp_score;
        best_conte = c;
      }
    }
    contests[d] = best_conte;
  }

  int64_t day_index = 123;
  int64_t contest_index = 2034;
  int64_t ignore_index = 34234;
  int64_t prev_score = Score(D);
  constexpr int64_t kIgnoreBunbo = 1000;
  constexpr int64_t kIgnoreBunshi = -1;

  for (int64_t i = 0; i < 1000; ++i) {
    const int64_t day_candidate = (day_index % D) + 1;
    const int64_t original_contest = contests[day_candidate];
    const int64_t contest_candidate = (contest_index % kN) + 1;
    contests[day_candidate] = contest_candidate;
    const int64_t temp_score = Score(D);
    if (ignore_index <= kIgnoreBunshi || temp_score > prev_score) {
      // KEEP
    } else {
      contests[day_candidate] = original_contest;
    }
    day_index = day_candidate + kMod1;
    contest_index = contest_candidate + kMod2;
    ignore_index += kMod3;
    ignore_index %= kIgnoreBunbo;
  }

  OutputResults();
  return 0;
}


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

void solve() {
	string s; cin >> s;
	int cnt = 0;
	for (char x : s)cnt += x - '0';
	if (cnt % 9 == 0)cout << "Yes";
	else cout << "No";
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// int t; cin >> t;
	// while (t--)
	solve();

}

Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL f[200];
int main(){
	f[0]=2;
	f[1]=1;
	for(int i=2;i<=86;i++)f[i]=f[i-1]+f[i-2];
	int n;
	scanf("%d",&n);
	printf("%lld\n",f[n]);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 1e9
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  pair<double,double> now=mp(0.0,0.0);
  int a,b;
  double r=0;
  while(scanf("%d,%d",&a,&b),a+b){
    now.F+=cos((r*M_PI)/180)*a;
    now.S+=sin((r*M_PI)/180)*a;
    r+=b;
  }
  int aa=now.F,bb=now.S;
  cout<<bb<<endl<<aa<<endl;
  return 0;
}


Measured memory_bytes: 3468
import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
//------------------------------------------------------------

		Scanner sc =new Scanner(System.in);
		String s = sc.nextLine();
		sc.close();
		String start = String.valueOf(s.charAt(0));
		String end = String.valueOf(s.charAt(s.length()-1));
		String abbreviation = String.valueOf(s.length()-2);
		System.out.println(start+abbreviation+end);
//------------------------------------------------------------
	}
}

Measured memory_bytes: 21972
import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		int[] h =new int[n];
		for(int i = 0;i < n;i++){
			h[i] = sc.nextInt();
		}
		int ans = 0;

		while(true){
			boolean cc = true;
			for(int i = 0;i < n;i++){			//チェック
				if(h[i] != 0){
					cc = false;
				}
			}
			if(cc){
				break;
			}

			int l = 0;			//左端
			while(h[l] == 0){
				l++;
			}
			int r = l+1;			//右端
			if(r < n){
				while( h[r] != 0 ){
					r++;
					if(r >= n){
						break;
					}
				}
			}

			for(int x = l;x < r;x++){			//-1
				h[x]--;
			}
			ans++;



		}
		System.out.println(ans);

	}


}

class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	}
}



Measured memory_bytes: 23380
#include<iostream>
#include<cstdio>
#include<stack>
#include<string>
#include<cstdlib>

using namespace std;
int A[1000];
int top;

void push(int x)
{
	A[++top] = x;
}

int pop()
{
	top--;
	return A[top + 1];
}

int main()
{
	char s[100];
	while (scanf("%s", s) != EOF)
	{
	
		if (s[0] =='+')
		{
			int a = pop();
			int b = pop();
			push(a + b);
		}
		else if (s[0] == '-')
		{
			int a = pop();
			int b = pop();
			push(b-a);
		}
		else if (s[0] == '*')
		{
			int a = pop();
			int b = pop();
			push(a*b);
		}
		else
		{
			push(atoi(s));
		}
		
	}
	printf("%d\n", pop());
	return 0;
}


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

int gcd(int a, int b) {
	return (b == 0 ? a : gcd(b, a % b));
}

int main() {
	int K;
	cin >> K;
	vector<vector<int>> GCD(K + 1, vector<int>(K + 1));
	for (int i = 1; i <= K; i++) for (int j = i + 1; j <= K; j++) GCD[i][j] = gcd(i, j);
	long long ans = 0;
	for (int i = 1; i <= K; i++) ans += i;
	for (int i = 1; i <= K; i++) for (int j = i + 1; j <= K; j++) ans += ((long long)6 * GCD[i][j]);
	for (int i = 1; i <= K; i++) for (int j = i + 1; j <= K; j++) for (int k = j + 1; k <= K; k++) ans += (6 * gcd(k, GCD[i][j]));
	cout << ans << endl;
}

Measured memory_bytes: 3784
#include<bits/stdc++.h>
#define ll long long
#define vll vector<ll>
#define pb push_back
#define eb emplace_back
#define sll set<ll>
#define ins insert
#define rep(i,n) for(int i=0;i<n;i++)
#define vpp vector<pair<int,int>>
#define mp make_pair
#define ft first
#define sc second
#define gp " ";
#define MAX 9999999
#define MOD 1000000007
#define mnn(v2) *min_element(v2.begin(),v2.end());
#define mxx(v2) *max_element(v2.begin(),v2.end());
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t,i,j,n,c=0,d=0;
    string s,a,b,k;
    cin>>s;
    a=s;
    n=s.size();
     for(i=0;i<(n-1)/2;i++)
          b+=s[i];
     for(i=(n+3)/2-1;i<n;i++)
          k+=s[i];
    reverse(s.begin(),s.end());
                  string ru,an;
           ru=b;an=k;
           reverse(b.begin(),b.end());
           reverse(k.begin(),k.end());
    if(a==s && ru==b && an==k)
    {
              c=1;
    }
    //cout<<s<<" "<<b<<" "<<k;
   if(c==1)cout<<"Yes";
          else cout<<"No";
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

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; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll dp[2][1 << 21];
bool A[21][21];
int main() {
    init();
    ll N;
    cin >> N;
    rep(i, N) rep(j, N) cin >> A[i][j];
    dp[0][0] = 1;
    rep(i,N){
        ll now = i % 2, to = (i + 1) % 2;
        rep(bit,1<<N){
            if(dp[now][bit])rep(j,N){
                if (!(bit & 1 << j) and A[i][j]) dp[to][bit | 1 << j] += dp[now][bit];
            }
        }
        rep(bit, 1 << N) dp[to][bit] %= MOD, dp[now][bit] = 0;
    }
    // rep(i,2) verr(dp[i], 1 << N);
    cout << dp[N % 2][(1 << N) - 1] << endl;
}

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

int n, k, w[100010];
bool check(int p){
	int i = 0;
	for(int j = 1; j <= k; j++){
		ll s = 0;
		while(s + w[i] <= p){
			s += w[i];
			i++;
			if(i >= n) return true;
		}
	}
	return false;
}
void solve(){
	ll l = 0, r = 100000 * 100000;
	ll mid;
	while(l < r){
		mid = (l + r) / 2;
		//printf("l = %d, r = %d, mid = %d\n", l, r, mid);
		if(check(mid)) r = mid;
		else l = mid + 1;
	}
	printf("%d\n", l);
}
int main()
{
	scanf("%d%d", &n, &k);
	for(int i = 0; i < n; i++) scanf("%d", &w[i]);
	solve();
	return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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; }

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    string S;
    cin >> S;

    int ans = 0;
    if (S == "SSS") ans = 0;
    if (S == "SSR" || S == "SRS" || S == "RSS" || S == "RSR") ans = 1;
    if (S == "RRS" || S == "SRR") ans = 2;
    if (S == "RRR") ans = 3;

    cout << ans << endl;
}

Measured memory_bytes: 3588
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N = int(input())
adj = [[] for _ in range(N)]
for i in range(N - 1):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    adj[x].append(y)
    adj[y].append(x)


def dfs(v, p):
    nim = 0
    for u in adj[v]:
        if u == p:
            continue
        nim ^= dfs(u, v)
    if p == -1:
        return nim
    nim += 1
    return nim

res = dfs(0, -1)

if res:
    print("Alice")
else:
    print("Bob")


Measured memory_bytes: 115052
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const ll MOD = 1000000007;
using namespace std;

int main(){
    int n, ovcnt=0, cnt=0; cin >> n;
    bool used[8] = {false};
    REP(i, n){
        int a; cin >> a;
        if(a >= 3200) ++ovcnt;
        else if(!used[a/400]){
            used[a/400] = true;
            ++cnt;
        }
    }
    cout << max(cnt,1) << " " << cnt + ovcnt << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
typedef long long LL;
int n,m;
int A[100010];
struct Line{
	int l,r;
	Line(int a=0,int b=0){l=a,r=b;}
	bool operator < (const Line& a)const{
		return l==a.l?r<a.r:l<a.l;
	}
}B[300010];
int cnt=0;
LL f[200010],g[200010];
LL Tree1[200010],Tree2[200010];
void Insert1(int i,int a){
	for(;i;i-=(i&(-i))) Tree1[i]+=a;
}
void Insert2(int i,int a){
	for(;i;i-=(i&(-i))) Tree2[i]+=a;
}
LL QuerySum1(int i){
	LL c=0;
	for(;i<=(m<<1);i+=(i&(-i))) c+=Tree1[i];
	return c;
}
LL QuerySum2(int i){
	LL c=0;
	for(;i<=(m<<1);i+=(i&(-i))) c+=Tree2[i];
	return c;
}
int main(){
	scanf("%d%d",&n,&m);
	LL ans=0;
	for(int i=1;i<=n;++i) scanf("%d",&A[i]);
	for(int i=1;i<n;++i){
		if(A[i]<A[i+1]) B[++cnt]=Line(A[i],A[i+1]);
		else B[++cnt]=Line(A[i],A[i+1]+m);
		ans+=(B[cnt].r-B[cnt].l);
	}
/*	for(int i=1;i<=m;++i){
		for(int j=1;j<=cnt;++j){
			if(i>B[j].l&&i<=B[j].r) f[i]+=(i-B[j].l-1);
			else if(i+m>B[j].l&&i+m<=B[j].r) f[i]+=(i+m-B[j].l-1);
			printf("%lld ",f[i]);
		}
		puts("");
	}*/
	for(int i=1;i<=(m*2);++i) B[++cnt]=Line(i,-1);
	sort(B+1,B+1+cnt);
	for(int i=1;i<=cnt;++i){
		if(B[i].r==-1){
			f[B[i].l]=QuerySum1(B[i].l);
			g[B[i].l]=QuerySum2(B[i].l);
		}
		else{
			Insert1(B[i].r,1);
			Insert2(B[i].r,B[i].l);
		}
	}
//	printf("ans=%lld\n",ans);
	LL maxn=0;
	for(int i=1;i<=m;++i){
		f[i]=(i-1)*f[i]-g[i]+(i+m-1)*f[i+m]-g[i+m];
	//	printf("f[%d]=%lld\n",i,f[i]);
		if(f[i]>maxn) maxn=f[i];
	}
	printf("%lld\n",ans-maxn);
//	while(1);
	return 0;
}


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

using namespace std;

typedef long long ll;

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

int main() {
  string s; cin >> s;
  for(int i = 0; i < 2; i++) {
    if(s[i] != s[i + 1]) {
      print("Yes");
      return 0;
    }
  }
  print("No");
}

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

int n;  /* 島の数 */
int bridge[800][800];  /* 橋の行き先 */
int distance[800][800];  /* 橋の長さ */
int num[800];  /* 各島に掛かる橋の数 */

int base, b;

/* 初期化する */
void init(){
	int i;
	for (i = 0; i < n; i++){
		num[i] = 0;
	}
}

/* 指定された二つの島の間に橋を作る。 */
void construct(int i, int j, int d){
	bridge[i][num[i]] = j;
	distance[i][num[i]] = d;
	num[i]++;
	bridge[j][num[j]] = i;
	distance[j][num[j]] = d;
	num[j]++;
}

/*
	指定された島から探索を始める。
	島と橋は木構造であることが分かっているので、深さ優先探索によって遠くの橋から順に解体してゆく。
*/
int tryr(int current, int last){
	int time = 0;
	int i;

	/* 隣の島に移動する場合 */
	for (i = 0; i < num[current]; i++){
		if (bridge[current][i] == last) continue;

		if (num[bridge[current][i]] == 1){
			/* 端の島に繋がる橋なので、渡ることなく解体する */
			time += distance[current][i];
			if (b > base) base = b;
		}else{
			/* 渡った先にも橋があるので、渡って全て解体した後この橋も解体する */
			b += distance[current][i];
			time += distance[current][i] * 3 + tryr(bridge[current][i], current);
			b -= distance[current][i];
		}
	}

	return time;
}

/*
	全ての橋を撤去するのに必要な最短の単位時間数を返す。
	各島を始点とした場合についてそれぞれ int tryr(int current, int last) で試行するが、
	探索の始点と終点は同じ島でなくてよいので、その取りうる最長距離を base として求め、差し引く。
*/
int try(){
	int min = INT_MAX;
	int t, i;
	for (i = 0; i < n; i++){
		base = 0;
		b = 0;
		t = tryr(i, i);
		t -= base;
		if (t < min) min = t;
	}
	return min;
}

int main(void){
	int p[800], d[800];
	int i;

	while (scanf("%d", &n) == 1){
		if (n < 3 || n > 800) break;

		/* 初期化する */
		init();

		/* 橋を入力する */
		for (i = 2; i <= n; i++) scanf("%d", &p[i-1]);
		for (i = 2; i <= n; i++) scanf("%d", &d[i-1]);
		for (i = 2; i <= n; i++) construct(i - 1, p[i-1] - 1, d[i-1]);

		/* 試行し結果を出力する */
		printf("%d\n", try());
	}

    return 0;
}

Measured memory_bytes: 5668
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;


int main(){
    int n, m, k; cin >> n >> m >> k;
    vector<int> a(n), b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    vector<ll> suma(n+1, 0);
    vector<ll> sumb(m+1, 0);
    rep(i, n) suma[i+1] = suma[i] + a[i];
    rep(i, m) sumb[i+1] = sumb[i] + b[i];
    int ans = 0;
    rep(i,n+1){
        int x = k - suma[i];
        if(x < 0) break;
        auto itr = upper_bound(ALL(sumb), x);
        itr--;
        ans = max(ans, i + (int)(itr - sumb.begin()));
    }
    cout << ans << endl;
}

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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#ifdef LOCAL
#define dmp(x) cerr << __LINE__ << " " << #x << " " << x << endl
#else
#define dmp(x) void(0)
#endif

template <class t, class u>
void chmax(t &a, u b)
{
  if (a < b)
    a = b;
}
template <class t, class u>
void chmin(t &a, u b)
{
  if (b < a)
    a = b;
}
const int mod = 1000000007;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};
struct combination
{
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1)
  {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i)
      fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i)
      ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k)
  {
    if (k < 0 || k > n)
      return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

template <class t>
using vc = vector<t>;
template <class t>
using vvc = vc<vc<t>>;

using vi = vc<int>;
int gcd(int a, int b)
{
  if (b == 0)
    return a;
  return gcd(b, a % b);
}
int lcm(int a, int b)
{
  return (a * b) / gcd(a, b);
}
int fact(int n)
{
  if (n == 0)
    return 1;
  return n * fact(n - 1);
}

int main()
{
	string s;
  cin >> s;  
  int ans=0;
  int l =0;
  int r=0;
  rep(i,s.size()){
    if(s[i]=='A'){
    l=i;
      break;
    }
  }
  reverse(s.begin(),s.end());
  rep(i,s.size()){
  if(s[i]=='Z'){
  r=i;
    break;
  }
  }
  
  cout <<s.size()-l-r <<endl;
}

Measured memory_bytes: 640
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define fast  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long


int32_t main(){
	fast;
	int n;
	cin>>n;
	int i,a[n],prod=1,zero=0;
	for(i=0;i<n;i++){
		cin>>a[i];
		if(a[i]==0) zero++;
	}
	if(zero>0){
		cout<<0<<endl;
		return 0;
	}	
	for(i=0;i<n;i++){
		if(a[i]<=1000000000000000000/prod)
			prod*=a[i];
		else{
			cout<<"-1\n";
			return 0;
		}
		
	}
	
	cout<<prod<<endl;
}


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

int N, M;
vector<vector<int>> G;

void dfs(vector<bool> &used, int u, int v, int c) {
  used[c] = true;
  for(auto n: G[c]) {
    if(used[n] || (u == c && v == n) || (v == c && u == n)) continue;
    dfs(used, u, v, n);
  }
}

bool isBridge(int u, int v) {
  vector<bool> used(N, false);
  dfs(used, u, v, u);
  return !used[v];
}

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

  G.resize(N);
  rep(i,M) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }

  int ans = 0;
  rep(i,N) {
    for(int j: G[i]) {
      ans += isBridge(i, j);
    }
  }

  cout << ans/2 << endl;

  return 0;
}


Measured memory_bytes: 256
def answer(x: int) -> int:
    dict = {500: 1000, 5: 5}
    happiness = 0

    for coin in sorted(dict, reverse=True):
        q, x = divmod(x, coin)
        happiness += dict[coin] * q

    return happiness


def main():
    x = int(input())
    print(answer(x))


if __name__ == '__main__':
    main()

Measured memory_bytes: 9136
#include <stdio.h>

int main()
{
    int A, B;
    scanf("%d %d", &A, &B);
    if ((A == 1 && B == 2) || (A == 2 && B == 1))
    {
        printf("3");
    } else if ((A == 1 && B == 3) || (A == 3 && B == 1))
    {
        printf("2");
    } else if ((A == 2 && B == 3) || (A == 3 && B == 2))
    {
        printf("1");
    }

    return 0;
}

Measured memory_bytes: 1636
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const ll mod = 1e9 + 7;
static  ll INF = 1e9;
using namespace std;

signed main(){
	string s;
	cin>>s;
	vector<ll>ans(s.size(),0);
	ll r=0,l=0;
	int mem;
	rep(i,s.size()){
		if(s[i]=='R'){
			if(i){
				if(s[i-1]=='L'){
					if((l+r)%2==0){
						ans[mem-1]=(l+r)/2;
						ans[mem]=(l+r)/2;
					}
					else {
						ans[mem-1]=(l+r)/2+((l+r)%2==r%2);
						ans[mem]=(l+r)/2+((l+r)%2==l%2);
					}
					r=0;
					l=0;
				}
			}
			++r;
		}
		else {
			++l;
			if(s[i-1]=='R')mem=i;
		}
	}
if((l+r)%2==0){
						ans[mem-1]=(l+r)/2;
						ans[mem]=(l+r)/2;
					}
					else {
						ans[mem-1]=(l+r)/2+((l+r)%2==r%2);
						ans[mem]=(l+r)/2+((l+r)%2==l%2);
					}

rep(i,s.size()){
		if(i)cout<<" ";
		cout<<ans[i];
	}
	cout<<endl;
	return 0;
}


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

int keta(int x)
{
	int cnt;

	cnt = 0;
	if (x < 10)
	{
		cnt++;
		return cnt;
	}
	cnt += keta(x / 10);
	cnt += keta(x % 10);
	return (cnt);
}

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

	cnt = 0;
	for (int i = 1; i <= n; i++)
		if (keta(i) % 2 != 0)
			cnt++;
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
  int E;
  int A, B;
  cin >> A >> B;
  vector<int> vec(A);
  rep(i,B){
    int C = 0;
    cin >> C;
    rep(i,C){
      int D = 0;
      cin >> D;
      vec[D-1] = 1;
    }
  }
  rep(i,A){
    if(vec[i] == 0){
      E++;
    }
  }
  cout << E << endl;
 
 
 
  return 0;
}

Measured memory_bytes: 3628
def makelist(n, m):
  return [[False for i in range(m)] for j in range(n)]


N, M = map(int, input().split())
graph = [0]*N
ans = [0]

for i in range(N):
  graph[i] = []
  
for i in range(M):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  graph[a].append(b)
  graph[b].append(a)
  
def dfs(now, dp):
  if dp.count(True) == N:
    ans[0] += 1
  else:
    for e in graph[now]:
      if not dp[e]:
        nextdp = dp[:]
        nextdp[e] = True
        dfs(e, nextdp)

first = [False]*N
first[0] = True
dfs(0, first)
print(ans[0])

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

using namespace std;

#define INF (1ll << 62)
#define pb push_back
#define ii pair<int,int>
#define OK cerr <<"OK"<< endl
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define endl '\n'

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

  int ans = 0;

  int n;

  cin >>  n;

  for(int i = 1; i <= n; i++) {
    if(to_string(i).size() & 1) 
        ans++;
  }

  cout << ans << endl;

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

void solveA(){
    ll N,K; cin >> N >> K;
    if(N%K == 0) cout << 0 << endl;
    else cout << 1 << endl;
}
void solveB(){
    ll N; cin >> N;
    vector<int> dp(1000);
    dp[0] = true;
    for(int i = 0; i < 100;i++){
        for(int j = 0; j < 500;j++){
            if(dp[j]){
                dp[j+4] = true;
                dp[j+7] = true;
            }
        }
    }
    if(dp[N]) cout << "Yes" << endl;
    else cout << "No" << endl;
}
void solveC(){
    ll n; cin >> n;
    if(n == 0) cout << 0 << endl;
    string ans;
    while(n!=0){
        ans += to_string(abs(n)%2);
        if(n%2==0) n /= (-2);
        else{
            if(n>=0){
                n/= 2;
                n*=-1;
            }else{
                n*=-1;
                n++;
                n/=2;
            }
        }
    }
    reverse(ans.begin(),ans.end());
    cout << ans << endl;
}
void solveD(){
    ll N,M; cin >> N >> M;
    vector<ll> A(N); for(auto& in:A) cin >> in;
    for(int i = 0; i < N;i++) A[i]%=M;
    vector<ll> cusum(N+1);
    for(int i = 0; i < N;i++){
        cusum[i+1] = cusum[i] + A[i];
        cusum[i+1]%=M;
    }
    map<ll,ll> mp;
    for(int i = 0; i <= N;i++) mp[cusum[i]]++;
    ll ans = 0;
    for(auto p:mp){
        ll cnt = p.second;
        ans += cnt*(cnt-1)/2;
    }
    cout << ans << endl;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
//    solveA();
//    solveB();
    solveC();
//    solveD();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define print(a,n)  for(lli i=0;i<n;i++)cout<<a[i]<<' ';br
#define br          cout<<endl;
#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define f           first
#define s           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define upar        1000000007
#define fr(i,a,b)   for(int i=a;i<=b;i++)
#define tez         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int arr[1000005];
void solve()
{
int a,b,ans=0;
cin>>a>>b;
a= __gcd(a,b);
fr(i,2,2000000)
{
    if(a%i==0)
    {
        ans++;
        while(a%i==0)
        {
            a/=i;
        }
    }
}
if(a>1) ans++;
cout<<ans+1;
}


signed main() {

  tez;
  int t = 1;
  // cin>>t;
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef signed long long int ll;
ll inf=1000000007;




int main(){
    int n,m;
    cin>>n>>m;
    ll x[1005],y[1005],z[1005];
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i]>>z[i];
    }
    ll ans=0;
    for(int i=-1;i<=1;i+=2){
        for(int j=-1;j<=1;j+=2){
            for(int k=-1;k<=1;k+=2){
                ll tmp[1005];
                ll tmpans=0;
                for(int l=0;l<n;l++){
                    tmp[l]=i*x[l]+j*y[l]+k*z[l];
                }
                
                sort(tmp,tmp+n,greater<ll>());
                for(int l=0;l<m;l++){
                    tmpans+=tmp[l];
                }
                
                ans=max(ans,tmpans);
            }
        }
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
H,W=map(int,input().split())
Map=['.'*(W+2)]
for i in range(H):
    line='.'+input()+'.'
    x=[]
    for j in range(W+2):
        x.append(line[j])
    Map.append(x)
Map.append('.'*(W+2))
for h in range(1,1+H):
    for w in range(1,1+W):
        if Map[h][w]=='.':
            cnt=0
            for i,j in [(-1,-1),(-1,0),(0,-1),(1,-1),(-1,1),(1,0),(0,1),(1,1)]:
                if Map[h+i][w+j]=='#':cnt+=1
            Map[h][w]=str(cnt)
for h in range(1,1+H):
    print(''.join(Map[h][1:-1]))

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

using namespace std;

int main() {
    int n;
    cin >> n;
    set<string> se;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s, se.insert(s);
    }
    cout << se.size() << endl;
    return 0;
}

Measured memory_bytes: 19256
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include <map>
#include <string.h>
#include <algorithm>
#include <bits/stdc++.h>
#include <vector>
 
using namespace std;
#define set_precision cout << fixed << setprecision(10)
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repb(i, a, b) for (int i = a; i >= b; i--)
#define replb(i, a, b) for (ll i = a; i >= b; i--)
#define repl(i, a, b) for (ll i = a; i < b; i++)
#define repit(arr) for (auto it = arr.begin(); it != arr.end(); it++)
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vl vector<long long int>
#define Vi vector<vector<int>>
#define vpi vector<pair<int,int>>
#define seti set<int>
#define setl set<ll>
#define dseti set<int, greater<int>>
#define dsetl set<ll, greater<ll>>
#define mseti multiset<int>
#define msetl multiset<ll>
#define dmseti multiset<int, greater<int>>
#define dmsetl multiset<ll, greater<ll>>
#define sortA(arr) sort(arr.begin(), arr.end())
#define dsortA(arr) sort(arr.begin(), arr.end(), greater<int>())
#define ssort(arr) stable_sort(arr.begin(), arr.end())
#define search(arr, c) binary_search(arr.begin(), arr.end(), c)
#define pb push_back
#define ll long long
#define cl_bf cin.ignore(numeric_limits<streamsize>::max(), '\n');
#define castl static_cast<ll>
#define BRAHAMASTRA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ull unsigned long long int

int main()
{
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	BRAHAMASTRA

	ull n,k;
	cin>>n>>k;
	ull a[n];
	for(int i=0;i<n;++i)
		cin>>a[i];
	ull sum=0;
	int j=0;
	sum=accumulate(a,a+k,sum);
	for(int i=k;i<n;++i)
	{
		ull nsum=sum+a[i]-a[j];
		if(nsum>sum)
			cout<<"Yes"<<"\n";
		else
			cout<<"No\n";
		sum=nsum;
		j++;
	}
}

Measured memory_bytes: 5200
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;

class Main {
    public static void main (String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder("");
        int a, b, digit;
        while (sc.hasNextInt()) {
            a = sc.nextInt();
            b = sc.nextInt();
            digit = (int) Math.log10(a+b) + 1;
            sb.append(digit);
            sb.append('\n');
        }
        System.out.print(sb);
    }
}

Measured memory_bytes: 26528
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

const ll INF = 1000000;

int main() {
  ll n;
  cin >> n;
  ll M = -INF, m = INF, sum = 0;
 
  for (ll i = 0; i < n; i++) {
    ll a;
    cin >> a;
    M = max(M, a);
    m = min(m, a);
    sum += a;
  }

  cout << m << " " << M << " " << sum << endl;
  return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
int main () {
  int A, B, C;
  cin >> A >> B >> C;
  int flag = 0;
  if(A == B && B != C)flag = 1;
  if(A == C && B != C)flag = 1;
  if(B == C && A != C)flag = 1;
  cout << (flag?"Yes":"No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
using namespace std;
int intinput() {
	int x;
	cin >> x;
	return x;
}
vector<int> forintinput(int n) {
	vector<int> x(100000);
	for(int i = 0;i < n;i++) cin >> x[i];
	return x;
}
int main(){
	vector<int> x(5);
	x = forintinput(5);
	int cnt = 0;
	for(int i = 0;i < 5;i++){
		if(x[i] == 0){
			cnt = i;
		}
	}
	cout << cnt+1 << endl;
}

Measured memory_bytes: 3672
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n;
  	string s;
  	cin>>n>>s;
  	int ans = 1;
  	rep(i,1,n-1)if(s[i]!=s[i-1])++ans;
  	cout<<ans<<endl;
}


Measured memory_bytes: 512
import numpy as np

def main():
    n=int(input())
    d=inputList()

    ans=0
    for i in range(0,n):
        for j in range(i+1,n):
            ans+=d[i]*d[j]

    print(ans)

def inputList():
    a=list(map(int,input().split()))
    return a

def multisort(li,index):
    return sorted(li,key=lambda x: x[index])

if(__name__=='__main__'):
    main()


Measured memory_bytes: 12504
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n,cnt=0;
  cin>>n;
  for(int i=0;i<n;i++){
    int a,b;
    cin>>a>>b;
    if(a==b)cnt++;
    if(a!=b)cnt=0;
    if(cnt>=3){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}

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


int N, A[100000], A_odd[100000], A_even[100000], A_sort[100000], A_compressed[100000];



int main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        A_sort[i] = A[i];
    }
    sort(A_sort, A_sort + N);
    long long ans = 0;
    for(int i = 0; i < N; i++){
        int *p = lower_bound(A_sort, A_sort + N, A[i]);
        //printf("i = %d, p-A_sort = %d\n", i, p-A_sort);
        if( (p - A_sort - i) % 2 != 0 ){
            ans++;
        }
    }
    cout << ans/2 << endl;
    
    
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(){

  int i,j,k,v,N;
  
  scanf("%d",&N);
  j=N;
  int A[N];
  
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  
  for(i=0;i<N;i++){
    
    v=A[i];
    
    j=i-1;
    
    while(j>=0 && A[j]>v){
      
      A[j+1] = A[j];
      j--;
      A[j+1] = v;
      
    }
    
    for(k=0;k<N;k++){
      if(k!=N-1) printf("%d ",A[k]);
      else printf("%d",A[k]);
    }
    printf("\n");
  }
  
  
  return 0;
}



Measured memory_bytes: 2056
// Problem : 
// 			A - Rainy Season
// 			
// 		
// Contest : AtCoder - AtCoder Beginner Contest 175
// URL : https://atcoder.jp/contests/abc175/tasks/abc175_a
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
   

#include<bits/stdc++.h>
#define ll                    long long int
#define pb                    push_back
#define F                     first
#define S                     second
#define mp                    make_pair
#define MOD                   1000000007
#define vi                    vector<int>
#define vll                   vector<ll>
#define pll                   pair<ll,ll>
#define pii                   pair<int,int>
#define all(p)                p.begin(),p.end()
#define mid(s,e)              (s+(e-s)/2)
#define eb                    emplace_back
#define ull                   unsigned long long
#define bug(x)				  cout<<"  [ "#x<<" = "<<x<<" ]"<<endl;
#define KAMEHAMEHA            ios_base::sync_with_stdio(0);
#define RASENGAN              ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
void solve()
{
	string s;
	cin>>s;
	int mx=0;
	if(s[0]=='R' && s[1]=='R' && s[2]=='R')
		mx=3;
	else if((s[0]=='R' && s[1]=='R') || (s[1]=='R' && s[2]=='R'))
		mx=2;
	else if(s[0]=='R' || s[1]=='R' || s[2]=='R')
		mx=1;
	cout<<mx<<endl;
}
int main()
{
    KAMEHAMEHA
	int t=1;
	//cin>>t;
	for(int cn=1;cn<=t;cn++)
	{
		solve();
	}
    return 0;
}



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

int main(){
    int n,k;
    cin>>n>>k;
    int ans=k;
    for(int i=0;i<n-1;i++){
        ans*=(k-1);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string.h>
#include<math.h>
using namespace std;

string change(string S, char c1, char c2, int num, int length) {
	string ans = S;
	for (int i = 0; i < length; i++) {
		if (ans[i] == c1) {
			if (i < num) return "X";
			ans[i] = c2;
		}
		else if (ans[i] == c2) {
			if (i < num) return "X";
			ans[i] = c1;
		}
	}
	return ans;
}

int main()
{
	string S,T;
	cin >> S;
	cin >> T;
	string tmp;
	for (int i = 0; i < S.length(); i++) {
		if (S[i] != T[i]) {
			tmp = change(S, S[i], T[i], i, S.length());
			if (tmp == "X") {
				cout << "No" << endl;
				return 0;
			}
			else {
				S = tmp;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1280
#include <stdio.h>

int main(int argc, char **argv){
	int i,j,k;
	int n,m,l,*a,*b;
	int nm,ml,c1,c2;

	// Input N*M
	scanf("%d %d %d",&n,&m,&l);
	// Input a
	nm = n * m;
	a = malloc(sizeof(int)*nm);
	for(i=0;i<nm;i++){
		scanf("%d", a+i);
	}
	// Input b
	ml = m * l;
	b = malloc(sizeof(int)*ml);
	for(i=0;i<ml;i++){
		scanf("%d",b+i);
	}
	// Calc c & Output c
	for(i=0;i<n;i++){
		for(j=0;j<l;j++){
			c1 = c2 = 0;
			for(k=0;k<m;k++){
				c1 += a[m*i+k] * b[l*k+j];
				if( c1 >= 100000000 ){
					c2++;
					c1 -= 100000000;
				}
			}
			if( c2 > 0 ){
				printf("%d%08d",c2,c1);
			} else {
				printf("%d",c1);
			}
			if( j < l-1 ){
				printf(" ");
			} else {
				printf("\n");
			}
		}
	}

	return 0;
}

Measured memory_bytes: 692
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define mp make_pair
#define vi vector<int>
#define pb push_back
using namespace std;
const int N=1e5+5;
int a[3];
int main()
{
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	cout<<a[0]+a[1];
	return 0;
}

Measured memory_bytes: 256
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main(){
	FIO
	
	int a, b, c;
	cin  >> a >> b >> c;
	if(a + c == 2 * b)puts("YES");
	else puts("NO");
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;


public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
		String [] str = bufferedReader.readLine().split(" ");
		Integer a = Integer.parseInt(str[0]);
		Integer b = Integer.parseInt(str[1]);
		Integer c = Integer.parseInt(str[2]);
		Integer tmp;
		
		Integer [] inlist = new Integer[str.length];
		
		for(int i = 0; i < str.length; i++){
			inlist[i] = Integer.parseInt(str[i]);
		}
		Arrays.sort(inlist);
	
		System.out.println(inlist[0] + " "+ inlist[1] + " " + inlist[2]);
		
	}
}

Measured memory_bytes: 24252
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = INT64_MAX;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;
using Vi = vector<long long int>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<=former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
typedef vector<vector<ll> > matrix;
///////////////////////////////////////////////////////////////////////////////////

Vi a(100000),l(100000),r(100000);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    rep(i,n)cin>>a[i];
    l[0]=a[0];
    rep(i,n-1){
        l[i+1] = __gcd(l[i],a[i+1]);
    }
    r[n-1]=a[n-1];
    for(ll i=n-1;i>0;i--){
        r[i-1] = __gcd(r[i],a[i-1]);
    }
    ll ans=l[n-1],tmp;
    rep(i,n){
        if(i==0)continue;
        if(i==n-1)continue;
        chmax(ans,__gcd(l[i-1],r[i+1]));
    }
    chmax(ans,l[n-2]);
    chmax(ans,r[1]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2560
<?php
/**
 * Created by PhpStorm.
 * User: ramia
 * Date: 2016/09/24
 * Time: 21:00
 */
class STD {
	static function input(){
		$line = trim(fgets(STDIN));
		return $line;
	}

	static function output( $text ){
		echo $text."\n";
	}
}


$n = STD::input();
$neko = explode(' ',STD::input());

$likes[] = 99999;
foreach ( $neko as $hoge ){
	$likes[] = $hoge;
}

$result = 0;
foreach ( $likes as $key => $value ){
	if( $key == 0 ){
		continue;
	}
	//echo $key.' + '.$likes[$value]."\n";
	if( $key == $likes[$value] ){
		$result++;
	}
}

STD::output($result/2);


?>

Measured memory_bytes: 30576
#include<bits/stdc++.h>
using namespace std;
int a[500];

int main()
{
	int n;
	cin>>n;
	for (int i=1;i<=2*n;i++)
	    cin>>a[i];
	n*=2;
	sort(a+1,a+n+1);
	int ans=0;
	for (int i=1;i<=n;i+=2)
	    ans+=a[i];
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	A, B := sc.nextStr(), sc.nextStr()
	ans := ""
	if len(A) > len(B) {
		ans = "g"
	} else if len(A) < len(B) {
		ans = "l"
	} else {
		all := true
		for i, r := range A {
			if r > rune(B[i]) {
				ans = "g"
				all = false
				break
			} else if r < rune(B[i]) {
				ans = "l"
				all = false
				break
			}
		}
		if all {
			ans = "e"
		}
	}

	if ans == "g" {
		fmt.Fprintln(wtr, "GREATER")
	} else if ans == "l" {
		fmt.Fprintln(wtr, "LESS")
	} else {
		fmt.Fprintln(wtr, "EQUAL")
	}
	wtr.Flush()
}


Measured memory_bytes: 640