akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

int w,h,dx[]={1,0,-1,0},dy[]={0,1,0,-1},used[51][51];
char a[51][51];

int bfs(int y,int x){
	if(x<0||w<=x||y<0||h<=y||used[y][x])return 0;
	if(a[y][x]=='W')return 2;
	if(a[y][x]=='B')return 1;
	used[y][x]=1;
	int res=0;
	rep(i,4)res|=bfs(y+dy[i],x+dx[i]);
	return res;
}

int main(){
	while(cin>>w>>h&&w){
		rep(i,h)rep(j,w)cin>>a[i][j];
		int B=0,W=0;
		rep(i,h)rep(j,w)if(a[i][j]=='.'){
			rep(k,h)fill(used[k],used[k]+w,0);
			int res=bfs(i,j);
			if(res==1)B++;
			if(res==2)W++;
		}
		cout<<B<<" "<<W<<endl;
	}
}

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

int main(){
  int W, H, N;
  cin >> W >> H >> N;
  int x[N], y[N], a[N];
  int max1 = 0, max2 = 0, max3 = 0, max4 = 0;
  for(int i = 0; i < N; i++){
    cin >> x[i] >> y[i] >> a[i];
    if(a[i] == 1) max1 = max(max1, x[i]);
    if(a[i] == 2) max2 = max(max2, W - x[i]);
    if(a[i] == 3) max3 = max(max3, y[i]);
    if(a[i] == 4) max4 = max(max4, H - y[i]);
  }
  int minx = 0, miny = 0;
  minx = W - max1 - max2;
  if(minx < 0)minx = 0;
  miny = H - max3 - max4;
  if(miny < 0)miny = 0;
  int ans = minx * miny;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define MAX 100005

vector<int> adj[MAX], par(MAX, -1);

void bfs(int st){
	queue<int> qu;
	qu.push(st);
	par[st] = 1;
	while( !qu.empty() ){
		auto node = qu.front();
		qu.pop();
		for(int e : adj[node])
			if( par[e] == -1 ){
				par[e] = node;
				qu.push(e);
			}
	}
}

int32_t main(){
	IOS;
	int n, m, a, b;
	cin >> n >> m;

	for(int i = 0; i < m; i++){
		cin >> a >> b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}

	bfs(1);
	bool pos = true;
	for(int i = 2; i <= n; i++)
		if( par[i] == -1 )
			pos = false;

	if( pos ){
		cout << "Yes\n";
		for(int i = 2; i <= n; i++)
			cout << par[i] << "\n";
	}else{
		cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 12788
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#define int long long
using namespace std;
signed main() {
	string S;
    cin>>S;
    bool A=false;
    
    for(int i=0;i<S.size();i++){
        if(i%2==0&&S[i]=='L'||i%2==1&&S[i]=='R'){
            A=true;
        }
    }
    if(A==true){
        cout<<"No"<<endl;
    }
    else{
        cout<<"Yes"<<endl;
    }
}

Measured memory_bytes: 3636
n = int(input())
tmp = list(map(int,input().split()))
lis = [0]
for i in range(n):
    lis.append(lis[-1] + tmp[i])
lis.sort()
ans = 0
k = 0
for i in range(n):
    if lis[i] == lis[i+1]:
        k += 1
    else:
        ans += (k * (k+1)) // 2
        k = 0
ans += (k * (k+1)) // 2
print(ans)


Measured memory_bytes: 25724
#include <iostream>
#include <vector>
#include <algorithm>
#define LL long long

int main(){

	int a,b,c, d;
	std::cin >> a >> b >> c >> d;

	if(std::abs(a-b)<=d && std::abs(b-c)<=d)std::cout << "Yes";
	else if(std::abs(a-c)<=d)std::cout << "Yes";
	else std::cout << "No";

	return 0;
}


Measured memory_bytes: 256
import collections
import itertools
n = int(input())
M = "MARCH"
S = []
for i in range(n):
  S.append(input()[0])
T = []
for i in S:
  if i in M:
    T.append(i)
U = collections.Counter(T)
TT = set(T)
P = list(itertools.combinations(TT, 3))
ans = 0
for i in P:
  ans += U[i[0]] * U[i[1]] * U[i[2]]
print(ans)

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

#define int ll
void solve()
{
	ll d;
	cin>>d;
	vector<ll>c(26);
	rep(i,26)cin>>c[i];
	vector<vector<ll>>s(d,vector<ll>(26));
	rep(i,d)rep(j,26)cin>>s[i][j];
	vector<ll>last(26);
	ll res=0;
	rep(i,d){
		ll maxv=0;
		int day=0;
		rep(j,26){
			if(chmax(maxv,s[i][j]))day=j;
		}
		cout<<day+1<<"\n";
		// res+=maxv;
		// last[day]=i+1;
		// rep(j,26){
		// 	res-=c[j]*(i+1-last[j]);
		// }
		// cout<<res<<"\n";
	}
}
#undef int
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


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

#define rep(i, n) for(long long i=0;i<n;i++)
using ll = long long;
const ll INF = (1LL<<60);

int main(){

    ll n; cin >> n;
    set<string> s;
    string in;
    rep(i, n){
        cin >> in;
        s.insert(in);
    }

    cout << s.size() << endl;

    return 0;
}

Measured memory_bytes: 19104
N, M = gets.split.map(&:to_i)
submits = M.times.map { 
  r, s = gets.chomp.split

  [r.to_i, s]
}

accepted = Hash.new(false)
wa_count = Hash.new(0)
ac_count = 0
penalty = 0

submits.each do |id, ret|
  next if accepted[id]

  if ret == 'AC'
    accepted[id] = true
    ac_count += 1
    penalty += wa_count[id]
  else
    wa_count[id] += 1
  end
end

puts [ac_count, penalty].join(' ')


Measured memory_bytes: 21500
use itertools::Itertools as _;
use proconio::{input, marker::Usize1};

fn main() {
    input! {
        n: usize,
        k: usize,
        d: [[Usize1]; k],
    }

    let ans = n - d.into_iter().flatten().unique().count();
    println!("{}", ans);
}


Measured memory_bytes: 2204
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000100010001000100LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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; }


int main(){ 
    ll n, k; cin >> n >> k;
    vector<int> next(n);
    rep(i, n){
        int a; cin >> a; a--;
        next[i] = a;
    }
    vector<int> seen(n,-1); //最短距離
    seen[0] = 0; int cur = 0; bool roop = false;
    rep(i, k){
        int nx = next[cur];
        if(seen[nx]== -1){
            seen[nx] = seen[cur]+1;
            cur = nx;
        }
        else{
            roop = true;
            break;
        }
    }
    if(roop){
        ll len = seen[cur]+1 - seen[next[cur]];
        ll rs = k - seen[next[cur]];
        rep(i, rs % len+1){
            cur = next[cur];
        }
    }
    cout << cur+1 << ln;

}

Measured memory_bytes: 4844
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
P x[100000];
ll cnt[100000];
bool comp(P a, P b) {
	if (a.second != b.second)return a.second > b.second;
	return a.first < b.first;
}
int main() {
	int n; cin >> n;
	rep(i, n) {
		int a; cin >> a;
		x[i] = { i,a };
	}
	sort(x, x + n, comp);
	int num = 1; int ind = x[0].first; ll sto = x[0].second;
	rep1(i, n - 1) {
		cnt[ind] += num * (sto - x[i].second);
		num++;
		sto = x[i].second;
		ind = min(ind, x[i].first);
	}
	cnt[ind] += num * sto;
	rep(i, n) {
		cout << cnt[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 2688
#include<iostream>
int main()
{
	int n;
	std::cin >> n;
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1;; j *= 10)
		{
			const int i_rownddowned = i / j;
			const int digit = i_rownddowned % 10;
			if(i_rownddowned == 0)
			{
				break;
			}
			else if(i % 3 == 0 || digit == 3)
			{
				std::cout << ' ' << i;
				break;
			}
		}
	}
	std::cout << std::endl;
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> piipi;
typedef pair<pii, pii> piipii;

#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back

char s[100005];
int dp[100005];
int main(){
    int n;
    scanf("%d", &n);
    scanf("%s", s);
    for(int j=0;j<2;j++){
        for(int k=0;k<2;k++){
            memset(dp, -1, sizeof(dp));
            dp[n-1] = j;
            dp[0] = k;

            bool ok = 1;
            for(int i=0;i<n;i++){
                if(dp[i] == 0){
                    if(s[i] == 'o'){
                        if(dp[(i+1)%n] == -1) dp[(i+1)%n] = dp[(i-1+n)%n];
                        else if(dp[(i+1)%n] != dp[(i-1+n)%n]) ok = 0;
                    }
                    else{
                        if(dp[(i+1)%n] == -1) dp[(i+1)%n] = 1-dp[(i-1+n)%n];
                        else if(dp[(i+1)%n] != 1-dp[(i-1+n)%n]) ok = 0;
                    }
                }
                else{
                    if(s[i] == 'x'){
                        if(dp[(i+1)%n] == -1) dp[(i+1)%n] = dp[(i-1+n)%n];
                        else if(dp[(i+1)%n] != dp[(i-1+n)%n]) ok = 0;
                    }
                    else{
                        if(dp[(i+1)%n] == -1) dp[(i+1)%n] = 1-dp[(i-1+n)%n];
                        else if(dp[(i+1)%n] != 1-dp[(i-1+n)%n]) ok = 0;
                    }
                }
            }
            if(ok){
                for(int i=0;i<n;i++){
                    if(dp[i] == 0   ) printf("S");
                    else printf("W");
                }
                return 0;
            }
        }
    }
    printf("-1\n");
}

Measured memory_bytes: 4180
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    string s;
    cin >> s;
    vi sa = suffix_array(s);
    vi lcp = lcp_array(s, sa);
    ll ans = (ll)sz(s) * (ll)(sz(s) + 1) / 2LL;
    for (auto x : lcp) ans -= x;
    cout << ans << endl;
}

Measured memory_bytes: 15664
n = gets.chomp.to_i

puts "? #{[*1..n].join(" ")}"
$stdout.flush
x = gets.chomp

l = 1
r = n+1
while l+1 < r
  m = (l+r)/2
  puts "? #{[*m...m+n].join " "}"
  $stdout.flush
  y = gets.chomp
  if x == y
    l = m
  else
    r = m
  end
end

s = r
half = [*s...s+n-1].join(" ")
half = " " + half if !half.empty?

ans = Array.new(n*2)
h = {"Red" => "R", "Blue" => "B"}

(1...s).each do |i|
  puts "?#{half} #{i}"
  $stdout.flush
  ans[i-1] = h[gets.chomp]
end
(s+n..n*2).each do |i|
  puts "?#{half} #{i}"
  $stdout.flush
  ans[i-1] = h[gets.chomp]
end

half = [*1...s-1, *s+n..n*2].join(" ")
half = " " + half if !half.empty?
(s..s+n-1).each do |i|
  puts "?#{half} #{i}"
  $stdout.flush
  ans[i-1] = h[gets.chomp]
end

puts "! #{ans.join}"
$stdout.flush

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n;
void solve(){
	cin >> n;
	
	cout << n*n*n << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] e = {2, 4, 3, 9, 8, 10, 6, 12};
        int[] o = {6, 2, 4 ,3, 9, 8, 10, 12};
        
        if (n == 3) {
            System.out.println("2 5 63");
            return;
        }
        
        int m = 0;
        boolean isEven = n % 2 == 0;
        for (int i = 0; i < n; i++) {
            System.out.print(isEven ? e[i % 8] + 12*m : o[i % 8] + 12*m);
            System.out.print(" ");
            if (i % 8 == 7) {
                m++;
            }
        }
    }
}


Measured memory_bytes: 28992
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		long[] chars = new long[26];
		for (char c : arr) {
			chars[c - 'a']++;
		}
		long length = arr.length;
		long total = length * (length - 1) / 2 + 1;
		for (long x : chars) {
			if (x > 1) {
				total -= x * (x - 1) / 2;
			}
		}
		System.out.println(total);
	}
}


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

