akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<algorithm>
#define N (300000+1000)
using namespace std;

int n,a[N],vis[N],q[N];
long long ans;

int main()
{
	scanf("%d",&n);
	for (int i=1; i<=n; ++i)
		scanf("%d",&a[i]);
	int head=1,tail=0;
	
	for (int i=1; i<=n; ++i)
	{
		q[++tail]=a[i];
		for (int j=0; j<=20; ++j)
		{
			if ((a[i]>>j)&1)
			{
				if (!vis[j])
				{
					vis[j]=true;
				}
				else
				{
					while (/*head<tail && !((q[head]>>j)&1) &&*/ vis[j])
					{
						for (int k=0; k<=20; ++k)
							if ((q[head]>>k)&1)
								vis[k]=false;
						head++;
					}
//					head++;
					vis[j]=true;
				}
			}
		}
		ans+=(tail-head+1);
	}
	cout<<ans;
}

Measured memory_bytes: 1920
import sys
sys.setrecursionlimit(10**6)

n = int(input())

d = {(i-97+1)%26:chr(i) for i in range(97,97+26)}
#d[0] = 'z'

l = []

while n > 0:
    tmp = n%26
    l.append(tmp)
    if tmp == 0:
        n = n//26-1
    else:
        n //= 26

ans = ''

for i in l[::-1]:
    ans += d[i]
    
print(ans)

Measured memory_bytes: 9192
#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1

struct Node { int p, l, r; };

Node T[MAX];
int n, D[MAX];

void print(int u) {
  int i ,c;
  cout << "node " << u << ": ";
  cout << "parent = " << T[u].p << ", ";
  cout << "depth = " << D[u] << ", ";

  if ( T[u].p == NIL) cout << "root, ";
  else if ( T[u].l == NIL ) cout << "leaf, ";
  else cout << "internal node, ";

  cout << "[";

  for ( i = 0, c = T[u].l; c != NIL; i++, c = T[c].r) {
    if (i) cout << ", ";
    cout << c;
  }
  cout << "]" << endl;
}

void rec(int u, int p) {
  D[u] = p;
  if (T[u].r != NIL ) rec(T[u].r , p);
  if (T[u].l != NIL ) rec(T[u].l , p + 1);
}

int main() {
  int i, j, d,v, c, l ,r;
  cin >> n;
  for ( i = 0; i < n; i++) T[i].p = T[i].l = T[i].r = NIL;

  for ( i = 0; i < n; i++) {
    cin >> v >> d;
    for ( j = 0; j < d; j++) {
      cin >> c;
      if (j == 0) T[v].l = c;
      else T[l].r = c;
      l = c;
      T[c].p = v;
    }
  }

  for ( i = 0; i < n; i++ ) {
    if (T[i].p == NIL) r = i;
  }

  rec(r, 0);

  for ( i = 0; i < n; i++ ) print(i);

  return 0;
}



Measured memory_bytes: 7672
#include<bits/stdc++.h>
#include<limits>
#define ll long long
#define F first
#define S second
#define pb push_back
#define oo (1LL<<63-1)
#define endl '\n'
#define si size()
#define all(v) v.begin(),v.end()
#define FASTIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define Matrix vector< vector < long long > >


using namespace std;

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

const long double Pi=acos(-1),e=2.718;
const int N=1e2+10,mod=1e9+7;


int main ()
{
    FASTIO
    string s,t;
    cin >> s >> t;
    t.pop_back();
    if(s==t)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}
/**

*/


Measured memory_bytes: 3652
X,Y,A,B,C = map(int,input().split())
p,q,r = [sorted(map(int,input().split()),reverse=True) for i in range(3)]
ans = 0
pp,qq = [p[i] for i in range(X)] ,[q[i] for i in range(Y)]
r = r + pp + qq
r = sorted(r,reverse=True)
for i in range(X+Y):
    ans += r[i]
print(ans)

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

int main() {

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

    int a = n - k + 1;
    int b = n / k;
    cout << a - b << endl;

    return 0;
}

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

int main() {
  int D;
  cin >>D;
  if(D==22){
    cout<<"Christmas Eve Eve Eve"<<endl;
  }
  if(D==23){
    cout<<"Christmas Eve Eve"<<endl;
  }
  if(D==24){
    cout<<"Christmas Eve"<<endl;
  }  
  if(D==25){
    cout<<"Christmas"<<endl;
 }
}

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

