akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-10;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	int n, t;
	cin >> n >> t;
	vi v(n);
	REP(i, n) cin >> v[i];
	sort(ALL(v));
	ll ans = 1;
	REP(i, n)
	{
		int l = v.begin() + i - lower_bound(v.begin(), v.begin() + i, v[i] - t);
		ans *= l + 1;
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int n,m,c;
  cin >> n >> m >> c;
  
  vector<int> b(m);
  for (int i=0;i<m;i++){
    cin >> b.at(i);
  }
  
  vector<vector<int>> a(n,vector<int>(m));
  for (int i=0; i<n;i++){
    for (int j=0;j<m;j++){
      cin >> a.at(i).at(j);
    }
  }
  
  int cnt = 0;
  for (int i=0;i<n;i++){
    int sum=0;
    for(int j=0;j<m;j++){
      sum += a.at(i).at(j)*b.at(j);
    }
    sum += c;
    if (sum>0) cnt++;
  }
  
  cout << cnt << endl;
  
}


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

class State{
public:
  int t[32], pos[50];
  int cost;

  State(int _t[32], int _pos[50], int _cost){
    for(int i = 0; i < 32; i++){
      t[i] = _t[i];
    }

    for(int i = 0; i < 50; i++){
      pos[i] = _pos[i];
    }

    cost = _cost;
  }
};

int t2[32];
int pos2[50];

void copy(int t[32], int pos[50]){
  for(int i = 0; i < 32; i++){
    t2[i] = t[i];
  }
  for(int i = 0; i < 50; i++){
    pos2[i] = pos[i];
  }
}

bool finish(int t[32]){
  for(int i = 0; i < 4; i++){
    for(int j = 0; j < 7; j++){
      int val = 10 * (i + 1) + j + 1;
      int idx = i * 8 + j;

      if(t[idx] != val){
        return false;
      }
    }
  }

  return true;
}

void solve(const State &start){
  queue<State> open;
  set<vector<int> > closed;
  open.push(start);

  while(!open.empty()){
    State st = open.front();
    open.pop();

    vector<int> v(st.t, st.t + 32);

    if(closed.find(v) != closed.end()) continue;
    closed.insert(v);

    if(finish(st.t)){
      cout << st.cost << endl;
      return;
    }

    for(int i = 0; i < 32; i++){
      if(st.t[i] == 0){
        if(st.t[i - 1] == 0) continue;
        int val = st.t[i - 1] + 1;
        if(st.pos[val] == 0) continue;

        copy(st.t, st.pos);

        t2[i] = val;
        t2[st.pos[val]] = 0;
        pos2[val] = i;

        open.push(State(t2, pos2, st.cost + 1));
      }
    }
  }

  cout << "-1\n";
}

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

  while(T--){
    int t[32];
    int pos[50];

    memset(t, 0, sizeof(t));
    memset(pos, 0, sizeof(pos));

    for(int i = 0; i < 4; i++){
      for(int j = 1; j < 8; j++){
        int idx = i * 8 + j;
        cin >> t[idx];
        pos[t[idx]] = idx;
      }
    }

    for(int i = 0; i < 4; i++){
      int val = 11 + i * 10;
      t[i * 8] = val;
      t[pos[val]] = 0;
      pos[val] = i * 8;
    }

    solve(State(t, pos, 0));
  }
}

Measured memory_bytes: 12000
n,q = map(int,input().split())
s = input()
count = [0]*n
for i in range(1,n):
    count[i]+=count[i-1]
    if s[i-1:i+1] == 'AC':
        count[i]+=1
for _ in range(q):
    l,r = map(int,input().split())
    print(count[r-1]-count[l-1])

Measured memory_bytes: 9236
#include <iostream>
#include <queue>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <tuple>
#include <functional>
using namespace std;

string S, V; int N;

bool solve(string T) {
	int dep = 0;
	for (int i = 0; i < T.size(); i++) {
		if (T[i] == '(') dep++;
		if (T[i] == ')') dep--;
		if (dep < 0) return false;
	}
	if (dep != 0) return false;
	return true;
}

int main() {
	cin >> N >> S; for (int i = 0; i < 10000; i++) V += "(";
	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			string T = "";
			for (int k = 0; k < i; k++) T += "(";
			T += S;
			for (int k = 0; k < j; k++) T += ")";

			if (solve(T) == true) {
				if (V.size() > T.size()) V = T;
				else if (V.size() == T.size() && V > T) V = T;
			}
		}
	}
	cout << V << endl;
	return 0;
}

Measured memory_bytes: 256
n, h = map(int, input().split())
a = []
b = []
for i in range(n):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)
b.append(0)
a2 = sorted(a, reverse=True)
b2 = sorted(b, reverse=True)

