akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main()
{
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N), B(N);
  int cnt = 0;
  ll sum = 0;
  for (int i = 0; i < N; i++)
  {
    scanf("%lld", &A[i]);
    if (A[i] < 0)
      cnt++;
    B[i] = abs(A[i]);
    sum += B[i];
  }
  if (cnt % 2 == 0)
    cout << sum << endl;
  else
    cout << sum - 2 * (*min_element(B.begin(), B.end())) << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#define n 10000
#define q 500

int *linearSearch(int, int *, int);

int main(){
  int S[n], T[q], C=0, S_len, T_len, i, j=0, found_flag=0;

  scanf("%d",&S_len);
  for(i = 0; i < S_len; i++) scanf("%d",&S[i]);
  scanf("%d",&T_len);
  for(i = 0; i < T_len; i++) scanf("%d",&T[i]);

  for(i = 0; i < T_len; i++){
    if( linearSearch(S_len,S,T[i]) ){
      C++;
      found_flag = 1;
    }
  }

  if( found_flag == 0 ) printf("0\n");
  else printf("%d\n",C);
  
  return 0;
}

int *linearSearch(int len, int *X, int key){
  int i;

  for(i = 0; i < len; i++){
    if( X[i] == key ) return &X[i];
  }
  return NULL;
}



Measured memory_bytes: 2108
#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 

int32_t main()
{
    IOS;
    int n, m, d;
    cin>>n>>m>>d;
    double factor=1.0;
    if(d!=0)
    	factor=2;
    double ans=((double)factor*(n-d)*(m-1))/(n*n);
    cout<<fixed<<setprecision(12)<<ans;
    return 0;
}   

Measured memory_bytes: 256
A, B, C, D, E, F = map(int, input().split())

ans = []
for ai in range(31):
    for bi in range(31):
        for ci in range(101):
            for di in range(101):
                ab = ai*A*100 + bi*B*100
                cd = ci*C + di*D
                if ab + cd > F:
                    break
                else:
                    if (ab/100) * E >= cd:
                        ans.append([ab + cd, cd])
print(*sorted(ans, key=lambda x: (100*x[1] / x[0] if x[0] else 0))[-1])

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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
int n,p[200005],dp[200005],mx=0;
void solve(){
    cin>>n;
    rep(i,1,n+1){
        cin>>p[i];
    }
    for(int i=n;i>=1;--i){
        dp[p[i]]=1+dp[p[i]+1];
        mx=max(mx,dp[p[i]]);
    }
    cout<<n-mx<<endl;
}

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

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

const ll INF=1000000000000000000;

