akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <algorithm>
#include <iostream>
#include <queue>
using namespace std;
using Graph = vector< vector<int> >;

int main() {
    int N, M; cin >> N >> M;
    Graph G(N);
    for(int i=0; i<M; i++) {
        int u, v; cin >> u >> v;
        u--; v--;
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }

    const int INF = 1 << 28;
    vector<int> dist(N, INF);
    dist[0] = 0;
    
    queue<int> que;
    que.emplace(0);
    while(que.size()) {
        int cur = que.front(); que.pop();
        for(auto to : G[cur]) {
            if(dist[to] > dist[cur] + 1) {
                dist[to] = dist[cur] + 1;
                que.emplace(to);
            }
        }
    }

    bool infinite = true;
    vector<int> ans(N, INF);
    for(int i=0; i<N; i++) {
        for(auto j : G[i]) {
            // 二部グラフでない
            if(dist[i] == dist[j]) {
                infinite = false;
                ans[i] = ans[j] = dist[i];
            }
        }
    }

    if(infinite) {
        cout << -1 << endl;
    }
    else {
        for(int i=0; i<N; i++) {
            if(ans[i] != INF) {
                que.emplace(i);
            }
        }

        while(que.size()) {
            int cur = que.front(); que.pop();
            for(auto to : G[cur]) {
                if(ans[to] > ans[cur] + 1) {
                    ans[to] = ans[cur] + 1;
                    que.emplace(to);
                }
            }
        }

        cout << *max_element(ans.begin(), ans.end()) << endl;
    }
    return 0;
}



Measured memory_bytes: 9920
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		long X = stdIn.nextLong();
		long ans = 0;
		long a = 100;
		for(;;){
			ans++;
			a = a + a/100;
			if(X <= a){
				break;
			}
		}
		System.out.println(ans);
		stdIn.close();
	}
}

Measured memory_bytes: 35704
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,d,res=0; cin >>a >>b >>c >>d;
  bool al = false;
  bool bo = false;
  for(int i=0; i<101; ++i) {
    if(a <= i && i <= b) al = true;
    if(c <= i && i <= d) bo = true;
    if(al && bo) ++res;
    al = false;
    bo = false;
  }
  if(res == 0) ++res;
  cout << res-1 << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

// Common memset settings
//memset(memo, -1, sizeof memo); // dp memoization with -1
//memset(arr, 0, sizeof arr); //clear array of integers




int main(){
	//ios::sync_with_stdio(0);
	//cin.tie(0);
	
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	int n,m;

	cin >> n >> m;

	vector <int> arr(m+1,0);


	int k;

	for(int i =0;i<n;i++){
		cin >> k;

		int a;

		for(int j = 0; j<k; j++){
			cin >> a;

			arr[a]++;
		}
	}


	int counter = 0;

	for(int i =0;i<=m;i++){
		if(arr[i] == n)
			counter++;
	}

	cout << counter;
	

	return 0;
}




Measured memory_bytes: 256
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
B = [int(input()) for i in range(N)]

for i in range(3):
    for j in range(3):
        for k in range(N):
            if A[i][j] == B[k]:
                A[i][j] = 0

ans = "No"
for i in range(3):
    if A[i][0] == 0 and A[i][1] == 0 and A[i][2] == 0:
        ans = "Yes"
    elif A[0][i] == 0 and A[1][i] == 0 and A[2][i] == 0:
        ans = "Yes"
    elif A[0][0] == 0 and A[1][1] == 0 and A[2][2] == 0:
        ans = "Yes"
    elif A[0][2] == 0 and A[1][1] == 0 and A[2][0] == 0:
        ans = "Yes"

print(ans)

Measured memory_bytes: 3064
#include"bits/stdc++.h"
#include<iostream>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define rep(i, c) for(int i = 0; i < (int)c; i++)
const ll inf = ll(1e18)+1;

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

	vector<ll> a(n);

	rep (i,n) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());

	rep(i, n-1) {
		if (a[i]==a[i+1]) {
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES"<< endl;
	return 0;
}

Measured memory_bytes: 4748
//organize , stay in moment and work -- Abhinav IIIT-A
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ar array
#define f(i,x,n) for(int i=x;i<n;++i)
#define sz(s) s.size()
#define pb push_back
void solve(){
    int a[3];
    f(i,0,3)
    cin>>a[i];
    sort(a,a+3);
    if((a[0]==a[1] || a[1] == a[2] )&& a[0]!=a[2] )
        cout<<"Yes\n";
    else
        cout<<"No\n";
}
void tp(){
    int n; cin>>n;
    bool tp=1;
    while(n--){
        int cp;
        cin>>cp;
        if(cp%2==0){
            if(!(cp%3==0 || cp%5==0))
                tp=0;
        }
    }
    tp ? cout<<"APPROVED" : cout<<"DENIED";
}
void q3(){
    int n;
    cin>>n;
    int mx=0;
    map<string ,int> mp;
    while(n--){
        string cp;
        cin>>cp;
        int xp=++mp[cp];
        mx=max(mx,xp);
    }
    for(auto ip : mp){
        if(ip.second==mx)
            cout<<ip.first<<"\n";
    }
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;t=1;
    //cin>>t
    while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    String[] line = br.readLine().split(" ");

	    int r = Integer.parseInt(line[0]);
	    int c = Integer.parseInt(line[1]);

	    int[][] matrix = new int[r + 1][c + 1];

	    for (int i = 0; i < r; i++) {
	    	line = br.readLine().split(" ");

	    	for (int j = 0; j < line.length; j++) {
		    	matrix[i][j] = Integer.parseInt(line[j]);

		    	// row sum
		    	matrix[i][c] += matrix[i][j];
		    	// col sum
		    	matrix[r][j] += matrix[i][j];

		    	if (j == line.length - 1) {
			    	// all sum
			    	matrix[r][c] += matrix[i][c];
		    	}
	    	}
	    }

	    for (int i = 0; i < r + 1; i++) {
	    	for (int j = 0; j < c + 1; j++) {
	    		System.out.print(matrix[i][j]);
	    		if (j < c) System.out.print(" ");
	    	}
	    	System.out.println("");
	    }
	}
}