int main() {
    int N, x;
    vector<int> X;

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> x;
        X.push_back(x);
    }

    vector<int> Y(X);
    sort(Y.begin(), Y.end());
    int median = Y[int(N / 2) - 1];

    for (int i = 0; i < N; i++) {
        if (X[i] <= median) cout << Y[int(N / 2)] << endl;
        else cout << median << endl;
    }

    return 0;
}

Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int ans = 0, num = 1;
    while(num <= n)
    {
        string s = to_string(num);
        if((int)s.size() % 2 == 0)
        {
            num *= 10;
        }
        else
        {
            ans++;
            num++;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
def SCI(i):
    i -= 1
    x = i * (i + 1) / 2
    return x


while 1:
    x = int(input())
    if x == 0:
        break
    ans = 0
    for i in range(2,x/2+2):
        if x-SCI(i) <= 0:
            break
        elif (x-SCI(i))%i == 0:
            ans += 1
    print ans

Measured memory_bytes: 6372
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

class Program
{
	static void Main(string[] args)
	{

		int AC_num = 0;
		int WA_num = 0;
		int TLE_num = 0;
		int RE_num = 0;

		int inputCount = int.Parse(Console.ReadLine());


		for(int i = 0;i < inputCount; i++)
        {
			string s = Console.ReadLine();

			if (s == "AC") AC_num++;
			if (s == "WA") WA_num++;
			if (s == "TLE") TLE_num++;
			if (s == "RE") RE_num++;
		}

		Console.WriteLine("AC x " + AC_num);
		Console.WriteLine("WA x " + WA_num);
		Console.WriteLine("TLE x " + TLE_num);
		Console.WriteLine("RE x " + RE_num);

	}

}

Measured memory_bytes: 30544
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
#define SZ(x) (int)((x).size())
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int n;
  cin >> n;
  vector<int64> a(n);
  int64 s1 = 0, s2 = 0;
  for (auto& x : a) {
    cin >> x;
    s1 = (s1 + x) % MOD;
    s2 = (s2 + x * x) % MOD;
  }
  int64 ret = (s1 * s1 % MOD + MOD - s2) % MOD;
  if (ret % 2 == 0) {
    ret /= 2;
  } else {
    ret = (ret + MOD) / 2;
  }

  cout << ret << '\n';
  return 0;
}


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

#define scd second
#define fst first
#define pb push_back
#define mkp make_pair
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
typedef vector<ll> vlong;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vint> vvint;
typedef vector<vlong> vvlong;
typedef list<int> lint;
typedef list<ll> llong;
typedef list<pii> lpii;
typedef list<pll> lpll;
typedef list<lint> llint;
typedef list<llong> lllong;

ll const LINF=numeric_limits<long long int>::max();
int const INF=numeric_limits<int>::max();

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

ll pow_mod(ll a, ll e, ll m){
	ll res=1;
	while(e){
		if(e&1) res=res*a%m;
		a=a*a%m;
		e>>=1;
	}
	return res;
}

ll inv_mod(ll b, ll m){
	b%=m;
	ll x=0, y=1, r, q, a=m;
	while(b){
		q=a/b;
		r=a%b;
		a=b;
		b=r;
		r=x;
		x=y;
		y=r-q*y;
	}
	x+=m;
	return x%m;
}

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

	int n;
	string s;
	cin>>n>>s;
	bool f=true;
	if(n&1) f=false;
	else{
		for(int i=0, j=n/2; j<n; i++,j++){
			if(s[i]!=s[j]){
				f=false;
				break;
			}
		}
	}

	if(f) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
require 'prime'

class Integer
  def divisor_list
    return [] if self <= 0
    return [1] if self == 1

    prime_division.map.with_index { |(base, k), i|
      s = i.zero? ? 0 : 1
      (s..k).map { |n| base ** n }
    }.inject { |res, e| res + res.flat_map { |t| e.map { |v| t * v } } }.sort
  end
end

# 75の素因数分解は、3 * (5 ^ 2 )
# p 75.prime_division #=> [3, 1], [5, 2]]
# 75の素因数分解は、以下の6つ
# p 75.divisor_list # => [1, 3, 5, 15, 25, 75]
# 75 = 5 * 5 * 3 = 25 * 3 = 15 * 5
# 9と10の違いを見ると答えがみれそう
# 10!の素因数分解は、{2=>8, 3=>4, 5=>2, 7=>1}
# 9!の素因数分解は、{2=>7, 3=>4, 5=>1, 7=>1}
# [4, 4, 2], [24, 3], [14,4],[74]
# [74]は、80以上で+1
#[14, 4]は、

# 最小の七五数32400 = (2^4) * (3^4) * (5^2)
# p 32400.prime_division #=> [[2, 4], [3, 4], [5, 2]]

# 今回の問題での最大の七五数は2^74。100!を素因数分解すると、50 + 25 + 12 + 6 + 3 + 1 > 75
# 80!で、素因数分解すると、2^78がでてくる。(頑張って求めた)

# k = 0
# 1.upto(100) do |i|
#   k +=1 if i%2 == 0
#   k +=1 if i%4 == 0
#   k +=1 if i%8 == 0
#   k +=1 if i%16 == 0
#   k +=1 if i%32 == 0
#   k +=1 if i%64 == 0
#   p i if k >= 75
#   break if k >= 75
# end

N = gets.to_i

# N!の素因数分解を行う
h = Hash.new(0)
1.upto(N) do |i|
  (i.prime_division).each do |k|
    h[k[0]] += k[1]
  end
end
# p h

cnt = Hash.new(0)
h.each do |k, v|
  [2, 4, 14, 24, 74].each do |t| 
    cnt[t]+=1 if v >= t
  end
end

# @satanic0258さんのツイートを見て、これか～ってなった。丸写しかな。
ans = 0
ans += cnt[4] * ( cnt[4] - 1 ) / 2 * ( cnt[2] - 2 )
ans += cnt[14] * ( cnt[4] - 1 )
ans += cnt[24] * ( cnt[2] - 1 )
ans += cnt[74]

p ans

Measured memory_bytes: 2300
S=input()
N=len(S)

b=[int(S[i]) for i in range(N)]
for i in range(1,N):
    b[i]+=b[i-1]
black=[0 for i in range(0,N+1)]
for i in range(0,N):
    black[i+1]=b[i]

def condition(K):
    if 2*K-1<N:
        return True
    else:
        if black[K]-black[N-K]==0 or black[K]-black[N-K]==2*K-N:
            return True
        else:
            return False

start=1
end=N
while end-start>1:
    test=(end+start)//2
    if condition(test):
        start=test
    else:
        end=test

if condition(end):
    print(end)
else:
    print(start)


Measured memory_bytes: 48348
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>
#include <array>
#include <cstdio>

using namespace std;

using ll = long long;
using ull = unsigned long long;

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

    vector<ll> A(N);
    unordered_map<ll, ll> m;

    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        m[A[i]]++;
    }

    ll total = 0;

    for (auto&& mi : m) {
        ll c = mi.second;
        total += c*(c-1)/2;
    }

    for (int k = 0; k < N; ++k) {
        ll c = m[A[k]];

        if (c == 1) {
            cout << total << endl;
            continue;
        }

        ll ans = total - c*(c-1)/2 + (c-1)*(c-2)/2;
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 10748
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

int main()
{
	string n;
	cin >> n;
	int digit = n.size();
	// cout << n.size() << endl;
	// cout << n[0] << endl;
	for(int i = 0; i < n.size(); i++)
	{
		if (n[i] != '9')
		{
			break;
		}
		if (i == n.size()-1)
		{
			cout << 9 * n.size() << endl;
			return 0;
		}
	}

	for(int i = 1; i < n.size(); i++)
	{
		if (n[i] != '9')
		{
			break;
		}
		if (i == n.size()-1)
		{
			cout << 9 * (n.size()-1) + (int)(n[0]-'0') << endl;
			return 0;
		}
	}

	if (digit == 1)
	{
		cout << (int)(n[0]-'0') << endl;
		return 0;
	}
	cout << (digit-1) * 9 + (int)(n[0]-'0')-1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

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

  int A,B;
  cin>>A>>B;

  for(int a=0;a<=A;a++) for(int b=0;a+b<=A;b++){
    int val=2*a+4*b;
    if(a+b==A&&val==B){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 3644
#include <cstdlib>
#include <iostream>
#include <typeinfo>
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
  int n;
  cin >> n;
  vector<int> t(n);
  vector<int> x(n);
  vector<int> y(n);
  for (int i = 0; i < n; i++)
  {
    cin >> t.at(i) >> x.at(i) >> y.at(i);
  }
  bool can = true;
  if (t.at(0) < (x.at(0) + y.at(0)))
  {
    can = false;
  }
  if (t.at(0) % 2 != (x.at(0) + y.at(0)) % 2)
  {
    can = false;
  }
  if (can)
  {
    for (int i = 0; i < n - 1; i++)
    {
      if ((t.at(i + 1) - t.at(i)) < abs(x.at(i + 1) - x.at(i)) + abs(y.at(i + 1) - y.at(i)))
      {
        can = false;
        break;
      }
      if ((t.at(i + 1) - t.at(i)) % 2 != (abs(x.at(i + 1) - x.at(i)) + abs(y.at(i + 1) - y.at(i))) % 2)
      {
        can = false;
        break;
      }
    }
  }
  if (can)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int w, h, n;
	cin >> w >> h >> n;
	int x1, x2, y1, y2;
	x1 = 0, x2 = w, y1 = 0, y2 = h;
	for(int i=0; i<n; i++){
		int x, y, a;
		cin >> x >> y >> a;
		if(a == 1){
			if(x1 < x && x < x2) x1 = x;
			else if(x2 <= x) x1 = x2;
		}else if(a == 2){
			if(x1 < x && x < x2) x2 = x;
			else if(x <= x1) x1 = x2;
		}else if(a == 3){
			if(y1 < y && y < y2) y1 = y;
			else if(y2 <= y) y1 = y2;
		}else{
			if(y1 < y && y < y2) y2 = y;
			else if(y <= y1) y1 = y2;
		}
	}

	cout << (x2-x1)*(y2-y1) << endl;

	return 0;
}

Measured memory_bytes: 256
int main(void){
  int n;
  int v,j=0,i=0,k=0;
  scanf("%d",&n);
  int A[n];
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<n;i++){
    v=A[i];
    j=i-1;
    if(i>=1){
      for(k=0;k<n;k++){
	if(k==n-1){
	  printf("%d",A[k]);
	}else{
	  printf("%d ",A[k]);
	}
      }
      printf("\n");
    }
    while(j>=0 && A[j]>v){
      A[j+1]=A[j];
      j=j-1;
      A[j+1]=v;
    }
  }
  for(k=0;k<n;k++){
    if(k==n-1){
      printf("%d",A[k]);
    }else{
      printf("%d ",A[k]);
    }
  }
  printf("\n");
  return 0;
}


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

char alp [26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

int num(char c) {
    int res = -1;
    for (int i = 0; i < 26; ++i) {
        if (alp[i] == c) {
            res = i;
        }
    }
    return res;
}

int main() {
    string S;
    cin >> S;
    
    string T = S;
    reverse(T.begin(), T.end());
    
    int A[26] = {0};
    for (int i=0; i<26; ++i) {
        A[num(S[i])] = 1;
    }
    
    bool done = false;
    
    if (S == "zyxwvutsrqponmlkjihgfedcba") {
        done = true;
        cout << -1 << endl;
    }
    
  
    if (!done){
        string res = S;
        for (int i = 0; i < 26; ++i) {
            if (A[i] == 0) {
                res += alp[i];
                done = true;
                break;
            }
        }
    
        if (!done) {
        
            for( char& c : T) {
                int i = num(c) + 1 ;
                if (!done){
                    while (i < 26){
                        if (A[i] == 0) {
                            res.pop_back();
                            res += alp[i];
                            ++i;
                            done = true;
                            break;
                        } ++i;
                    }
                } else break;
                if (!done){
                    res.pop_back();
                    A[num(c)] = 0;
                    }
                }
            }
        cout << res << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PII pair<int, int>
#define LL long long
using namespace std;
const int MAXN = 2505;
const int INF = (int) 1e9 + 5;

struct Edge {
	int fr, to, w;
};

int N, M, P, dist[MAXN];
bool vis[MAXN];
vector<Edge> es;
vector<int> G[MAXN];

bool dfs(int v) {
	vis[v] = true;
	if (v == N) return true;
	for (int to : G[v]) {
		if (!vis[to] && dfs(to)) {
			return true;
		}
	}
	return false;
}

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

	cin >> N >> M >> P;
	for (int i = 0; i < M; i++) {
		int u, v, w;
		cin >> u >> v >> w;
		es.push_back({u, v, -(w - P)});
		G[u].push_back(v);
	}
	for (int i = 2; i <= N; i++) {
		dist[i] = INF;
	}
	
	for (int i = 1; i <= 2 * N - 1; i++) {
		for (const Edge &e : es) {
			if (dist[e.fr] != INF && dist[e.fr] + e.w < dist[e.to]) {
				dist[e.to] = dist[e.fr] + e.w;
				if (i > N - 1 && !vis[e.to] && dfs(e.to)) {
					cout << "-1\n";
					return 0;
				}
			}
		}
//		cout << "At " << i << " " << dist[N] << '\n';
	}
	
	cout << max(0, -dist[N]) << '\n';

	return 0;
}

Measured memory_bytes: 640
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"strconv"
)

// An IntHeap is a min-heap of ints.
type IntHeap []int

func (h IntHeap) Len() int {
	return len(h)
}
func (h IntHeap) Less(i, j int) bool {
	// return h[i] < h[j]
	return h[i] > h[j]
}
func (h IntHeap) Swap(i, j int) {
	h[i], h[j] = h[j], h[i]
}

// Push appends input into the heap
func (h *IntHeap) Push(x interface{}) {
	*h = append(*h, x.(int))
}

// Pop removes input from the heap
func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	var N, M int
	fmt.Scan(&N, &M)
	A := make([]int, N)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
    for i := 0; i < N; i++ {
		A[i] = nextInt(sc)
	}
	PQ := IntHeap(A)
	heap.Init(&PQ)
	for i := 0; i < M; i++ {
		t := heap.Pop(&PQ).(int)
		t /= 2
		heap.Push(&PQ, t)
	}

	ans := 0
	for i := 0; i < N; i++ {
		ans += heap.Pop(&PQ).(int)
	}
	fmt.Println(ans)

}


Measured memory_bytes: 4736
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector> 
#include <cstring>
#include <queue>
#include <ctime>
#include <set>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const ll INF = 1ll<<50;
const int maxN = 100010;
const int maxK = 17;
const int MOD = 1000000007;

vector<pii> w[maxN];     //原来的图 
int deep[maxN];
ll dis[maxN];        //每个点到 根节点的值 
int pre[maxN][maxK];
void build(int x,int p)           //新树 
{
	for(int i=0;i<w[x].size();i++)
	{
		int y = w[x][i].first;
		int len = w[x][i].second;
		if(y == p) continue;
		deep[y] = deep[x] + 1;              //记录层次 
		dis[y] = dis[x] + len;
		pre[y][0] = x;
		build(y,x);
	}
}
int getLCA(int x,int y)        //新树 
{
	if(deep[x] < deep[y]) swap(x,y);
	for(int i=maxK-1;i>=0;i--)
	{
		if(deep[x] - deep[y] >= 1<<i)
		{
			x = pre[x][i];
		}
	}
	if(x == y)
		return x;
	for(int i=maxK-1;i>=0;i--)
	{
		if(pre[x][i] != pre[y][i])
		{
			x = pre[x][i];
			y = pre[y][i];
		}	
	}
	return pre[x][0];	
}
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		w[a].push_back(pii(b,c));
		w[b].push_back(pii(a,c));
	}
	build(1,0);
	deep[1] = 1;
	for(int k=1;k<=maxK-1;k++)
	{
		for(int i=1;i<=n;i++)
		{
			pre[i][k] = pre[pre[i][k-1]][k-1];
		}
	}
	int Q,K;
	scanf("%d%d",&Q,&K);
	for(int i=1;i<=Q;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		int u = getLCA(x,K);
		ll len1 = dis[x]+dis[K] - 2*dis[u];
		int v = getLCA(K,y);
		ll len2 = dis[K] + dis[y] - 2*dis[v];
		ll ans = len1 + len2;
		printf("%lld\n",ans);	
	}
	return 0;
} 