int main(void) {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a.at(i);
  int mindesu = 1000001;
  rep(i,100){
    int minkamo = 0;
    rep(j,n){
      minkamo += (a.at(j)-i)*(a.at(j)-i);
    }
    if (mindesu>minkamo) mindesu = minkamo;
  }
  cout << mindesu << endl;
    
               
   
}

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

float y(float a, float b, float c, float d, float x) {
	return a * x*x*x / 3 + b * x*x / 2 + c * x + d;
}
int main() {
	float a, b, c, d, D;
	int p, m, n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%f %f %f %f", &a, &b, &c, &d);
		if (a < 0) a *= -1, b *= -1, c *= -1, d *= -1;
		a *= 3;
		b *= 2;
		D = b * b - 4 * a*c;
		if (D > 0) {
			float k1 = (-b - sqrt(D)) / (2 * a), k2 = (-b + sqrt(D)) / (2 * a);
			if (y(a, b, c, d, k2) > 0 || y(a, b, c, d, k1) < 0) {
				if (d > 0)p = 0, m = 1;
				else if (d < 0)p = 1, m = 0;
				else p = 0, m = 0;
			}
			else {
				if (k2 < 0) {
					if (d > 0)p = 0, m = 3;
					else if (d < 0)p = 1, m = 2;
					else p = 0, m = 2;
				}
				else if (k1 > 0) {
					if (d > 0)p = 2, m = 1;
					else if (d < 0)p = 3, m = 0;
					else p = 2, m = 0;
				}
				else if (k1 == 0) {
					if (d > 0)p = 2, m = 1;
					else if (d < 0)p = 1, m = 0;
					else p = 1, m = 0;
				}
				else if (k2 == 0) {
					if (d > 0)p = 0, m = 1;
					else if (d < 0)p = 1, m = 2;
					else p = 0, m = 1;
				}
				else {
					if (d > 0)p = 2, m = 1;
					else if (d < 0)p = 1, m = 2;
					else p = 1, m = 1;
				}
			}
		}
		else if (D < 0) {
				if (d > 0)p = 0, m = 1;
				else if (d < 0)p = 1, m = 0;
				else p = 0, m = 0;
			}else {
				if (d > 0) {
					if (y(a, b, c, d, -b / (2 * a)) == 0)p = 0, m = 3;
					else p = 0, m = 1;
				}
			else if (d < 0) {
				if (y(a, b, c, d, -b / (2 * a)) == 0)p = 3, m = 0;
				else p = 1, m = 0;
			}
			else p = 0, m = 0;
		}
		printf("%d %d\n", p, m);
	}
	
}