Measured memory_bytes: 32988
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
int n,a[200010],dp[200010][5];
void solve(){
    cin>>n;
    rep(i,n)cin>>a[i];
    rep(i,n+1)rep(j,5)dp[i][j]=INF;
    dp[0][0]=0;
    rep(i,n){
        rep(j,5){
            for(int k=j;k<5;k++){
                int cost;
                if(k==0||k==4)cost=a[i];
                if(k==1||k==3){
                    if(a[i]==0)cost=2;
                    else cost=a[i]%2;
                }
                if(k==2)cost=(a[i]+1)%2;
                chmin(dp[i+1][k],dp[i][j]+cost);
            }
        }
    }
    int ans=INF;
    rep(i,5)chmin(ans,dp[n][i]);
    cout<<ans<<endl;
}
signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    //int t;cin>>t;while(t--)
    solve();
    return 0;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ll N;
  cin >> N;
  FOR(w,1,3501){
    FOR(n,1,3501){
      if(4*n*w - N*(n+w) == 0) continue;
      ll h = (N * n * w)/(4LL * n * w - N * (n + w) );

      if(h > 0 && h <= 3500){
        if(4LL*h*n*w == (h*n + n*w + w*h) * N){
          cout << h << ' ' << n << ' ' << w << endl;
          return 0;
        }
      }
    }
  }
  cout << "error" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<iostream>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstring>
#include<cassert>
#include<random>
#include<fstream>
#include<chrono>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define int          long long
#define ld           long double
#define pii          pair<int,int>
#define vi           vector<int>
#define pb           push_back
#define mp           make_pair
#define ff           first
#define ss           second
#define rep(i,s,e)   for(int i=(s);i<=(e);i++)
#define brep(i,s,e)  for(int i=(s);i>=(e);i--)
#define all(x)       (x).begin(),(x).end()
#define ball(x)      (x).rbegin(),(x).rend()
#define sz(x)        (int)x.size()
#define mem(x,y)     memset(x,y,sizeof(x))
#define VR46         ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);ifstream fin("ip.txt");ofstream fout("op.txt");
#define milf(x)      x.reserve(1LL<<14LL); x.max_load_factor(0.25); // less_equal
#define pbds         tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
mt19937              rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1e9+7;
const int INF = 0x3F3F3F3F3F3F3F3F;
ld EPS = 1e-12;

signed main()
{
    VR46 // GANDU TEST CASE BNALE
    // int t;cin>>t;rep(test,1,t)
    {
        int a, b;
        cin>>a>>b;
        int pa1 = (a*25)/2 + ( (a*25)%2 != 0 ), pa2 = ((a+1)*25)/2 - ( ((a+1)*25)%2 == 0 );
        int pb1 = b*10, pb2 = pb1 + 9;
        int ans = max( pa1,pb1 );
        // cout<< ans <<endl;
        // cout<< pa2 <<" "<< pb2 <<endl;
        if( ans>pa2 || ans>pb2 ) cout<<"-1\n";
        else cout<< ans <<endl;
    }
}

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

vi par,sz,vis,dis;
vector<vi> graph;
vector<vector<pair<li,li>>> wgraph;

void init(li n)
{
    par.resize(n);
    sz.resize(n);
    wgraph.resize(n);
    dis.resize(n);
    vis.resize(n);
    graph.resize(n);

    f(i,0,n-1)
    {
        par[i]=i;
        sz[i]=1;
        dis[i]=1e18;
    }
}

li root(li a)
{
    while(a!=par[a])
    {
        par[a]=par[par[a]];
        a=par[a];
    }

    return a;
}

void unio(li a,li b)
{
    li r_a=root(a);
    li r_b=root(b);

    if(par[r_a]!=r_b)
    { 
        if(sz[r_a]<sz[r_b])
        {
            par[r_a]=par[r_b];
            sz[r_b]+=sz[r_a];
            sz[r_a]=0;
        }
        else
        {
            par[r_b]=par[r_a];
            sz[r_a]+=sz[r_b];
            sz[r_b]=0;
        }
    }
}