Measured memory_bytes: 21376
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] intervals = new int[m][2];

        for(int i = 0; i < m; i++) {
        	intervals[i][0] = sc.nextInt();
        	intervals[i][1] = sc.nextInt();
        }
        Arrays.sort(intervals, (it1, it2) -> it1[0] - it2[0]);

        int cnt = 1;
        int start = intervals[0][0];
        int end = intervals[0][1];

        int curStart = 0, curEnd = 0;
        for(int i = 1; i < m; i++) {
        	curStart = intervals[i][0];
        	curEnd = intervals[i][1];
        	if(curStart < end) {
        		start = Math.max(start, curStart);
        		end = Math.min(end, curEnd);
        	} else {
        		cnt++;
        		start = curStart;
        		end = curEnd;
        	}
        }
        System.out.println(cnt);
    }
}


Measured memory_bytes: 93012
import java.util.*;
public class Main {
	int n, ans;

	int dfs(int pos, int sum, int before) {
		int ret = 0;
		if(pos == 0 && sum == ans)             return(1);
		else if(pos < 0 || before > 9 || sum > ans) return(0);
		
		for(int r =before; r< 10; r++) {
			ret += dfs(pos - 1, sum + r, r + 1);
		}
		return(ret);
	}

	void doIt()  {
		Scanner stdIn = new Scanner(System.in);

		while(true) {
			n = stdIn.nextInt();
			ans =stdIn.nextInt();
			if(n + ans == 0) break;
			System.out.println(dfs(n, 0, 0));
		}
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().doIt();
	}
}