Measured memory_bytes: 2560
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod ((int)1e9+7)
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<pi,null_type,less<pi>,rb_tree_tag,tree_order_statistics_node_update> indexed_set_pair;
ll power(ll a,ll b) {
   ll res=1;
   while(b){
      if(b%2==1) res=(res*a)%mod;
      a=(a*a)%mod;
      b>>=1;
   }
   return res;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int N = (int)2e5+5;
const int M = (int)1e3+5;
const int Q = 102;
const int logN = 19;

const double pie = acos(-1);

void solve() {
  string s;
  cin>>s;
  int cnt = 0, ans = 0;
  for(int i=0;i<s.size();i++) {
    if(s[i]=='S') {
      ans = max(ans, cnt);
      cnt = 0;
    } else cnt++;
  }
  ans = max(ans, cnt);
  cout<<ans;
}

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

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

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        //cout<<"\n";
    }
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <stdlib.h>

using namespace std;
 
int ascSort(const void* v1, const void* v2) {
    const int _v1 = *((const int*)v1);
    const int _v2 = *((const int*)v2);
 
    if ( _v1 < _v2 ) {
        return 1;
    } else if ( _v1 > _v2 ) {
        return -1;
    } else {
        return 0;
    }
}
int main() {
	int x,y;
	cin >>x>>y;
	if(x ==4 || x==6 || x==9 || x==11){
		x=1;
	}else if(x==2){
		x=2;
	}else{
		x=3;
	}
		if(y ==4 || y==6 || y==9 || y==11){
		y=1;
	}else if(y==2){
		y=2;
	}else{
		y=3;
	}
	if(x==y){
		cout << "Yes" << endl;
	}else{
		cout <<"No"<<endl;
	}
	return 0;
}

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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var << endl;
#else
#define debug(var)
#endif

