akhauriyash/Code-Regression huggingface dataset:
package main

import "fmt"

func main(){
  l := make([]int, 3)
  fmt.Scanln(&l[0], &l[1], &l[2])
  cal := l[1] * l[2]
  if l[0] <= cal {
    fmt.Println("Yes")
  }else {
    fmt.Println("No")
  }
}


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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

  ll r;
  cin >> r;

  cout << r * r << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

string s;

int main() {
    cin >> s;

    int a = 0, z = 0;
    rep(i, s.size()) {
        if (a == 0 && s[i] == 'A') a = i + 1;
        if (s[i] == 'Z') z = max(z, i) + 1;
    }
    printf("%d\n", z-a+1);
}

Measured memory_bytes: 640
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define dump(x)  cout << #x << " = " << (x) << endl;

#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
//             0123456789 - digits. check the limits, int vs long
const int MX = 100001;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(0);
    cout << std::fixed;
    // freopen("ex.in","r",stdin);
    // freopen("ex.out","w",stdout);
    int a, b;
    cin >> a >> b;
    if (b == 1) {
        cout << 0 << "\n";
        return 0;
    }
    if (a >= b) {
        cout << 1 << "\n";
        return 0;
    }


    cout << (b - 1 + a - 2) / (a - 1) << "\n";
    return 0;
}

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

#define SORT(vec) sort(vec.begin(), vec.end());
typedef long long ll;

using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
//  --------------------------------------

	double A, B; cin >> A >> B;

	cout << int(ceil( (B-1.0) / (A-1.0) )) << "\n";
}

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

int main(){
    int a, b, c, tema, temb, temc, res = 0;
    cin >> a >> b >> c;
    if(a%2 == 1 || b%2 == 1 || c%2 == 1){
        cout << 0;
    }else if(a == b && b == c){
        cout << -1;
    }else{
        while(a%2 == 0 && b%2 == 0 && c%2 == 0){
            tema = a;
            temb = b;
            temc = c;
            a = (temb+temc)/2;
            b = (temc+tema)/2;
            c = (tema+temb)/2;
            res++;
        }
        cout << res;
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
restaurant = [[0 for i in range(3)] for j in range(N)]
for i in range(N):
    restaurant[i][0] = i
    restaurant[i][1], restaurant[i][2] = map(str, input().strip().split())
    restaurant[i][2] = int(restaurant[i][2])

restaurant = sorted(restaurant, key=lambda x: x[2], reverse=True)
restaurant = sorted(restaurant, key=lambda x: x[1])
for i in range(N):
    print(restaurant[i][0] + 1)


Measured memory_bytes: 3064
import copy
N, M =map(int, input().split())
K = []
S = []
for i in range(M):
    k, *s=map(int, input().split())
    K.append(k)
    S.append(s)

P= map(int, input().split())

C=[]
for s in S:
    c=0
    for ss in s:
        c += 2**(ss-1)
    C.append(c)
result=0

for i in range(2**N):
    f = 0
    x = 0
    CC= copy.deepcopy(C)
    PP= copy.deepcopy(P)
    for c,p in zip(CC,PP):
        x = i&c
        #print(i,c,p,x)
        if bin(x).count("1")%2 == p:
                f+=1
    if f==len(C):
        result+=1
    #print(i)

print(result)


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

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

	int a, b, c;
	a = N / 100;
	b = (N - 100 * a) / 10;
	c = N - 100 * a - 10 * b;

	if(b < a) {
		cout << 100 * a + 10 * a + a << endl;
	} else if(b > a) {
		cout << 100 * (a + 1) + 10 * (a + 1) + a + 1 << endl;
	}
	else if (c <= a) { // a == b
		cout << 100 * a + 10 * a + a << endl;
	}
	else {
		cout << 100 * (a + 1) + 10 * (a + 1) + a + 1 << endl;
	}

}

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

#define INF 1e+18
#define MAX_V 100000
#define int long long

struct edge {
  int to;
  int cost;
};
typedef pair<int, int> P;

int V;
vector<edge> G[MAX_V];
int d[MAX_V];

void dijkstra(int s) {
  priority_queue<P, vector<P>, greater<P> > que;
  fill(d, d + V, INF);
  d[s] = 0;
  que.push(P(0, s));

  while (!que.empty()) {
    P p = que.top();
    que.pop();
    int v = p.second;
    if (d[v] < p.first) continue;

    for (int i = 0; i < G[v].size(); ++i) {
      edge e = G[v][i];
      if (d[e.to] > d[v] + e.cost) {
        d[e.to] = d[v] + e.cost;
        que.push(P(d[e.to], e.to));
      }
    }
  }
}

signed main() {
  cin >> V;
  int E = V - 1;
  for (int i = 0; i < E; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    edge e1 = {b, c};
    G[a].push_back(e1);
    edge e2 = {a, c};
    G[b].push_back(e2);
  }

  int q, k;
  cin >> q >> k;
  k--;
  dijkstra(k);

  // for (int i = 0; i < V; ++i) {
  //   cerr << d[i] << " ";
  // }
  // cerr << endl;

  for (int i = 0; i < q; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    cout << d[x] + d[y] << endl;
  }
  return 0;
}

Measured memory_bytes: 12032
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;

long long a[5000];
bool dp[5000][10001];
bool is_needed(int ind, int K, int N){
    //cout << ind << endl;
    if(K <= a[ind]){
        return true;
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j <= K; j++){
            dp[i][j] = false;
        }
    }
    if(ind != 0){
        dp[0][0] = true;
        dp[0][a[0]] = true;
    } else {
        dp[1][0] = true;
        dp[1][a[1]] = true;
    }
    for(int i = 1; i < N; i++){
        if(i == ind){
            for(int j = 0; j <= K; j++){
                dp[i][j] = dp[i - 1][j];
            }
            continue;
        }
        for(int j = 0; j <= K; j++){
            dp[i][j] |= dp[i - 1][j];
            if(j + a[i] < K){
                dp[i][j + a[i]] |= dp[i - 1][j];
            } else {
                dp[i][K] |= dp[i - 1][j];
            }
        }
    }
    /*
    for(int i = 0; i < N; i++){
        for(int j = 0; j <= K; j++){
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
    */
    for(int i = K - a[ind]; i < K; i++){
        if(dp[N - 1][i]){
            return true;
        }
    }
    return false;
}