Measured memory_bytes: 18132
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
#define Endl endl
const int INF=100000000;
int main(){
	int a,b;
	cin>>a>>b;
	cout<<(((a*b)%2==0)?"Even":"Odd")<<endl;
	return 0;
}

Measured memory_bytes: 256
w,cnt,flag = list(input()),0,0

for i in w:
    for j in w:
        if i==j:
            cnt+=1
    if cnt%2 == 0:
        flag = 1
    else:
        flag = 0
        break
    cnt=0
if flag == 1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define acc(v) accumulate(v.begin(), v.end(), 0)

using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;

ll g[1000010];
int main()
{
	int n;
	cin >> n;
	vector<int> v(n);
	rep(i, n)
	{
		cin >> v[i];
		g[v[i]]++;
	}
	ll ans = 0;
	rep(i,n+1){
		ans += g[i] * (g[i] - 1) / 2;
	}
	rep(i,n){
		cout << ans - g[v[i]] * (g[v[i]] - 1) / 2 + (g[v[i]]-1) * (g[v[i]] - 2) / 2 << endl;
	}
}


Measured memory_bytes: 3968
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <cstdio>
#include <sstream>
#include <iostream>
#include <cstring>
#define REP(i,x,v)for(int i=x;i<=v;i++)
#define REPD(i,x,v)for(int i=x;i>=v;i--)
#define FOR(i,v)for(int i=0;i<v;i++)
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define IN(x,y) ((y).find((x))!=(y).end())
#define LOLDBG
#ifdef LOLDBG
#define DBG(vari) cout<<#vari<<" = "<<vari<<endl;
#define DBG2(v1,v2) cout<<(v1)<<" - "<<(v2)<<endl;
#else
#define DBG(vari)
#define DBG2(v1,v2)
#endif
#define CZ(x) scanf("%d",&(x));
#define CZ2(x,y) scanf("%d%d",&(x),&(y));
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
template<typename T,typename TT> ostream &operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream &operator<<(ostream &s,vector<T> t){s<<"{";FOR(i,t.size())s<<t[i]<<(i==t.size()-1?"":",");return s<<"}"<<endl; }