count = 0
while True:
    if h <= 0:
        break
    elif b2[0] <= a2[0]:
        count += -(- h // a2[0])
        break
    else:
        h -= b2.pop(0)
        count += 1

print(count)

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

using namespace std;

void abc_160a();

void abc_161a();

void abc_162();

int main()
{
  //abc_160a();
  //abc_161a();
  abc_162();
}

void abc_160a()
{
  string S;
  cin >> S;

  if (S[2] == S[3] && S[4] == S[5]) cout << "Yes\n";
  else cout << "No\n";
}

void swap(int& a, int& b)
{
  int tmp;
  tmp = a;
  a = b;
  b = tmp;
}

void abc_161a()
{
  int x, y, z;
  cin >> x >> y >> z;

  swap(x, y);
  swap(x, z);

  cout << x << " " << y << " " << z << "\n";
}

void abc_162()
{
  string s;
  cin >> s;
  for (char c : s)
  {
    if (c == '7')
    {
      cout << "Yes\n";
      return;
    }
  }

  cout << "No\n";
}


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

int main(void){
	int n;
	cin >> n;
	vector<vector<int>> cnt(n,vector<int>(26));
	for(int i=0;i<n;i++){
		string s;
		cin >> s;
		for(int j=0;j<s.size();j++){
			cnt[i][s[j] - 'a']++;
		}
	}

	vector<int> res(26);
	for(int j=0;j<26;j++){
		res[j] = 100;
		for(int i=0;i<n;i++){
			res[j] = min(res[j], cnt[i][j]);
		}
	}
	for(int i=0;i<26;i++){
		string s(res[i],'a'+i);
		cout << s;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
using namespace std;
#define l long long
#define pb push_back
#define mem(a,n) memset(a,n,sizeof(a))
#define find(v,n) find(v.begin(),v.end(),n)
#define sort1(v) sort(v.begin(),v.end())
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mod 998244353
#define reverse(s) reverse(s.begin(),s.end())
//#define pi pair<l,l> 
const double pi=3.141592653589793;
bool isprime(l n)
{
	for(l i=2;i<=n;i++)
	{
		if(n%i==0)
			return false;
	}
	return true;
}
/*bool fact(l n)
{
	vector<l> v;
	for(l i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			if(i%2==1||(n/i)%2==1)
			{
				return true;
			}
		}
	}
	return false;
}*/
l power(l a,l b)
{
	l ans=1;
	while(b>0)
	{
		if(b&1)
		{
			ans=(ans*a)%mod;
		}
		b>>=1;
		a=(a%mod*a%mod)%mod;
	}
	return ans;
}//prefixsums
void frooty()
{
	l n;
	cin>>n;
	vector<l> v((l)1e5+1,0);
	l sum=0;
	for(l i=0;i<n;i++)
	{
		l a;
		cin>>a;
		v[a]++;
		sum+=a;
	}
	l q;
	cin>>q;
	while(q--)
	{
		l b,c;
		cin>>b>>c;
		if(v[b]>0)
		{
			sum-=(v[b]*b);
			sum+=(v[b]*c);
			v[c]+=v[b];
			v[b]=0;
		}
		cout<<sum<<"\n";
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int q=1;
//	cin>>q;
	while(q--)
	{
		frooty();
	}
}

Measured memory_bytes: 3992
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N, K;
  string S;
  vector<long long int> b_v;
  cin >> S;
  for (int i = 0; i < S.size()-2; i++) {
    long long int b = 100*(S[i] - '0') + 10*(S[i+1] - '0') + (S[i+2] - '0');
    b_v.push_back(abs(b-753));
  }
  sort(b_v.begin(), b_v.end());
  for (int i = 0; i < S.size()-2; i++) {
    //cout << b_v[i] << endl;
  }
  cout << b_v[0] << endl;
  //cout << max_cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/
 
const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n == 0) return 1;

    ll res = modpow(x, n/2);
    if(n%2 == 0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


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

    int a, p; cin >> a >> p;
    p += 3*a;
    cout << p/2 << endl;
    
    return 0;
}



Measured memory_bytes: 256
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

if M == 0:
  exit()

result = min(a) + min(b)
for _ in range(M):
    x, y, c = map(int, input().split())
    t = a[x - 1] + b[y - 1] - c
    if t < result:
        result = t
print(result)


Measured memory_bytes: 18648
def merge(A, left, mid, right):
	n1 = mid - left
	n2 = right - mid
	L = []
	R = []
	for i in range(n1):
		L.append(A[left + i])
	for i in range(n2):
		R.append(A[mid + i])
	L.append(1000000001)
	R.append(1000000001)
	i = 0
	j = 0
	for k in xrange(left, right):
		global cnt
		cnt += 1
		if L[i] <= R[j]:
			A[k] = L[i]
			i += 1
		else:
			A[k] = R[j]
			j += 1

def mergeSort(A, left, right):
	if left + 1 < right:
		mid = (left + right) / 2
		mergeSort(A, left, mid)
		mergeSort(A, mid, right)
		merge(A, left, mid, right)
	return A

n = int(raw_input())
S = map(int, raw_input().split())

cnt = 0
A = mergeSort(S, 0, n)

for i in xrange(len(A)-1):
	print(A[i]),
print A[len(A) - 1]
print cnt

Measured memory_bytes: 49776
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.ABC_105
{
    class B
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            for (int i = 0; i*4 <=n; i++)
            {
                if ((n - i * 4) % 7 == 0)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }
            Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 13140
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    auto n = lread();
    long ans = 1;
    long mod = (10 ^^ 9) + 7;
    long tmp;
    foreach (i; 0 .. n)
    {
        tmp = i + 1;
        tmp %= mod;
        ans %= mod;
        ans *= tmp;
    }
    writeln(ans % mod);

}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}


Measured memory_bytes: 3628
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL << 60;

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

    sort(v.begin(),v.end());

    for(int i = 1; i<n; i++){
        v[0] = (v[0]+v[i])/2;
    }

    cout << v[0] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N >> M;
	vector< pii > R(M);
	rep(i, M) cin >> R[i].first >> R[i].second;
	int mn = -1, mx = N;
	rep(i, M) {
		chmax(mn, R[i].first);
		chmin(mx, R[i].second);
	}
	cout << max(0LL, mx - mn + 1) << endl;
	return 0;
}

Measured memory_bytes: 1792
// Problem Code: abc161_a

#include <bits/stdc++.h>

using namespace std;

void A(vector<int>& box) {
	swap(box[0], box[1]);
	swap(box[0], box[2]);
}

int main() {
	vector<int> box(3);
	for (int i = 0; i < box.size(); i++)
		cin >> box[i];
	A(box);
	for (int i = 0; i < box.size(); i++)
		cout << box[i] << " ";
	return 0;
}

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

#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
typedef long long ll;

using namespace std;
 
int main() {
	int n;
    cin>>n;
    int a[n][3];
    REP(i,n){
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    }
    int dp[n][3];
    for(int i=0;i<n;i++){
        if(i==0){
            for(int j=0;j<3;j++){
                dp[0][j]=a[0][j];
            }
        }else{
            dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i][0];
            dp[i][1]=max(dp[i-1][0],dp[i-1][2])+a[i][1];
            dp[i][2]=max(dp[i-1][1],dp[i-1][0])+a[i][2];
        }
    }
    cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
    return 0;
}