int main(){ 
    int N;
    int K;
    cin >> N >> K;
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    
    sort(a, a + N);
    if(!is_needed(N - 1, K, N)){
        cout << N << endl;
        return 0;
    }
    if(is_needed(0, K, N)){
        cout << 0 << endl;
        return 0;
    }
    
    int left = 0;
    int right = N - 1;
    while(left + 1 < right){
        int mid = (left + right) / 2;
        //cout << mid << " " << is_needed(mid, K, N) << endl;
        if(is_needed(mid, K, N)){
            right = mid;
        } else {
            left = mid;
        }
    }
    cout << right << endl;
    return 0;
}


Measured memory_bytes: 48768
import java.util.*;
import java.util.function.*;
 
public class Main {
  public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		char[][] S = new char[H][];
		for (int i = 0; i < H; i++) S[i] = sc.next().toCharArray();
		sc.close();

		int ans = 0;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (S[i][j] == '#') continue;

				int[][] d = new int[H][W];
				int sy = i;
				int sx = j;
				int[] empty = new int[0];
				BiFunction<int[], int[], int[]> set = (dist, dirc) -> {
					int y = dist[0];
					int x = dist[1];
					int dx = x + dirc[0];
					int dy = y + dirc[1];
					if (sy == dy && sx == dx) return empty;
					if (dy < 0 || dx < 0 || H <= dy || W <= dx) return empty;
					if (S[dy][dx] != '.' || d[dy][dx] != 0) return empty;
					d[dy][dx] = d[y][x] + 1;
					return new int[] {dy, dx};
				};

				Queue<int[]> queue = new ArrayDeque<>();
				queue.add(new int[]{i, j});
				while (0 < queue.size()) {
					int[] p = queue.poll();
					if (p.length == 0) continue;
					queue.add(set.apply(p, new int[] {-1, 0}));
					queue.add(set.apply(p, new int[] {1, 0}));
					queue.add(set.apply(p, new int[] {0, -1}));
					queue.add(set.apply(p, new int[] {0, 1}));
				}

				int max = 0;
				for (int di = 0; di < H; di++)
					for (int dj = 0; dj < W; dj++)
						max = Math.max(max, d[di][dj]);
				ans = Math.max(ans, max);
			}
		}
		System.out.println(ans);
  }
}

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


int main() {
    int n;
    cin >> n;
    vector<int> a(n+1,0);
    rep(i,n)cin >> a.at(i+1);
    int ans = 0;
    for(int i = 1;i<=n;i++){
        if(a.at(a.at(i)) == i)ans++;
    }
    cout << ans/2 << endl;
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 640
N, M = map(int, input().split())
visited = [False for i in range(N)]
matrix = [[False for i in range(N)] for j in range(N)]
a = []
b = []
def dfs(v):
    visited[v] = True
    for v2 in range(N):
        if matrix[v][v2] == False:
            continue
        if visited[v2] == True:
            continue
        dfs(v2)
for i in range(M):
    _a, _b = map(int, input().split())
    a.append(_a - 1)
    b.append(_b - 1)
    matrix[a[i]][b[i]] = True
    matrix[b[i]][a[i]] = True
ans = 0
for i in range(M):
    matrix[a[i]][b[i]] = False
    matrix[b[i]][a[i]] = False

    visited = [False for i in range(N)]
    dfs(0)

    bridge = False
    for j in range(N):
        if(visited[j] == False):
            bridge = True
    if(bridge):
        ans += 1
    matrix[a[i]][b[i]] = True
    matrix[b[i]][a[i]] = True

print(ans)


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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    
    if(a > b) swap(a,b);
    if(b > c) swap(b,c);
    if(a > b) swap(a,b);
    
    cout<<a<<" "<<b<<" "<<c<<endl;
    
    return 0;
    
}


Measured memory_bytes: 3084
#include <iostream>

using namespace std;

int main(){
    int N;
    cin >> N;
    int sum = 0, max_value = 0;

    for(int i = 0; i < N; i++){
        int X;
        cin >> X;
        sum += X;
        max_value = max(max_value, X);
    }

    max_value /= 2;

    cout << sum - max_value << endl;
    return 0;
}


Measured memory_bytes: 256
n,x,y=map(int,input().split())
#a<b
def dis(a,b):
    return min (b-a,abs(a-x)+1+abs(b-y))

# for k in range(1,n):
#   count=0
#   #i<j
#   for i in range(1,n):
#     for j in range(i+1,n+1):
#       if dis(i,j)==k:
#         count+=1
#   print(count)
ans=[0]*(n-1)
#i<j
for i in range(1,n):
  for j in range(i+1,n+1):
    ans[dis(i,j)-1]+=1