int main()
{
    ios_base::sync_with_stdio(0);
    int h,w,n;
    cin>>h>>w>>n;
    cout<<min((n+h-1)/h, (n+w-1)/w);

    return 0;
}


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

namespace ABC132_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var d = Console.ReadLine().Split().Select(int.Parse).ToArray();
            d = d.OrderBy(x => x).ToArray();

            Console.WriteLine(d[N / 2] - d[N / 2 - 1]);
        }
    }
}


Measured memory_bytes: 20960
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int xcomp(vector<LL>& a, vector<LL>& b) {
	return a[0] < b[0];
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;

int main() {
	int A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;

	vector<bool> water(31, false);
	vector<bool> suger(3001, false);

	water[0] = true;
	suger[0] = true;
	REP(i, 31) {
		if (i - A >= 0) {
			if (water[i - A]) {
				water[i] = true;
			}
		}
		if (i - B >= 0) {
			if (water[i - B]) {
				water[i] = true;
			}
		}
	}
	REP(i, 3001) {
		if (i - C >= 0) {
			if (suger[i - C]) {
				suger[i] = true;
			}
		}
		if (i - D >= 0) {
			if (suger[i - D]) {
				suger[i] = true;
			}
		}
	}

	double max = -1;
	int maxw = -1;
	int maxs = -1;

	REP(w, 31) {
		REP(s, 3001) {
			if (w != 0 || s != 0) {
				if (water[w] && suger[s]) {
					if (w * 100 + s <= F) {
						if (w*E >= s) {
							if (100.0*s / (w*100.0 + s) > max) {
								maxw = w;
								maxs = s;
								max = 100.0*s / (w*100.0 + s);
							}
						}
					}


				}
			}
		}
	}

	cout << maxw * 100 + maxs << " " << maxs << endl;
}

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

ll GetDigit(ll num)
{
  return log10(num) + 1;
}

//実行部
void Main()
{
  ll a; cin >> a;
  fin(a/3)
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){
	
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n;
	cin>>n;
	vector<ll> vc;
	for(i=2;i*i<=n;i++){
		if(n%i==0){
			vc.ps(i);
			if(n/i!=i){
				vc.ps(n/i);
			}
		}
	}
	vc.ps(n);
	// cout<<vc.size()<<endl;
	ll an=0;
	for(auto it:vc){
		k=it; l=n; j=0;
		while(l%k==0&&l>1&&k>1){
			l=l/k;
			// j++;
			// cout<<k<<" "<<l<<" "<<j<<endl;
			//if(j==3) break;
		}
		l=l%k;
		// cout<<k<<" "<<l<<endl;
		if(l==1){
			an++;
		}
	}
	if(n>2){
		ll e=1;
		for(i=2;i*i<=(n-1);i++){
			if((n-1)%i==0){
				e++;
				if((n-1)/i!=i) e++;
			}
		}
		an+=e;
	}
	cout<<an;
	return 0;
}

Measured memory_bytes: 384
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <sstream>
#include <cassert>
#include <queue>
#include <bitset>
#include <ctime>
#include <random>
#include <chrono>
using namespace std;
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define db(v) cerr << #v << " = " << v << endl
#define pb push_back
#define sz(x) ((int)x.size())
#define fst first
#define snd second
typedef long long ll;
typedef pair<int, int> ii;
const int MAXN = -1;

int main(){
    string s; cin >> s; s[3] = '8'; cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
 
#define ll long long 
#define repd(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, n) repd(i, 0, n)
using namespace std;
 
int main(){
  int a;
  cin >> a;
  cout << a + (a*a) + (a*a*a) << endl;
  return 0;
}

Measured memory_bytes: 3180
#define TEST_MODE true
 
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= b; --i)
#define range(i, a, b, c) for (int i = a;             \
                               c > 0 ? i < b : i > b; \
                               i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long
 
#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x)
#define dump_l(x) dump(x) << endl
#else
const bool test = false;
#define dump(x)
#define dump_l(x)
#endif
 
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }
 