void init() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
}

void solve() {
	int a, b; cin >> a >> b;
	if (a+b >= 10) cout << "error";
	else cout << a+b;
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        static void Main(string[] args)
        {
            //var watch = new Stopwatch();
            /*var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);*/


            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = input[0];
            int M = input[1];
            List<bool[]> s = new List<bool[]>();
            for(var i = 0; i < M; i++)
            {
                s.Add(new bool[N]);
                var p = Console.ReadLine().Split().Select(int.Parse).ToArray();
                for(var j = 1; j <= p[0]; j++)
                {
                    s[i][p[j] - 1] = true;
                }
            }

            int[] P = Console.ReadLine().Split().Select(int.Parse).ToArray();
            long ans = 0;

            for(int bit = 0; bit < (1 << N); bit++)
            {

                List<int> B = new List<int>();
                int[] num = new int[M];
                for(var i = 0; i < M; i++)
                {
                    num[i] = 0;
                }

                for(int i = 0; i < N; i++)
                {
                    if ((bit & (1 << i)) != 0)
                    {
                        B.Add(i);
                    }
                }
                foreach(var x in B)
                {
                    for(var j = 0; j < M; j++)
                    {
                        if (s[j][x])
                        {
                            num[j]++;
                        }
                    }
                }

                int on = 0;
                for(var i = 0; i < M; i++)
                {
                    if (num[i] % 2 == P[i])
                    {
                        on++;
                    }
                }
                if (on == M) { ans++; }

            }


            Console.WriteLine(ans);


            //watch.Start();

            

            Console.Out.Flush();
            /*watch.Stop();

            Console.WriteLine($"time:{watch.ElapsedMilliseconds} ms"); //Debug Only.
            Console.Out.Flush();*/
        }
    }
    


    public class Calculation
    {
        
    }

    public class Graph
    {

    }
}
    

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

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a; }

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

  vector<ll> t;
  for (int a=1; a<=k; a++) {
    for (int b=1; b<=k; b++) {
      t.push_back(gcd(a, b));
    }
  }
  
  ll sum = 0;
  for (int c=1; c<=k; c++) {
    rep(i,t.size()) {
      sum += gcd(t[i], c);
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3928
import java.util.Scanner;

public class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int n;
		n=sc.nextInt();
		char ch[] = String.valueOf(n).toCharArray();
		char x = ch[0];
		char ans[]= {x,x,x};
		int di = Integer.parseInt(String.valueOf(ans));
		if(di>=n)
			System.out.println(di);
		else
		{
			di=di+111;
			System.out.println(di);
		}
		
	}
}


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