#print(*ans,sep="\n")
print("\n".join(map(str,ans)))

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		//???????????°
		int turns = Integer.parseInt(scan.nextLine());
		//?????¬??????????????????
		int player1 = 0;
		int player2 = 0;
		
		int jad;
		String str = scan.nextLine();
		String[] answer = str.split(" ");
		for (int i = 0; i < turns; i++) {
			jad = answer[0].compareTo(answer[1]);
			if(jad > 0){
				player1 += 3;
			}else if(jad < 0){
				player2 += 3;
			}else{
				player1++;
				player2++;
			}
			if(!(i == (turns - 1))){
				str = scan.nextLine();
				answer = str.split(" ");
			}
		}
		
		System.out.println(player1 + " " + player2);
		
	}

	
}

Measured memory_bytes: 25300
n = int(input())

if n == 0:
    print(0)
    
else:
    a = []
    while n != 0:
        if n%2 == 0:
            a.append(0)
        else:
            a.append(1)
            n -= 1
        n//=(-2)
    
    print(''.join(map(str, a[::-1])))

Measured memory_bytes: 3060
import java.util.*;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int m, max, min;
		while(true){
			m = sc.nextInt();
			min = sc.nextInt();
			max = sc.nextInt();
			sc.nextLine();
			if(m == 0) break;

			int[] array = new int[m];
			for(int i = 0; i < m; i++){
				array[i] = sc.nextInt();
			}
			sc.nextLine();
			
			int dif, gap=0, pos=0;
			for(int i = min - 1; i < max; i++){
				dif = array[i] - array[i+1];
				if(gap <= dif){
					gap = dif;
					pos=i;
				}
			}
			System.out.println(pos+1);
		}
	}
}

Measured memory_bytes: 65220
#include <bits/stdc++.h>
using namespace std;
#define ll              long long
#define pb              push_back
#define mp              make_pair
#define ff              first
#define ss              second
#define SQ(x)           ((x)*(x))
#define LCM(x,y)        (((x)/gcd((x),(y)))*(y))
#define PI              acos(-1)
#define SZ(x)           x.size() - 1
#define waa             printf("Ripon\n")
#define mem(a,b)        memset(a,b,sizeof(a))
#define rep(i,a,n)      for(int i=(int)(a);i<=(int)(n);i++)
#define per(i,n,a)      for(int i=(int)(n);i>=(int)(a);i--)
#define all(v)          v.begin(), v.end()
#define allr(v)         v.rbegin(), v.rend()
int dx[] = { 0, 1, 0, -1, -1, 1, 1, -1 };
int dy[] = { 1, 0, -1, 0, -1, -1, 1, 1 };
int kx[] = { -2, -2, -1, 1, 2, 2, 1, -1 };
int ky[] = { -1, 1, 2, 2, 1, -1, -2, -2 };
int overlap(int rs,int re,int qs,int qe){ if(rs>qe or re<qs) return 0; else if(qs<=rs and re<=qe) return 1; else return 2;} // 0 no, 1 total, 2 partial
void pvec(auto v){for(auto x:v){cout<<x<<" ";}cout<<'\n';}
//*************useless stuff*************//
#define TC 0
#define mod 10000007
#define N 1000000

void solve(int T) {
    int n;
    int m;
    cin>>n>>m;
    ll sum = 0;
    vector<int> v;
    rep(i,1,n){
        int x;
        cin>>x;
        v.pb(x);
        sum+=x;
    }
    int cnt = 0;
    double th = (1.0/(4*m))*sum;

    for(int x:v){
        double val = x * 1.0;
        if(val>=th) cnt++;
    }
    cout<<(cnt>=m?"Yes":"No")<<endl;

    return;
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(nullptr);
    #ifdef LOCALDEF
        freopen("input.txt","r",stdin);
    #endif
    int T=1;
    if(TC) cin>>T;
    for(int t=1;t<=T;t++)   solve(t);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int m=sc.nextInt();
    int x=sc.nextInt();
    int[] c=new int[n]; 
    int[][] a=new int [n][m]; 
    for(int i=0;i<n;i++){
      c[i]=sc.nextInt();
      for(int j=0;j<m;j++){
        a[i][j]=sc.nextInt();
      }
    }
    int[] aExp=new int[m];
    int cSum=0;
    List<Integer> cList=new ArrayList<>();
    boolean masterd=true;
    sc.close();
    
    for(int i=0;i< 1<<n;i++){
      for(int j=0;j<n;j++){
        if((1&i>>j)==1){
          for(int k=0;k<m;k++){
            aExp[k]+=a[j][k];
          }
          cSum+=c[j];
        }
      }
      for(int k=0;k<m;k++){
        if(aExp[k]<x){
          masterd=false;
          break;
        }
      }
      if(masterd) cList.add(cSum);
      for(int k=0;k<m;k++) aExp[k]=0;
      cSum=0;
      masterd=true;
    }
    int cMin=Integer.MAX_VALUE;
    if(cList.isEmpty()){
      cMin=-1;
    }
    else{
      for(int z:cList){
        if(cMin>z) cMin=z;
      }
    }
    System.out.println(cMin);
  }
}

