akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


string s,t;

int main(){

    ll d[3] = {};
    
    IN d[0] >> d[1] >> d[2];
    
    

    int ans = 0;

    while(1){
        sort(d,d+3);
   
      //  rep(i,0,3)PS(d[i]);
        //cout << endl;
        if(d[0] == d[1] && d[1] == d[2])break;
        
        if(d[0] < d[1]){
            d[0]+= 2;
            ans ++;
        }else{
            d[2]--;
            ans++;
        }
   }

    P(ans);
	return  0;
}

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;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
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:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll A,B,K; cin >> A >> B >> K;
    vector<ll> vals;
    for(int i = 1; i <= max(A,B); i++){
        if(A%i == 0 && B%i == 0){
            vals.push_back(i);
        }
    }
    reverse(vals.begin(),vals.end());
    res = vals[K-1];
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    var (N,M,C) = readLine()!!.split(" ").map(String::toInt)
    var B = readLine()!!.split(" ").map{x->x.toInt()}
    var cnt = 0
    (1..N).map{
        var sum = 0
        var A = readLine()!!.split(" ").map{x->x.toInt()}
        (0..M-1).map{i->
            sum += A[i] * B[i]
        }
        if(sum+C > 0) cnt++
    }
    println(cnt)
}


Measured memory_bytes: 37848
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define eFOR(i,a,n) for(int i=(a);i<=(n);++i)
#define rFOR(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define erFOR(i,a,n) for(int i=(n);i>=(a);--i)
#define each(i, a) for(auto &i : a)
#define SORT(a) sort(a.begin(),a.end())
#define rSORT(a) sort(a.rbegin(),a.rend())
#define fSORT(a,f) sort(a.begin(),a.end(),f)
#define all(a) a.begin(),a.end()
#define out(y,x) ((y)<0||h<=(y)||(x)<0||w<=(x))
#define tp(a,i) get<i>(a)
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }
template<class T>inline void print(const T& a) { cout << a << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }
template<class T>inline void print(const vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "\n" : " "); }
template<class T>inline void print(const vector<vector<T>>& v) { for (auto& a : v)print(a); }
inline string reversed(const string& s) { string t = s; reverse(all(t)); return t; }

int main() {
    init();

    int n; cin >> n;
    VL a(n); cin >> a;
    ll ans = 0, Max = a[0];
    FOR(i, 1, n) {
        ans += max(Max - a[i], 0LL);
        chmax(Max, a[i]);
    }
    print(ans);

    return 0;
}

Measured memory_bytes: 4776
# -*- coding: utf-8 -*-
#AGC020A
import sys
#import collections

n= int(input())
s= input()
#tmp = input().split()
#s = list(map(lambda a: int(a), tmp))

rcount=0
rcountmax=0
for i in range(0,n):
	if(s[i]==")"):
		rcount+=1
		rcountmax=max(rcountmax,rcount)
	else:
		rcount-=1
lcount=0
lcountmax=0
for i in range(0,n):
	if(s[n-1-i]=="("):
		lcount+=1
		lcountmax=max(lcountmax,lcount)
	else:
		lcount-=1
ans=""
for i in range(0,rcountmax):
	ans+="("
ans+=s
for i in range(0,lcountmax):
	ans+=")"

#print(s)
#print(rcountmax)
#print(lcountmax)
print(ans)


Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int w=sc.nextInt();
        int h=sc.nextInt();
        int x=sc.nextInt();
        int y=sc.nextInt();
        
        System.out.println((double)w*h/2+" "+((w==x*2&&h==y*2)?1:0));
    }
}


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

template<class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[";
  for (int i = 0; i < (int) V.size(); i++) {
    if (i > 0) {
      cout << ", ";
    }
    cout << V[i];
  }
  return os << "]\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<pair<int, int>> vec(n);
  for (int j = 0; j < n; j++) {
    cin >> vec[j].first;
    vec[j].second = j;
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i < n; i++) {
    cout << vec[n - 1 - (vec[n - 1].second == i)].first << '\n';
  }
  return 0;
}


Measured memory_bytes: 3200
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
using namespace std;
//#define int long

signed main() {
	int N;
	cin >> N;
	double x, sum = 0;
	string u;
	for (int i = 0; i < N; i++)
	{
		cin >> x >> u;
		if (u == "JPY")sum += x;
		else sum += 380000 * x;
	}
	cout << sum;
}

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

namespace AtCoder
{
	// http://abc106.contest.atcoder.jp/tasks/abc106_b
	public class Abc106_b
	{
#if !Development
		public static void Main(string[] args)
		{
			Abc106_b.Solve(args);
		}
#endif

		public static void Solve(string[] args)
		{
			var n = ReadLineIntOne();

			var answer = Enumerable.Range(1, n)
			                       .Where(x => x % 2 == 1)
								   .Where(x =>
								   {
									    var count = 0;
										foreach(var i in Enumerable.Range(1, (int)Math.Sqrt(x)))
										{
											if (x / i == (float)x / i)
											{
											    count++;
												if (x / (x / i) != x / i)
												{
												    count++;
												}
											}

										}

										return count == 8;
			}).Count();
			
			Console.WriteLine(answer);
		}