Measured memory_bytes: 2560
N = int(input())
H = list(map(int, input().split()))
h = H[-1]
ans = "Yes"
for i in range(N-1, -1, -1):
  if H[i] <= h+1:
    h = min(h, H[i])
  else:
    ans = "No"
    break
print(ans)

Measured memory_bytes: 14396
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using ll = int64_t;
#define MAX_N 1010
#define MAX_M 100010
const long long mod = pow(10, 9) + 7;
#define vect vector<int>
#define vecll vector<ll>
#define vecllvec vector<vector<ll>>
#define vecb vector<bool>
#define vecBvec vector<vector<bool>>
#define vecst vector<string>
#define veche vector<char>
#define vecd vector<double>
#define vecvec vector<vector<int>>
#define vecDvec vector<vector<double>>
#define vecHvec vector<vector<char>>
#define all(x) (x).begin(),(x).end()
#define ent cout<<endl
#define printvec(vect) for(int aqw=0;aqw<vect.size();aqw++){cout<<vect[aqw]<<" ";}ent;
#define rep1(n) for(ll i = 0; i < (n); ++i)
#define rep2(i, n) for(ll i = 0; i < (n); ++i)
#define rep3(i, a, b) for(ll i = (a); i < (b); ++i)
#define rep4(i, a, b, c) for(ll i = (a); i < (b); i += (c))
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; }
#define INF 100100101001LL;
#define print(x) cout<<x<<endl;
using P = pair<int, int>;
#define PLL pair<ll, ll>;
#define MAX_V 10010
#define PI 3.141592653589793
#define vecP vector<P>
//cout << setprecision(15) << std::fixed;


int main() {
	int n;
	cin >> n;
	vector<map<char, int>> M(n);
	for (int i = 0;i < n;i++) {
		string s;
		cin >> s;
		for (int j = 0;j < s.size();j++) {
			//print(s[j]);
			M[i][s[j]]++;
		}
	}
	string ans = "";
	for (char al = 'a';al <= 'z';++al) {
		vect A;
		for (int i = 0;i < n;i++) {
			A.push_back(M[i][al]);
		}
		int cut = *min_element(all(A));
		ans += string(cut,al);
	}
	print(ans);
}

Measured memory_bytes: 256
K,X = map(int,input().split())

m,M = -1000000,1000000
if X - (K - 1) > m: m = X - (K - 1)
if X + (K - 1) < M: M = X + (K - 1)

ans = [i for i in range(m,M+1)]
print(' '.join(map(str,ans)))

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

#define str(a) to_string(a)
#define int long long
#define pb push_back
#define mp make_pair
#define SORT(c) sort(c.begin(),c.end())
#define max_heap priority_queue<int>
#define min_heap priority_queue< int,vector<int>, greater<int> >
#define mod 1000000007
#define setbits(x) __builtin_popcount(x)
#define ps(x,y) fixed<<setprecision(y)<<x
#define start(t) int x;cin>>x;while(x--)
#define inf LLONG_MAX
#define sync ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"







int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int k, a, b;
	cin >> k >> a >> b;
	for (int i = a; i <= b; i++) {
		if (i % k == 0) {
			cout << "OK" << endl;
			return 0;
		}
	}
	cout << "NG" << endl;

}













Measured memory_bytes: 3652
import sys
input = sys.stdin.readline

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y

def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

X, Y = [int(x) for x in input().strip().split()]
p = (X, 2 * X)
n1 = X
n2 = 0
f = True
while p != (X, Y):
    n1 -= 2
    n2 += 1
    p = (n1 + 2 * n2, 2 * n1 + n2)
    if p[1] <= 0:
        f = False
        break