Measured memory_bytes: 37988
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
// Begin Template IO/Utility
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
void dbg_out(){
	cerr<<endl;
}
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){
	cerr<<' '<< H; 
	dbg_out(T...);
}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &V){
	for(int i=0;i<(int)V.size();i++)
		os<<V[i]<<" ";
	return os;
}
template<typename T> istream& operator>>(istream &is, vector<T> &V){
	for(T &x:V)
		is>>x;
	return is;
}
template<typename T, typename U> ostream& operator<<(ostream &os, const pair<T,U> &p){
	os<<'{'<<p.first<<','<<p.second<<'}';
	return os;
}
template<typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){
	is>>p.first>>p.second;
	return is;
}
// End Template IO/Utility
int solve(){
	int n;
	cin>>n;
	vector<int> v(n), ans(n);
	cin>>v;
	for(int i=0;i<31;i++){
		int all=0;
		vector<int> cnt(n);
		for(int j=0;j<n;j++)
			if(v[j]&(1<<i)){
				all++;
				cnt[j]--;
			}
		for(int j=0;j<n;j++)
			if((cnt[j]+all)%2)
				ans[j]+=(1<<i);
	}
	cout<<ans;
	return 0;
}
int main(){
	cin.tie(0),cin.sync_with_stdio(0),cout.tie(0),cout.sync_with_stdio(0);
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
}


Measured memory_bytes: 5788
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X = sc.nextInt() - 1;
		int Y = sc.nextInt() - 1;
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		for(int k = 1; k < N; k++) {
			map.put(k, 0);
		}
		for(int i = 0; i < N; i++) {
			for(int j = i + 1; j < N; j++) {
				int temp = Math.min(j - i, Math.abs(j - Y) + Math.abs(i - X) + 1);
				if(map.containsKey(temp)){
					map.put(temp, map.get(temp) + 1);
				}
			}
		}
		for(int k = 1; k < N; k++) {
			System.out.println(map.get(k));
		}
	}
}


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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N;
int T[111];

int M;

signed main(){
    cin>>N;
    rep(i,N)cin>>T[i];

    int sum=accumulate(T,T+N,0ll);
    cin>>M;
    rep(i,M){
        int p,x;
        cin>>p>>x;
        cout<<sum-T[p-1]+x<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

const int MOD = 998244353, S = 3005;

int dp[S][S][2], a[S];

inline int add(int x, int y){
	int res = x + y;	
	while(res >= MOD)res-=MOD;
	return res;
}

inline int mul(int x,int y){
	return (1LL * x * y) % MOD;
}

int modpow(int x,int p){
	int res = 1;
	while(p){
		if(p&1)gmul(res,x);
		gmul(x,x);
		p/=2;
	}
	return res;
}

inline int invert(int x){
	return modpow(x,MOD - 2);
}


int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int n,s;
	cin >> n >> s;
	rep(i,0,n)cin >> a[i];
	rep(i,0,n){
		// forward
		rep(j,0,s+1){
			gadd(dp[i+1][j][0],add(dp[i][j][0], j == 0));
			gadd(dp[i+1][j][1],add(add(dp[i][j][0], j == 0), dp[i][j][1]));
			if(j + a[i] <= s){ // in
				gadd(dp[i+1][j+a[i]][0],add(dp[i][j][0], j == 0));
				gadd(dp[i+1][j+a[i]][1],add(dp[i][j][0], j == 0));
			}
		}
	}
	cout << dp[n][s][1] << '\n';
}


Measured memory_bytes: 70656
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j;
    int cnt =0;
    int ans =0;
    int n;
    cin >> n;
    for(i=3;i<=n;i=i+2)
    {
    int tmp = i;
        for(j=1;j<=tmp;j=j+2)
        {
        if(tmp % j == 0)
            {
            cnt++;
            }
        
            if(cnt == 8)
            {
            ans++;
            cnt = 0;
            break;
            }
        
        }
    cnt = 0;
    }
cout << ans << endl;
return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <valarray>
#include <string>
#include <algorithm>
#include <set>
#include <cstdio>
typedef unsigned long long ull;
typedef long long ll;
#define fst first
#define snd second
#define rep(i,n) for(ull i = 0;i<(n);i++)
#define rep1(i,n) for(ull i = 1;i<=(n);i++)
#define revrep(i,n) for(ull i = (n-1);i>=0;i--)
#define all(n) (n).begin(),(n).end()
#define show(x) cout << "debug " << #x << ":" << x << endl;
#define showvec(x) cout << endl << "debug " << #x << ";" << endl; \
    for(ull __i = 0;__i < x.size();__i++){ \
        for(ull __j = 0;__j<x[0].size();__j++){ \
            cout << x[__i][__j] << " "; \
        } \
        cout << endl; \
    } \
    cout << endl;
using namespace std;

int f(int x){
	return x*x;
}

int main(){
	int d;
	while(~scanf("%d\n",&d)){
		ll sum = 0;
		for(int x = d;x <= 600 - d; x += d){
			sum += d * f(x);
		}
		cout << sum << endl;
	}
}

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

int main(){
  long long N;cin>>N;
  long long M=7;
  long long x=7;
  long long ans=0;
  while(ans<=1000000){
    x %= N;
    ans++;
    if(x ==0)  break;
    M *= 10;
    M %= N;
    x += M;
  }
  if(ans==1000001) cout<<-1<<endl;
  else  cout<<ans<<endl;
}
  

Measured memory_bytes: 3616
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n,k = map(int,input().split())
for i in range(k,n+2):
  ans += (n+n-i+1)*i//2 - i*(i-1)//2 + 1
  ans %= mod
print(ans) 


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

using namespace std;

typedef long long ll;

int main()
{
    ll n, a, b, mn, mx;
    cin >> n >> a >> b;
    if(a > b)
    {
        cout << 0 << endl;
        return 0;
    }
    if(n == 1 && a != b)
    {
        cout << 0 << endl;
        return 0;
    }
    mn = mx = a + b;
    mn += (n - 2) * a;
    mx += (n - 2) * b;
    cout << mx - mn + 1 << endl;
    //system("pause");
    return 0;
}

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

const int x[4]={0,0,1,-1};
const int y[4]={1,-1,0,0};
int main() {
   int H,W;
   cin >> H >> W;
   int Ch,Cw,Dh,Dw;
   cin >> Ch >> Cw >> Dh >> Dw;
   string S[H];
   for (int i=0; i<H; i++) cin >> S[i];
   vector<vector<int>> C(H,vector<int>(W));
   for (int i=0; i<H; i++) {
       for (int j=0; j<W; j++) C[i][j]=-1;
   }
   C[Ch-1][Cw-1]=0;
   queue<pair<int,int>> q;
   q.push({Ch-1,Cw-1});
   int count=0;
   while(!q.empty()) {
       queue<pair<int,int>> pq;
       while(!q.empty()) {
       pair<int,int> p=q.front();
       q.pop();
       pq.push(p);
       queue<pair<int,int>> qq;
       qq.push(p);
       while(!qq.empty()) {
           pair<int,int> pp=qq.front();
           qq.pop();
           for (int i=0; i<4; i++) {
               int xx=pp.first+x[i],yy=pp.second+y[i];
               if (xx<0 || yy<0 || xx>=H || yy>=W) continue;
               if (C[xx][yy]!=-1) continue;
               if (S[xx][yy]=='#') continue;
               C[xx][yy]=C[p.first][p.second];
               qq.push({xx,yy});
               pq.push({xx,yy});
           }
       }
       }
       /*for (int i=0; i<H; i++) {
           for (int j=0; j<W; j++) {
               if (C[i][j]!=count) continue;*/
               while(!pq.empty()) {
                   int i=pq.front().first;
                   int j=pq.front().second;
                   pq.pop();
               for (int k=-2; k<3; k++) {
                   for (int l=-2; l<3; l++) {
                       if (i+k<0 || j+l<0 || i+k>=H || j+l>=W) continue;
                       if (C[i+k][j+l]!=-1) continue;
                       if (S[i+k][j+l]=='#') continue;
                       C[i+k][j+l]=C[i][j]+1;
                       q.push({i+k,j+l});
                   }
               }
               }/*
           }
       }
       count++;*/
   }
   /*for (int i=0; i<H; i++) {
       for (int j=0; j<W; j++) {
           cout << C[i][j] << " ";
       }
       cout << endl;
   }*/
   cout << C[Dh-1][Dw-1] << endl;
}

Measured memory_bytes: 9456
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }

  vector<int>left(N,0);
  vector<int>right(N,0);
  for(int i=1;i<N;i++)left[i]=max(left[i-1],A[i-1]);
  for(int i=N-2;i>=0;i--)right[i]=max(right[i+1],A[i+1]);
  for(int i=0;i<N;i++){
    cout<<max(left[i],right[i])<<endl;
  }
}

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

  const int MOD = 1000000007;
  const double PI = acos(-1); 

  //long long
  using ll = long long;

  //出力系
  #define print(x) cout << x << endl
  #define yes cout << "Yes" << endl
  #define YES cout << "YES" << endl
  #define no cout << "No" << endl
  #define NO cout << "NO" << endl
  
  // begin() end()
  #define all(x) (x).begin(),(x).end()

  //for
  #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

  //最大公約数（ll）
  ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

  //素因数分解
  vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
      if(n % i) continue;
      res.emplace_back(i, 0);
      while(n % i == 0){
        n /= i;
        res.back().second++;
      }
    }
  if(n != 1) res.emplace_back(n, 1);
  return res;
  }