#define debug(x) cout <<"DEBUG"<<" "<<#x<<":"<<x<<'\n'

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-origin昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-origin昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-origin降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-origin降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
template<typename T> bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1;} return 0;}
template<typename T> bool chmin(T &a, const T &b){ if(a>b){ a=b; return 1;} return 0;}


/*FUNCs=================================================*/


/*MAIN==================================================*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化

    int r; cin >> r;
    cout << 3*r*r << '\n';
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<math.h>

using namespace std;
#define MAX 100000
int n,k;
long long T[MAX];

int check(long long  p){
    int i=0;   
    for(int j=0; j<k; j++){
    	long long sum=0;
        while(sum + T[i]<= p){
            sum += T[i];
            i++;
            if(i == n)  return n;
        }
    }
    return i;
}

int binarySearch(){
    long long left = 0;
    long long right = 100000 * 10000;
    long long mid;
    while(right - left > 1){
    mid = (left + right)/2;
    int v = check(mid);
    if(v>=n) right = mid;
    else left = mid;
    }
    return right;
}

int main(){
    cin >> n >> k;
    for(int i=0; i<n; i++) cin>>T[i];
    long long ans = binarySearch();
    cout<<ans<<endl;
}


Measured memory_bytes: 3892
#include <iostream>
#include <queue>
using namespace std;
signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int n,m,o;
    cin>>n>>m;
    queue<int> l[n+1];
    int info;
    for(int i=0;i<m;i++){
        cin>>info;
        if(info==0){
            cin>>o;
            cout<<l[o].front()<<"\n";
            l[o].pop();
        }else{
            cin>>o;
            int s=1;
            for(int j=2;j<=n;j++){
                if(l[j].size()<l[s].size()) s=j;
            }
            l[s].push(o);
        }
    }
    return 0;
}


Measured memory_bytes: 3272
#include <bits/stdc++.h>
using namespace std;
#define loop(i,n) for (int i =0;i<(n);i++)
typedef long long ll;
 
int main (){

//     int n;
//     cin >>n;
//     vector <int> a(n);
//     loop(i,n){
//         cin>>a[i];
//     }
//     bool dobar = true;
//     loop(i,n){
//         if(a[i]%2==1) continue;
//         if(a[i]%3 != 0 && a[i]%5 !=0) dobar = false;

//     }
// if(dobar) cout << "APPROVED"<< endl;
// else
// {
//     cout << "DENIED" << endl;
// }
// return 0 ;
int n ;
cin >>n;
map <string, int >mp;
loop(i,n){
string s;
cin >>s;
mp[s]++;

}
int mx = 0;
for (auto p : mp) mx = max(mx,p.second);
for (auto p: mp){
    if(p.second != mx) continue;
    cout <<p.first<<endl;
}
return 0;

}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
const int maxn=(1e5)+10;
int n,ans;
char s[maxn];
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	scanf("%s",s+1);
	for (int i=1;i<=n;i++)
		if (i==1||s[i]!=s[i-1]) ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <vector>
#include <cctype>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<30;

bool fizzBuzzCheck(int n,string s){
	if(n%15==0)return (s == "FizzBuzz");
	if(n%3==0)return  (s == "Fizz");
	if(n%5==0)return  (s == "Buzz");

  REP(i,s.size()) if (!isdigit(s[i])) return false;

	return (atoi(s.c_str()) == n);
}

int main(){
	int n,m;
	string s;
	
	while(scanf("%d %d\n",&m,&n), m||n){
	
		vector<int> rem(m);
		for(int i=0;i<m;i++){
			rem[i] = i+1;
		}
		int c = 0;
		for(int i=1;i<=n;i++){
			getline(cin,s);
			if(rem.size() == 1)continue;
			if( !fizzBuzzCheck(i,s) ){
        rem.erase(rem.begin()+c);
			}else{
				c++;
			}
			c %= rem.size();
		}
    REP(i,rem.size())
			cout << (i?" ":"") << rem[i];
		cout << endl;
	}
}

Measured memory_bytes: 968
#include <stdio.h>

int main(void)
{
	int i, n, a[100];
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	
	for (i = 1; i <= n; i++) {
		if (i != 1) printf(" ");
		printf("%d", a[n-i]);
	}
	printf("\n");
						
	return 0;
}

Measured memory_bytes: 600
using System;
using System.Collections.Generic;
using System.Linq;
//using System.Numerics;
class Program
{     
    const int MOD = 1000000007;
    public void Slove()
    {
        int n = int.Parse(Console.ReadLine());
        int[] factCount = new int[n + 1];
        foreach(int j in Enumerable.Range(1, n))
        {
            int num = j;
        foreach(int i in Enumerable.Range(2, j - 1))
        {
            while(num % i == 0)
            {
                factCount[i]++;
                num /= i;
            }
        }

        }
        long result = 1;
        foreach(int i in factCount)
            result = result * (i + 1) % MOD;
            System.Console.WriteLine(result);
    }
    
    static void Main(string[] args)
    {
        new Program().Slove();
    }
}


Measured memory_bytes: 11220
#include <stdio.h>
int main(void){
    int n, d, x;
    int a[100+5];
    scanf("%d %d %d", &n, &d, &x);
    for(int i=0; i<n; i++)scanf("%d", &a[i]);
    
    for(int i=0; i<n; i++)x+=(1+(d-1)/a[i]);
    
    printf("%d\n", x);
    return 0;
}


Measured memory_bytes: 1712
#include <bits/stdc++.h> 
 
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

int main(){
    int N;cin>>N;
    vector<LL>a(N),b(N);
    REP(i,N)cin>>a[i];
    REP(i,N)cin>>b[i];
    LL p=0,q=0;
    REP(i,N){
        if(a[i]>b[i])q+=(a[i]-b[i]);
        else if(a[i]<b[i])p+=(b[i]-a[i])/2LL;
    }
    //cout<<p<<" "<<q<<endl;
    if(p>=q)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 384
K, N = map(int,input().split())
#K: 湖1周の長さ, N:湖の周りにある家の数
 
A = list(map(int, input().split()))
l = 0
A.append(A[0]+K)
for i,aa in enumerate(A):
    if(i<len(A)-1):
        l = max(l, A[i+1]-aa)
print(K-l)
    

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

int main()
{
    int N,m,num=0;
    double d;
    cin>>N;
    int j;
    for(int i=0;i<N;i++){
        cin>>m;
        d=sqrt(m);
        for(j=2;j<=(int)d&&m%j;j++);
        if(d<j){
            num++;
        }
    }
    cout<<num<<endl;
}

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

typedef vector<int> veci;
typedef pair<int, int> pii;
typedef vector<pii> vecii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vecl;
typedef vector<pll> vecll;
#define EPS (1e-9)
#define MOD (1e9 + 7)
#define fi first
#define se second
#define endl '\n'

void solve() {
    int ab[2], k;
    cin >> ab[0] >> ab[1] >> k;

    for (int i=0; i<k; ++i) {
        if (ab[i%2]%2) {
            ab[i%2] -= 1;
        }
        ab[(i + 1) % 2] += ab[i % 2] / 2;
        ab[i % 2] /= 2;
    }

    cout << ab[0] << " " << ab[1] << endl;
}

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL_TEST
    (void)argc;
    const string strpath = string(argv[0]) + string("-test.in");
    freopen(strpath.c_str(), "r", stdin);
    int tcs;
    cin >> tcs;
    while (tcs-- > 0)
#endif
    solve();
}


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

using namespace std;

typedef long long ll;

int main() {
  string s; cin >> s;
  int k = s.size();
  int won = 0;
  for(int i = 0; i < k; i++) {
    won += s[i] == 'o';
  }
  if(won + 15 - k >= 8) {
    puts("YES");
  }
  else {
    puts("NO");
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s,t;
  cin >> s >> t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end(),greater<char>());
  if(s < t) {
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }
}

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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

string S, T;
signed main() {
    cin >> S >> T;
    rep(i, S.length()) {
        if (S.substr(i, S.length() - i) + S.substr(0, i) == T) { fin("Yes"); }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int head[200001];
int save[200001][200];
int main() {
    long long N;
    long long a[200001];
    long long b[200001];
    long long size = 0;
    cin >> N;
    for (int i=1; i<=N; i++) cin >> a[i];

    for (int i=1; i<=N; i++) {
        for (int j=2; i*j <= N; j++) {
            save[i*j][head[i*j]] = i;
            head[i*j]++;
        }
    }
    for (int i=N; i>=1; i--) {
        b[i] = a[i];
        if (b[i] == 1) size++;
        for (int jh = 0; jh < head[i]; jh++) {
                a[save[i][jh]] ^= b[i];
        }
    }
    cout << size << endl;
    for (int i=1; i<=N; i++) {
        if (b[i] == 1) {
            cout << i;
            size--;
            if (size > 0) cout << " ";
            else cout << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 161024
import math

def main(A, B, C, D):
    TAKAHASHI = math.ceil(C / B)
    AOKI = math.ceil(A / D)
    # print(TAKAHASHI, AOKI)
    if TAKAHASHI <= AOKI:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    A, B, C, D = list(map(int, input().split()))
    main(A, B, C, D)


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

using namespace std;

typedef long long ll;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll N, A, B, cnt = 0, c = 0;
	cin >> N >> A >> B;
	if (A + B - 1 > N || N > A*B){
		cout << -1;
		return 0;
	}
	vector<int> seq[300005];
	for (int i = 1; i <= B; ++i){
		do{
			seq[i].push_back(++cnt);
			if (B - i >= N - cnt){
				c = 1;
			}
		} while(!c && seq[i].size() < A);

	}
	for (int i = B; i >= 1; --i){
		for (auto it : seq[i]){
			cout << it << ' ';
		}
	}
	cout << '\n' << flush;
	//for (int i = 0; i < 1e9; ++i){for (int j = 0; j < 1e9; ++j){}}
}

Measured memory_bytes: 15488
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.stream.IntStream;

/**
 * 解説通り実装したソースコード
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int m = scanner.nextInt();
			Path[] paths = new Path[m];
			@SuppressWarnings("unchecked")
			List<Path>[] pathLists = new List[n];
			IntStream.range(0, n).forEach(i -> pathLists[i] = new ArrayList<>());
			IntStream.range(0, m).forEach(i -> {
				paths[i] = new Path(scanner.nextInt() - 1, scanner.nextInt() - 1, scanner.nextInt());
				pathLists[paths[i].from].add(paths[i]);
				pathLists[paths[i].to].add(new Path(paths[i].to, paths[i].from, paths[i].cost));
			});
			int[][] dist = new int[n][];
			IntStream.range(0, n).forEach(i -> dist[i] = dijkstra(pathLists, i, n));
			int answer = m;
			for (Path path : paths) {
				boolean shortest = false;
				for (int j = 0; j < n; j++) {
					if (dist[j][path.from] + path.cost == dist[j][path.to]) {
						shortest = true;
						break;
					}
				}
				if (shortest) {
					answer--;
				}
			}
			System.out.println(answer);
		}
	}

	/**
	 * @param pathLists ノード間の連結パス一覧の配列
	 * @param src       開始ノード
	 * @param n         ノードの数
	 * @return 開始ノードからの距離の配列
	 */
	private static int[] dijkstra(List<Path>[] pathLists, int src, int n) {
		int[] distances = new int[n];
		Arrays.fill(distances, Integer.MAX_VALUE);
		// 最短距離が確定したかどうか
		boolean[] fixed = new boolean[n];
		Arrays.fill(fixed, false);
		// 出発地点までの距離を0とする
		distances[src] = 0;
		Queue<Path> queue = new PriorityQueue<>();
		queue.add(new Path(src, src, 0));
		while (!queue.isEmpty()) {
			int now = queue.poll().to;
			if (!fixed[now]) {
				fixed[now] = true;
				for (Path path : pathLists[now]) {
					if (!fixed[path.to] && distances[path.to] > distances[now] + path.cost) {
						distances[path.to] = distances[now] + path.cost;
						queue.add(new Path(path.to, path.to, distances[path.to]));
					}
				}
			}
		}
		return distances;
	}

	/**
	 * ノード間の一つのパスを表すクラス
	 */
	private static class Path implements Comparable<Path> {
		/** 開始ノード */
		int from;
		/** 終了ノード */
		int to;
		/** 移動コスト */
		int cost;

		Path(int from, int to, int cost) {
			super();
			this.from = from;
			this.to = to;
			this.cost = cost;
		}

		@Override
		public int compareTo(Path path) {
			return this.cost - path.cost;
		}
	}
}