		public static List<string> ReadLineString() { return Console.ReadLine().Split(' ').ToList(); }
		public static List<int> ReadLineInt() { return Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToList(); }
		public static int ReadLineIntOne() { return Console.ReadLine().Split(' ').Select(str => int.Parse(str)).First(); }
		public static List<int> MultiReadLineInt(int lineNum) { return Enumerable.Range(0, lineNum).Select(_ => ReadLineIntOne()).ToList(); }
	}
}

Measured memory_bytes: 11348
N, W = map(int, input().split())

INF = float("inf")
dp = [0] + [INF] * 10**5

for _ in range(N):
  w, v = map(int, input().split())
  for j in range(10**5, v-1, -1):
    dp[j] = min(dp[j], dp[j-v] + w)

for i, x in enumerate(dp):
  if x <= W:
    ans = i

print(ans)

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

#include <cstdio>
#include <cstdlib>
 
using namespace std;
int main(){
	char str[5];
	char val[5];
	cin >> str;
	sprintf(val,"%c%c%c",str[0],str[0],str[0]);
	if(atoi(val) < atoi(str)){
		char c = str[0] + 1;
		printf("%c%c%c\n",c,c,c);
	}else{
		printf("%s\n",val);
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 998244353;
int add(int &a, const int &b) {
	a = (a + b) % MOD;
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	vector<vector<int> > A(N, vector<int>(M));
	int res = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			cin >> A[i][j];
		}
	}


	int cur = 0;
	int t = -1;
	for (int k = 0; k < M; k++) {
		t = -1;
		for (int i = cur + 1; i < N; i++) {
			if (A[i][k] == 1) {
				t = i;
				break;
			}
		}
		if (t == -1)continue;
		for (int i = 0; i < N; i++) {
			if (t != i) {
				if (A[i][k] == 1) {
					for (int j = k; j < M; j++) {
						A[i][j] ^= A[t][j];
					}
				}
			}
		}
		swap(A[t], A[cur]);
		cur++;
		if (cur >= N)break;
	}


	//for (int i = 0; i < N; i++) {
	//	for (int j = 0; j < M; j++) {
	//		cerr << A[i][j] << " ";
	//	}
	//	cerr << endl;
	//}


	//int base = 1;
	//for (int i = 0; i < N; i++) {
	//	int sum = 0;
	//	for (int j = 0; j < M; j++) {
	//		sum += A[i][j];
	//	}
	//	if (sum == 0) {
	//		swap(A[i], A.back());
	//		A.pop_back();
	//		N = A.size();
	//		base = (base * 2) % MOD;
	//	}
	//}

	//for (int j = 0; j < M; j++) {
	//	int sum = 0;
	//	for (int i = 0; i < N; i++) {
	//		sum += A[i][j];
	//	}
	//	if (sum == 0) {
	//		for (int i = 0; i < N; i++) {
	//			swap(A[i][j], A[i].back());
	//			A[i].pop_back();
	//		}
	//		M = A[0].size();
	//		base = (base * 2) % MOD;
	//	}
	//}

	/*cerr << N << " " << M << endl;

	if (N == 0 || M == 0) {
		return 0;
	}
*/



	//for (int i = 0; i < N; i++) {
	//	for (int j = 0; j < M; j++) {
	//		cerr << A[i][j] << " ";
	//	}
	//	cerr << endl;
	//}

	int X = 0;
	for (int i = 0; i < N; i++) {
		int sum = 0;
		for (int j = 0; j < M; j++) {
			sum += A[i][j];
		}
		if (sum > 0)X++;
	}

	//cerr << X << endl;

	res = 0;
	vector<vector<int> > dp(X + 1, vector<int>(X + 1, 0));

	dp[0][0] = 1;
	for (int i = 1; i <= X; i++) {
		for (int j = 0; j <= X; j++) {
			if (j > 0)add(dp[i][j], dp[i - 1][j - 1]);
			add(dp[i][j], 3 * dp[i - 1][j]);
		}
	}
	for (int i = 1; i <= X; i += 2) {
		add(res, dp[X][i]);
	}

	for (int i = 0; i < N + M - X - X; i++) {
		res = (res * 2) % MOD;
	}


	cout << res << endl;
}

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