// // 二分探索(最小値を出す問題は疑う)
// bool C(ll x){
//     ll res = 0;
//     for(int i = 0; i < N; ++i){
// 		res += max(0ll, A[i]-x/F[i]);
//     }
//     return res <= K;
// }

//   ll binary_search(ll ok, ll ng){
//     while(abs(ok - ng) > 1){
//       ll mid = (ok + ng) / 2;
//       if(C(mid)) ok = mid;
//       else ng = mid;
//     }
//     return ok;
//   }

int main(){
int Q, H, S, D;
cin >> Q >> H >> S >> D;

if(Q * 4 < S) S = Q * 4;
if(H * 2 < S) S = H * 2;

if(Q * 8 < D) D = Q * 8;
if(H * 4 < D) D = H * 4;
if(S * 2 < D) D = S * 2;

ll N;
cin >> N;
ll ans = 0;
ans += D * (N / 2);
if(N % 2 == 1) ans += S;
print(ans);
}

Measured memory_bytes: 256
// -----------------------------------
// Author     : MatsuTaku
// Country    : Japan
// Created    : 04/22/20 21:00:03
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n; cin>>n;
  cout << n/3 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#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 ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    VI l(n * 2);
    REP(i, n * 2) cin >> l[i];
    sort(ALL(l), greater<int>());
    int ans = 0;
    for(int i = 0; i < 2 * n - 1; i +=2)    
        ans += min(l[i], l[i + 1]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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


int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A,B,C;
    cin>>A>>B>>C;
    if(A==B&&B==C){
        if(A%2==0) cout<<-1;
        else cout<<0;
        return 0;
    }
    int cnt=0;
    while(A%2==0&&B%2==0&&C%2==0){
        ll tmpA=A,tmpB=B,tmpC=C;
        A = (tmpB+tmpC)/2;
        B = (tmpA+tmpC)/2;
        C = (tmpA+tmpB)/2;
        cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		long n = sc.nextLong();

		int max = cnt(n);

		for (int i = 1; true; i++) {
			long tmp = n + 1;
			for (int j = 0; j < i; j++) {
				tmp /= 10;
			}
			tmp -= 1;
			if (tmp < 0) {
				break;
			}
			for (int j = 0; j < i; j++) {
				tmp *= 10;
				tmp += 9;
			}

			max = Math.max(max, cnt(tmp));
		}

		pr.println(max);
	}

	private static int cnt(long n) {
		int cnt = 0;
		long tmp = n;
		while (tmp > 0) {
			cnt += tmp % 10;
			tmp /= 10;
		}

		return cnt;
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 21716
mx,my;pn[7];px[7][1000],py[7][1000];M[5][7][1000];a0;Calc(a1,a2){int n1,n2,m,mm;for(n2=0;n2<pn[a2];n2++){mm=1e9;for(n1=0;n1<pn[a1];n1++){m=M[a0][a1][n1]+abs(px[a1][n1]-px[a2][n2])+abs(py[a1][n1]-py[a2][n2]);if(m<mm)mm=m;}M[a0][a2][n2]=mm;}}main(){int x,y,c,a,am;for(;scanf("%d%d\n",&mx,&my),mx;){memset(pn,0,sizeof(pn));for(y=0;y<my;y++){for(x=0;x<=mx;x++){c=getchar();if(c>='1'){if(c<='5')a=c-'0';else if(c=='S')a=0;else if(c=='G')a=6;px[a][pn[a]]=x;py[a][pn[a]++]=y;}}}am=0;for(a0=0;a0<5;a0++){M[a0][0][0]=0;Calc(0,1+(a0+1)%5);for(a=0;a<3;a++)Calc(1+(a0+a+1)%5,1+(a0+a+2)%5);Calc(1+(a0+4)%5,6);if(M[a0][6][0]<M[am][6][0])am=a0;}printf(M[am][6][0]!=1e9?"%d %d\n":"NA\n",1+am,M[am][6][0]);}{int n;for(n=300000;n--;)getchar();}exit(0);}

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

using namespace std;

using ll = long long;

int main(){
  string s;
  cin >> s;
  ll sum = 0;
  for(char c : s){
    sum += (c - '0');
  }
  puts((sum % 9 == 0) ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 3720
def solve(string):
    k, n, *a = map(int, string.split())
    b = [a[-1]] + [_a + k for _a in a]
    return str(min(a1 - a0 for a0, a1 in zip(a, b)))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


Measured memory_bytes: 26132
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <numeric>


const int mod = 1000000007;

	std::pair<int, int> t[200000];
int main() {
	int N;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d %d", &t[i].second, &t[i].first);
	}
	std::sort(t, t + N);
	bool ok = true;
	long long time = 0;
	for (int i = 0; i < N; i++) {
		time += t[i].second;
		if (time > t[i].first) {
			ok = false;
			break;
		}
	}
	printf("%s", ok ? "Yes" : "No");
}





Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
vector<ll>edge[(ll)1e5+10];
int main(void){
    ll n,m;
    cin>>n>>m;
    ll h[n];
    rep(0,i,n)cin>>h[i];
    rep(0,i,m){
        ll a,b;
        cin>>a>>b;
        --a,--b;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    ll ans=0;
    rep(0,i,n){
        bool t=true;
        for(ll j:edge[i]){
            if(h[j]>=h[i])t=false;
            //cout<<h[j]<<" "<<h[i]<<endl;
        }
        if(t)++ans;
        //cout<<ans<<endl;
    }
    cout<<ans;
}

Measured memory_bytes: 10260
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

A = int(input())
B = int(input())
if A>B:
    print('GREATER')
elif A<B:
    print('LESS')
else:
    print('EQUAL')

Measured memory_bytes: 61944
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    if(a+b>=10){
        puts("error");
    }else{
        cout<<a+b<<endl;
    }
    
 
return 0;
}


Measured memory_bytes: 256
fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let n: u32 = s.trim().parse().unwrap();
    let v = (n + 1) / 2;
    let ans: f64 = v as f64 / n as f64;
    println!("{:.7}", ans);
}

fn main() {
    run();
}

Measured memory_bytes: 4352
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

struct UnionFind{
    v: Vec<usize>
}

impl UnionFind{
    fn new(n: usize) -> UnionFind{
        let mut v: Vec<usize> = Vec::new();
        for i in 0..n{
         v.push(i);
        }
        UnionFind{v:v}
    }

    fn find(&mut self, i: usize) -> usize{
        if self.v[i] == i{
            i
        }else{
            let ni = self.v[i];
            self.v[i] = self.find(ni);
            self.v[i]
        }
    }

    fn union(&mut self, i: usize, j: usize){
        let root_i = self.find(i);
        let root_j = self.find(j);
        self.v[root_i] = root_j;
    }
    
}

struct CombMod{
    fac: Vec<u64>,
    inv: Vec<u64>,
    finv: Vec<u64>,
    mmod: u64,
}

impl CombMod{
    pub fn new(max: u64, m: u64) -> CombMod{
        let max: usize = max as usize;
        let mut fac: Vec<u64> = vec![0;max+1];
        let mut finv: Vec<u64> = vec![0;max+1];
        let mut inv: Vec<u64> = vec![0;max+1];

        fac[0] = 1;
        fac[1] = 1;
        finv[0] = 1;
        finv[1] = 1;
        inv[1] = 1;

        for i in 2..max+1{
            fac[i] = fac[i-1] * i as u64 % m;
            inv[i] = m - inv[m as usize %i] * (m/(i as u64)) % m;
            finv[i] = finv[i-1] * inv[i] % m;
        }
        
        CombMod{
            fac: fac,
            finv: finv,
            inv: inv,
            mmod: m,
        }
    }

    fn get(&self, n: u64, m: u64) -> u64{
        assert!(n >= m && n != 0 && m != 0);
        self.fac[n as usize] * self.finv[m as usize] % self.mmod
            * self.finv[(n-m) as usize] % self.mmod
    }
}

fn main(){
    let n: usize = read_as_vec()[0];
    
    let line = read_as_string();

    let s = line.chars().collect::<Vec<char>>();

    let k: usize = read_as_vec()[0];

    let target = s[k-1];

    for c in s{
        if c == target{
            print!("{}", c);
        }else{
            print!("*");
        }
    }
    println!("");
}

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

#define ll long long

#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define fill(a,b) memset(a,b,sizeof(a))

#define f first
#define s second
#define pb push_back

#define inf 1e17
#define ninf -1*1e17
#define mod 1000000007
#define N 500005
#define Ns 5005

string s;
ll n,m,o,x,y,z,d,k,l,r;
unsigned long long power(unsigned long long x,
                        int y, int p)
{
   unsigned long long res = 1; // Initialize result
    x = x % p; // Update x if it is more than or
   // equal to p
    while (y > 0) {
       // If y is odd, multiply x with result
       if (y & 1)
           res = (res * x) % p;
        // y must be even now
       y = y >> 1; // y = y/2
       x = (x * x) % p;
   }
   return res;
}


int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
	int t=1;
	//cin>>t;
	while(t--){
	    
	    ll ans=0;
	    cin>>n;
	    if(n<2){
	        ans=0;
	    }
	    else
	    {
	        ans=(power(10,n,mod) - 2*power(9,n,mod)+ power(8,n,mod)+ 2*mod)%mod;
	    }
	   
	    cout<<ans<<"\n";
	    
	    
	}
	return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
#include <cassert>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1e9)
#define LINF (long long int)(1e18)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}

int main(void){
  fast_io
  cout<<fixed<<setprecision(15);

  ll a,b;cin>>a>>b;cout<<a*b<<endl;
  return 0;
}

Measured memory_bytes: 3652
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

long long int INF = 1e18;
using namespace std;

int H_left[30000], H_right[30000], H_w[30000];
int H1[30000], H2[30000];

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

int main(){
	
	string str;
	cin >> str;
	
	int N = str.size();
	
	int H_max = 0;
	int H_cur = 0;
	H_left[0] = 0;
	H1[0] = 0;
	for(int i = 0; i < N; i++){
		if(str[i] == '/'){
			H_cur++;
		}
		if(str[i] == '\\'){
			H_cur--;
		}
		H_max = max(H_max, H_cur);
		H_left[i + 1] = H_max;
		H1[i + 1] = H_cur;
	}
	
	H_max = H_cur;
	H_right[N] = H_cur;
	H2[N] = H_cur;
	for(int i = N - 1; i >= 0; i--){
		if(str[i] == '/'){
			H_cur--;
		}
		if(str[i] == '\\'){
			H_cur++;
		}
		H_max = max(H_max, H_cur);
		H_right[i] = H_max;
		H2[i] = H_cur;
	}
	
	
	for(int i = 0; i <= N; i++){
		H_w[i] = min(H_left[i], H_right[i]);
		//cout << H_w[i] << " ";
	}
	//cout << endl;
	
	/*
	for(int i = 0; i <= N; i++){
		cout << H1[i] << " ";
	}
	cout << endl;
	*/
	
	vector<long long int> v;
	double S = 0;
	long long int SS = 0;
	for(int i = 0; i <= N; i++){
		if(H_w[i] == H1[i]){
			v.push_back(S);
			SS += S;
			S = 0;
		}
		S += (double)(H_w[i] - H1[i] + H_w[i + 1] - H1[i + 1]) / 2.0;
		//cout << S << " ";
	}
	
	vector<long long int> v_ans;
	for(int i = 0; i < v.size(); i++){
		if(v[i] > 0){
			v_ans.push_back(v[i]);
		}
	}
	
	cout << SS << endl;
	
	if(v_ans.size() == 0){
		cout << 0 << endl;
		return 0;
	}
	cout << v_ans.size() << " ";
	
	for(int i = 0; i < v_ans.size() - 1; i++){
		cout << v_ans[i] << " ";
	}
	cout << v_ans[v_ans.size() - 1] << endl;
	
	return 0;
}


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

vector<vector<int>> g;
vector<vector<int>> gw;
vector<int> gc;

int f(int x, int c, int o = -1){
	gc.at(x) = c;
	rep(i, g.at(x).size()){
		if(g.at(x).at(i) == o) continue;
		if(gw.at(x).at(i)%2 == 0){
			f(g.at(x).at(i), c, x);
		}else{
			f(g.at(x).at(i), (c+1)%2, x);
		}
	}
	return 0;
}

int main(){
	int n;
	cin >> n;
	g = vector<vector<int>>(n, vector<int>(0));
	gw = vector<vector<int>>(n, vector<int>(0));
	gc = vector<int>(n);
	rep(i, n-1){
		int a, b, w;
		cin >> a >> b >> w;
		a--; b--;
		g.at(a).push_back(b);
		g.at(b).push_back(a);
		gw.at(a).push_back(w);
		gw.at(b).push_back(w);
	}
	rep(i, n) gc.at(i) = -1;
	f(0, 0);
	rep(i, n){
		cout << gc.at(i) << endl;
	}
	return 0;
}

Measured memory_bytes: 14848
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 100100100100;


ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int keta(ll num){
    int digits = 0;
    while(num > 0){
        num /= 10;
        digits++;
    }
    return digits;
}


int main(){
    int N, M;
    cin >> N >> M;
    vector<ll> a(N);
    vector<ll> sumA(N);
    rep(i, N) cin >> a[i];
    sort(all(a));
    
    vector<pair<ll, ll>> p(M);
    rep(i, M){
        ll B, C;
        cin >> B >> C;
        p[i] = make_pair(C, B);
    }
    sort(all(p));
    ll index = 0;
    for(int i = M - 1; i >= 0; i--){
        if(index == N) break;
        for(int j = 0; j < p[i].second; j++){
            if(index == N) break;
            if(a[index] < p[i].first) a[index] = p[i].first;
            else break;
            index++;
        }
    }
    ll ans = 0;
    rep(i, N) ans += a[i];
    cout << ans << endl;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define endl  "\n"
#define ll long long
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);cout.tie(NULL);
using namespace std;
bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i += 6)
    {
        if ((n % i == 0) || (n % (i + 2) == 0))
            return false;
    }
    return true;
}
int32_t main()
{
	ll x,n;
	cin >> x >> n;
	ll a[n];
	ll mn=INT_MAX;
	ll raj=mn;
	set<ll> s;
	for(ll i=0;i<n;i++)
	{
		cin >> a[i];
		s.insert(a[i]);
	}
	for(ll i=-200;i<=200;i++)
	{
		if(s.find(i)==s.end())
		{
			if(abs(i-x)<mn)
			{
				mn=abs(i-x);
				raj=i;
			}
		}
	}
	
	cout << raj;
		
}