Measured memory_bytes: 30992
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

bool judge(int l1, int l2, int l3){
	if (l1 == l2 || l2 == l3) return false;
	return (l1 + l2 > l3);
}

int main(void){
	int N; cin >> N;
	vector<int> L(N);
	for (auto& li : L)
		cin >> li;
	sort(L.begin(), L.end());
	int res = 0;
	for (int i = 0; i < N; ++i)
	for (int j = i + 1; j < N; ++j)
	for (int k = j + 1; k < N; ++k)
		res += judge(L[i], L[j], L[k]) ? 1 : 0;
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define _h cout<<"here"<<endl;
#define fill(a,v) memset(a,v,sizeof(a));
#define all(v) v.begin(),v.end()
#define rep(i,n) for(int i=0;i<n;i+=1)
#define prarr(a,n) rep(i,n) cout<<a[i]<<" \n"[i==n-1];// printf("%s\n"," " );
#define ff first
#define ss second
#define pu push_back
#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)
template<typename S, typename T> 
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.ff<<", "<<p.ss<<')';return out;}
template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
int l=v.size();for(int i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}
template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}
template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}
const int inf = 1e9+10;
const ll INF = 1e18+10;
const int MOD = 1e9+7;
const int MAXN = 2e5+10;

void solve()
{
	ll h,w,a = 1;
	cin>>h>>w; a*=w;
	a*=h;
	if(a&1)
		a++;
	if(h==1 || w == 1) a = 2;
	cout<<a/2<<endl;
}
int main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin>>t;
	while(t--){
		solve();
	}
	return 0;

}
    

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int INF=1e9;
const ll MOD=1e9+7;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};