//.....................
const int MAX = (int)2e5 + 5;
 
vector<string> split(const string &str, char sep)
{
	vector<string> v;
	stringstream ss(str);
	string buffer;
	while (getline(ss, buffer, sep))
    {
			v.push_back(buffer);
    }
	return v;
}

string reverse_str(string input) {
  string res = input;
  reverse(all(res));
  return res;
}
 
template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
	return accumulate(begin, end, 0ll);
}

int H = 20, W = 30;

bool ng(int y, int x) {
	return y < 0 || H <= y || x < 0 || W <= x;
}

void solve();

class Solver {
public:
	int N, T;
	vector<int> c, t;
	
  void solve() {
		cin >> N >> T;
		c.resize(N); t.resize(N);
		rep(i, N) cin >> c[i] >> t[i];
		int res = INF;
		rep(i, N) {
			if ( (t[i] <= T) && (c[i] < res) ) res = c[i];
		}
		string res_s = "TLE";
		if (res != INF) res_s = to_string(res);
		cout << res_s << endl;
		
  }
};
 
signed main()
{
	cout << fixed << setprecision(20);
	auto ptr = new Solver();
	ptr->solve();
	delete ptr;
	// while (true) {
	//   auto ptr = new Solver();
	//   ptr->solve();
	//   delete ptr;
	// }
	return 0;
}
 