Measured memory_bytes: 3564
#define ll long long int
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define maxx(a,b) std::max(a,b)
#define maxxx(a,b,c) std::max(a,std::max(b,c))
#define minn(a,b) std::min(a,b)
#define minnn(a,b,c) std::min(a,std::min(b,c))
#define pii 3.14159265358979323846

#include <bits/stdc++.h>
using namespace std;

int main()
{  
  string s,t;
  cin>>s>>t;
  int n=s.size();
  ll dif=0;
  forn(i,n)
  {
      if(s[i]!=t[i])dif++;
  }
  cout<<dif<<endl;
    
   return 0;
}





Measured memory_bytes: 3856
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
const ll MOD=1000003;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const vector<pll> dir={{0,1},{1,0},{-1,0},{0,-1},{1,1},{-1,1},{1,-1},{-1,-1}};
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=b-1;i>=a;i--)
#define range(i) (i).begin(),(i).end()
#define rrange(i) (i).rbegin(),(i).rend()
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm (ll a,ll b) {return a*b/gcd(a,b);}
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans%MOD*(b&1?a:1)%MOD;
}
inline constexpr int modf(ll n){
    ll ans=1;
    rep(i,0,n) {ans=ans*(n-i)%MOD;}
    return ans;
}
inline long double median(vector<ll> v){
    ll size=v.size();
    sort(v.begin(),v.end());
    if (size % 2 == 1) return v[(size - 1) / 2];
    else return v[(size / 2) - 1] ;
}
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;}
template<class T,class L>ostream& operator << (ostream& os, pair<T,L>& p){os << p.first << " " << p.second;return os;}