int main()
{    
    

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

    li n,r;

    cin>>n>>r;

    if(n>=10)
        cout<<r;
    else
        cout<<r+100*(10-n);



    return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

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

    bool f = true;
    REP(i,1,SZ(S)) {
        if(S[i] != S[0]) {
            f = false;
            break;
        }
    }

    if(f) {
        PR(K*SZ(S)/2);
    }
    else {
        string T = S + S;
        ll cnt1 = 0, cnt2 = 0;
        REP(i,0,SZ(S)-1) {
            if(S[i] == S[i+1]) {
                ++cnt1;
                ++i;
            }
        }
        REP(i,0,SZ(T)-1) {
            if(T[i] == T[i+1]) {
                ++cnt2;
                ++i;
            }
        }
        PR(cnt1+(cnt2-cnt1)*(K-1));
    }

    return 0;
}

/*

*/

Measured memory_bytes: 3592
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int n,m,s,g;
	static boolean[][][] visited;   //node,pref,v
	static double[][][] cost;       //node,pref,v
	static int[][] D,C;
	static int[] dspeed = {-1, 0, 1};
	static final int INF = (1 << 21);

	public static void main(String[] args) {
		while(read()) {
			solve();
		}
	}

	static boolean read() {
		n = sc.nextInt(); m = sc.nextInt();
		if(n == 0 && m == 0) return false;
		s = sc.nextInt(); g = sc.nextInt();
		D = new int[n+1][n+1]; C = new int[n+1][n+1];
		for(int v = 0; v < n+1; v++) {
			Arrays.fill(D[v], INF);
			Arrays.fill(C[v], INF);
		}
		for(int i = 0; i < m; i++) {
			int x = sc.nextInt(), y = sc.nextInt(), d = sc.nextInt(), c = sc.nextInt();
			D[y][x] = D[x][y] = d;
			C[y][x] = C[x][y] = c;
		}
		return true;
	}

	static void solve() {
		cost = new double[n+1][n+1][30+1];
		for(int i = 0; i < n+1; i++) for(int j = 0; j < n+1; j++) Arrays.fill(cost[i][j], INF);
		PriorityQueue<IState> que = new PriorityQueue<IState>();
		for(int v = 1; v <= n; v++) {
			if(D[s][v] == INF) continue;
			cost[v][s][1] = D[s][v] / 1.0;
			IState st = new Main().new IState(v,s,1, D[s][v] / 1.0);
			que.add(st);
		}
		while(!que.isEmpty()) {
			IState u = que.poll();
			if(u.node == g && u.speed == 1) {
				System.out.printf("%.5f\n", cost[u.node][u.pref][u.speed]);
				return;
			}
 			for(int v = 1; v <= n; v++) {
				if(D[u.node][v] == INF) continue;
				for(int k = 0; k < 3; k++) {
					int nspeed = u.speed + dspeed[k];
					if(nspeed > C[u.node][v] || v == u.pref) continue;
					double new_cost = cost[u.node][u.pref][u.speed] + D[u.node][v] / (double)nspeed;
					if(new_cost < cost[v][u.node][nspeed]) {
						cost[v][u.node][nspeed] = new_cost;
						IState st = new Main().new IState(v, u.node, nspeed, new_cost);
						que.add(st);
					}
				}
			}
		}
		System.out.println("unreachable");
	}

	public class IState implements Comparable<IState>{
		int node,pref,speed;
		double cost;
		IState(int node, int pref, int speed, double cost) {
			this.node = node; this.pref = pref; this.speed = speed; this.cost = cost;
		}
		public int compareTo(IState s) {
			if(this.cost < s.cost) {
				return -1;
			} else if(this.cost > s.cost) {
				return 1;
			} else {
				return 0;
			}
		}

		public String toString() {
			return "" + node + " " + pref + " " + speed + " " + cost;
		}
	}

}

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

long long H, W, INF = 1000000000;
long long dx[4] = { 0, 0, 1, -1 }, dy[4] = { 1, -1, 0, 0 };
vector<string> S;

long long BFS(long long X, long long Y) {
	queue<pair<long long, long long> > Q;
	vector<vector<long long> > Dist(H, vector<long long>(W, INF));
	Q.push({ X, Y });
	Dist[X][Y] = 0;
	while (!Q.empty()) {
		pair<long long, long long> P = Q.front();
		Q.pop();
		for (int i = 0; i < 4; i++) {
			long long NX = P.first + dx[i], NY = P.second + dy[i];
			if (0 <= NX && NX < H && 0 <= NY && NY < W) {
				if (S[NX][NY] == '.' && Dist[NX][NY] == INF) {
					Dist[NX][NY] = Dist[P.first][P.second] + 1;
					Q.push({ NX, NY });
				}
			}
		}
	}
	long long MAX = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (Dist[i][j] != INF) MAX = max(MAX, Dist[i][j]);
		}
	}
	return MAX;
}

int main() {
	cin >> H >> W;
	S.resize(H);
	for (int i = 0; i < H; i++) cin >> S[i];
	long long ANS = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (S[i][j] == '.') ANS = max(ANS, BFS(i, j));
		}
	}
	cout << ANS << endl;
}

Measured memory_bytes: 256
n = list(map(int,input().split()))
if n[0]*-1+n[1]*-1+n[2]>0:
    if (n[0]*-1+n[1]*-1+n[2])**2 > 4*n[0]*n[1]:
        print("Yes")
    else:
        print("No")
else:
    print("No")