int gcd(int x,int y){
    if(y==0) return x;
    return gcd(y,x%y);
}

int dis2(int x1,int y1,int x2,int y2){
    return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}

int main(){
    ll n,p;cin>>n>>p;
    if(n==1){
        cout<<p<<endl;
        return 0;
    }
    ll g=1;
    for(ll i=2;i*i<=p;i++)if(p%i==0){
        ll c=0;
        while(p%i==0){
            p/=i;
            c++;
        }
        if(c>=n){
            g*=pow(i,c/n);
        }
    }
    cout<<g<<endl;
    return 0;
}

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

int main()
{
	int N;
	cin >> N;
	vector<vector<int>> d(N, vector<int>(N));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cin >> d[i][j];
		}
	}
	vector<vector<int>> deg(N, vector<int>(N, -1));
	for (int k = 0; k < N; k++) {
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				if (d[i][j] == d[i][k] + d[k][j]) {
					if (deg[i][j] == -1 || deg[i][j] == i || deg[i][j] == j) {
						deg[i][j] = k;
					}
				}
				else if (d[i][j] > d[i][k] + d[k][j]) {
					cout << -1 << endl;
					return 0;
				}
			}
		}
	}
	ll res = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			if (deg[i][j] == -1) {
				cout << -1 << endl;
				return 0;
			}
			else if (deg[i][j] == i || deg[i][j] == j) {
				res += d[i][j];
			}
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cout << setiosflags(ios::fixed) << setprecision(10);
	while(true){
		int n, m, k;
		cin >> n >> m >> k;
		if(n == 0 && m == 0 && k == 0){ break; }
		double answer = 0;
		if(n == 1){
			const double r = 1.0 / m;
			for(int i = 1; i <= m; ++i){
				answer += max(1, i - k) * r;
			}
		}else{
			const double r = 1.0 / m;
			const int len = n * m + 1;
			vector<double> dp(len);
			dp[0] = 1.0;
			for(int i = 0; i < n; ++i){
				vector<double> next(len);
				for(int j = 0; j + m < len; ++j){
					for(int k = 1; k <= m; ++k){
						next[j + k] += r * dp[j];
					}
				}
				dp.swap(next);
			}
			for(int i = n; i < len; ++i){
				answer += dp[i] * max(1, i - k); 
			}
		}
		cout << answer << endl;
	}
	return 0;
}