int main()
{
	int N;
	scanf("%d", &N);
	std::vector<int64_t> a(3 * N);
	for (auto& e: a) scanf("%lld", &e);
	std::vector<int64_t> former(N + 1), latter(N + 1);
	std::priority_queue<int64_t, std::vector<int64_t>, std::greater<int64_t>> formerPQ;
	std::priority_queue<int64_t> latterPQ;
	for (int i{}; i < N; i++)
	{
		former.front() += a[i];
		formerPQ.push(a[i]);
	}
	for (int i{}; i < N; i++)
	{
		formerPQ.push(a[N + i]);
		former[i + 1] = former[i] + a[N + i] - formerPQ.top();
		formerPQ.pop();
	}
	for (int i{N - 1}; i >= 0; i--)
	{
		latter.back() += a[2 * N + i];
		latterPQ.push(a[2 * N + i]);
	}
	for (int i{N - 1}; i >= 0; i--)
	{
		latterPQ.push(a[N + i]);
		latter[i] = latter[i + 1] + a[N + i] - latterPQ.top();
		latterPQ.pop();
	}
	int64_t ans{LLONG_MIN};
	for (int i{}; i <= N; i++)
		ans = std::max(ans, former[i] - latter[i]);
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 6516
n, m, v, p = map(int, input().split())
a = list(map(int, input().split()))
a.sort()


def check(x):
    if x > n - p:
        return True

    for i in range(x + 1, n - p + 1):
        if a[x] + m < a[i]:
            return False

    if v - x - p > 0:
        cnt = 0
        for i in range(x + 1, n - p + 1):
            cnt += min((a[x] + m) - a[i], m)

        if (cnt // (v - x - p)) >= m:
            return True
        else:
            return False
    else:
        return True


lb = -1  # False
ub = n - 1  # True
while ub - lb > 1:
    mid = (ub + lb) // 2
    if check(mid):
        ub = mid
    else:
        lb = mid

# print(a)
# print(lb, ub)
ans = n - ub
print(ans)


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


int main(){
	map<char, int> char_dict;
	for (int i = 0; i < 4; i++) {
		char c; cin >> c;
		char_dict[c]++;
	}

    bool ans = true;
	if (char_dict.size() != 2) ans = false;
	for (auto m : char_dict) {
		if (m.second != 2) ans = false;
	}
	if (ans) cout << "Yes";
	else cout << "No";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
int N, A[100005], B[100005], s = 0;
map <int, int> M;
vector <int> V[100005];
int Aux[100005];
set <int> S;

int ind;
bool Use[100005];
int A2[100005], B2[100005];
vector <int> G[100005];
bool check()
{
    sort(A2 + 1, A2 + N + 1);
    sort(B2 + 1, B2 + N + 1);
    for(int i = 1; i <= N; i++)
        if(A2[i] != B2[i])
            return 0;
    return 1;
}
void Read()
{
    cin >> N;
    for(int i = 2; i <= N + 1; i++)
        cin >> A[i], A[1] = (A[1] ^ A[i]);
    for(int i = 2; i <= N + 1; i++)
        cin >> B[i], s = (s ^ B[i]);
    B[1] = s;
    ++N;
    for(int i = 1; i <= N; i++)
    {
        A2[i] = A[i];
        B2[i] = B[i];
        if(M.find(B[i]) == M.end())
        {
            M[B[i]] = ++ind;
        }
        int pos = M[B[i]];
        if(A[i] != B[i] && i > 1)
            V[pos].push_back(i);
    }
    for(int i = 1; i <= ind; i++)
        if(V[i].size() > 0)
            S.insert(i);
    for(int i = 1; i <= N; i++)
    {
        if(M.find(A[i]) != M.end())
        A[i] = M[A[i]];
        B[i] = M[B[i]];
    }
}
void DFS(int node)
{
    Use[node] = 1;
    for(int i = 0; i < G[node].size(); i++)
    {
        int neighb = G[node][i];
        if(Use[neighb] == 0)
            DFS(neighb);
    }
}
void Solve()
{
    int ans = -1;
    int cnt = 0;
    map <int, int> X;
    for(int i = 2 ; i <= N; i++)
        if(A[i] != B[i])
        {
            if(Aux[B[i]] == 0)
            Aux[B[i]] = ++cnt;
            if(Aux[A[i]] == 0)
                Aux[A[i]] = ++cnt;
            G[Aux[B[i]]].push_back(Aux[A[i]]);
            G[Aux[A[i]]].push_back(Aux[B[i]]);
            ++ans;
        }
    if(Aux[A[1]] == 0)
        Aux[A[1]] = ++cnt;
    if(Aux[B[1]] == 0)
        Aux[B[1]] = ++cnt;
    for(int i = 1; i <= cnt; i++)
        if(Use[i] == 0)
        {
            DFS(i);
            ++ans;
        }


    cout << max(ans, 0) << "\n";
}
int main()
{
    Read();
    if(check() == 0)
    {
        cout << "-1\n";
        return 0;
    }
    bool ok = 1;
    for(int i = 1; i <= N; i++)
        if(A[i] != B[i])
            ok = 0;
    if(ok == 1)
    {
        cout << "0\n";
        return 0;
    }
    Solve();
    return 0;
}


Measured memory_bytes: 25728
#include<iostream>
#include<string>
using namespace std;
int main(){
int h,w;
cin >> h >> w;

string s[h];
int i,j;
for(i=0;i<h;i++) cin >> s[i];
const int dx[4] = {0,0,1,-1};
const int dy[4] = {1,-1,0,0};
  bool a = true;

for(i=0;i<h;i++){
  for(j=0;j<w;j++){
    if(s[i][j] == '.') continue;
    bool can = false;
      for(int d=0;d<4;d++){
        const int ni=i+dy[d];
        const int nj=j+dx[d];
        if(ni<0 or h<=ni) continue;
        if(nj<0 or w<=nj) continue;
        if(s[ni][nj] =='#') {can = true; break;}
    }
    if(!can) {a=false; break;}
  }
}
if(a) cout << "Yes" << endl;
else cout <<"No"<<endl;

}


Measured memory_bytes: 256
while True:
    n = input()
 
    if n == "0000":
        break
    if n.count(n[0]) == 4:
        print("NA")
        continue
 
    cnt = 0
    while n != "6174":
        n, l = sorted(list(n)), sorted(list(n), reverse=True)
        n = str(int("".join(l)) - int("".join(n))).zfill(4)
        cnt += 1
 
    print(cnt)

Measured memory_bytes: 7648
#include <iostream>

using namespace std;

/*??\??????????????°??????????????????????£?????????°????????¨??????*/
/*???????????¨??????????????????????????§???????????§?????????????£??????????*/
class Vector2D {
  private:
    double x;
    double y;
  public:
    Vector2D(double _x, double _y) {
      x = _x;
      y = _y;
    }
    double operator * (Vector2D vec2) {
      return this->x*vec2.y-this->y*vec2.x;
    }
};

int main() {
  double x1,x2,x3,y1,y2,y3,xp,yp;

  while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    Vector2D vec_12(x2-x1,y2-y1);
    Vector2D vec_2p(xp-x2,yp-y2);
    
    Vector2D vec_23(x3-x2,y3-y2);
    Vector2D vec_3p(xp-x3,yp-y3);

    Vector2D vec_31(x1-x3,y1-y3);
    Vector2D vec_1p(xp-x1,yp-y1);

    double crossproduct1 = vec_12*vec_2p;
    double crossproduct2 = vec_23*vec_3p;
    double crossproduct3 = vec_31*vec_1p;

    if ((crossproduct1 > 0 && crossproduct2 > 0 && crossproduct3 > 0) ||
        (crossproduct1 < 0 && crossproduct2 < 0 && crossproduct3 < 0))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

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

using namespace std;
int N;
int a[100001];
int ans;
int main() {
  cin >> N;

  for(int i = 1; i <= N; i++) cin >> a[i];

  for(int i = 1; i <= N; i++) {
    if(a[a[i]] == i)ans++;
  }
  cout << ans / 2 <<endl;
}
  


Measured memory_bytes: 640
#include <iostream>
 
int main(){
    using namespace std;
 
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
 
    if( (r <= x) && ((x+r) <= W) &&
        (r <= y) && ((y+r) <= H) )
    {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 1160
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> al = new ArrayList<Integer>();
    int N = sc.nextInt();
    int K = sc.nextInt();
    for(int i = 0;i < N;i++) {
      al.add(sc.nextInt());
    }
    Collections.sort(al,Collections.reverseOrder());
    Long turn = 0L;
    for(int i = 0;i < (N - K);i++) {
      turn += al.get(K + i);
    }
    System.out.println(turn);
  }
}

Measured memory_bytes: 94808
S = int(input())

def fib(n):
    a,b, c = 1,1,1
    if n == 0:
        return a
    elif n == 1:
        return b
    elif n == 2:
        return c
    else:
        for i in range(n -2):
            a,b,c = b,c,a+c
        return c

if S <= 2:
    ans = 0
else:
    ans = fib(S-3)

print(ans%(10**9+7))



Measured memory_bytes: 9184
a = int(input())
if a == 1:
	print("Yes")
	print(2)
	print(1, 1)
	print(1,1)
elif a == 3:
	print("Yes")
	print(3)
	print(2,1,2)
	print(2,3,1)
	print(2,2,3)
elif (int((2*a) ** 0.5)**2  + int((2*a) ** 0.5))  == 2*a:
	print ("Yes")
	t = int((2*a) ** 0.5)
	print(t + 1)
	print(str(t) +' ' +  ' '.join([str(i) for i in list(range(1, t + 1))]))
	now = t + 1
	for i in range(1, t + 1):
		left = ' '.join([str(i + (2*t - j - 1)*j //2) for j in list(range(i))])
		right = ' '.join([str(j) for j in list(range(now, now + t - i))])
		now = now + t - i
		print(str(t) +' ' + left + ' ' + right)
else:
	print("No")

Measured memory_bytes: 42092
#include <bits/stdc++.h>
using namespace std;
 
int main() {
string s;
  cin >>s;
int n = s.length();
	s='a'+s;
  bool count=true;
	for(int i=1;i<=n; i++) if(s[i]!=s[n-i+1]) count=false;
			
	for(int i=1; i<=(n-1)/2; i++) if(s[i]!=s[(n-1)/2-i+1]) count=false;
	
	for(int i=(n+3)/2; i<=n; i++) if(s[i]!=s[n-i+(n+3)/2]) count=false;
	
    
 
if(count){
  cout<<"Yes"<<endl;
}
  else{
    cout<<"No"<<endl;
  }
  
 
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define ll long long
#define inf 0x3f3f3f3f
#define mod 1000000007
#define Mod1(x) ((x)>=mod?(x)-mod:x)
#define Mod2(x) ((x)<0?(x)+mod:x)
#define maxn 200010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static char buf[20];
	int len=0;
	if(x<0)putchar('-'),x=-x;
	for(;x;x/=10)buf[len++]=x%10+'0';
	if(!len)putchar('0');
	else while(len)putchar(buf[--len]);
}
inline void writesp(ll x){write(x); putchar(' ');}
inline void writeln(ll x){write(x); putchar('\n');}
ll f[25010][410],sumf[25010][410],g[25010][410],sumg[25010][410];
int a[25010],pre[25010],nxt[25010];
int pos[410];
int n,k,m;
ll power(ll a,ll b)
{
	ll ans=1;
	for(;b;b>>=1,a=a*a%mod)
		if(b&1)ans=ans*a%mod;
	return ans;
}
int main()
{
	n=read(); k=read(); m=read();
	for(int i=1;i<=m;i++)
		a[i]=read();
	for(int i=1;i<=m;i++){
		pre[i]=pos[a[i]]; nxt[pos[a[i]]]=i;
		pos[a[i]]=i;
	}
	for(int i=1;i<=k;i++)
		if(pos[i])nxt[pos[i]]=n+1;
	int flag=0;
	for(int i=k;i<=m;i++){
		int cur=0;
		for(int j=i;j>i-k;j--)
			if(pre[j]>i-k){
				cur=1; break;
			}
		if(!cur){
			flag=1; break;
		}
	}
	// writeln((n-m+1)*power(k,n-m)%mod);
	if(flag){
		writeln((n-m+1)*power(k,n-m)%mod);
		return 0;
	}
	flag=0;
	for(int i=1;i<=m;i++)
		if(pre[i]){
			flag=1; break;
		}
	if(!flag){
		for(int i=0;i<k;i++)
			f[0][i]=(!i),sumf[0][i]=1,g[0][i]=sumg[i][0]=0;
		for(int i=1;i<=n;i++){
			f[i][0]=sumf[i][0]=g[i][0]=sumg[i][0]=0;
			for(int j=1;j<k;j++){
				f[i][j]=((k-j+1)*f[i-1][j-1]+(sumf[i-1][k-1]-sumf[i-1][j-1]+mod))%mod;
				sumf[i][j]=(sumf[i][j-1]+f[i][j])%mod;
				g[i][j]=((k-j+1)*g[i-1][j-1]+(sumg[i-1][k-1]-sumg[i-1][j-1]+mod)+(j>=m)*f[i][j])%mod;
				sumg[i][j]=(sumg[i][j-1]+g[i][j])%mod;
			}
		}
		// for(int i=0;i<=n;i++){
		// 	for(int j=0;j<k;j++)
		// 		writesp(f[i][j]);
		// 	putchar('\n');
		// }
		ll t=sumg[n][k-1];
		for(int i=k-m+1;i<=k;i++)
			t=t*power(i,mod-2)%mod;
		ll tot=((n-m+1)*power(k,n-m)-t+mod)%mod;
		writeln(tot);
	}
	else{
		int first=1,last=1;
		while(!pre[first+1])++first;
		while(nxt[m-last]>n)++last;
		// printf("%d %d ***\n",first,last);
		for(int i=0;i<k;i++)
			f[0][i]=(i==first),sumf[0][i]=(i>=first),g[0][i]=(i==last),sumg[0][i]=(i>=last);
		for(int i=1;i<=n-m;i++){
			f[i][0]=sumf[i][0]=g[i][0]=sumg[i][0]=0;
			for(int j=1;j<k;j++){
				f[i][j]=((k-j+1)*f[i-1][j-1]+(sumf[i-1][k-1]-sumf[i-1][j-1]+mod))%mod;
				sumf[i][j]=(sumf[i][j-1]+f[i][j])%mod;
				g[i][j]=((k-j+1)*g[i-1][j-1]+(sumg[i-1][k-1]-sumg[i-1][j-1]+mod))%mod;
				sumg[i][j]=(sumg[i][j-1]+g[i][j])%mod;
			}
		}
		// for(int i=0;i<=n-m;i++){
		// 	for(int j=0;j<k;j++)
		// 		writesp(f[i][j]);
		// 	putchar('\n');
		// }
		// putchar('\n');
		// for(int i=0;i<=n-m;i++){
		// 	for(int j=0;j<k;j++)
		// 		writesp(g[i][j]);
		// 	putchar('\n');
		// }
		ll tot=(n-m+1)*power(k,n-m)%mod;
		for(int i=0;i<=n-m;i++)
			tot-=sumf[i][k-1]*sumg[n-m-i][k-1]%mod;
		tot=(tot%mod+mod)%mod;
		writeln(tot);
	}
	return 0;
}

Measured memory_bytes: 320640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  int like[N][M];
  for(int i=0; i<N; i++){
    for(int j=0; j<M; j++){
      cin >> like[i][j];
      like[i][j]--;
    }
  }
  vector<int> join(N,0);
  int ans = 1e5;
  set<int> S;
  while(S.size() < M){
    vector<int> cnt(M,0);
    int MAX = 0;
    for(int i=0; i<N; i++){
      int x = like[i][join[i]];
      cnt[x]++;
      MAX = max(MAX,cnt[x]);
    }
    ans = min(ans,MAX);
    for(int i=0; i<M; i++){
      if(cnt[i] == MAX){
        S.insert(i);
      }
    }
    if(S.size() == M){
      break;
    }
    for(int i=0; i<N; i++){
      while(S.count(like[i][join[i]])){
        join[i]++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
# 169A
# 値 A × B を整数として出力せよ。

# 1.入力をプログラムで扱えるように受け取ること。
a, b = map(int, input().split())
# print(a, b)

# 2.受け取った入力値を使って、適切に処理
answer = a * b

# 3. 計算した結果を出力
print(answer)

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  long double a,b;
  cin>>a>>b;
  long double c = a*b;
  ll ans = c;
  cout<<ans<<endl;

}

Measured memory_bytes: 3732
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

const int inf = 99999;

int check(vector<int> vec, int n)
{
	int c = 0, t = n;
	
	while(t-1 >= 0 && vec[t-1] == vec[t]){
		t--;
	}
	
	for(int i = 1; i <= 3 && t+i < vec.size(); i++){
		if(vec[t] != vec[t+i]){
			break;
		}
		c++;
	}
	if(c == 3){
		return t;
	}
	
	return -1;
}

int func(vector<int> vec, int n)
{
	vector<int> v = vec;
	int t = n;
	
	while(v.size()){
		t = check(v, t);
		if(t == -1){
			break;
		}
		
		while(t+1 < v.size() && v[t+1] == v[t]){
			v.erase(v.begin()+(t+1));
		}
		v.erase(v.begin()+t);
	}
	
	return v.size();
}

int main()
{
	int n, s, t;
	
	while(cin>>n && n){
		vector<int> vec;
		while(n--){
			cin >> t;
			vec.push_back(t);
		}
		s = inf;
		
		for(int i = 0; i < vec.size(); i++){
			for(int j = 1; j <= 3; j++){
				t = vec[i];
				vec[i] = j;
				s = min(s, func(vec, i));
				vec[i] = t;
			}
		}
		
		cout << s << endl;
	}
	
	return 0;
}

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

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int inf = 1e9;
int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    int A[3];
    while (cin >> A[0] >> A[1] >> A[2]) {
        int ans = inf;
        FOR(i,0,3) FOR(j,i+1,3) {
            ans = min(ans, A[i]+A[j]);
        }
        cout << ans << endl;
    }
    return 0;
}


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

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
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;
}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#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 ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

    int n;
    cin >> n;

    vi s(n);
    REP(i, n) cin >> s[i];

    int q;
    cin >> q;
    vi t(q);
    REP(i, q) cin >> t[i];

    int ans = 0;
    for (int qu : t) {
        if (!INRANGE(qu, s[0], s[n-1])) {
            continue;
        } else if (qu == s[0] or qu == s[n-1]) {
            ans++;
            continue;
        }

        int l = 0;
        int r = n;

        while (l < r) {
            int mid = (l+r)/2;
            if (s[mid] == qu) {
                ans ++;
                break;
            } else if (qu < s[mid]) {
                r = mid;
            } else {
                l = mid + 1;
            }
        }

    }

    cout << ans << endl;

    return 0;
}



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

typedef long long ll;

vector<ll> s;

bool check(ll k,int n){
    int left=0,right = n;
    while(right-left>1){
        int mid = (left + right)/2;
        if(s[mid]>k){
            right = mid;
        }else{
            left = mid;
        }
    }
    if(s[left] == k)return true;
    else return false;
}

int main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll a;
    for(int i=0;i<n;i++){
        cin >> a;
        s.push_back(a);
    }
    sort(s.begin(),s.end());
    unique(s.begin(),s.end());

    int q;
    cin >> q;

    ll t,cou=0;;
    for(int i=0;i<q;i++){
        cin >> t;
        if(check(t,n))cou++;
    }
    cout << cou << endl;
}



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

#define INF 1e9
#define MAX 105
#define xx first
#define yy second
#define pb push_back
#define mp make_pair
#define ull long long
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define nl '\n'
#define zai <<' '<<
#define all(a) a.begin(),a.end()
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
int n,w[MAX];
int v[MAX];

bool vis[MAX][100005];
long long dp[MAX][100005];
long long solve(int i,int W){
	if(W<0)return -INF;
	if(i==n)return 0;
	if(vis[i][W])return dp[i][W];
	vis[i][W]=1;		
	long long ans=0;
	ans=max(ans,v[i]+solve(i+1,W-w[i]));
	ans=max(ans,solve(i+1,W));

	return dp[i][W]=ans;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	int W;
	cin >> n >> W;
	
	for(int i=0;i<n;i++){
		cin >> w[i] >> v[i];
	}
	
	cout << solve(0,W);
	return 0;
}

Measured memory_bytes: 88320
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String input = scanner.nextLine();
		scanner.close();

		boolean isStepEasy = true;
		List<Character> odd = Arrays.asList('R', 'U', 'D');
		List<Character> even = Arrays.asList('L', 'U', 'D');

		for (int i=1; i<=input.length(); i++) {
			char c = input.charAt(i-1);
			if (i % 2 == 0) {
				if (!even.contains(c)) {
					isStepEasy = false;
					break;
				}
			} else {
				if (!odd.contains(c)) {
					isStepEasy = false;
					break;
				}
			}
		}

		if (isStepEasy) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 25172
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

int n, bit[1 << 18];

// iが与えられた時に、a[1]+a[2]+...+a[i]を計算する
int sum(int i) {
    int s = 0;
    while (i > 0) {
        s += bit[i];
        i -= i & -i; // 最後の1ビット
    }
    return s;
}

// iとxが与えられた時に、a[i]にxを足す
void add(int i, int x) {
    while (i <= n) {
        bit[i] += x;
        i += i & -i;
    }
}

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

    string s;
    int k;
    cin >> s >> k;
    n = s.size();

    queue <int> q[26];
    for (int i = 0; i < n; i++) {
        q[s[i] - 'a'].push(i);
        add(i+1, 1);
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 26; j++) {
            if (!q[j].size()) continue;

            int pos = q[j].front();
            int count = sum(pos);
            if (count <= k) {
                q[j].pop();
                k -= count;
                add(pos+1, -1);
                cout << s[pos];
                break;
            }
        }
    }

    for (int i = 0; i < n; i++) {
        if (bit[i+1]) {
            cout << s[i];
        }
    }

    cout << endl;
    return 0;
}


Measured memory_bytes: 4652
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
	int h,w;
	cin>>h>>w;
	vector<string>ban;
	for(int i=0;i<h;i++){
		string s;
		cin>>s;
		bool flag=false;
		for(int j=0;j<w;j++)
			if(s[j]=='#')flag=true;
		if(flag)ban.push_back(s);
	}
	vector<int>yoko;
	for(int i=0;i<w;i++){
		bool flag=false;
		for(int j=0;j<ban.size();j++)
			if(ban[j][i]=='#')flag=true;
		if(flag)yoko.push_back(i);
	}
	for(int i=0;i<ban.size();i++){
		for(int j=0;j<w;j++){
			if(find(yoko.begin(), yoko.end(), j)!=yoko.end())cout<<ban[i][j];
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
n=int(input())
s=[]
for _ in range(n):
    s.append(int(input()))
s.sort()
ans=sum(s)
i=0
while ans % 10 ==0 and i < n:
    if s[i]%10!=0:
        ans-=s[i]
    i+=1
if i==n:
    print(0)
else:
    print(ans)


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

static const int N = 100;

int main(){
	int n, p[N+1], m[N+1][N+1];
	cin >> n;
	for (int i=1; i<=n; i++){
		cin >> p[i-1] >> p[i];
	}

	for (int i=1; i<=n; i++) m[i][i] = 0;
	for (int l=2; l <= n; l++){
		for (int i=1; i<=n-l+1; i++){
			int j = i + l - 1;
			m[i][j] = 1 << 21;
			for (int k = i; k<= j - 1; k++){
				m[i][j] = min(m[i][j], m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
			}
		}
	}

	cout << m[1][n] << endl;

	return 0;
}

Measured memory_bytes: 1196
// Problem: A - Rainy Season
// Contest: AtCoder - AtCoder Beginner Contest 175
// URL: https://atcoder.jp/contests/abc175/tasks/abc175_a
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
//
//#include <immintrin.h>
//#include <emmintrin.h>

#include <bits/stdc++.h>
//#pragma GCC optimize("O2")
#define vi vector<int>
#define pii pair<int, int >
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define LL long long
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define all(x) (x).begin(), (x).end()
#define all2(x,n) (x+1), (x+1+n)
#define sz(x) ((int)(x).size())
#define mod(x) ((x)%MOD)
#define debug(x) cerr<<#x<<" : "<<x<<endl
#define mt make_tuple
#define eb emplace_back
#define o(X) (1<<(X))
#define oL(X) (1LL<<(X))
#define contain(S,X) (((S)&o(X))!=0)
#define containL(S,X) (((S)&oL(X))!=0)
#define ppt(x) __builtin_popcount(x)
using namespace std;
const int INF=0x3f3f3f3f,N=1e6+5,MOD=1e9+7;
const LL INF_LL=0x3f3f3f3f3f3f3f3fLL;
inline int getplc(int x,int y) { return (x>>y)&1; }
template<typename T>
T square(T x) {return x*x;}
LL qpow(LL a,LL b=MOD-2,LL _MOD=MOD){
	LL res=1;
	for(;b;b>>=1,a=a*a%_MOD){
		if(b&1)res=res*a%_MOD;
	}
	return res;
}
// Smax
//int Smax() { return -INF; }
template <typename T>
T Smax(T x) { return x; }
template<typename T, typename... Args>
T Smax(T a, Args... args) { return max(a, Smax(args...)); }
// Smin
template <typename T>
T Smin(T x) { return x; }
template<typename T, typename... Args>
T Smin(T a, Args... args) { return min(a, Smin(args...)); }
template <typename T>
// erro
#define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); errl(_it, args); }

void errl(istream_iterator<string> it) {}
template<typename T, typename... Args>
void errl(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	errl(++it, args...);
}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr<<endl;}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << "=" << a << " # ";
	err(++it, args...);
}
void Solve();
int main() {
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//    freopen("o1.txt","w",stdout);
#endif
	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
	Solve();
	return 0;
}

//////////////////////////////////////////////////////////////////

char s[N];
void Solve(){
  cin>>s;
  int n=strlen(s),ans=0,cur=0;
  rep(i,0,n-1){
    if(s[i]=='R')cur++;else cur=0;
    ans=max(ans,cur);
  }
  cout<<ans<<endl;
} 


Measured memory_bytes: 3632
def main():
    C = [list(map(int, input().split())) for _ in range(3)]

    res = 'No'

    for i in range(101):
        b1 = C[0][0] - i
        b2 = C[0][1] - i
        b3 = C[0][2] - i
        a2 = C[1][0] - b1
        a3 = C[2][0] - b1

        if C[1][1] == a2 + b2 and C[1][2] == a2 + b3 and C[2][1] == a3 + b2 and C[2][2] == a3 + b3:
            res = 'Yes'
            break
    
    print(res)

if __name__ == '__main__':
    main()

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

using namespace std;
#define ull unsigned long long
#define ll long long
const int MAXN = 2e5 + 1;
const ll inf = 1e12;
vector<ll> arr(0);
vector<ll> prefsumm(0);
map<ll, int> ost;
vector<ll> dp(1e5 + 1, inf);
vector<int> where(1e5 + 1, 0);
vector<pair<ll, int>> t(4e5 + 1);

void build(int v, int vl, int vr) {
    if (vl == vr) {
        t[v] = {dp[vl], vl};
        return;
    }
    int tmp = (vl + vr) / 2;
    build(2 * v, vl, tmp);
    build(2 * v + 1, tmp + 1, vr);
    if (t[2 * v].first <= t[2 * v + 1].first) {
        t[v] = make_pair(t[2 * v].first, t[2 * v].second);
    } else {
        t[v] = make_pair(t[2 * v + 1].first, t[2 * v + 1].second);
    }
}

pair<ll, int> query(int v, int vl, int vr, int l, int r) {
    if (l > r) return {inf, MAXN};
    if (vl == l && vr == r) {
        return t[v];
    }
    int tmp = (vl + vr) / 2;
    pair<ll, int> fi = query(2 * v, vl, tmp, l, min(r, tmp));
    pair<ll, int> se = query(2 * v + 1, tmp + 1, vr, max(l, tmp + 1), r);
    if (fi.first <= se.first) {
        return fi;
    } else {
        return se;
    }
}

void update(int v, int vl, int vr, int pos, ll val) {
    if (vl == vr) {
        t[v] = {val, pos};
        return;
    }
    int tmp = (vl + vr) / 2;
    if (pos <= tmp) {
        update(2 * v, vl, tmp, pos, val);
    } else update(2 * v+1,tmp+1,  vr, pos, val);
    if (t[2 * v].first <= t[2 * v + 1].first) {
        t[v] = make_pair(t[2 * v].first, t[2 * v].second);
    } else {
        t[v] = make_pair(t[2 * v + 1].first, t[2 * v + 1].second);
    }
}

void solve() {
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    if(s[n]=='1'){
        cout<<-1;
        return;
    }
    dp[n] = 0;
    build(1,0,n);
    //cout<<"ok"<<endl;
    update(1,0,n, n, dp[n]);
    //cout<<"ok2"<<endl;
    for (int i = n - 1; i >= 0; i--) {
        if (s[i] == '1') continue;
        //cout<<"ok3"<<endl;
        pair<ll , int> left = query(1, 0, n, i + 1, min(i + m, n));
        //cout<<"ok4"<<endl;
        if (left.first == inf) continue;
        dp[i] = left.first + 1;
        where[i] = left.second;
        update(1, 0, n, i, dp[i]);
        //cout<<i<<endl;
    }
    if(dp[0]==inf) cout<<-1;
    else{
        int i=0;
        while(i!=n){
            cout<<where[i]-i<<" ";
            i=where[i];
        }
    }

}

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


Measured memory_bytes: 8144
#include <stdio.h>
int main(void)
{
  int a,b,c;
  int x;

  scanf("%d",&x);

  a=x/3600;
  x=x%3600;
  b=x/60;
  x=x%60;
  c=x;

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

  return 0;
}

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

int main() {
    int n;cin>>n;
    int a[n];
    for (int i=0;i<n;i++)
        cin>>a[i];
    ll mn=1e18;
    for (int i=0;i<2;i++) {
        ll sm=0;
        ll cnt=0;
        for (int j=0;j<n;j++) {
            sm+=a[j];
            if ((i+j)%2==0) {
                if (sm<=0) {
                    cnt+=-sm+1;
                    sm=1;
                }
            } else {
                if (sm>=0) {
                    cnt+=sm+1;
                    sm=-1;
                }
            }
        }
        mn=min(mn,cnt);
    }
    cout<<mn<<endl;
    return 0;
}

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

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353 
#define MEM_SIZE 100010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


template< typename T >
struct edge {
  int src, to;
  T cost;
 
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
 
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
 
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
 
  operator int() const { return to; }
};
 
template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;
 
 
template< typename T >
vector< T > bellman_ford(Edges< T > &edges, int V, int s,int g) {
  // const auto INF = numeric_limits< T >::max();
  vector< T > dist(V, INF);
  dist[s] = 0;
  for(int i = 0; i < V - 1; i++) {
    for(auto &e : edges) {
      if(dist[e.src] == INF) continue;
      dist[e.to] = min(dist[e.to], dist[e.src] + e.cost);
    }
  }
  auto dist2 = dist;

  for (int i = 0; i < V; i++)
  {
  for(auto &e : edges) {
    if(dist2[e.src] == INF) continue;
    if(dist2[e.src] + e.cost < dist2[e.to]) 
    if(chmin(dist2[e.to],dist2[e.src] + e.cost ))
    {
      dist2[e.to] = -INF;
    }
  }
  }
  

  if(dist[g] > dist2[g])
    return vector< T >();
 
  return dist;
}
 
void solve(void)
{
  int n,m,p;
  cin>>n>>m>>p;
  Edges<int> es;
  for (int i = 0; i < m; i++)
  {
    int a,b,c;
    cin>>a>>b>>c;
    a--;b--;
    es.emplace_back(a,b,p - c);
  }
  auto dist = bellman_ford(es,n,0,n-1);
  // DEBUG(dist);
  if(dist.size() == 0)
  {
    cout<<-1<<endl;
    return;
  }
 
  if(dist[n-1] == INF)
  {
    cout<<-1<<endl;
    return;
  }
  cout<<max(0LL,dist[n-1]*-1)<<endl;
 
 
  
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 3668
N = int(input())
P = [int(p) for p in input().split()]


for i in range(N-1):
    if P[i] > P[i+1]:
        tmp = P[P[i]-1]
        P[P[i]-1] = P[i]
        P[i] = tmp
        break

if P == sorted(P):
    print('YES')
else:
    print('NO')


Measured memory_bytes: 3060