Measured memory_bytes: 38476
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
    public:
        long long solve(int n, int m, int K) {
            init(n + K + 123);

            vector<long long> cnts(n + 2, 1);
            cnts[1] = m;
            for (int i = 2; i <= n; ++i) {
                cnts[i] = cnts[i - 1] * (m - 1) % MOD;
            }

            long long res = 0;
            
            for (int i = 1; i <= n; ++i) {
                if (n - i <= K) {
                    res += cnts[i] * nCr(n - 1, i - 1) % MOD;
                    res %= MOD;
                }
            }

            return res;
        }

    private:
    const static long long MOD = 998244353;

    vector<long long> pow2;
    vector<long long> F;
    vector<long long> IF;

    long long norm(long long a) {
        a %= MOD;
        if (a < 0) {
            a += MOD;
        }
        return a;
    }

    long long inverse(long long a) {
        long long b = MOD;
        long long u = 0, v = 1;
        a = norm(a);
        while (a != 0) {
            long long d = b / a;
            b -= d * a;
            u -= d * v;
            swap(a, b);
            swap(u, v);
        }
        return norm(u);
    }

    long long powM(long long x, long long e) {
        long long res = 1;
        while (e > 0) {
            if (e & 1) {
                res = res * x % MOD;
            }
            x = x * x % MOD;
            e >>= 1;
        }
        return res;
    }

    void init(int n) {
        F.clear();
        F.resize(n + 1, 1);
        IF = F;
        pow2.clear();
        pow2.resize(n + 1, 1);
        for (int i = 1; i <= n; ++i) {
            pow2[i] = pow2[i - 1] * 2 % MOD;
        }

        for (int i = 1; i <= n; ++i) {
            F[i] = F[i - 1] * i % MOD;
        }
        IF[n] = inverse(F[n]);
        for (int i = n - 1; i > 0; --i) {
            IF[i] = IF[i + 1] * (i + 1) % MOD;
        }
    }

    long long nCr(int n, int r) {
        if (r < 0 || r > n) {
            return 0;
        }
        long long res = F[n] * IF[r] % MOD * IF[n - r] % MOD;
        return res;
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);


    int n, m, k;
    cin >> n >> m >> k;

    Solution sol;

    cout << sol.solve(n, m, k) << '\n';

    return 0;
}

Measured memory_bytes: 14248
function Main(input) {

	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n").filter(Boolean);
    
    let K = Number(input[0])
    let res = ""
    
    for (let i = 0; i < K; i++) res += "ACL"
    
    console.log(res)
    
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29628
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int member = sc.nextInt();
			int quorum = sc.nextInt();
			if(member==0&&quorum==0) break;
			int[] dates = new int[100];

			for(int i=0; i<member; i++){
				int dates_num = sc.nextInt();
				for(int j=0; j<dates_num; j++){
					int day = sc.nextInt();
					dates[day-1]++;
				}
			}

			int max = 0, maxday = 0;

			for(int i=0; i<100; i++){
				if(max<dates[i]){
					max = dates[i];
					maxday = i+1;
				}
			}

			if(max<quorum){
				System.out.println("0");
			}else{
				System.out.println(maxday);
			}
		}
	}
}