// class Mycin {
// 	bool flag = true;
// public:
// 	Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
// 	Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
// 	Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
// 	operator bool() {return flag;}
// } mycin;
 
// class Mycout {
// public:
// 	Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
// 	Mycout& operator << (const char c) {printf("%c", c); return *this;}
// 	Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
// } mycout;
 
// #define cin mycin
// #define cout mycout
// #define endl '\n'
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  fspcnt = 0;
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}*/


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/
vector<int64_t> par(100005);

void init(int64_t n){
  rep(i,n) par[i] = i;
}

int root(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = root(par[x]);
  }
}

bool same(int x,int y){
  return root(x) == root(y);
}

void unite(int x,int y){
  x = root(x);
  y = root(y);
  if(x == y)return;
  par[x] = y;
  //cout << "#";
}
    
 
int main(){
  int64_t x;
  cin >> x;
  int64_t highscore = 0;
  for(int64_t i=1;i<=40;i++){
    for(int64_t j=2;j <= 10;j++){
      int64_t k=1;
      rep(l,j){
        k *= i;
      }
      if(k <= x){
        highscore = max(highscore,k);
      }else{
        break;
      }
    }
  }
  cout << highscore << endl;
 
  
}

Measured memory_bytes: 1024
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            WriteLine(700 + 100 * ReadLine().Count(r => r == 'o'));
        }


        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 26048
#include <bits/stdc++.h>
#define PI acos(-1)
using namespace std;
int main() {
	double a, b, h, m; cin >> a >> b >> h >> m;
	double angle1 = abs(5.0 * (h + m / 60.0) - m);
	double angle2 = 60.0 - angle1;
	double angle = 2.0 * PI * min(angle1, angle2) / 60.0;
	printf("%.9f", sqrt(a * a + b * b - 2 * a * b * cos(angle)));
}

Measured memory_bytes: 4216
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    cin >> n >> k;
    cout << n-k+1 << endl;

    return 0;
}

Measured memory_bytes: 256
A=[]
for i in range(3):
    a,b=map(int,input().split())
    A.append(a)
    A.append(b)
c=0
d=0
e=0
f=0
for j in A:
    if j==1:
        c+=1
    elif j==2:
        d+=1
    elif j==3:
        e+=1
    else:
        f+=1
if c>=3 or d>=3 or e>=3 or f>=3:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 3064
#! python3
# diceIV.py - サイコロを転がす動きをシミュレートするプログラム
import sys

def getKeyFromValue(dice, value):
    keys = [k for k, v in dice.items() if v == value]
    if keys:
        return keys[0]
    return None

def initDice(numbers):  # サイコロオブジェクトに値を入れる
        # サイコロオブジェクトを定義, 配列の数値を、各面にわたす
    dice = {'top': numbers[0], 'bottom': numbers[5], 'front': numbers[1],
            'back': numbers[4], 'right': numbers[2], 'left': numbers[3]}
    return dice


def rollDice(dice, direction):  # サイコロを転がしたときの関数
    if direction == 'N':
        top = dice['front']
        bottom = dice['back']
        front = dice['bottom']
        back = dice['top']
        dice['top'] = top
        dice['bottom'] = bottom
        dice['front'] = front
        dice['back'] = back
    elif direction == 'S':
        top = dice['back']
        bottom = dice['front']
        front = dice['top']
        back = dice['bottom']
        dice['top'] = top
        dice['bottom'] = bottom
        dice['front'] = front
        dice['back'] = back
    elif direction == 'E':
        top = dice['left']
        bottom = dice['right']
        right = dice['top']
        left = dice['bottom']
        dice['top'] = top
        dice['bottom'] = bottom
        dice['right'] = right
        dice['left'] = left
    elif direction == 'W':
        top = dice['right']
        bottom = dice['left']
        right = dice['bottom']
        left = dice['top']
        dice['top'] = top
        dice['bottom'] = bottom
        dice['right'] = right
        dice['left'] = left
    return dice


def spinDice(dice):
    front = dice['right']
    right = dice['back']
    back = dice['left']
    left = dice['front']
    dice['front'] = front
    dice['right'] = right
    dice['back'] = back
    dice['left'] = left
    return dice

def assertDice(dice_1, dice_2):
    if dice_1 == dice_2:
        print('No')
        sys.exit()