if n1 < 0 or n2 < 0:
    print(0)
else:
    print(combination(n1 + n2, n1))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
using namespace std;
using ll = long long;
/*
int main()
{
    int n, m;
    cin >> n >> m;
    int p[m];
    string s[m];
    int ac = 0;
    bool solved[n] = {};
    int counter[n] = {};
    int pen = 0;
    rep(i, m){
        cin >> p[i] >> s[i];
        if(s[i] == "AC"){
            solved[p[i]-1] = true;
        }else{
            if(solved[p[i]-1] == false) counter[p[i]-1]++;
        }
    }
    rep(i, n){
        if(solved[i]){
            ac++;
            pen += counter[i];
        }
    }
    cout << ac << endl;
    cout << pen << endl;
    return 0;
}
*/

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> ac(n), pena(n);
    rep(i, m){
        int p;
        string s;
        cin >> p >> s;
        p--;
        if(ac[p]) continue;
        if(s == "AC"){
            ac[p] = 1;
        }else{
            pena[p]++;
        }
    }
    int AC = 0, PENA = 0;
    rep(i, n){
        AC += ac[i];
        if(ac[i]) PENA += pena[i];
    }
    cout << AC << endl << PENA << endl; 
    return 0;
}

Measured memory_bytes: 1024
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;

	writeln(N * (N - 1) / 2);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define MAX 10005
#define int long long
#define T int t;cin>>t;while(t--)
#define f(i,a,b) for(int i=a;i<b;i++)
#define debug(x) cout<<x = <<x<<n;
#define set_dp(dp) memset(dp,-1,sizeof(dp))
using namespace std;

signed main(){
	ios_base::sync_with_stdio(false);	
	cin.tie(0);
	cout.tie(0);
	
	map<char,vector<int> > ma;
	string s,t;
	cin >> s >> t;
	int n = s.length();
	vector<vector<int> > map(26);
	f(i,0,n) map[s[i]-'a'].push_back(i);
	f(i,0,n) map[s[i]-'a'].push_back(i+n);
	int ans = 0;
	int i = 0;
	f(j,0,t.length()){
		int c = t[j]-'a';
		if(map[c].size()==0){
			cout<<"-1\n";
			return 0;
		}
		i = *lower_bound(map[c].begin(), map[c].end(),i) + 1;
		if(i>=n){
			i -= n;
			ans += n;
		}
	}
	ans += i;
	cout << ans << "\n";
	return 0;
}



Measured memory_bytes: 2756
import heapq
N, M = map(int, input().split())

jobs = [[] for _ in range(M)]
for _ in range(N):
    A, B = map(int, input().split())
    if A > M:
        continue
    jobs[A-1].append(-B)

total = 0
heap = []
for i in range(M):
    for job in jobs[i]:
        heapq.heappush(heap, job)

    if len(heap) == 0:
        continue
    else:
        total += -heapq.heappop(heap)

print(total)

Measured memory_bytes: 21924
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

#define ff first
#define ss second
#define pb push_back
#define sz size()
#define mp make_pair
#ifndef ONLINE_JUDGE 
#include "/home/asif/Codes/Library/debug.h"
#endif
/*--------------------------------------------------------------------*/

const int N = 1e5 + 5;
const int MOD = 1e9 + 7;

int main() {

  ll h1, h2, m1, m2, k;

  cin >> h1 >> m1 >> h2 >> m2 >> k;

  m2 += (h2 * 60);
  m1 += (h1 * 60);
  cout << m2 - m1 - k << endl;

  return 0;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

template <int N, typename T, T M>
struct factorial_mod {
    T mod[N + 1];
    T inv_mod[N + 1];

    constexpr factorial_mod() : mod(), inv_mod() {
        mod[0] = 1;
        for (int i = 0; i < N; ++i) {
            mod[i + 1] = (mod[i] * (i + 1)) % M;
        }
        inv_mod[N] = power(mod[N], M - 2);
        for (int i = N - 1; i >= 0; --i) {
            inv_mod[i] = (inv_mod[i + 1] * (i + 1)) % M;
        }
    }

    constexpr T power(T a, T b) const {
        T r = 1;
        while (b > 0) {
            if ((b & 1) != 0) r = (r * a) % M;
            a = (a * a) % M;
            b >>= 1;
        }
        return r;
    }

    constexpr T comb(T n, T r) const {
        if (r < 0 || r > n || n < 0) return 0;
        return (((mod[n] * inv_mod[r]) % M) * inv_mod[n - r]) % M;
    }
};

constexpr factorial_mod<ll(1e6), ll, ll(1e9 + 7)> facMod;

int main() {
    ll x, y;
    cin >> x >> y;
    if ((x + y) % 3 != 0) {
        cout << 0 << endl;
        return 0;
    }
    ll n = (x + y) / 3;
    x -= n;
    y -= n;
    if (x < 0 || y < 0) {
        cout << 0 << endl;
        return 0;
    }
    cout << facMod.comb(n, x) << endl;
    return 0;
}


Measured memory_bytes: 256
sx,sy,tx,ty=gets.split.map(&:to_i)
ans=""
xdiff=tx-sx
ydiff=ty-sy
ans+="U"*ydiff+"R"*xdiff
ans+="D"*ydiff+"L"*xdiff
ans+="L"+"U"*(ydiff+1)+"R"*(xdiff+1)+"D"
ans+="R"+"D"*(ydiff+1)+"L"*(xdiff+1)+"U"
puts ans


Measured memory_bytes: 1916
n,k=map(int,input().split())
P=[list(map(int,input().split())) for _ in range(n)]
X=sorted(list(map(lambda x:x[0],P)))
Y=sorted(list(map(lambda x:x[1],P)))
s=(X[0]-X[-1])*(Y[0]-Y[-1])
ans=0
for r in range(n-1,0,-1):
  for l in range(r):
    for u in range(n-1,0,-1):
      for b in range(u):
        c=0
        for p in P:
          if X[l]<=p[0]<=X[r] and Y[b]<=p[1]<=Y[u]:
            c+=1
        if c>=k:
          s=min(s,(X[r]-X[l])*(Y[u]-Y[b]))
        else:break
    if u==n-1 and b==0 and c<k:
      break
print(s)

Measured memory_bytes: 45532
#include<stdio.h>
#include<string.h>
int main(){
  int counth=0,countt=0,n,i,ku;
  char ha[101],ta[101];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",ta,ha);
    ku=strcmp(ta,ha);
    if(ku==0){
      counth++;
      countt++;
    }
    else if(ku>0)countt+=3;
    else counth+=3;
  }
  printf("%d %d\n",countt,counth);
  return 0;
}