Measured memory_bytes: 68708
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int n;
int dp[10010];
int s[110];
int main(void){
	cin >> n;
	rep(i, n) cin >> s[i];
	dp[0] = 1;
	for (int i = 0; i < n; ++i){
		for (int j = 10000; j >= 0; --j){
			if(j - s[i] >= 0 && dp[j - s[i]]){
				dp[j] = 1;
			}
		}
	}
	int ans = 0;
	for (int i = 10000; i >= 0; --i){
		if(i % 10 != 0 && dp[i]) chmax(ans, i);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.20f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

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

	a.pb(-1);

	bool dw = true;
	int nowi = 100000;
	ll ans = 1000;
	int nowa = 0;
	for (int i = 0; i < n; ++i) {
		if (dw) {
			chmin(nowi, a[i]);
			if (a[i + 1] > a[i]) {
				dw = false;
			}
		}
		else {
			chmax(nowa, a[i]);
			if (a[i + 1] < a[i]) {
				//cout << i << " " << nowi << " " << nowa << endl;
				ans = ans / nowi * nowa + ans % nowi;
				dw = true;
				nowi = 100000;
				nowa = 0;
			}
		}
	}

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


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;
const ll INFL = 100100100100100100;

int main()
{
  ll N;
  ll res=INFL;
  cin >> N;

  vector<int> v;
  FOR(i,1,(int)(sqrt((double)N)+1e-9)){
    if(N%i==0){
      ll n=N/i;
      res = min(res, n+i-2);
      //cout << i << "x" << n << "=" << n*i << endl;                            
    }
  }

  cout << res << endl;
}

Measured memory_bytes: 256
n = int(input())
ps = []

def isPrime(target):
    for i in range(2, target):
        if target % i == 0:
            return False
    return True

for i in range(11, 55555, 5):
    if isPrime(i):
        ps.append(i)
        if len(ps) == n:
            break

print(*ps)

Measured memory_bytes: 2940
N = int(input())
L = list(map(int, input().split()))

from itertools import combinations
c = combinations(L, 3)
count = 0
for cs in c:
    if len(set(cs)) < 3:
        continue
    cs = sorted(cs)

    if cs[0] + cs[1] <= cs[2]:
        continue

    count += 1
print(count)

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

int main()
{
    int n;
    cin>>n;
    vector<tuple<string,int,int>> res(n);
    for(int i=0;i<n;i++)
    {
        string name;int score;int num=i;
        cin>>name>>score;
        res[i] = make_tuple(name,score,i);
    }
    
    for(int i=0;i<n;i++)
    {
        for(int j=n-1;j>0;j--)
        {
            if(get<0>(res[j]) < get<0>(res[j-1]))
            {
                tuple<string,int,int> temp = res[j-1];
                res[j-1] = res[j];
                res[j] = temp;
            }
            if(get<0>(res[j]) == get<0>(res[j-1]))
            {
                if(get<1>(res[j]) > get<1>(res[j-1]))
                {
                    tuple<string,int,int> tmp = res[j-1];
                    res[j-1] = res[j];
                    res[j] = tmp;
                }
            }
        }
    }
    
    for(auto r : res)
    {
        cout<<get<2>(r)+1<<endl;
    }
}

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

#define MAXN 200010

int n,a[20][20];
char s[100];
long long ans;

void add()
{
	int m=strlen(s+1),point=0,d=0;
	long long val=0;
	for(int i=1;i<=m;++i)
	{
		if(s[i]=='.')
		{
			point=1;
			continue;
		}
		val=val*10+s[i]-'0';
		if(point)++d;
	}
	while(d<9)val*=10,++d;
	int cntx=0,cnty=0;
	while(cntx<18 && val%2==0)++cntx,val/=2;
	while(cnty<18 && val%5==0)++cnty,val/=5;
	for(int i=18-cntx;i<=18;++i)ans+=a[i][18-cnty];
	for(int i=cnty;i>=0;--i)++a[cntx][i];
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	{
		scanf("%s",s+1);
		add();
	}
	printf("%lld\n",ans);
}

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

int n,m;

const int maxn=1e5+5;

unordered_map<int,vector<int> >e[maxn];
set<int>g[maxn];//颜色 
unordered_map<int,int>d[maxn];

struct st
{
	int p,b,c;//点 颜色 花费 
	st(int x,int y,int z)
	{
		p=x;b=y;c=z;
	}
};
bool operator < (const st &a,const st &b)
{
	return a.c>b.c;
}
priority_queue<st>q;

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int u,v,c;cin>>u>>v>>c;
		e[u][c].push_back(v);
		e[v][c].push_back(u);
		g[u].insert(c);
		g[v].insert(c);
	}
	q.push(st(1,0,0));d[1][0]=0;
	while(!q.empty())
	{
		st tmp=q.top();q.pop();
		if(d[tmp.p][tmp.b]!=tmp.c)continue;
		if(!d[tmp.p].count(0)||d[tmp.p][0]>tmp.c)
		{
			d[tmp.p][0]=tmp.c;
			q.push(st(tmp.p,0,tmp.c));
		}
		if(tmp.b==0)
		{
			for(auto v:g[tmp.p])
			{
				if(!d[tmp.p].count(v)||d[tmp.p][v]>tmp.c+1)
				{
					d[tmp.p][v]=tmp.c+1;
					q.push(st(tmp.p,v,tmp.c+1)); 
				}
			}
		}
		else
		{
			for(auto v:e[tmp.p][tmp.b])
			{
				if(!d[v].count(tmp.b)||d[v][tmp.b]>tmp.c)
				{
					d[v][tmp.b]=tmp.c;
					q.push(st(v,tmp.b,tmp.c));
				}
			}
		}
	}
	int ans=INT_MAX;
	for(auto i:d[n])
	{
		ans=min(ans,i.second);
	}
	cout<<(ans==INT_MAX?-1:ans)<<'\n'; 
	
	return 0;
}

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

using LL = long long;

#define ALL(a) begin((a)), end((a))
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define RFOR(i, a, b) for (int(i) = (a); (i) > (b); (i)--)
#define debug(x) cout << #x << " : " << x << '\n'

const int INF = 1e9;

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

  int ans;
  int N, K;
  cin >> N >> K;

  ans = N - K + 1;

  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define fi first
#define se second
#define endl '\n'

int main(){

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ll n, d; cin >>n >>d;

    ll ans = 0;
    for(int i = 0; i<n; i++){
        ll x, y; cin >>x >>y;
        if(d*d >= (x*x + y*y)) ans++;
    }

    cout <<ans <<endl;

    return 0;
}


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

using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll max = 100000;
char s[100];
int main(){
	ll n;
	cin >> n;
	ll ans = 0;
	ans += n / 500;
	n -= ans * 500;
	ans *= 1000;
	ans += n / 5 * 5;
	cout << ans << endl;
	return 0;
}

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

int main ()
{
    int n, b, f, r, v;
    int house[5][4][11];
    
    for (int i = 1;i <= 4;i++)
        for (int j = 1;j <=3;j++)
            for (int k = 1;k <= 10;k++)
                house[i][j][k] = 0;
                
    cin >> n;
    while(n--)
    {
        cin >> b >> f >> r >> v;
        house[b][f][r] += v;
    }
    
    for (int i = 1;i <= 4;i++)
    {
        for (int j = 1;j <=3;j++)
        {
            for (int k = 1;k <= 10;k++)
            {
                cout << " " << house[i][j][k];
            }
            cout << endl;
        }
        if (i < 4)
        {
            for (int i = 0; i < 20;i++) cout << "#";
              cout << endl;
        }
    }
    
    return 0;
}


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