# 一つの目でやるチェックをまとめる
def checkDice(dice_1,dice_2):
    assertDice(dice_1, dice_2)
    for i in range(3):
        dice_1 = spinDice(dice_1)
        assertDice(dice_1, dice_2)

def diceIII(dice_1, dice_2):
    checkDice(dice_1,dice_2)

    roll_directions = [['N'], ['S'], ['W'],['E'],['N','N']]

    dice_1 = initDice(numbers_1)

    for direction in roll_directions:
        for d in direction:
            dice_1 = rollDice(dice_1, d)
        checkDice(dice_1,dice_2)
        dice_1 = initDice(numbers_1)

n = int(input())
all_dice_numbers = []
for i in range(n):
  numbers = [int(i) for i in input().split()]
  all_dice_numbers.append(numbers)

for i in range(n):
  numbers_1 = all_dice_numbers[i]
  dice_1 = initDice(numbers_1)

  for j in range(i+1, n):
    if j == n:
      pass
    else :
      numbers_2 = all_dice_numbers[j]
      dice_2 = initDice(numbers_2)
      diceIII(dice_1, dice_2)

print('Yes')


Measured memory_bytes: 5640
#!/usr/bin/env python3
import sys
from itertools import accumulate
from collections import Counter
from math import factorial
def comb(n, k):
    if n < k:
        return 0  
    k = min(n-k,k)
    ans = 1
    for i in range(1, k + 1):
        ans = (ans * (n + 1 - i) // i)
    return ans

def solve(N: int, A: "List[int]"):
    accum = accumulate(A)
    counter = dict(Counter(accum))

    answer = 0
    for key,value in counter.items():
        if key == 0:
            answer += value + comb(value,2)
        else:
            answer += comb(value,2)
    print(answer)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 59360
#include<iostream>
#include<vector>

int main(void){
  int N;
  std::cin >> N;
  std::vector<int> m; m.resize(N);
  int counter = 0;
  for(int i = 0; i < N; i++){
    std::cin >> m[i];
  	if(((i+1) & 1) && (m[i] & 1)) counter ++;
  }
  std::cout << counter << std::endl;
  return 0;
}

Measured memory_bytes: 3600
import java.io.PrintWriter;
import java.util.*;

public class Main {
	public static String implementation(List<String> array){
		int n = Integer.parseInt(array.get(0));
		String a = array.get(1);
		String b = array.get(2);
		String c = array.get(3);

		int count = 0;
		for(int i=0; i<n; i++){
			if(a.charAt(i)==b.charAt(i) && a.charAt(i)==c.charAt(i)){
				// Do nothing
			} else if (a.charAt(i)==b.charAt(i) || b.charAt(i)==c.charAt(i) || c.charAt(i)==a.charAt(i)) {
				count += 1;
			} else {
				count +=2;
			}
		}
		return String.valueOf(count);
	}

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

		// Read input and execute method
		String tmp;
		List<String> array = new ArrayList<String>();
		while(true) {
			try {
				tmp = sc.nextLine();
				if (tmp.length() == 0) {
					exec(array);
					array.clear();
				} else {
					array.add(tmp);
				}
			} catch (Exception e){
				exec(array);
				break;
			}
		}
	}

	public static void exec(List<String> array){
		// Output variable
		String out = implementation(array);

		// Output
		PrintWriter stdOut = new PrintWriter(System.out);
		stdOut.println(out);
		stdOut.flush();

		// Debug
		if(array.get(array.size()-1).startsWith("a:")) {
			if (!array.get(array.size() - 1).substring(2).equals(out)) {
				System.out.println("error included");
				System.out.println("output : " + out);
				System.out.println("expected : " + array.get(array.size()-1).substring(2));
			} else {
				System.out.println("correct answer!!");
			}
			System.out.println("");
		}
	}
}


Measured memory_bytes: 23508
#include <bits/stdc++.h>
#define px(str) cout<<(str)<<endl,exit(0);
#define pe(str) return cout<<(str)<<endl,0;
#define IF(a,b,c) ((a)?(b):(c))
#define re(i,n) for(int i=0;i<(n);i++)
#define rep(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;

int t[1001];
int main(int argc,char** argv){
	int a,b;
	int n;
	cin>>a>>b>>n;
	int x,y;
	re(i,n){
		cin>>x>>y;
		rep(j,x,y)t[j]=1;
	}
	rep(i,a,b){
		if(t[i])pe(1);
	}
	pe(0);
		return 0;
}



Measured memory_bytes: 3100
#include <stdio.h>

int main(void)	{
	int i, j, n, max, min, a[200000];
	scanf("%d", &n);
	for (i = 0; i < n; i++)	{
		scanf("%d", &a[i]);
	}
	max = -1000000000;
	min = a[0];
	
	for (i = 1; i < n; i++)  {
		if ( a[i] - min > max)
			max = a[i] - min;
		if (a[i] < min)
			min = a[i];
	} 
	printf("%d\n", max);
	return 0;	
}

Measured memory_bytes: 2624