Measured memory_bytes: 2052
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
#include<map>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define mod 1000000007

int H,W;
char S[2005][2005];//[h][w]
int L[2005][2005];
int R[2005][2005];
int U[2005][2005];
int D[2005][2005];
signed main(){
    scanf("%lld %lld",&H,&W);
    rep(i,H){
        scanf("%s",S[i]);
    }
    rep(i,H){//L
        rep(j,W){
            if(S[i][j]=='#')continue;
            if(j==0||S[i][j-1]=='#')L[i][j]=0;
            else L[i][j]=L[i][j-1]+1;
        }
    }
    rep(i,H){//L
        for(int j=W-1;j>=0;j--){
            if(S[i][j]=='#')continue;
            if(j==W-1||S[i][j+1]=='#')R[i][j]=0;
            else R[i][j]=R[i][j+1]+1;
        }
    }
    rep(j,W){//U
        rep(i,H){
            if(S[i][j]=='#')continue;
            if(i==0||S[i-1][j]=='#')U[i][j]=0;
            else U[i][j]=U[i-1][j]+1;
        }
    }
    rep(j,W){//D
        for(int i=H-1;i>=0;i--){
            if(S[i][j]=='#')continue;
            if(i==H-1||S[i+1][j]=='#')D[i][j]=0;
            else D[i][j]=D[i+1][j]+1;
        }
    }

    int ans=0;
    rep(i,H){//L
        rep(j,W){
            ans=max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]+1);
        }
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 129664
#include<cstdio>
using namespace std;
int beg[200100],nex[200100],tto[200100],e;
void putin(int s,int t){
	tto[++e]=t;
	nex[e]=beg[s];
	beg[s]=e;
}
int sg[200100];
void dfs(int u,int fa){
	sg[u]=0;
	for(int i=beg[u];i;i=nex[i])
	{
		if(tto[i]==fa) continue;
		dfs(tto[i],u);
		sg[u]^=sg[tto[i]]+1;
	}
}
int main()
{
//	freopen("D.in","r",stdin);
	int n;
	int s,t;
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		scanf("%d%d",&s,&t);
		putin(s,t);
		putin(t,s);
	}
	dfs(1,0);
	if(sg[1])
		printf("Alice\n");
	else
		printf("Bob\n");
	return 0;
}


Measured memory_bytes: 7168
#include<iostream>
#include<vector>
#include<climits>
#include<queue>
#define INF 1e+18
using namespace std;

struct Edge{
	int trg;
	long long w;
};

struct vertex{
	int v;
	long long w;
	bool operator < (const vertex &x) const{
		return w < x.w;
	}
	bool operator > (const vertex &x) const{
		return w > x.w;
	}
};

const int MAX_V = 100000;
vector<vector <Edge> > graph(MAX_V);
vector<long long> min_cost(MAX_V,INF);
vector<bool> used(MAX_V,false);

void dijkstra(int s, int V){
	min_cost[s] = 0;

	priority_queue< vertex,vector<vertex>,greater<vertex> > pq;
	pq.push(vertex{s,0});
	while (!pq.empty() ) {
		vertex ver =  pq.top();	
		pq.pop();
		int v = ver.v;
		if ( used[v] ) continue;		
		used[v] = true;
		min_cost[v] = ver.w;

		for (int i = 0; i < graph[v].size(); i++){
			if (!used[graph[v][i].trg]){
				pq.push(vertex{graph[v][i].trg, min_cost[v] + graph[v][i].w});
			}
		}
	}
}	

void print_array(vector<long long>& array, int node){
	for (int i = 0; i < node; i++) {
		if ( array[i] == INF) {
			cout << "INF" << endl;
		}else{
			cout << array[i] << endl;
		}
	}
}