using namespace std;

#define ll long long

int main()
{
	int X, Y, Z, K;
	cin >> X >> Y >> Z >> K;

	vector < ll > A(X);
	vector < ll > B(Y);
	vector < ll > C(Z);

	for (int i = 0; i < X; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < Y; i++) {
		cin >> B[i];
	}
	for (int i = 0; i < Z; i++) {
		cin >> C[i];
	}

	sort(A.begin(), A.end(), greater < ll > ());
	sort(B.begin(), B.end(), greater < ll > ());
	sort(C.begin(), C.end(), greater < ll > ());

	vector < ll > ansV;

	for (int i = 0; i < X; i++) {
		for (int j = 0; j < Y; j++) {
			for (int k = 0; k < Z; k++) {
				if ((i + 1) * (j + 1) * (k + 1) <= K) {
					ansV.push_back(A[i] + B[j] + C[k]);
				} else {
					break;
				}
			}
		}
	}
	sort(ansV.begin(), ansV.end(), greater < ll > ());

	for (int i = 0; i < K; i++) {
		cout << ansV[i] << endl;
	}

	return 0;
}


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

int main() {
  int N,K;
  cin >> N >> K;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  int64_t ans = 0;
  if (K >= N) {
    ans = 0;
  } else {
    for (int i = K; i < N; i++) {
      ans += vec.at(i);
    }
  }
  cout << ans << endl;
}


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

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

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

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

int main(){
    string s;
    cin >> s;
    int n = sz(s);
    vector<vi> dp(1, vi(n));
    rep(i, n) {
        if (s[i] == 'R') dp[0][i] = i+1;
        else dp[0][i] = i-1;
    }
    int t = 1, ti = 0;
    while (t*2 <= n) {
        t *= 2; ++ti;
        dp.pb(vi(n));
        rep(i, n) dp[ti][i] = dp[ti-1][dp[ti-1][i]];
    }
    vi res(n);
    rep(i, n) res[i] = i;
    int val = (n+1)/2*2, i = 0;
    while (val > 0) {
        if (val%2==1) {
            vi nres(n);
            rep(j, n) nres[j] = dp[i][res[j]];
            res = nres;
        }
        val /= 2;
        ++i;
    }
    vi ans(n);
    rep(i, n) ans[res[i]]++;
    rep(i, n) printf("%d%c", ans[i], (i<n-1?' ':'\n'));
    return 0;
}


Measured memory_bytes: 10892
from math import gcd

def lcm(x,y):
    return (x * y) // gcd(x, y)

a,b,c,d = map(int, input().split())