signed main(){
    int n,x=0;
    cin>>n;
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<n;i++){
        if(s[i]=='I') x++;
        else x--;
        chmax(ans,x);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int m, n, d;
int x, y;

void idou(int);

main(){
  int k, p;
  char a;

  while(1){
    scanf("%d %d", &m, &n);
    if(m==0 && n==0) break;
    getchar();
    
    x=y=d=0;

    while(1){
      scanf("%c", &a);
      if(a=='F') p=1;
      else if(a=='B') p=2;
      else if(a=='R') p=3;
      else if(a=='L') p=4;
      else if(a=='S') p=5;

      while(1){
	scanf("%c", &a);
	if(a==' ' || a=='\n') break;
      }
      
      if(p==1 || p==2){
	scanf("%d", &k);
	getchar();
      }
      
      if(p==1) idou(k);
      else if(p==2) idou(-k);
      else if(p==3){
	d++;
	if(d==4) d=0;
      }
      else if(p==4){
	d--;
	if(d==-1) d=3;
      }
      else if(p==5){
	printf("%d %d\n", x+1, y+1);
	break;
      }
    }
  }
  return 0;
}


void idou(int k){


  if(d==0){
    y=y+k;
    if(y>=n) y=n-1;
    if(y<0) y=0;
  }
  else if(d==1){
    x=x+k;
    if(x>=m) x=m-1;
    if(x<0) x=0;
  }
  else if(d==2){
    y=y-k;
    if(y>=n) y=n-1;
    if(y<0) y=0;
  }
  else if(d==3){
    x=x-k;
    if(x>=m) x=m-1;
    if(x<0) x=0;
  }
}

Measured memory_bytes: 0
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N=gets.to_i
a=get_i
b=get_i
add=0
N.times do|i|
    if a[i]>b[i]
        add+=a[i]-b[i]
    end
end
N.times do|i|
  if a[i]<b[i]
      r=(b[i]-a[i])/2
      add-=r
  end
end
if add>0
    puts "No"
else
    puts "Yes"
end

Measured memory_bytes: 15436
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll,ll>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
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; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;
ll c;
vector<pl> g[100100];
ll ans[100100];

void dfs(ll n,ll p){
	if(g[n].size() == 0)return;
	//cout << n <<" " << g[n].size() << endl;
	ll color = p+1;
	color %= c;
	for(auto d:g[n]){
		ans[d.second] = color;
		dfs(d.first,color);
		color++;
		color %= c;
	}
	return;
}

signed main(){
	//cout << fixed << setprecision(10);
	ll n;
	cin >> n;
	rep(i,0,n-1){
		ll a,b; cin >> a >> b;
		--a; --b;
		g[a].push_back(pl(b,i));
	}
	rep(i,0,n){
		ll k = g[i].size();
		if(i != 0)k++;
		chmax(c,k);
	}
	ans[0] = 0;
	dfs(0,0);
	cout << c << endl;
	rep(i,0,n-1)cout << ans[i] + 1 << endl;

	return 0;
}

Measured memory_bytes: 10844
loop do
  n = gets.chomp.to_i;
  
  if n == 0
    break
  end

  f = gets.chomp.split(" ").map(&:to_s)
  
  ans = 0
  # 0:down, 1:up
  pos = 0
  left = 0
  right = 0

  n.times do |i|
    if f[i] == 'lu' || f[i] == 'ld'
      left = 1 - left
    else
      right = 1 - right
    end
    
    if pos == 0 && left == 1 && right == 1
      pos = 1
      ans += 1
    elsif pos == 1 && left == 0 && right == 0
      pos = 0
      ans += 1
    end
  end
  
  puts ans
end

Measured memory_bytes: 6108
N, K = map(int, input().split())
scores = list(map(int, input().split())) # スペース区切りを受け取る場合

# 積の同じ部分は考慮しなくて良い
for i in range(K, N):
    bef = scores[i - K]
    aft = scores[i]

    if aft > bef:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 31604
macro_rules! input {
     (source = $s:expr, $($r:tt)*) => {
         let mut iter = $s.split_whitespace();
         input_inner!{iter, $($r)*}
     };
     ($($r:tt)*) => {
         let s = {
             use std::io::Read;
         let mut s = String::new();
         std::io::stdin().read_to_string(&mut s).unwrap();
         s
     };
     let mut iter = s.split_whitespace();
     input_inner!{iter, $($r)*}
     };
}
     
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
 
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
 
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
 
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
 
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
 
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
 
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{VecDeque, HashMap, BTreeMap, HashSet, BTreeSet};
#[allow(unused_imports)]
use std::io::{stdout, Write, BufWriter};
//#[allow(unused_imports)]
//use proconio::marker::{Isize1, Usize1, Bytes, Chars};
//#[proconio::fastout]
fn main() {
    input!{
        n: usize,
        sp: [(String, i32); n],
    }
    let mut btmap = BTreeMap::new();
    for (i, (s, p)) in sp.into_iter().enumerate() { btmap.entry(s).or_insert(BTreeMap::new()).insert(p, i + 1); }
    for rests in btmap.values() {
        for rest in rests.values().rev() { println!("{}", rest); }
    }
} 


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

int f(int n){
    if(n % 2){
        return n * 3 + 1; 
    }else{
        return n /2;
    }
}

signed main(){
    int s;
    cin >> s;

    map<int,int> mp;
    int ans = 0;
    while(true){
        ans++;
        mp[s] = true;
        s = f(s);
        if(mp[s]){
            cout << ans + 1 << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

using Graph = vector<vector<int>>;
int N;
Graph G;

vector<vector<long long>> dp;
long long rec(int v, int p = -1) {
    int s = G[v].size();
    long long res = 0;
    dp[v].assign(s, -1);
    for (int i = 0; i < s; ++i) {
        int to = G[v][i];
        if (to == p) continue;
        dp[v][i] = rec(to, v);
        chmax(res, dp[v][i] + 1);
    }
    return res;
}

void rerec(int v, long long pval = 0, int p = -1) {
    int s = G[v].size();
    for (int i = 0; i < s; ++i) {
        int to = G[v][i];
        if (to == p) {
            dp[v][i] = pval;
            continue;
        }
    }
    vector<long long> left(s+1, -1), right(s+1, -1);
    for (int i = 0; i < s; ++i) {
        left[i+1] = max(left[i], dp[v][i]);
        right[i+1] = max(right[i], dp[v][s-i-1]);
    }
    for (int i = 0; i < s; ++i) {
        int to = G[v][i];
        if (to == p) continue;
        rerec(to, max(left[i], right[s-i-1]) + 1, v);
    }
}

void solve() {
    dp.assign(N, vector<long long>());
    rec(0);
    rerec(0);
    for (int v = 0; v < N; ++v) {
        long long res = 0;
        for (int i = 0; i < G[v].size(); ++i) {
            chmax(res, dp[v][i] + 1);
        }
        cout << (N-1)*2 - res << endl;
    }
}

int main() {
    cin >> N;
    G.assign(N, vector<int>());
    for (int i = 0; i < N-1; ++i) {
        int u, v; cin >> u >> v; --u, --v;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    solve();
}



Measured memory_bytes: 27868
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main()
{
    int a, b; cin >> a >> b;
    char ac = a + '0';
    char bc = b + '0';
    string as, bs;

    for (int i = 0; i < b; ++i) as.push_back(ac);
    for (int i = 0; i < a; ++i) bs.push_back(bc);

    cout << min(as, bs) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
// AtCoder DP Contest A. Frog 1.

void solve()
{
	int n;
	cin >> n;
	vector<int> h(n);
	for(int &i: h) cin >> i;	
	
	vector<int> dp(n);
	dp[0] = 0;
	dp[1] = abs(h[0] - h[1]);
	for(int i = 2; i < n; i++) {
		dp[i] = min(dp[i - 1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
	}
	cout << dp[n-1];
}

int main()
{
	int t = 1;
	//cin >> t;
	while(t--) {
		solve();
		cout << '\n';
	}
}


Measured memory_bytes: 3976
N, Q = map(int, input().split())
S =input()
length = [list(map(int, input().split())) for _ in range(Q)]
AC_list = [0]*N
count = 0
for i in range(1,N):
  if (S[i-1] + S[i]) == "AC":
    count +=1
  AC_list[i] = count

for l, r in length:
  print(AC_list[r-1] - AC_list[l-1])


Measured memory_bytes: 30688
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

using Weight = int;
struct Edge {
	int s, d; Weight w;
	Edge() {};
	Edge(int s, int d, Weight w) : s(s), d(d), w(w) {};
};
bool operator<(const Edge &e1, const Edge &e2) { return e1.w < e2.w; }
bool operator>(const Edge &e1, const Edge &e2) { return e2 < e1; }
inline ostream &operator<<(ostream &os, const Edge &e) { return (os << '(' << e.s << ", " << e.d << ", " << e.w << ')'); }

using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

void addArc(Graph &g, int s, int d, Weight w = 1) {
	g[s].emplace_back(s, d, w);
}
void addEdge(Graph &g, int a, int b, Weight w = 1) {
	addArc(g, a, b, w);
	addArc(g, b, a, w);
}

auto bfs = [&](const Graph &g, int s, Array &dist) {
	int n = g.size();
	vector<bool> vis(n);
	vector<int> prev(n, -1);
	dist.assign(n, INF); dist[s] = 0;
	using State = tuple<Weight, int, int>;
	queue<State> q;
	q.emplace(0, s, -1);
	while (q.size()) {
		Weight d; int v, p; tie(d, v, p) = q.front(); q.pop();
		vis[v] = true;
		prev[v] = p;
		for (auto &e : g[v]) {
			if (vis[e.d])continue;
			if (dist[e.d] > dist[v] + e.w) {
				dist[e.d] = dist[v] + e.w;
				q.emplace(dist[e.d], e.d, v);
			}
		}
	}
	return prev;
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M; cin >> N >> M;
	Graph g(N);

	vector<int> a(M), b(M); rep(i, 0, M) {
		cin >> a[i] >> b[i];
		a[i]--, b[i]--;
		addEdge(g, a[i], b[i]);
	}
	Array dist;
	bfs(g, 0, dist);
	dump(dist);

	int X = 0, Y = 0;
	rep(i, 0, N) {
		if (dist[i] % 2)
			X++;
		else
			Y++;
	}
	dump(X, Y);
	int ans = X*Y;
	dump(ans);
	rep(i, 0, M) {
		if (dist[a[i]] % 2 != dist[b[i]] % 2) {
			dump(a[i], b[i]);
			ans--;
		}
		else {
			cout << N*(N - 1) / 2 - M << endl;
			return 0;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
  int x,a,b;
  cin >> x >> a >> b;
  if (abs(x - a) < abs(x - b)){
    cout << "A" << endl;
  }else{
    cout << "B" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
struct point
{
	int x,v;
	bool operator<(const point &b)const{return v<b.v;}
	bool operator>(const point &b)const{return x<b.x;}
}p[300001];
int n,l[300001],r[300001],f[300001];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)cin>>p[i].x>>p[i].v;
	sort(p+1,p+1+n,greater<point>());
	for(int i=1;i<=n;i++)p[i].x=i;
	sort(p+1,p+1+n);
	for(int i=1;i<=n;i++)l[p[i].x]=r[p[i].x]=i;
	for(int i=2;i<=n;i++)r[i]=max(r[i],r[i-1]);
	for(int i=n-1;i;i--)l[i]=min(l[i],l[i+1]);
	f[0]=1;
	for(int i=1,j=0,s=f[0];i<=n;i++)
	{
		while(j<l[i]-1)s=(s-f[j++]+mod)%mod;
		f[r[i]]=(f[r[i]]+s)%mod;
		s=s*2%mod;
	}
	cout<<f[n]<<'\n';
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
map<ll, int> M;
int n;
ll ans, a, b;
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) 
	{
		int val;
		scanf("%d", &val);
		++M[val];
	}
	for(auto v : M)
	{
		if(v.second >= 4)
			ans = max(ans, v.first * v.first);
		if(v.second >= 2)
		{
			if(v.first > a)
			{
				b = a;
				a = v.first;
			}
			else if(v.first > b)
				b = v.first;
		}
	}
	ans = max(ans, a * b);
	cout << ans << endl;
	return 0;
}
	

Measured memory_bytes: 10016
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
ll mod=1e9+7;
struct unionfind{
  vector<int> par;
  vector<int> size;
  unionfind(int n):par(n),size(n,1){
    rep(i,n)par.at(i)=i;
  }
  int root(int x){
    if(par[x]==x)return x;
    return root(par[x]);
  }
  void unit(int x,int y){
    x=root(x);
    y=root(y);
    if(x==y)return;
    if(size[par[x]]<size[par[y]])swap(x,y);
    par[y]=x;
    size[x]+=size[y];
  }
  bool find(int x,int y){
    x=root(x);
    y=root(y);
    return x==y;
  }
};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;cin>>n>>m;
    vector<int> p(n);
    rep(i,n)cin>>p[i],p[i]--;
    unionfind uf(n);
    int ans=0;
    rep(i,m){
        int s,t;cin>>s>>t;
        --s;--t;
        uf.unit(s,t);
    }
    rep(i,n){
        if(uf.find(i,p[i]))ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <stdio.h>
#include <vector>
#include <algorithm> // sort
#include <map>
using namespace std;

int main(){
    string s;
    int q;
    cin>>s>>q;

    int t;
    char p,e;
    int f;
    string c;
    int count=0;

    for(int i=0;i<q;i++){
        cin>>t;
        if(t==1){
            count=1-count;
        }else{
            cin>>f>>c;
            if(f-1==count){
                s.insert(0,c);
            }else{
                s+=c;
            }
        }
    }
    if(count==0){
        cout<<s<<endl;
    }else{
        for(int i=0;i<s.size();i++){
            cout<<s.at(s.size()-i-1);
        }
        cout<<endl;
    }
}

Measured memory_bytes: 900
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define CEIL(a,b) (((a) + ((b)-1)) / (b))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	string s;
	cin >> s;
	int ret = 700;
	REP(i,3){
		if(s[i]=='o') ret += 100;
	}
	println(ret);
	return 0;

}


Measured memory_bytes: 384
import numpy as np

n, k = map(int, input().split())
h = np.array(list(map(int, input().split())), np.int64)
INF = 10 ** 18

dp = np.full(n, INF, np.int64)
dp[0] = 0

for i, e in enumerate(h[1:], 1):
    lb = max(0, i - k)
    dp[i] = np.min(dp[lb:i] + np.abs(h[lb:i] - e))

ans = dp[-1]
print(ans)


Measured memory_bytes: 38732
#include <stdio.h>
#include <algorithm>

using namespace std;

int main(){
    
    int n,max_num = -1000001,min_num = 1000001,tmp;
    long long int sum = 0;
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        scanf("%d",&tmp);
        sum += tmp;
        max_num = max(max_num,tmp);
        min_num = min(min_num,tmp);
        
    }
    printf("%d %d %lld\n",min_num,max_num,sum);
}


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

int main(){
  int s;
  int ho, mi, se;
  cin >> s;
  se = s % 60;
  s /= 60;
  mi = s % 60;
  s /= 60;
  ho = s;
  
  cout << ho << ":" << mi << ":" << se << endl;
  return 0;
}



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


int main()
{
	int H,W;
	cin>>H>>W;
	vector<vector<string>> ans(H+2,vector<string>(W+2));
	rep(j,W+2) ans[0][j]="#";
	rep(i,H)
	{
		ans[i+1][0]="#";
		string s;
		cin>>s;
		rep(j,W) ans[i+1][j+1]=s[j];
		ans[i+1][W+1]="#";
	}
	rep(j,W+2) ans[H+1][j]="#";
	rep(i,H+2)
	{
		rep(j,W+2)
		{
			cout<<ans[i][j];
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 768
import copy
H, W, K, = list(map(int, input().split()))
C = [0] * H
for i in range(H):
  C[i] = input()
  C[i] = [1 if(C[i][j] == "#") else 0 for j in range(W)]
h = 2 ** H
w = 2 ** W
ans = 0
for i in range(2 ** H):
  w = 2 ** W
  for j in range(2 ** W):
    D = copy.deepcopy(C)
    for k in range(H):
      for l in range(W):
        if(bin(h)[k + 3] == "1" or bin(w)[l + 3] == "1"):
          D[k][l] = 0
    ans += (sum(map(sum, D)) == K)
    w += 1
  h += 1
print(ans)

Measured memory_bytes: 78752
use std::cmp;
use std::fmt::Debug;
use std::str::FromStr;
#[allow(dead_code)]
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()
}

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

fn main() {
    let n = read_as_string();

    let mut digit_sum: u64 = 0;

    for d in n.chars() {
        digit_sum += d.to_digit(10).unwrap() as u64;
    }

    if digit_sum % 9 == 0 {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long

static const ll MAX = 1000000;
static const ll INFTY = 1e12;
static const ll MOD = 1000000007;

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


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

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const ll INF = 1e18;

int main() {

    int N;
    cin >> N;
    if(N==1){
        cout << "Hello World" << endl;
    }else{
        int A, B;
        cin >> A >> B;
        cout << A+B << endl;
    }
}

/*
みんな、くるくるぱーにな〜れ
　∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/



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

using namespace std;

template <class T> inline bool chmin(T &a, T b) { /* {{{ */
  if (a > b) {
    a = b;
    return true;
  }
  return false;
} /* }}} */

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  for (auto &h : H) {
    cin >> h;
  }
  vector<int> dp(N + 5, 1e9 + 10);
  dp[0] = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 1; j <= K; j++) {
      if (i + j <= N) {
        chmin(dp[i + j], dp[i] + abs(H[i] - H[i + j]));
      }
    }
  }
  cout << dp[N - 1] << endl;

  return 0;
}
/* vim:set fdm=marker: */


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

int main(){
  int N;
  cin>>N;
  vector<int> H(N);
  for(int i=0;i<N;++i){
    cin>>H.at(i);
  }

  int count=0;
  int max=0;
  for(int i=0;i<N-1;++i){
    if(H.at(i)>=H.at(i+1)){
      ++count;
    }
    else{
      if(max<count){
        max=count;
      }
      count=0;
    }
  }
  
  if(max<count){
    max=count;
  }
  
  cout<<max<<endl;
}

Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<double> dvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;

int main(){
    ll n;
    cin>>n;
    lvec a(n);
    rep(i,n) cin>>a[i];
    deque<ll> que;
    bool flag;
    if(n%2==0) flag=true;
    else flag=false;
    rep(i,n){
        if(flag){
            que.push_back(a[i]);
            flag=false;
        }else{
            que.push_front(a[i]);
            flag=true;
        }
    }
    while(!que.empty()){
        cout<<que.front()<<' ';
        que.pop_front();
    }
}

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;



ll solve(ll n, vector<ll> a){
  ll plusmax = (n+1)/2;
  ll minusmin = n/2;

  sort(all(a));

  vector<ll> pluss;
  vector<ll> minuss;
  ll sum = a[n-1] - a[0];
  pluss.push_back(a[n-1]);
  minuss.push_back(a[0]);
  ll idx = 1;
  for(; idx < n-1; idx++){
    if(0 < a[idx]) break;
    sum -= a[idx], minuss.push_back(a[idx]);
  }
  for(; idx < n-1; idx++) sum += a[idx], pluss.push_back(a[idx]);
    
  cout << sum << endl;

  ll l = minuss.back(); minuss.pop_back();
  ll r;
  while(2 <= pluss.size() && minuss.size() < pluss.size()){
    r = pluss.back(); pluss.pop_back();
    cout << l << " " << r << endl;
    l = l - r;
  }
  minuss.push_back(l);

  vector<ll> v;
  while(2 <= pluss.size()){
    v.push_back(pluss.back()), pluss.pop_back();
    v.push_back(minuss.back()), minuss.pop_back();
  }
  v.push_back(pluss.back()), pluss.pop_back();
  ll vn = v.size();
 
  
  r = v[vn-1];
  rep(i, vn-1){
    l = v[vn-1-i-1];
    cout << l << " " << r << endl;
    r = l - r;
  }

  l = r;
  while(!minuss.empty()){
    ll m = minuss.back(); minuss.pop_back();
    cout << l << " " << m << endl;    
    l = l - m;
  }

  return sum;
}

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

  solve(n, a);


  return 0;
}


Measured memory_bytes: 5108
#include <iostream>

using namespace std;

int main()
{
    int i,n,m,sum=0,k=0;
    int a[120]={0};
    cin >> n >> m;
    for(i = 0;i < n;i++)
    {
        cin >> a[i];
        sum += a[i];
    }
    for(i = 0;i < n;i++)
    {
        if(a[i] >= 1.0*sum/(4*m))
            k++;
    }
    if(k >= m)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

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

int main() {
	int n; cin >> n;
	int64_t ans; cin >> ans; --ans;
	int64_t maxi = 1;
	for(int i = 1; i < n; ++i) {
		int64_t a; cin >> a;
		if(a <= maxi + 1) {
			maxi = max(maxi, a);
			cerr << a << " " << ans << '\n';
			continue;
		}
		ans += (a - 1) / (maxi + 1);
	}
	cout << ans << '\n';
	return 0;
}


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

int main() {
	int n, m = 0, nd;
	cin >> n;
	nd = n;
	m += (nd % 10) * 100;
	nd /= 10;
	m += (nd % 10) * 10;
	nd /= 10;
	m += nd;
	cout << (n == m ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  string n;
  cin >> n;
  int sum=0;
  for(int i=0;i<n.size();++i){
    sum+=(n.at(i)-'0');
  }

  if(sum%9==0) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 3712
temp = input().split(" ")

n=int(temp[0])
m=int(temp[1])
Answer=0
ball_list=list()

for i in range(0,n):
    ball_list.append(2)

for i in range(0,m):
    ball_list.append(1)

for i in range(0,n+m):
    for j in range(0,n+m):
        if i < j:
            if (ball_list[i]+ball_list[j])%2==0:
                Answer=Answer+1

print(Answer)


Measured memory_bytes: 3060
/*
ID: rchalam1
LANG: C++14
TASK:
*/
// For train.usaco.org, fill the template above.

// Competitive Coding Template

// GCC OPTIMIAZTION FLAGS
#ifdef ONLINE_JUDGE
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#endif

#include <bits/stdc++.h>

/*
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
*/
// All Includes for Competitive Coding Template

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

using vi = std::vector<int>;
using vll = std::vector<long long>;
using vull = std::vector<unsigned long long>;

#define FOR(i, a, b) for (auto i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (auto i = (a); i >= (b); --i)
#define R0F(i, a) ROF(i, a, 0)
#define ITR(a, x) for (auto& a: x)

#define FSRT(set) sort((set).begin(),(set).end())
#define RSRT(set) sort((set).rbegin(),(set).rend())
#define CSRT(set, function) sort((set).begin(),(set).end(), (function))
#define TRS(set) sort((set).begin(),(set).end(), greater<>())
#define REV(set) reverse((set).begin(),(set).end());

#define ALL(set) (set).begin(), (set).end()

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// For stdio, call setIO() or setIO("").
void setIO(std::ifstream &readFile, std::ofstream &writeFile, const std::string &name = "", bool stdIO = false)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	if(!name.empty() && !stdIO)
	{
		readFile.open(name + ".in");
		if(readFile.fail()) return;
		writeFile.open(name + ".out");
		std::cin.rdbuf(readFile.rdbuf());
		std::cout.rdbuf(writeFile.rdbuf());
	}
}

// To time program, create object Timer  to start timing, and call Timer.elapsed().
#include <chrono>

class Timer
{
	std::chrono::time_point<std::chrono::high_resolution_clock> m_beg;
public:
	Timer() : m_beg(std::chrono::high_resolution_clock::now())
	{}

	void reset()
	{ m_beg = std::chrono::high_resolution_clock::now(); }

	[[nodiscard]] long double elapsed() const
	{
		return std::chrono::duration_cast<std::chrono::duration<long double, std::ratio<1> >>(
				std::chrono::high_resolution_clock::now() - m_beg).count();
	}
};

// Defines datatype
using dt = int;
// Defines MAXN value
constexpr dt MAXN = 1e5 + 1;
// Defines Modulus
constexpr dt MOD = 1e9 + 7;
// Defines Floating Point Correction
constexpr long double EPS = 1e-9;

//*****
//START CODE BELOW
//*****

int main(int argc, char *argv[])
{
	static std::ifstream readFile;
	static std::ofstream writeFile;
	setIO(readFile, writeFile);
	int n;
	cin >> n;
	int sum = 0;
	vector<int> elements(n);
	for(auto &element : elements)
	{
		cin >> element;
		sum += element;
	}
	set<int> answers;
	answers.insert(floor((sum + 0.0) / n));
	answers.insert(ceil((sum + 0.0) / n));
	int answer = 1e9;
	for(auto &possible : answers)
	{
		int total = 0;
		for(auto &element : elements) total += (element - possible) * (element - possible);
		answer = min(answer, total);
	}
	cout << answer << '\n';
}

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

#define FOR(i, a, b)   for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b)  for(int i = (a); i > (b); --i)
#define rep(i, n)      for(int i = 0; i < (n); ++i)
#define all(c)         begin(c), end(c)
#define rall(c)        rbegin(c), rend(c)
#define SZ(a)          ((ll) a.size())

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main() {
  string S;
  cin >> S;
  int len=S.size();
  vi sint(len);
  rep(i,len){
    if(S[i]=='0')sint[i]=0;
    if(S[i]=='1')sint[i]=1;
  }
  vi p1(len);
  vi p2(len);
  rep(i,len){
    if(i%2==0){
      p1[i]=0;
      p2[i]=1;
    }
    else{
      p1[i]=1;
      p2[i]=0;
    }
  }
  int diff1=0;
  int diff2=0;
  rep(i,len){
    if(sint[i]!=p1[i]) diff1++;
    if(sint[i]!=p2[i]) diff2++;
  }
  cout << min(diff1,diff2) << endl;
  return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI                acos(-1)
#define pb                emplace_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define forr(i, b, e)     for(int i = b; i < e; i++)
#define forg(i, b, e, m)  for(int i = b; i < e; i+=m)
#define F first
#define S second

using namespace std;
using namespace __gnu_pbds;

typedef long long       ll;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const int INF = int(1e9 + 7);
#define tam 2200
typedef pair<ii,int> iii;
int main()
{
    std::ios::sync_with_stdio(false); cin.tie(0);
    string txt;
    cin>>txt;
    if ("Sunny"==txt)
        cout<<"Cloudy\n";
    if ("Cloudy"==txt )
        cout<<"Rainy\n";
    if ("Rainy"==txt)
        cout<<"Sunny\n";

}
// PLUS ULTRA!


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <deque>
#include <queue>
#include <iomanip>

using namespace std;
typedef long long ll;

int N;
void dfs(string s, char mx){
    if(s.length()==N){
        cout << s << endl;
    } else {
        for(char c = 'a'; c <= mx; c++){
            if(c==mx) dfs(s+c, (char)(mx+1));
            else dfs(s+c, mx);
        }
    }
}
int main(){    
    cin >> N;
    dfs("", 'a');
    return 0;
}

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

using namespace std;

struct Graph {
    struct Edge {
        int u, v;
        int cost;
        Edge(int _u, int _v, int _cost) : u(_u), v(_v), cost(_cost) {}
    };
    int n, m;
    bool is_digraph;
    vector<vector<int>> g;
    vector<Edge> e;

    Graph(int _n) : n(_n), m(0) {
        assert(n >= 1);
        g.resize(n);
        set_di(false);
    }
    Graph(int _n, int _m, bool _di=false) : n(_n) {
        assert(n >= 1);
        g.resize(n);
        e.reserve(_m);
        m = 0;
        set_di(_di);
        input(_m);
    }
    void set_di(bool _di) {
        is_digraph = _di;
    }
    inline void add(int u, int v, int cost=1) {
        assert(0 <= u && u < n);
        assert(0 <= v && v < n);
        if (is_digraph) {
            //outdeg[u]++; indeg[v]++;
            g[u].emplace_back(m);

        } else {
            //deg[u]++; deg[v]++;
            g[u].emplace_back(m);
            g[v].emplace_back(m);
        }
        e.emplace_back(u, v, cost);
        m++;
    }
    void input(int _m) {
        int u, v, c;
        for (int i = 0; i < _m; i++) {
            cin >> u >> v >> c;
            u--; v--; // input 1-based
            add(u, v, c);
        }
    }
    template <typename T=int>
    vector<T> _01bfs(int s);
};

// work when cost only 0 or c
template <typename T>
vector<T> Graph::_01bfs(int s) {
    const int INF = 0x3f3f3f3f;
    vector<T> d(n, INF);
    d[s] = 0;
    deque<int> q;
    q.push_front(s);
    while (!q.empty()) {
        int u = q.front();
        q.pop_front();
        for (int i: g[u]) {
            int v = e[i].u ^ e[i].v ^ u;
            if (d[v] > d[u] + e[i].cost) {
                d[v] = d[u] + e[i].cost;
                if (e[i].cost)
                    q.push_back(v);
                else
                    q.push_front(v);
            }
        }
    }
    return d;
}

void solve() {
    int n; cin >> n;
    Graph g(n); g.set_di(true);
    for (int i = 0; i < n; i++) {
        g.add(i, (i+1)%n, 1);
        g.add(i, (i*10)%n, 0);
    }
    auto d = g._01bfs<int>(1);
    int res = d[0] + 1;
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 9140
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int n,m,pik[10],a,b,ok,ans,cnt;
vector<int>v[10];
int main(void){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a;
        for(int j=0;j<a;j++){
            cin>>b;
            b--;
            v[i].push_back(b);
        }
    }
    for(int i=0;i<m;i++){
        cin>>pik[i];
    }
    for(int i=0;i<(1<<n);i++){
        ok=1;
        for(int j=0;j<m;j++){
            cnt=0;
            for(int x:v[j]){
                if((i>>x)&1)cnt++;
            }
            if((cnt&1)!=pik[j])ok=0;
        }
        if(ok==1)ans++;
    }
    cout<<ans<<endl;
}


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

int main(){
  int h,w;
  cin >> h >> w;
  vector<vector<char>> vec(h, vector<char>(w));
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      char x;
      cin >> x;
      vec.at(i).at(j)=x;
    }
  }
  vector<vector<int>> num(h, vector<int>(w));
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      int count1=0; 
      int count2=0;
      if(i != 0){
        count1=num.at(i-1).at(j);
        if(vec.at(i).at(j)!=vec.at(i-1).at(j)) count1++;
      }
      else count1=10000;


      if(j!=0) {
        count2=num.at(i).at(j-1);
        if(vec.at(i).at(j)!=vec.at(i).at(j-1)) count2++;
      }
      else count2=10000;

      int x=min(count1,count2);
      if(x==10000) x=0;
      num.at(i).at(j)=x;
    }
  }
  int ans;
  if(vec.at(0).at(0)=='.')ans= (num.at(h-1).at(w-1)+1)/2;
  else ans= (num.at(h-1).at(w-1))/2+1;
  
    cout << ans << endl;
}
      

Measured memory_bytes: 256
from collections import Counter
from operator import mul
n = int(input())
s = input()
c = Counter(s)
if n < 3:
    print(0)
    exit()
elif len(c.keys()) < 3:
    print(0)
    exit()
ans = 0
for i in range(n):
    x = s[i]
    ans += mul(*[v for k, v in c.items()if k != x])
    c[x] -= 1
    for j in range(i+1, n):
        y = s[j]
        if x == y:
            continue
        idx_diff = j-i
        if n <= j+idx_diff:
            continue
        z = s[j+idx_diff]
        if x != z and y != z:
            ans -= 1
print(ans)


Measured memory_bytes: 69256
import sys
s = int(input())
cop = []
cop.append(s)
if s%2 == 0:
	s //= 2
else:
	s = 3*s + 1

for i in range(1,1000):
	if s in cop:
		print(i+1)
		sys.exit()
	else:
		cop.append(s)
		if s%2 == 0:
			s //= 2
		else:
			s = 3*s + 1	

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

# define    ll            long long 
# define    vi             std::vector<ll>
# define    int            long long 
# define    setbits(x)     __builtin_popcountll(x)
# define    zrobits(x)     __builtin_ctzll(x)
# define    fast           ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
# define    pb             push_back
# define    fn             for(int i=0;i<n;i++)
# define    fo(i,a,b)      for(ll i=a;i<b;i++)
# define    all(x)         x.begin(), x.end()
# define    allr(a)        a.rbegin(), a.rend()
# define    PI             3.14159265358979323846
# define    mod            1000000007
# define    endl           "\n"
# define    pii            pair<ll,ll>
# define    deb1(x)        cout<<#x<<" "<<x<<endl;
# define    deb2(x,y)      cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
# define    deb3(x,y,z)    cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
 
void getio()
{
    fast
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}


void solve()
{
	ll n;
	cin>>n;
	ll a=0,b=0,c=0,d=0;
	for(int i=0;i<n;i++)
	{
		string s;
		cin>>s;
		if(s=="AC") a++;
		else if(s=="WA") b++;
		else if(s=="TLE") c++;
		else d++;
	}
	cout<<"AC x "<<a<<endl;
	cout<<"WA x "<<b<<endl;
	cout<<"TLE x "<<c<<endl;
	cout<<"RE x "<<d<<endl;
}



int32_t main()
{
	getio();
    // int t; cin>>t; while(t--)
    solve();
}

Measured memory_bytes: 3672
n,m=map(int,input().split())
ab=[]
for _ in range(m):
  ab.append(tuple(map(int,input().split())))
ab=sorted(ab, key=lambda x: x[1])
lastbridge=0
cnt=0
for i in range(m):
  st=ab[i][0]
  go=ab[i][1]
  if st<=lastbridge<go:
    continue
  else:
    cnt+=1
    lastbridge=go-1
  #print(lastbridge)

print(cnt)
  

Measured memory_bytes: 19004
open System

// prelude
let readStr () = stdin.ReadLine()

let readInt () = stdin.ReadLine() |> int
let readInts () = stdin.ReadLine().Split() |> Array.map int

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

// start
let s=readStr().ToCharArray()

let kaibun =
  let rec inner acc i j =
    if i>=j then acc
    elif s.[i]=s.[j] then inner acc (i+1) (j-1)
    elif s.[i]='x' then inner (acc |> Option.map inc) (i+1) j
    elif s.[j]='x' then inner (acc |> Option.map inc) i (j-1)
    else None
  inner (Some 0) 0 (s.Length-1)
  |> Option.getOr -1

printfn "%d" kaibun

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

int n;
long long x[1010], y[1010], v[1010], w[1010];
vector<long long> d;
int M = 31;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	int c = 0;
	for(int i=0; i<n; ++i){
		cin >> x[i] >> y[i];
		v[i] = x[i] + y[i];
		w[i] = x[i] - y[i];
		c += ((v[i] % 2) + 2) % 2;
	}
	if(c != 0 && c != n){
		cout << -1 << "\n";
		return 0;
	}
	if(c == 0){
		d.push_back(1);
	}
	for(int i=0; i<M; ++i)
		d.push_back((long long)1 << i);
	cout << d.size() << "\n";
	for(int i=0; i<d.size(); ++i)
		cout << d[i] << " \n"[i+1==d.size()];
	for(int i=0; i<n; ++i){
		if(c == 0){
			cout << 'R';
			--v[i]; --w[i];
		}
		long long a = -((long long)1<<M)+1;
		for(int j=0; j<M; ++j){
			// v\w + -
			//  +  R U
			//  -  D L
			int t = 0;
			if((((v[i] - a) / 2) >> j) % 2 == 1) t += 2;
			if((((w[i] - a) / 2) >> j) % 2 == 1) t += 1;
			cout << "LDUR"[t];
		}
		cout << "\n";
	}
}

Measured memory_bytes: 384
N,Q = map(int,input().split())
S = input()
qlist = [map(int,input().split()) for _ in range(Q)]
tarstr = "AC"
dp = []
maxnum = 0
flg = False
for c in S:
    if(c=="A"):
        flg = True
    elif(c=="C" and flg):
        maxnum += 1
        flg = False
    else:
        flg = False
    dp.append(maxnum)

for l,r in qlist:
    print(dp[r-1]-dp[l-1])



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

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)

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

  int in[3];
  REP(i, N) {
    REP(j,3) cin >> in[j];
    sort(in, in+3);
    if (in[2]*in[2]==in[0]*in[0]+in[1]*in[1]) cout << "YES";
    else                                cout << "NO";
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 1168
N = int(input())
i = 1
while i<=7000:
    if N/i >= 4:
        i += 100
        continue
    if i >100:
        i -= 100
    for x in range(i,3501):
        for y in range(i,3501):
            a = (4*x*y - N*y - N*x)
            if a == 0:
                continue
            z = N*x*y/a
            if z == int(z) and z >= 1:
                print(x,y,int(z))
                exit()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int n;
    cin >> n;
    vector<int> x(n);
    int sum = 0;
    rep(i, n) {
        cin >> x[i];
        sum += x[i];
    }
    if ( sum % n == 0 ) {
        int ans = 0;
        int p = sum / n;
        rep(i, n) {
            ans += (x[i] - p) * (x[i] - p);
        }
        cout << ans << endl;
        return 0;
    }
    else {
        int p1 = sum / n;
        int p2 = sum / n + 1;
        int ans1 = 0;
        int ans2 = 0;
        rep(i, n) {
            ans1 += (x[i] - p1) * (x[i] - p1);
            ans2 += (x[i] - p2) * (x[i] - p2);
        }
        cout << min(ans1, ans2) << endl;
        return 0;
    }
}


Measured memory_bytes: 256
N = int(input())
list_A = list(map(int, input().split()))

threshold = 1000000007
tmp = sum(list_A[1:])
ans = 0
for i in range(N-1):
    if i == 0:
        ans += list_A[i] * tmp % threshold
    else:
        tmp = tmp - list_A[i]
        ans += (list_A[i] * tmp % threshold)
ans = ans % threshold
print(ans)

Measured memory_bytes: 31580