int main(){
  ll n,cnt=0;
  cin>>n;
  vector<ll> p(n);
  rep(i,0,n) cin>>p[i];
  rep(i,1,n-1){
    if(p[i-1]<p[i]&&p[i]<p[i+1]) cnt++;
    if(p[i-1]>p[i]&&p[i]>p[i+1]) cnt++;
  }
  cout<<cnt;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>
#include<utility>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define all(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int inf = (int)1e9;
const ll INF = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };
const long double EPS = 1e-10;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << max({ a, b, c }) - min({ a, b, c }) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int64_t N,D;
int main(){
  cin>>N>>D;
  D=D*D;
  int ans=0;
  for(int i=0;i<N;i++){
  int64_t x,y;cin>>x>>y;
    if(x*x+y*y<=D)
      ans++;
  }cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3632
/*
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
*/
#include <bits/stdc++.h>

#define rep(i,n)  for(int i=0; i<(n); i++)
using ll = long long;
using namespace std;

int main()
{
    int x,a,b;
    cin >> x;
    a = x/500;
    b = (x%500)/5;
    cout << a*1000+b*5;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18

int main() {
    int n ;
    cin >> n ;
    vector<ll> a (100005) ;
    ll tot = 0; 
    rep(i, n){
        int k ; 
        cin >> k ;
        a[k]++ ;
        tot += k ;
    }    
    vector<ll> ans ; 
    int q ;
    cin >> q ;
    rep(i, q){
        ll b, c ;
        cin >> b >> c ;
        ll t = a[b] ;
        tot -= t*b ;
        tot += t*c ;
        ans.push_back(tot) ;
        a[b] = 0 ;
        a[c] += t ;
    }
    int s = ans.size() ;
    rep(i, s){
        cout << ans[i] << endl ;
    }
}


Measured memory_bytes: 5104