a_cnt = 0
a_cnt = (b//c) - ((a-1)//c)
b_cnt = (b//d) - ((a-1)//d)

lcmab = lcm(c,d)
ab_cnt = (b//lcmab) - ((a-1)//lcmab)

ans = (b-a+1) - a_cnt -b_cnt + ab_cnt
print(ans)

Measured memory_bytes: 62140
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		for (int i = 1; ; i++) {
			int x = sc.nextInt();
			if (x != 0) {
				System.out.println("Case " + i + ": " + x);
			} else {
				break;
			}
		}
		sc.close();
	}

}


Measured memory_bytes: 41256
#include<iostream>
using namespace std;
long long gcd(long long n, long long m)
{
	return n %m ? gcd(m, n%m) : m;
}
int main()
{
	int n,i;
	long long a[100],k,t;
	cin >> n;
	cin >> a[0];
	k = a[0];
	for (i = 1; i < n; i++)
	{
		cin >> a[i];
		t = gcd(a[i], k);
		k *= (a[i] / t);
	}
	cout << k<<'\n';
	return 0;
}

Measured memory_bytes: 256
nums = list(map(int, raw_input().split()))
health = [nums[0], nums[2]]
strength = [nums[1], nums[3]]
turn = 0
while(health[turn] > 0):
    health[1-turn] -= strength[turn]
    turn = 1 - turn
if(turn == 0): print('No')
else: print('Yes')


Measured memory_bytes: 84308
#include <iostream>
#include <utility>
#include <array>
#include <bits/stdc++.h>
#include <cstdio>
using namespace std;

int main(void){
  int N, A, B;
  scanf("%d", &N);
  scanf("%d", &A);
  scanf("%d", &B);
  
  int AN = A * N;
  if(AN >= B) {
  printf("%d", B);
  }else{
  printf("%d", AN);
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int A[] = new int[5];
		int min = 1000;
		int min_i = 0;
		int B[] = new int[5];
		for(int i = 0; i < 5; i++) {
			A[i] = sc.nextInt();
			if(A[i] % 10 != 0) {
				if(min > A[i] % 10) {
					min = A[i] % 10;
					min_i = i;
				}
				B[i] = 10 - (A[i] % 10);
			}
			//System.out.println(min_i);
		}
		
		int ans = 0;
		for(int i = 0; i < 5; i++) {
			if(min_i == i) {
				ans += A[i];
			} else {
				ans += A[i] + B[i];
			}
			//System.out.println(ans);
		}
		System.out.println(ans);
	}
}


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

using ll = long long;
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<ll> A(N);
    for (ll i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    ll res = 0;
    for (ll i = 0; i < N; i++)
    {
        while (i + 1 < N && A[i + 1] == A[i])
            i++;
        if (A[i + 1] >= A[i])
        {
            while (i + 1 < N && A[i + 1] >= A[i])
            {
                i++;
            }
        }
        else
        {
            while (i + 1 < N && A[i + 1] <= A[i])
            {
                i++;
            }
        }
        res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 3988
n = int(input()) #1行目のNを取得する
#print(n)
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
  x = input()
  #print(x,i)
  if x == 'AC':
    ac +=1
  if x == 'WA':
    wa +=1
  if x == 'TLE':
    tle +=1
  if x == 'RE':
    re +=1
print('AC x',ac)
print('WA x',wa)
print('TLE x',tle)
print('RE x',re)

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

int main() {
	int n, m;
	cin >> n >> m;
	set<int> a;
	rep(i, m) {
		int A;
		cin >> A;
		a.insert(A);
	}

	int mod = 1e9 + 7;
	vector<ll> dp(n + 1, 0);
	dp[0] = 1;
	for (int i = 1; i <= n; i++) {
		if (a.find(i) != a.end()) {
			dp[i] = 0;
			continue;
		}

		if (i == 1) dp[i] = dp[i - 1];
		else {
			dp[i] = dp[i - 1] + dp[i - 2];
		}
		dp[i] %= mod;
	}

	cout << dp[n] << endl;
}

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

map<int,int> res;
void prime_factor(int n){
	for(int i=2;i*i<=n;i++){
		while(n%i==0){
			++res[i];
			n /= i;
		}
	}
	if(n!=1)res[n]++;
}

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

	for(int i=1;i<=N;i++){
		prime_factor(i);
	}

	long long ret = 1;
	for(auto it=res.begin();it!=res.end();it++){
		// cerr << it->second << endl;
		ret *= (it->second + 1);
		ret %= 1000000007L;
	}
	cout << ret << endl;
	return 0;
}

// 2,3,4,5,6
// 4,3,1

Measured memory_bytes: 256
#include <stdio.h>

main() {
	int a,b,c,N,i;
	scanf("%d",&N);
	for(i=1;i<=N;i++){
		scanf("%d %d %d",&a,&b,&c);
		if(a*a+b*b==c*c || b*b+c*c==a*a || c*c+a*a==b*b){
			printf("YES\n");
		}else printf("NO\n");
	}
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template<typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template<typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template<typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template<typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  string s;
  cin >> s;
  int ans = 0;
  rep(i, s.size()) {
    if (i % 2 == 0) if (s[i] == 'p') ans--;
    if (i % 2 == 1) if (s[i] == 'g') ans++;
  }
  cout << ans << '\n';
}


Measured memory_bytes: 512
/// 10:34 pm 15/08/20
/// Author: t_bone_289 (An Immature Programmer.... I'm still developing !!)

#include<bits/stdc++.h>

using namespace std;
#define endl '\n'
typedef long long ll;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    string s;
    cin >> s;
    if (s == "RRR") {
        cout << 3;
    } else if (s == "RRS" || s == "SRR") {
        cout << 2;
    } else if (s == "RSR" || s == "SRS" || s == "SSR" || s == "RSS") {
        cout << 1;
    } else {
        cout << 0;
    }
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define INF -(1 << 30)
using namespace std;
//#define P pair<long long> 

map<long long, int> mp;
int Q[60][4];
int n, m, q;

int get(vector<int>& v ){
    int ret = 0;
    for( int i = 0; i < q; i++ )
        if(v[Q[i][1]] - v[Q[i][0]] == Q[i][2])
            ret += Q[i][3];
    return ret;
}

int bt( vector<int>& v, int idx, int mn ){
    if(idx == n)
        return get(v);
    int ret = 0;
    for( int i = mn; i <= m; i++ ){
        v[idx] = i;
        ret = max(ret, bt(v, idx + 1, i));
    }
    return ret;
}

int main()
{
    
    cin >> n >> m >> q;
    for( int i = 0; i < q; i++ ){
        for( int j = 0; j < 4; j++ )
            cin >> Q[i][j];
        Q[i][0]--, Q[i][1] --;
    }
    vector<int> v(n, -1);
    cout << bt(v, 0, 1) << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <stdio.h>
#include <string.h>

int main(void)
{
	char a[20001],*p;
	int h,i,j,k,s,c;
	while(1)
	{
	scanf("%s",a);
	if(strcmp(a,"-")==0)
	{
		break;
	}
	s=0;
	for(p=a;*p;p++)
	{
		s=s+1;
	}
	scanf("%d",&i);
	c=0;
	for(j=0;j<i;j++)
	{
		scanf("%d",&k);
		c=c+k;
	}
	for(j=0;j<c%s;j++)
	{
		a[s+j]=a[j];
	}
	for(j=c%s;j<s+c%s;j++)
	{
		a[j-c%s]=a[j];
	}
	for(j=0;j<s;j++)
	{
		printf("%c",a[j]);
	}
	printf("\n");
	}
	return 0;
}

Measured memory_bytes: 576
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  ll n,m;
  cin >> n >> m;
  if(abs(n-m)>1){
    print(0);
  }
  else{
    ll a = min(n, m);
    ll b = max(n, m);
    ll num1 = 1;
    for (ll i = 1; i <= a;i++){
      num1 *= i;
      num1 %= MOD;
    }
    ll num2 = num1;
    if (b - a == 1){
      num2 *= b;
      num2 %= MOD;
    }
    ll ans = num1 * num2;
    if(n==m){
      ans *= 2;
    }
    ans %= MOD;
    print(ans);
  }
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
#define debug(...) cout << "[" << #__VA_ARGS__ << ": " << __VA_ARGS__ << "]\n"
#define rd() abs((int)rng())
using namespace std;
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const int maxn = 1e5 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll dp[maxn][2];
string L;
ll ways(int i, int same)
{
	if(i == sz(L))
		return 1;
	ll &ret = dp[i][same];
	if(ret != -1)
		return ret;
	ret = 0;
	if(!same)
		ret = ways(i + 1, 0) * 3 % mod;
	else
	{
		if(L[i] == '1')
			ret = (ways(i + 1, 0) + ways(i + 1, 1) * 2) % mod;
		else
			ret = ways(i + 1, 1);
	}
	return ret;
}
int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0);
	cin >> L;
	memset(dp, -1, sizeof dp);
	cout << ways(0, 1) << "\n";
	return 0;
}

Measured memory_bytes: 6736
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//V,P(大文字)使用不可

const ll INF=1000000000000000000;

signed main(){
    ll n;
    cin>>n;
    V<ll> x(n),y(n);
    rep(i,n) cin>>x[i]>>y[i];
    map<P,P> mp;
    map<P,ll> mm;
    for(ll i=0;i<n;i++){
        for(ll j=0;j<n;j++){
            if(i==j) continue;
            mp[P(i,j)]=P(x[i]-x[j],y[i]-y[j]);
            mm[P(x[i]-x[j],y[i]-y[j])]++;
        }
    }
    ll cnt=0;
    for(auto p:mm) chmax(cnt,p.sc);
    cout<<n-cnt<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>	
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ld long double
#define pii pair <int, int>
#define sz(a) (int)(a.size()) 
#define resize(v) v.resize(unique(all(v)) - v.begin()); 
#define all(a) a.begin(), a.end()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)

// random_device rd; mt19937 g(rd());    
                                        	
using namespace std;
using namespace __gnu_pbds;
 
void Fast_Read_Out()
{
    ios_base::sync_with_stdio(0);
    cin.tie(), cout.tie();
}
 
void Random()
{
    unsigned int seed;                                                                        
    asm("rdtsc" : "=A" (seed));
    srand(seed);        
}
 
unsigned int Time()
{
     unsigned int time = clock() / 1000.00;                           
     return time;
}

template <typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>; 
 
const int mod = (int)1e9 + 7;

int n, k;
int d[101];
int used[101];

int main ()
{
	#ifdef JUDGE
		freopen("input.txt", "r", stdin);
	#endif		
	Fast_Read_Out();
	Random();
	cin >> n >> k;
	for(int i = 1; i <= k; i++)
	{
		cin >> d[i];
		for(int j = 1; j <= d[i]; j++) 
		{
			int cur;
			cin >> cur;
			used[cur]++;
		}
	}
	int cnt = 0;
	for(int i = 1; i <= n; i++) if(!used[i]) cnt++;
	cout << cnt;
}      

Measured memory_bytes: 3596
(r, c) = [int(i) for i in input().split()]
src = []
for i in range(r):
    row = [int(i) for i in input().split()]
    row.append(sum(row))
    src.append(row)
 
last_row = [0 for _ in range(c+1)]
for rc in range(r):
    for cc in range(c+1):
        last_row[cc] += src[rc][cc]
src.append(last_row)
for rc in range(r+1):
    print(' '.join([str(a) for a in src[rc]]))

Measured memory_bytes: 7864
from itertools import accumulate

def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    ans = 0
    E = [0] * N
    for i in range(N):
        E[i] = ((P[i] * (P[i] + 1)) // 2) / P[i]

    F = [0] + list(accumulate(E))
    ans = 0
    for i in range(N-K+1):
        tmp = F[i+K] - F[i]
        ans = max(ans, tmp)

    print(ans)






if __name__ == "__main__":
    main()

Measured memory_bytes: 87944
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,y;cin>>x>>y;
  set<int>s={4,6,9,11};
  x==2?x=0:s.count(x)?x=1:x=2;
  y==2?x=0:s.count(y)?y=1:y=2;
  cout<<(x-y?"No":"Yes");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
        int n,x,k;
        vector<int>height;
        vector<int>dp;
        cin>>n>>k;
        while(n--)
        {
                cin>>x;
                height.push_back(x);
        }
        dp.push_back(0);
        for(int i=1;i<height.size();i++)
        {
          		int min = INT_MAX;
                int temp = i-1;
          		int times = k;
          		while(temp>=0 && times--)
                {
                  int dis = dp[temp]+abs(height[i]-height[temp]);
                  if(min>dis)
                    min = dis;
                  temp--;
                }
          		dp.push_back(min);
        }
        cout<<dp.back()<<endl;
        return 0;
}

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

hs = [int(input()) for _ in range(N)]

lst = sorted(hs, reverse=True)

mini = lst[0] - lst[-1]
for i in range(N - K + 1):
    tmp = lst[i] - lst[i + K - 1]
    if tmp < mini:
        mini = tmp

print(mini)

Measured memory_bytes: 8200