int main (){

	int V,E,r;
	cin >> V >> E >> r;
	int s,t,d;
	for (int i = 0; i < E ; i++) {
		cin >> s >> t >> d;
		graph[s].push_back(Edge{t,d});
	}
	dijkstra(r,V);
	print_array(min_cost,V);

	return 0;
}

Measured memory_bytes: 21592
import java.util.Scanner;

/**
 *
 * @author beris
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int dp[][] = new int[n][3];
        for(int i=0;i<n;i++){
            dp[i][0] = scanner.nextInt();
            dp[i][1] = scanner.nextInt();
            dp[i][2] = scanner.nextInt();
        }
        for(int i=1;i<n;i++){
            dp[i][0] += Math.max(dp[i-1][1], dp[i-1][2]);
            dp[i][1] += Math.max(dp[i-1][0], dp[i-1][2]);
            dp[i][2] += Math.max(dp[i-1][0], dp[i-1][1]);
        }
        System.out.println(Math.max(dp[n-1][0], Math.max(dp[n-1][1], dp[n-1][2])));
    }
}

Measured memory_bytes: 94640
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define rep(i,a,b) for (int i = a; i < b; i++)
#define repn(i,a,b) for (int i = a; i >=b ;i--)
#define MOD 1000000007


int main(){
ios::sync_with_stdio(0);
cin.tie(0);
   int n;cin>>n;
   map<string,int>mp;
   string s;
   mp["AC"]=0;
   mp["WA"]=0;
   mp["TLE"]=0;
   mp["RE"]=0;
   rep(i,0,n){
       cin>>s;
       mp[s]++;
   } 
   cout<<"AC x "<<mp["AC"]<<"\n";
   cout<<"WA x "<<mp["WA"]<<"\n";
   cout<<"TLE x "<<mp["TLE"]<<"\n";
   cout<<"RE x "<<mp["RE"]<<"\n";
 
return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {
    template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
    template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
    template<typename T> void chadd(T& a, T b) { a = a + b; }

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t sz;
        inp(std::size_t _sz = 1) : sz(_sz) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { std::vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
    };

    // 2次元用の標準入出力
    template<typename T>
    struct inpn {
        std::size_t szi, szj;
        inpn(std::size_t _szi, std::size_t _szj) : szi(_szi), szj(_szj) {}
        operator std::vector<std::vector<T>>() const {
            std::vector<std::vector<T>> a(szi, std::vector<T>(szj));
            for (std::size_t i = 0; i < szi; ++i)
                for (std::size_t j = 0; j < szj; ++j) cin >> a[i][j];
            return a;
        }
    };

    inp inp1; // input one

    template<typename T>
    std::map<T, T> Factorize2Map(T x) {
        if (x <= 1) return std::map<T, T>();
        std::map<T, T> mp;
        for (T i = 2; i * i <= x; ++i) {
            while (x % i == 0) {
                x /= i;
                mp[i]++;
            }
        }
        if (x != 1) {
            mp[x]++;
        }
        return mp;
    }
}


int main() {

    ll n, p;
    cin >> n >> p;

    auto fact = Factorize2Map<ll>(p);

    ll ans = 1LL;

    for (auto m : fact) {
        ll cnt = m.second / n;
        rep(i, cnt) ans *= m.first;
    }

    Cout(ans);

    //// std::gcdのコンパイルが通るか試したかっただけ

    //int a = 12;
    //int b = 8;
    //int g = gcd(a, b);
    //int l = lcm(a, b);

    return 0;
}

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

#define SIZE 200001

using namespace std;

int main() {
    long  long int i,j,k,M,K,Q;
    long  long int X,N,Y,Z,nb;
    long  long int A[SIZE],B[SIZE];
// XOR =  ^
    cin >> N;
    for (i=0;i<N;i++)
      cin >> A[i];
   long long int somme;

   somme = 0;
   for (i=0;i<N;i++)
     somme = somme ^ A[i];
  for (i=0;i<N;i++)
     B[i] = A[i] ^ somme;

   for (i=0;i<N-1;i++)
    cout << B[i] << " ";
  cout << B[N-1] << endl;


  return 0;

}


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

int main() {
  ios::sync_with_stdio(false);

  int n;
  cin >> n;

  vector<pair<int, int>> v;
  int x, y;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    v.push_back(pair<int, int>(x, y));
  }

  sort(v.begin(), v.end(), [&v](pair<int, int> pl, pair<int, int> pr) {
    if (pl.first != pr.first) {
      return pl.first < pr.first;
    }
    return pl.second < pr.second;
  });

  for (int i = 0; i < n; i++) {
    cout << v[i].first << " " << v[i].second << endl;
  }
}




Measured memory_bytes: 3896
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>

using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> vec(n);
    for(int i=0;i<n;i++){
        cin >> vec[i];
    }
    vector<int> reg(n);
    reg[n-1]=0;
    for(int i=n-1;i>0;i--){
        if(vec[i-1]>=vec[i]){
            reg[i-1]=reg[i]+1;
        }else{
            reg[i-1]=0;
        }
    }
    int Max=0;
    for(int i=0;i<n;i++){
        Max = max(Max,reg[i]);
    }
    cout<<Max<<endl;
}

Measured memory_bytes: 1024
def solve():
    k = int(input())
    val = 7
    mod = 0
    for i in range(k+1):
        if (val+mod) % k == 0:
            print(i+1)
            return
        mod = (mod+val) % k
        val *= 10
        val %= k
    print(-1)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 9168
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <numeric>
#include <string>
#include <type_traits>
#include <vector>
using namespace std;

int main() {
  int r;
  cin >> r;
  cout
      << 2 * r *
             3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651
      << endl;
}

Measured memory_bytes: 3780
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<algorithm>
#define LL long long
#define Db double
#define ls (rt<<1)
#define rs ((rt<<1)+1)
using namespace std;
void Exgcd(int a,int b,int &g,int &x,int &y){
	if (!b){
		g=a; x=1; y=0; return;
	}
	Exgcd(b,a%b,g,y,x); y-=(a/b)*x;
}
int Gcd(int a,int b){
	if (!b) return a;
	return Gcd(b,a%b);
}



int A[202020];
int main(){
	int n;
	Db sum=0;
	cin>>n;
	for (int i=1;i<=n;i++) 
		scanf("%d",&A[i]),sum+=(Db)A[i];
	sum/=n;
	Db Min=21001010; int ans=0;
	for (int i=1;i<=n;i++)
		if (fabs(A[i]-sum)<Min)
			ans=i,Min=fabs(A[i]-sum);
	cout<<ans-1;	
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;

int main() {
	string a, b, c;
	cin >> a >> b >> c;
	string ans = "NO";
	if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0])ans = "YES";
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
program main
  implicit none
  integer :: n, i, x
  integer, allocatable :: h(:)
  read (*, *) n
  allocate (h(n))
  read (*, *) h(:)
  x = h(n)
  do i = n - 1, 1, -1
    if (h(i) <= x) then
      continue
    else if (h(i) == x + 1) then
      h(i) = x
    else
      write (*, "(a)") "No"
      stop
    end if
    x = h(i)
  end do
  write (*, "(a)") "Yes"
end program main


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll a[6],f;
ll i, j,ans;
int main(){
    fornum(i,0,5){
        scanf("%lld", &a[i]);
        if(a[i]%10!=0&&a[i]%10<a[j]%10){
            j = i;
        }
    }
    fornum(i,0,5){
        if(i!=j){
            ans += a[i] / 10 * 10 + (a[i] % 10 ? 10 : 0);
        }
    }
    printf("%lld",ans+a[j]);
    return 0;
}

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

int main()
{
	int n, m;
	cin >> n >> m;
	
	int a=1;
	int b=0;
	
	for(int i=1; i<=n; i++)
	{
		int h;
		cin >> h;
		
		b+=h;
		if(b<=m)
			a++;
	}
	cout << a << endl;
	return 0;
 } 

Measured memory_bytes: 256
# @author 

import sys

class BKleeneInversion:
    def solve(self):
        MOD = 10 ** 9 + 7

        n, k = [int(_) for _ in input().split()]
        a = [int(_) for _ in input().split()]
        s = [0] * n
        t = [0] * n
        for i in range(n):
            for j in range(i):
                if a[j] < a[i]:
                    t[i] += 1
            for j in range(i + 1, n):
                if a[j] < a[i]:
                    s[i] += 1
                    t[i] += 1

        # print(s, t)

        ans = k * sum(s) + k ** 2 * sum(t) - (k * (k + 1)) * sum(t) // 2
        ans %= MOD
        print(ans)

solver = BKleeneInversion()
input = sys.stdin.readline

solver.solve()


Measured memory_bytes: 40560
#include<iostream>
#include<cstdio>
#include<cmath>

using namespace std;

double x;
double y;

int main(void){
	while(1){
		x=1,y=0;
		int n;
		cin >> n;
		if(n==-1)break;
		for(int i=1;i<n;i++){
			double dx=-y/sqrt(x*x+y*y);
			double dy=x/sqrt(x*x+y*y);
			x+=dx;
			y+=dy;
		}
		printf("%0.5f\n%0.5f\n",x,y);
	}
    return 0;
}

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

int main(){
  int n,x;
  cin >> n >> x;
  int L[n];
  for (int i = 0; i < n;i++){
    cin >> L[i];
  }
    int ans = 1;
  int sum = 0;
  for (int i = 0; i < n;i++){
    sum += L[i];
    if(sum<=x){
      ans++;
    }else{
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


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

#define ll long long
#define mst(a) memset(a, 0, sizeof a)

const int mod = 1e9+7;
const int maxn = 550;
const int maxm = 2e5+50;
const int inf = 1e9;

int block[maxn];
int a[maxn][maxn];
int b[maxn][maxn];
struct node
{
    int l, r;
    int id;
    friend bool operator < (node a, node b)
    {
        if (block[a.l] != block[a.r]) return block[a.l] < block[b.l];
        return a.r < b.r;
    }
} st[maxm];
int ans[maxm];

int main()
{
    int n, m, q;
    scanf("%d %d %d", &n, &m, &q);
    int B = sqrt(n + 0.5);
    for (int i = 1; i <= n; ++i)
        block[i] = i / B;
    for (int i = 0; i < m; ++i)
    {
        int l, r;
        scanf("%d %d", &l, &r);
        a[l][r] ++;
        if (l != r) a[r][l] ++;
    }
    for (int i = 1; i <= n; ++i)
    {
        b[i][i] = a[i][i];
        for (int j = i+1; j <= n; ++j)
            b[i][j] = b[i][j-1] + a[i][j];
        for (int j = i-1; j >= 1; --j)
            b[i][j] = b[i][j+1] + a[i][j];
    }
    for (int i = 0; i < q; ++i)
    {
        st[i].id = i;
        scanf("%d %d", &st[i].l, &st[i].r);
    }
    sort(st, st + q);
    int L = 1, R = 0;
    int sum = 0;
    for (int i = 0; i < q; ++i)
    {
        while (R < st[i].r) sum += b[++R][L];
        while (L > st[i].l) sum += b[--L][R];
        while (R > st[i].r) sum -= b[R--][L];
        while (L < st[i].l) sum -= b[L++][R];
        ans[st[i].id] = sum;
    }
    for (int i = 0; i < q; ++i)
        printf("%d\n", ans[i]);
    return 0;
}

Measured memory_bytes: 5760
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.OutputStream;
public class Main {
    public static void main(String args[]) {
        Sc sc = new Sc(System.in);
        String s = sc.n();
        boolean fc = false;
        boolean ff = false;
        for(int i = 0; i<s.length(); i++) {
            if(!fc) {
                if(s.charAt(i) == 'C') fc = true;
            } else if(s.charAt(i) == 'F') ff = true;
        }
        if(ff&&fc) System.out.println("Yes");
        else System.out.println("No");
    }
}
class Sc {
    public Sc(InputStream i) {
        r = new BufferedReader(new InputStreamReader(i));
    }

    public boolean hasM() {
        return peekToken() != null;
    }

    public int nI() {
        return Integer.parseInt(nextToken());
    }

    public double nD() { 
        return Double.parseDouble(nextToken());
    }

    public long nL() {
        return Long.parseLong(nextToken());
    }

    public String n() {
        return nextToken();
    }

    private BufferedReader r;
    private String line;
    private StringTokenizer st;
    private String token;

    private String peekToken() {
        if (token == null) 
            try {
                while (st == null || !st.hasMoreTokens()) {
                    line = r.readLine();
                    if (line == null) return null;
                    st = new StringTokenizer(line);
                }
                token = st.nextToken();
            } catch (IOException e) { }
        return token;
    }

    private String nextToken() {
        String ans = peekToken();
        token = null;
        return ans;
    }
}

Measured memory_bytes: 8148
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )
#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

#include <complex>
typedef complex<double> Point;
const double EPS = 1e-8;

// テ・ツ?・テ・ツ環崚」ツつケテ」ツδ暗」ツδェテ」ツδシテ」ツδ?」ツ?凝」ツつ嘉・ツョツ淌ヲツ閉ーテ、ツコツ古」ツ?、テ」ツつ津」ツ?ィテ」ツ?」テ」ツ?ヲ Point テ」ツ?ク
istream& operator >> ( istream &s, Point &a )
{
	double r, i;
	s >> r >> i;
	a = Point( r, i );
	return s;
}

// テ・ツ債佚、ツスツ催」ツδ凖」ツつッテ」ツδ暗」ツδォ
Point unitVector( const Point &a )
{
	return a / abs( a );
}

// テヲツウツ陛ァツキツ堙」ツδ凖」ツつッテ」ツδ暗」ツδォ
Point normalVector1( const Point &a )
{
	return a * Point( 0, 1 );
}
Point normalVector2( const Point &a )
{
	return a * Point( 0, -1 );
}
Point ( *normalVectors[] )( const Point& ) = { normalVector1, normalVector2 };

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

	for ( int n; cin >> n, n; )
	{
		vector<Point> ps( n );
		REP( i, 0, n )
		{
			cin >> ps[i];
		}

		int res = 1;
		REP( i, 0, n )
		{
			REP( j, 0, i )
			{
				const Point &a = ps[i], &b = ps[j];
				if ( 2 + EPS < abs( a - b ) )
				{
					continue;
				}
				REP( k, 0, 2 )
				{
					const Point c = ( a + b ) / Point( 2, 0 ) + unitVector( normalVectors[k]( a - b ) ) * sqrt( 1 - pow( abs( a - b ) / 2., 2. ) );
					int tmp = 2;
					REP( l, 0, n )
					{
						if ( l == i || l == j )
						{
							continue;
						}
						tmp += abs( c - ps[l] ) <= 1. + EPS;
					}
					res = max( res, tmp );
				}
			}
		}
		cout << res << endl;
	}

	return 0;
}

Measured memory_bytes: 1268
#include "bits/stdc++.h"
using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> city(M);
    for(int i = 0; i < M; i++){
        cin >> city.at(i).first >> city.at(i).second;
    }

    vector<int> sum(N, 0);
    for(int i = 0; i < M; i++){
        sum.at(city.at(i).first - 1)++;
        sum.at(city.at(i).second - 1)++;
    }

    for(int i = 0; i < N; i++){
        cout << sum.at(i) << endl;
    }
}

Measured memory_bytes: 256