Measured memory_bytes: 1276
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <cassert>
#include <unordered_map>

#define _(x) { cout << #x << " = " << x << " "; }

const double E = 1e-8;
const double PI = acos(-1);

typedef long long ll;

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a[1<<18], b[1<<18];
    int n;
    ll total = 0;
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i], b[a[i]]++;
    for (int i = 1; i <= n; ++i) total += 1ll*b[i] * (b[i]-1) / 2;
    for (int i = 1; i <= n; ++i) cout << total - (b[a[i]]-1) << '\n';

    return 0;
}



Measured memory_bytes: 3712
h,*s=open(0)
h,w,k,*m=map(int,h.split())
b=512
while b:
 b-=1;r=t=j=0;d=[0]*h
 while w-j:
  i=c=0
  while h-i:
   d[c]+=s[i][j]>'0';f=d[c]>k
   if(t<j)&f:r+=1;t=j;d=[0]*h;break
   r+=h*w*f;c+=b>>i&1;i+=1
  else:j+=1
 m+=r+bin(b).count('1'),
print(min(m))

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

int main() {
  string s;
  cin >> s;
  if (s == "Sunny") {
    cout << "Cloudy" << endl;
  }
  else if (s == "Cloudy") {
    cout << "Rainy" << endl;
  }
  else {
    cout << "Sunny" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
h, _ = gets.chomp.split.map(&:to_i)
a = Array.new(h) { gets.chomp.chars }
res = []
a.each do |row|
  if row.join("")[/^\.+$/].nil?
    res << row
  end
end
a = res
res = []
a.transpose.each do |col|
  if col.join("")[/^\.+$/].nil?
    res << col
  end
end
puts res.transpose.map(&:join)

Measured memory_bytes: 2300
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using pq = priority_queue<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
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; }
const ll MOD = 1e9 + 7;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -MOD * MOD;
const long double pi = 3.141592653589793;
int main() { // 問題文はしっかり読め!!!
	int n;
	cin >> n;
	vector<P<int>> a(n);
	rep(i, n) {
		int x, l;
		cin >> x >> l;
		a[i] = make_pair(x + l, x - l);
	}
	sort(all(a));
	int now = a[0].first;
	int ans = 1;
	rep1(i, n - 1) {
		if (now <= a[i].second) {
			ans++;
			now = a[i].first;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024