akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int i[500][500];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a,b,c,d=0,e=1,f=0;
  char s;
  cin >>s;
  if(s=='a'||s=='e'||s=='i'||s=='o'||s=='u') cout <<"vowel\n";
  else cout <<"consonant\n";
  return (0);
}


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

using namespace std;

long long poww(int t){
    long long res = t;
    for(int i = 0; i < 4; i++)
        res *= t;
    return res;
}

void Solve(){
    string s;
    cin>>s;
    if(s == "ABC") cout<<"ARC"<<endl;
    else cout<<"ABC"<<endl;

}
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T = 1;
    //cin>>T;
    while(T--){
        Solve();
    }
}

Measured memory_bytes: 3624
loop do
  n = gets.to_i
  break if n==0
  m = gets.to_i
  table = Array.new(n){ Array.new(n){Float::INFINITY} }
  m.times do
    a,b,l = gets.split(",").map(&:to_i)
    table[a][b] = table[b][a] = l
  end
  length = table[0]
  cnt = 0
  a = [0]
  (n-1).times do
    l = length.min
    cnt += l/100 - 1
    i = length.index(l)
    a << i
    (1..(n-1)).each do |j|
      next if a.include?(j)
      length[j] = [length[j], table[i][j]].min
    end
    length[i] = Float::INFINITY
  end
  puts cnt
end

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N;
    cin >> N;
    Vl A(N + 1);
    for (ll i = 0; i < N; i++) {
        ll a;
        cin >> a;
        A[a] = i + 1;
    }
    set<ll> st;
    st.emplace(0);
    st.emplace(N + 1);
    ll ans = 0;
    for (ll i = 1; i <= N; i++) {
        auto res = st.emplace(A[i]);
        auto itr = res.first;
        ll a, b, c;
        b = *itr;
        --itr;
        a = *itr;
        advance(itr, 2);
        c = *itr;
        ans += i * (b - a) * (c - b);
    }
    cout << ans << "\n";
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

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

int main(){
  string s;
  cin >> s;
  int n,i;
  n=s.size()+1;
  vector<int> a(n,0);
  for(i=1;i<=n-2;i++){
    if(s.at(i-1)=='<'&&s.at(i)=='<'){
      a.at(i)=a.at(i-1)+1;
    }
  }
  for(i=n-2;i>=1;i--){
    if(s.at(i-1)=='>'&&s.at(i)=='>'){
      a.at(i)=a.at(i+1)+1;
    }
  }
  
  if(s.at(0)=='>'){
    a.at(0)=a.at(1)+1;
  }
  if(s.at(n-2)=='<'){
    a.at(n-1)=a.at(n-2)+1;
  }
  
  for(i=1;i<=n-2;i++){
    if(s.at(i-1)=='<'&&s.at(i)=='>'){
      a.at(i)=max(a.at(i-1),a.at(i+1))+1;
    }
  }
  
  long int x=0;
  for(i=0;i<=n-1;i++){
    x=x+a.at(i);
  }
  
  cout << x << endl;
}

Measured memory_bytes: 2820
let NT: [Int] = readLine()!.split(separator: " ").map { Int($0)! }
var res = Int(1e5)
var can = false
for _ in 1...NT[0] {
    let ct: [Int] = readLine()!.split(separator: " ").map { Int($0)! }
    if ct[1] <= NT[1] {
        can = true
        res = min(res, ct[0])
    }
}
print(can ? res : "TLE") // (๑•ૅㅁ•๑)

Measured memory_bytes: 8236
n, y = gets.split.map(&:to_i)
a = b = c = 0
(0..n).each do |i|
a = i
(0..n).each do |j|
b = j
c = n - a - b
break if c < 0
if 10000 * a + 5000 * b + 1000 * c == y
puts "#{a} #{b} #{c}"
exit
end
end
end

puts "-1 -1 -1"

Measured memory_bytes: 1788
a, b, c, x, y = list(map(int, input().split()))
ans = []
if a + b > 2 * c:
  cost = 0
  mxy = min(x, y)
  cost += mxy * 2 * c
  ans.append(cost + (x - mxy)* a + (y - mxy) * b)
  ans.append(max(x, y) * c * 2)
else:
  ans.append(x * a + y * b)
print(min(ans))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
using ll = long long;

int main() {
  int N, M;
  std::cin >> N >> M;
  int res{0};
  for (int i = 0; i < M; i++) {
    int a;
    std::cin >> a;
    res += a;
  }
  if (res > N)
    std::cout << -1 << std::endl;
  else
    std::cout << (N - res) << std::endl;
  return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int k, a, b;
	cin >> k >> a >> b;
	FOR(i, a, b + 1) if (i % k == 0) {
	  cout << "OK" << endl;
	  return 0;
	}
	cout << "NG" << endl;
    
    return 0;
}


Measured memory_bytes: 3644
n = list(map(int,input().split()))
s = list(input())
for i in s:
    if i == "N":
        n = [n[1],n[5],n[2],n[3],n[0],n[4]]
    elif i == "E":
        n = [n[3],n[1],n[0],n[5],n[4],n[2]]
    elif i == "W":
        n = [n[2],n[1],n[5],n[0],n[4],n[3]]
    elif i == "S":
        n = [n[4],n[0],n[2],n[3],n[5],n[1]]
print(n[0])


Measured memory_bytes: 5600
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();
    int k;
    cin >> k;
    string s;
    cin >> s;

    if (s.size() <= k) {
        cout << s << endl;
    }
    else {
        cout << s.substr(0, k) << "..." << endl;
    }
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;
typedef pair<ll,ll> pairs;
typedef vector<pairs> p;


ll gcd(ll A,ll B){
    if (A%B==0)return(B);
    else return(gcd(B,A%B));
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

vector<vector<ll>> combination(ll n, ll r){
    vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));
    for(ll i=0;i<v.size();++i){
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for(ll i=1;i<v.size();++i){
        for(ll j=0;j<i;++j){
            v[i][j] = (v[i - 1][j - 1] + v[i - 1][j]);
        }
    }
    return v;
}

bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll a[6];
    vector<ll> p(4);
    fill(p.begin(), p.end(), 0);
    for(ll i=0;i<6;++i){
        cin>>a[i];
        p[a[i]-1]++;
    }

    string ans = "YES";
    for(ll i=0;i<4;++i){
        if(p[i] > 2){
            ans = "NO";
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define ll long long
#define pii pair<int,int>

void test_case()
{
    int h,w,k,cnt=0;
    cin>>h>>w>>k;
    string s[h];
    for(int i=0;i<h;i++)
        cin>>s[i];
    for(ll row=0; row < (1<<h); row++) {
        for(ll col=0; col < (1<<w); col++) {
            int black=0;
            for(ll i=0; i<h; i++) {
                if(((row>>i)&1)==0)
                for(ll j=0; j<w; j++)
                    if( ((col>>j)&1)==0 && s[i][j]=='#' ) {
                        black++;
                    if(black>k)
                        break;
                }
                if(black>k)
                        break;
            }
            if(black==k)
                cnt++;
        }
    }
    cout<<cnt;
}

int main()
{
    fastio
//    int t;
//    cin>>t;
//    while(t--)
    test_case();
}


Measured memory_bytes: 3616
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;

int gcd(int x, int y);

const int INF = 1001001001;

/*struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }*/

int main() {
    ull n, a, b;
    cin >> n >> a >> b;
    ull ans = 0;
    if ((b - a) % 2 == 0)
        ans = (b - a) / 2;
    else {
        ans = min(a - 1, n - b) + 1 + (b - a - 1) / 2;
    }

    cout << ans << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

Measured memory_bytes: 256
n = int(input())
A, B, C = [[int(x) for x in input().split()] for _ in range(3)]

ans = 0
for i in range(n):
    ans += B[A[i] - 1]

for i in range(n - 1):
    if A[i + 1] - A[i] == 1:
        ans += C[A[i] - 1]

print(ans)


Measured memory_bytes: 3060
#include<iostream>
#include<math.h>
using namespace std;

int prime (int p){
	int i,flag=0;
	if (p==2){
		return 0;
	}else{
		for (i=2;i<=sqrt(p);i++){
			if (p%i==0){
				flag=1;
				break;
			}
		}
		return flag;
	}
} 

int main(){
	int n,i,p,P=0;
	cin >> n;
	for (i=1;i<=n;i++){
		cin >> p;
		P=P+prime(p);
	}
	cout << n-P << endl;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>=n;i--)
#define INF 999999999
#define pb(a) push_back(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef vector<pii> VP;

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

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

    vector<int> v(N), w(N);
    rep(i,0,N) cin >> v[i] >> w[i];

    int dp[101][10001];
    rep(i,0,N+1) rep(j,0,W+1) dp[i][j] = 0;

    rep(i,0,N) {
        rep(j,0,W+1) {
            if(w[i] > j) dp[i+1][j] = dp[i][j];
            else dp[i+1][j] = max(dp[i][j], dp[i+1][j - w[i]] + v[i]);
        }
    }

    cout << dp[N][W] << endl;
    return 0;
}

Measured memory_bytes: 5140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#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 fi first
#define se second
#define pb push_back
template<class T> inline int chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline int chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1<<29;
const ll LINF = 1LL<<58;

void solve() {
    int k, a ,b;
    cin >> k >> a >> b;
    if (a % k == 0 || (a / k) * k + k <= b) cout << "OK";
    else cout << "NG";
    cout << endl;
    return;
}

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


Measured memory_bytes: 3660
#逆元

def inverse(a,mod): #aのmodを法にした逆元を返す
    return pow(a,mod-2,mod)



#modのn!と、n!の逆元を格納したリストを返す(拾いもの)
#factorialsには[1, 1!%mod , 2!%mod , 6!%mod… , n!%mod] が入っている
#invsには↑の逆元が入っている

def modfac(n, MOD):
 
    f = 1
    factorials = [1]
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    inv = pow(f, MOD - 2, MOD)
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
    return factorials, invs


def modnCr(n,r,mod,fac,inv): #上で求めたfacとinvsを引数に入れるべし(上の関数で与えたnが計算できる最大のnになる)

    return fac[n] * inv[n-r] * inv[r] % mod

S = int(input())

mod = 10**9+7

ans = 0
fac,inv = modfac(S+10,mod)

for N in range(1,S):

    if S - 3*N < 0:
        break

    rem = S - 3*N
    ans += modnCr( rem + N - 1 , N-1 , mod,fac,inv )

print (ans % mod)


Measured memory_bytes: 64548
N = int(input())

A = input().split()  

answer = 1

sort = sorted(A)

for i in range(N) :
    answer = answer * int(sort[i])
    if answer == 0:
        print('0')
        quit()
    if answer > 1000000000000000000 : 
        print('-1')
        quit()


print(answer)     

Measured memory_bytes: 19500
from collections import deque
import sys
input = sys.stdin.readline

r, c = list(map(int, input().split()))
sy, sx = [0, 0]
gy, gx = [r-1, c-1]

s = [list(map(str, list(input()))) for i in range(r)]

N = r*c
G = [[] for _ in range(N)]
dist = [-1]*N
que = deque()
for i in range(r):
    for j in range(c):
        if s[i][j] == '#':
            que.append(i*c+j)
            dist[i*c+j] = 0


while que:
    v = que.popleft()
    d = dist[v]
    for x, y in ([0, 1], [0, -1], [1, 0], [-1, 0]):
        if 0 <= v//c+y <= r-1 and 0 <= (v % c)+x <= c-1:
            w = v+y*c+x
            if dist[w] > -1:
                continue
            dist[w] = d + 1
            que.append(w)

ans = max(dist)
print(ans)


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

using namespace std;
using ll = long long;

int main() {
    ll N = 0;
    cin >> N;
    vector<ll> A(N,0);
    ll sum = 0;
    for(ll i = 0; i < N; i++) {
        cin >> A.at(i);
        sum += A.at(i);
    }
    ll temp_sum = 0;
    ll min_sum = 1000000000000000000;
    for(ll i = 0; i < N; i++) {
        temp_sum += A.at(i)*2;
        min_sum = min(min_sum, abs(sum - temp_sum));
    }
    cout << min_sum << endl;


    return 0;
}

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

int main() {
	int N, K;
	long long ans = pow(2, 63) - 513;
	pair<long long, long long> P[50];
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> P[i].first >> P[i].second;
	}
	for (int i = 0; i < N; i++) {
		for (int j = i; j < N; j++) {
			for (int k = 0; k < N; k++) {
				for (int l = k; l < N; l++) {
					long long xl = min(P[i].first, P[j].first), xr = max(P[i].first, P[j].first);
					long long yu = min(P[k].second, P[l].second), yd = max(P[k].second, P[l].second);
					int count = 0;
					for (int m = 0; m < N; m++) {
						if (xl <= P[m].first && P[m].first <= xr && yu <= P[m].second && P[m].second <= yd) count++;
					}
					if (count >= K) ans = min(ans, (xr - xl) * (yd - yu));
				}
			}
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

ans = A
for k in range(K):
    temp = [0 for _ in range(N)]
    for i in range(N):
        a = ans[i]
        temp[max(i-a, 0)] += 1
        if i + a + 1 < N:
            temp[i+a+1] -= 1

    ans[0] = temp[0]
    for j in range(1, N):
        ans[j] = ans[j-1] + temp[j]

    if ans.count(N) == N:
        break

for i in range(N):
    print(ans[i], end=" ")

Measured memory_bytes: 161580
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
using namespace std;
int ans[100000];
int main(){
	for(int i=0;i<100000;i++){
		ans[i]=0;
	}
	string S;
	cin>>S;
	int rb,re,lb,le;
	int count=0;
	bool rr=true;
	rb=0;
	for(int i=0;i<S.size();i++){
		if(rr==true){
			if(S[i]=='L'){
				rr=false;re=i-1;lb=i;
			}
		}
		else{
			if(S[i]=='R'){
				rr=true;
				le=i-1;
			ans[lb]+=int((le+1-(re%2)+2)/2)-int((rb-(re%2)+2)/2);
			ans[re]+=int((le+1-(lb%2)+2)/2)-int((rb-(lb%2)+2)/2);
			rb=i;
			}
		}
	}
	le=S.size()-2;
	ans[lb]+=int((le+1-(re%2)+2)/2)-int((rb-(re%2)+2)/2);
	ans[re]+=int((le+1-(lb%2)+2)/2)-int((rb-(lb%2)+2)/2);
	if(re%2!=le%2){ans[re]++;}
	else{ans[lb]++;}
	for(int i=0;i<S.size();i++){
		cout<<ans[i];
		if(i!=S.size()){cout<<" ";}
	}
}

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

N, C = [int(x) for x in input().split()]
imos = [0]*(10**6 + 2)
stc = [[] for _ in range(31)]
for _ in range(N):
    tmp = [int(x) for x in input().split()]
    stc[tmp[2]].append([tmp[0], tmp[1]])

for i in range(C + 1):
    if len(stc[i]) == 0:
        continue
    stc[i].sort()
    s, t = stc[i][0][0], stc[i][0][1]
    new_stc_i = []
    flag = 1
    for j in range(1, len(stc[i])):
        flag = 0
        if t == stc[i][j][0]:
            t = stc[i][j][1]
            flag = 1
        else:
            new_stc_i.append([s, t])
            s = stc[i][j][0]
            t = stc[i][j][1]
    if flag:
        new_stc_i.append([s, t])
    stc[i] = new_stc_i

for i in range(C + 1):
    stc_i = stc[i]
    for j in stc_i:
        s, t = j 
        s *= 10
        t *= 10
        imos[max(0, s - 5)] += 1
        imos[t] -= 1

from itertools import accumulate

csum = list(accumulate(imos))

print(max(csum))

Measured memory_bytes: 115420
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define loop(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;
using ll = int64_t;

int main(){
    int n;ll d; cin >> n >> d;
    int ans = 0;
    rep(i, n) {
        ll x, y; cin >> x >> y;
        if(x*x + y*y <= d*d) ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>

using namespace std;

string s[8] = {"black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white"};

int main(){
	
	string str;
	
	while(true){
		cin >> str;
		if(str[0] == '0'){
			break;
		}
		int ans = 0;
		if(str[1] < '0' || str[1] > '7'){
			ans += 4;
		}
		if(str[3] < '0' || str[3] > '7'){
			ans += 2;
		}
		if(str[5] < '0' || str[5] > '7'){
			ans += 1;
		}
		cout << s[ans] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1192
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("0"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

const string st = ".#";

int f(deque<int>& a) {
  string s, t;
  rep(i,sz(a)) {
    s += st[a[i]&1];
    t += st[a[i]>>1&1];
  }
  cout<<s<<endl;
  cout<<t<<endl;
  cin >> s;
  if (s == "end") return -1;
  return s == "T";
}

int main() {
  int n;
  scanf("%d",&n);
  deque<int> a;
  rep(i,n) {
    a.pb(0);
    for (; a.back() < 4; ++a.back()) {
      int res = f(a);
      if (res == -1) return 0;
      if (res) break;
    }
    if (a.back() == 4) {
      a.pop_back();
      break;
    }
  }
  rep(i,n) {
    a.push_front(0);
    for (; a[0] < 4; ++a[0]) {
      int res = f(a);
      if (res == -1) return 0;
      if (res) break;
    }
    if (a[0] == 4) {
      assert(false);
    }
  }
  return 0;
}







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

int main(){
	vector<long> height(10);
	for (long i = 0; i < 10; i++) cin >> height[i];
	sort(height.begin(), height.end());
	cout << height[9] << endl;
	cout << height[8] << endl;
	cout << height[7] << endl;
	return 0;
}

Measured memory_bytes: 1208
#if 0
date +%Y.%m.%d

题解先咕着。
#endif
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long lolong;

inline int input() { int x; scanf("%d", &x); return x; }

const int maxn = 100005;
char s[maxn], t[maxn];
std::vector<int> pos[26];

int main() {
	scanf("%s", s);
	scanf("%s", t);
	int n = int(strlen(s));
	int m = int(strlen(t));

	for(int i = 0; i < n; i ++)
		pos[s[i] - 'a'].push_back(i);

	int a = 0, b = 0;
	for(int i = 0; i < m; i ++) {
		auto it = std::lower_bound(pos[t[i] - 'a'].begin(), pos[t[i] - 'a'].end(), b);
		if(it == pos[t[i] - 'a'].end()) {
			a ++;
			b = 0;
			it = std::lower_bound(pos[t[i] - 'a'].begin(), pos[t[i] - 'a'].end(), b);
			if(it == pos[t[i] - 'a'].end()) {
				puts("-1");
				return 0;
			}
		}
		b = *it + 1;
		if(b == n + 1) {
			a ++;
			b = 0;
		}
	}

	printf("%lld\n", 1ll * a * n + b);
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;


int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  int N, C, K; cin >> N >> C >> K;
  vector<int> T(N);
  for (int i = 0; i < N; i++) cin >> T.at(i);
  sort(T.begin(), T.end());
  int cnt = 0;
  int i = 0;
  while (i < N) {
    int st = T.at(i);
    int j = 1;
    for ( ; j < C && i + j < N && T.at(i + j) <= st + K; j++);
    cnt++;
    i += j;
  }
  cout << cnt << endl;

  return 0;
}



Measured memory_bytes: 640
#include <string>
#include <iostream>
#include <cinttypes>

using namespace std;

int main()
{
	string str;
	cin >> str;

	uint64_t size = str.size();

	uint64_t count = 0;
	uint64_t shift = 0;
	for (int i = 0; i < size; i++) {
		if (str[i] == 'B') {
			count++;
			shift += (size - i);
		}
	}

	cout << (shift - (count * (count + 1) / 2)) << endl;

	return 0;
}


Measured memory_bytes: 640
from collections import defaultdict as dd

N,M = map(int,input().split())
check = dd(int)
edge = []
res = 0
dist = [[10**18]*N for _ in range(N)]
for i in range(M):
    p,q,c = map(int,input().split())
    dist[p-1][q-1] = c
    dist[q-1][p-1] = c
    edge.append((p-1,q-1,c))
    check[(max(p-1,q-1),min(p-1,q-1))] = 1
for i in range(N):
    dist[i][i] = 0

for i in range(N):
    for j in range(N):
        for k in range(N):
            if dist[j][k] > dist[j][i]+dist[i][k]:
                dist[j][k] = dist[j][i] + dist[i][k]

for now in edge:
    for s in range(N):
        for t in range(N):
            if dist[s][t] == dist[s][now[0]] + now[2] + dist[now[1]][t]:
                check[(max(now[0],now[1]),min(now[0],now[1]))] = 0
for v in check.items():
    res += v[1]
    #print(v[0])
print(res)

Measured memory_bytes: 74532
/*
 ***
 Question Name:
 ***
 Question Link:
 
 ***
 Idea:
 */

#include <memory.h>
#include <iomanip>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>

#define REP(i,s,n) for(int (i)=s; (i)<(int)(n);(i)++)
#define RIT(it,c) for(__typeof(c.begin()) it = c.begin();it!=c.end();it++)
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)(x).size()
#define MSET(m,v) memset(m,v,sizeof(m))

using namespace std;

typedef long long LL;
typedef long double LD;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<LL> vL;
typedef vector<bool> vb;
typedef unordered_set<int> ui;
typedef pair<LL,LL> pLL;

int main(){
    int m,n;
    cin>>m>>n;
    cout<<(m-1)*(n-1)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

bool check(string t){
    int left = 0, right = t.size()-1;
    while(left < right){
        if (t[left++] != t[right--]) return false;
    }
    return true;
}

int main(){
    string s;
    cin >> s;
    if (check(s)){
        cout << 0 << endl;
        return 0;
    }
    string t = "";
    rep(i, s.size()){
        if (s[i] != 'x') t += s[i];
    }
    if (!check(t)){
        cout << -1 << endl;
        return 0;
    }

    string t_half = "";
    rep(i, (t.size()+1)/2) t_half += t[i];
    int i = 0, left = -1;
    while(i < t_half.size()){
        left++;
        if (s[left] == t_half[i]) i++;
    }
    int right;
    if (t.size() % 2 == 0){
        right = left+1;
        while(s[right] == 'x'){
            right++;
        }
    } 
    else{
        right = left;
    } 
    int ans = 0;
    while(true){
        if (left < 0) break;
        if (right >= s.size()) break;
        if (s[left] == s[right]){
            left--; right++;
        }else if (s[left] == 'x'){
            ans++;
            left--;
        }else if (s[right] == 'x'){
            ans++;
            right++;
        }
    }
    if (left >= 0) ans += left+1;
    if (right < s.size()) ans += s.size() - right;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3756
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var ab = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			Console.WriteLine((ab[0] + ab[1]) % 24);
		}
	}
}

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

int main()
{
    ll n, m;
    cin >> n >> m;

    vector<ll> h(n);
    for(int i = 0; i < n; i++)
    {
        cin >> h[i];
    }

    vector<ll> a(m), b(m);
    for(int i = 0; i < m; i++)
    {
        cin >> a[i] >> b[i];
    }

    set<ll> bad;
    for(int i = 0; i < m; i++)
    {
        ll ai = a[i] - 1;
        ll bi = b[i] - 1;
        if(h[ai] > h[bi])
        {
            bad.insert(b[i]);
        }
        else if(h[ai] < h[bi])
        {
            bad.insert(a[i]);
        }
        else
        {
            bad.insert(a[i]);
            bad.insert(b[i]);
        }
    }

    cout << n - bad.size();


    return 0;
}

Measured memory_bytes: 8272
#include <iostream>
#include <stdio.h>
#include <stdint.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <string>
#include <math.h>
#include <time.h>
#include <algorithm>
#include <deque>

using namespace::std;

int ri()
{
	int x;
	scanf("%d", &x);

	return x;
}

int64_t ri64()
{
	int64_t x;
	scanf("%lld", &x);

	return x;
}

void wi(int x)
{
	printf("%d\n", x);
}

void wvi(vector<int> &v)
{
	for (int i = 0; i < v.size(); i++)
		printf("%d ", v[i]);
	printf("\n");
}

void dbg(string &str, int x)
{
	cout << str << ": ";
	wi(x);
}

void dbg(string &str, vector<int> &x)
{
	cout << str << ": ";
	wvi(x);
}

int main()
{
	int N = ri();	
	
	int n = 8 * N + 1;
	int m = (int) (sqrt((double) n));
	
	if (n != (m * m))	
	{
		cout << "No" << endl;
		return 0;
	}	

	int k = (m + 1) / 2;

	vector<vector<int> > A(k);
	
	int c = 1;
	for (int i = 0; i < k; i++)
	{
		for (int j = i + 1; j < k; j++)
		{
			A[i].push_back(c);
			A[j].push_back(c);

			c++;
		}
	}

	cout << "Yes" << endl;
	cout << k << endl;
	
	for (int i = 0; i < k; i++)
	{
		cout << A[i].size() << " ";
		for (int j = 0; j < A[i].size(); j++)
			cout << A[i][j] << " ";
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 2304
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#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>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main (){
    int n;
    cin>>n;
    vector<ll> v(3*n);
    rep(i,0,3*n)cin>>v[i];
    Sort(v);
    reverse(all(v));
    ll ans=0;
    for(int i=1;i<2*n;i+=2)ans+=v[i];
    cout<<ans<<endl;
}

/*

*/


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

typedef unsigned long long ull;
typedef long long ll;
typedef double db;

#define mem(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define mk make_pair
#define pi pair<int,int>
#define vi vector<int>
#define pL pair<ll,ll>
#define vL vector<ll>
#define vp vector<pi>
#define vpL vector<pL>
#define pi3 pair<int, pi>
#define pi4 pair<pi, pi>

const int MX=300000+10;
const ll mod=998244353;

int bos[MX];

int BOSS(int x)
{
    if(bos[x]==x) return x;
    return bos[x]=BOSS(bos[x]);
}

int main()
{
    FasterIO;

    int n, m; cin>>n>>m;

    for(int i=1; i<=n; i++) bos[i]=i;

    for(int i=1; i<=m; i++)
    {
        int a, b; cin>>a>>b;
        int x=BOSS(a), y=BOSS(b);
        if(x!=y) bos[x]=y;
    }

    int cn=0;
    for(int i=1; i<=n; i++) if(bos[i]==i) cn++;

    cout<<cn-1<<endl;

    return 0;
}


Measured memory_bytes: 4028
let (>>=) x f = match x with None -> None | Some x -> f x

let rec rm_rightest temp i = function
  | [] -> None
  | b::bs -> 
     if i = b then Some (b, List.fold_left (fun acc b -> b::acc) bs temp) 
     else rm_rightest (b::temp) (i - 1) bs

let solve bs n =
  let rec inner ans n = function
    | [] -> Some ans
    | bs ->
(*       print_string "n: "; print_endline @@ string_of_int n;
       print_string "bs: "; List.iter (fun n -> print_int n; print_string "; ") bs;
       print_endline ""; *)
       rm_rightest [] n bs >>= fun (b, bs) ->
(*       print_string "b, bs: "; print_int b; print_string " | ";
       List.iter(fun n -> print_int n; print_string "; ") bs;
       print_endline "";*)
       inner (b::ans) (n - 1) bs
  in inner [] n bs

let print_result = function
  | None -> print_int (-1)
  | Some ans -> List.iter (fun n -> print_int n; print_endline "") ans

let _ =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let bs = ref [] in
  for i = 0 to n - 1 do
    Scanf.scanf (if i <> n - 1 then "%d " else "%d\n") (fun b -> bs := b::!bs)
  done;
  solve !bs n
  |> print_result

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main(){
        int n;
        long keep,ans=0;

        cin>>n;
        for(int i=0; i<n; i++){
                long a;
                cin>>a;
                if(i!=0 && keep>=a) {
                        ans+=keep-a;
                        a=keep;
                }
                keep=a;
        }

        cout<<ans<<endl;

        return 0;
}

Measured memory_bytes: 3636
# include<bits/stdc++.h>
using namespace std;
int main(){
	int a, b, c;
    cin >> a >> b >> c;
    int t = max(a,max(b,c));
    if(a == t) cout << (c*b)/2<<'\n';
    else if(b == t) cout << (a*c)/2 <<'\n';
    else cout << (a*b)/2 <<'\n';

	return 0;
}

Measured memory_bytes: 256
// B.

#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <vector>

using namespace std;

class BIT {
	std::vector<int> bit;
	int size;
public:
	BIT() { }
	BIT(int sz) { init(sz); }
	void init(int sz) {
		bit = std::vector<int>((size = sz) + 1);
	}
	int sum(int i) {
		int s = 0;
		while (i > 0) {
			s += bit[i];
			i -= i & -i;
		}
		return s;
	}
	void add(int i, int x) {
		while (i <= size) {
			bit[i] += x;
			i += i & -i;
		}
	}
};

int main(int argc, char *argv[])
{
	int n, m;
	cin >> n >> m;
	BIT x(150000);
	for (int i = 0; i < m; ++i) {
		int a, b;
		cin >> a >> b;
		x.add(a, 1);
		x.add(b, 1);
	}
	bool ans = true;
	for (int i = 2; i <= n; ++i) {
		if ((x.sum(i) - x.sum(i-1)) % 2) {
			ans = false;
		}
	}
	cout << (ans ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 896
N,M = map(int,input().split())
dp = [0]*(N+1)
li = []
kaku = [0]*(N+1)
dpp = [0]*(N+1)
count =0
for m in range(M):
    p,s = input().split()
    p = int(p)
    li.append([p,s])
    
for i in li:
    if i[1]=="WA":
        dp[i[0]] += 1
    
    else:
        if dpp[i[0]] ==0:
            dpp[i[0]]=1
            kaku[i[0]] = dp[i[0]]


print(sum(dpp),sum(kaku))

Measured memory_bytes: 67928
k = input()
d = int(input())
mod = 10**9+7

dp = [[[0]*2 for i in range(d)] for j in range(len(k)+1)]

dp[0][0][1] = 1
for i in range(len(k)):
    s = int(k[i])
    for j in range(10):
        for m in range(d):
            if s == j:
                dp[i+1][(m+j)%d][1] += dp[i][m][1]
                dp[i+1][(m+j)%d][1] %= mod
            elif s > j:
                dp[i+1][(m+j)%d][0] += dp[i][m][1]
                dp[i+1][(m+j)%d][0] %= mod
            dp[i+1][(m+j)%d][0] += dp[i][m][0]
            dp[i+1][(m+j)%d][0] %= mod

print((sum(dp[-1][0])-1)%mod)

Measured memory_bytes: 129500
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int h,w;
    char c[105];
    cin >> h >> w;
    FOR(i,0,h){
        FOR(j,0,w){
            cin >> c[j];
        }
        FOR(j,0,w){
            cout << c[j];
        }
        cout << endl;
        FOR(j,0,w){
            cout << c[j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
number=input().rstrip()
number=int(number)
mochi=[input().rstrip() for i in range(number)]
mochi=list(map(int,mochi))
mochi.sort()
#print(mochi)
count=1
for i in range(number-1):
    if mochi[i]<mochi[i+1]:
        count+=1
print(count)

Measured memory_bytes: 3060
flag = 1
all_tes_date = []
jag = []
while flag:
    tes_date = [int(tes) for tes in input().split()]
    if tes_date == [-1,-1,-1]:
        flag = 0
    else:
        all_tes_date.append(tes_date)

for tes_jag in all_tes_date:
    if (tes_jag[0] + tes_jag[1]) > 79:
        jag.append('A')
    elif (tes_jag[0] + tes_jag[1]) > 64:
        jag.append('B')
    elif ((tes_jag[0] + tes_jag[1]) > 49):
        jag.append('C')
    elif (tes_jag[0] + tes_jag[1]) > 29 and not(tes_jag[0] == -1) and not(tes_jag[1] == -1):
        if tes_jag[2] > 49:
            jag.append('C')
        else:
            jag.append('D')
    elif ((tes_jag[0] + tes_jag[1]) < 30) or (tes_jag[0] == -1) or (tes_jag[1] == -1):
        jag.append('F')
        
for jag_rs in jag:
    print(jag_rs)


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

int main()
{
    string S; cin >> S;
    const auto N = int(S.size());

    auto possible = vector<bool>(N+6);
    possible[0] = true;
    for (auto i = 0; i < N; i++) if (possible[i])
    {
        for (const auto& s : {"dream", "dreamer", "erase", "eraser"})
        {
            const auto n = strlen(s);
            if (S.substr(i, n) == s)
                possible[i+n] = true;
        }
    }

    cout << (possible[N] ? "YES" : "NO") << endl;
}


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

    using namespace std;
     
    int main(){
    	int a, b;
    	scanf("%d %d", &a, &b);
    	if(a>9 || b>9){
    		printf("-1");
    	}else{
    		printf("%d", a*b);
    	}
    	
    	return 0;
    }

Measured memory_bytes: 256
#include <iostream>
int main(){
	std::string S;
	std::cin>>S;
	int count0=0,count1=0;
	for(int i=0;i<S.size();++i){
		if(S[i]=='0'){
			count0++;	
		}else{
		count1++;
		}
	}
	std::cout<<std::min(count0,count1)*2;
	return 0;
}


Measured memory_bytes: 512
import java.util.*;
import java.math.*;

public class Main {
    static final int MOD = 1_000_000_007; // 10^9+7
    // static final int MAX = 2_147_483_646; // intの最大値
    static final int INF = 1_000_000_000; // 10^9
    static final int MAX = 10_000_000;
    static long[] fact = new long[100];
        public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] ary = new int[n];
        int[] zo = new int[2];
        for(int i = 0;i < n;i++){
            ary[i] = sc.nextInt()%2;
            zo[ary[i]]++;
        }
        if(k==1&&zo[1]==0){
            System.out.println(0);
            return;
        }
        if(k==0&&zo[1]==0){
            System.out.println(pow(2,n));
            return;
        }
        System.out.println(pow(2,n-1));
    }
    static long pow(long a, long n) {
        long ans = 1;
        long m = n;
        while (m > 0) {
            if ((m & 1) == 1)
                ans = ans * a;
            a = a * a;
            m >>= 1;
        }
        return ans;
    }
    
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using llong = long long;
using P = pair<int, int>;
const int inf = 1 << 20;
const int mod = 1e9 + 7;

int main() {
   int n, p;
   cin >> n >> p;
   string s;
   cin >> s;
   if (10 % p == 0) {
      llong ans = 0;
      rep(i, 0, n) {
         if ((s[i] - '0') % p == 0) {
            ans += i + 1;
         }
      }
      cout << ans << endl;
      return 0;
   }
   vector<int> d(n + 1);
   int ten = 1;
   rrep(i, n - 1, 0) {
      int a = (s[i] - '0') * ten % p;
      d[i] = (d[i + 1] + a) % p;
      ten *= 10;
      ten %= p;
   }
   vector<int> cnt(p);
   llong ans = 0;
   rrep(i, n, 0) {
      ans += cnt[d[i]];
      cnt[d[i]]++;
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 1412
#include<stdio.h>

int main(void){
   int i=0,n=0;
   int a[10000];
   for(i=0;i<10000;i++){
    scanf("%d",&a[i]);
       if(a[i]==0)
       break;
       
       n++;
   }
   
   for(i=0;i<n;i++)
    printf("Case %d: %d\n",i+1,a[i]);

	return 0;
}


Measured memory_bytes: 2044
#define _DEBUG 1
#define _GLIBCXX_DEBUG

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

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                     \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll N, ll M, std::vector<ll> H, std::vector<ll> A,
           std::vector<ll> B) {
  set<ll> c;
  vector<bool> seen(N, false);

  rep(i, N) { c.insert(i); }

  rep(i, M) {
    seen.at(A.at(i)) = true;
    seen.at(B.at(i)) = true;

    if (H.at(A.at(i)) > H.at(B.at(i))) {
      if (c.count(B.at(i))) {
        c.erase(B.at(i));
      }
    } else if (H.at(A.at(i)) < H.at(B.at(i))) {
      if (c.count(A.at(i))) {
        c.erase(A.at(i));
      }
    } else {
      if (c.count(A.at(i))) {
        c.erase(A.at(i));
      }
      if (c.count(B.at(i))) {
        c.erase(B.at(i));
      }
    }
  }

  ll result = 0;

  rep(i, N) {
    if (!seen.at(i)) {
      result++;
    }
  }
  result += c.size() - result;

  cout << result << endl;
}

int main() {
  ll N;
  scanf("%lld", &N);
  ll M;
  scanf("%lld", &M);
  std::vector<ll> H(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &H[i]);
  }
  std::vector<ll> A(M);
  std::vector<ll> B(M);
  for (int i = 0; i < M; i++) {
    scanf("%lld", &A[i]);
    scanf("%lld", &B[i]);
    A.at(i)--;  // 0-indexed
    B.at(i)--;  // 0-indexed
  }
  solve(N, M, std::move(H), std::move(A), std::move(B));
  return 0;
}


Measured memory_bytes: 10400
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	s = split(chomp(readline()),"")
	t = split(chomp(readline()),"")
	l = length(s)
	f = 0
	for i in 0:l-1
		ff = 0
		for j in 1:l
			if s[(j+i)%l+1] != t[j]
				ff = 1
			end
		end
		if ff == 0
			f = 1
		end
	end
	println(f==1?"Yes":"No")
end

main()

Measured memory_bytes: 109740
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <queue>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <deque>

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int MAXN = 123;
int y[MAXN * 2];

int main() {
    int N;
    while (~scanf("%d", &N)) {
          vector<pii> line;
          for (int i = 1; i <= 2 * N; i++) {
              int x;
              scanf("%d %d", &x, &y[i]);
              line.push_back(make_pair(x, i));
          }
          sort(line.begin(), line.end());
          set<int> st;
          int ans = 0;
          for (auto i : line) {
              if (i.second <= N) st.insert(y[i.second]);
              else {
                  auto tmp = upper_bound(st.begin(), st.end(), y[i.second]);
                  if (!st.empty() && tmp != st.begin()) {
                     ans++;
                     st.erase(prev(tmp));
                  }
              }
          }
          printf("%d\n", ans);
    }
    return 0;
}


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

using namespace std;
typedef long long ll;

const int mod = 1e9 + 7;
#define mad(a, b) a = (a + b) % mod

#define N 200010

ll fac[N], inv[N], ivf[N];

ll c(ll n, ll k) {
    return fac[n] * ivf[n - k] % mod * ivf[k] % mod;
}

int main() {
    fac[0] = ivf[0] = inv[1] = 1;
    for (int i = 1; i < N; ++i) {
        if (i > 1 ) {
            inv[i] = (mod - mod / i * inv[mod % i] % mod) % mod;
        }
        fac[i] = fac[i - 1] * i % mod;
        ivf[i] = ivf[i - 1] * inv[i] % mod;
    }

    ll n, m, k;
    cin >> n >> m >> k;
    ll ans = 0;
    for (int d = 1; d < m; ++d) {
        mad(ans, (m - d) * n * n * d);
    }
    for (int d = 1; d < n; ++d) {
        mad(ans, (n - d) * m * m * d);
    }
    ans = ans * c(n * m - 2, k - 2) % mod;
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 4992
a,b,c,d,e=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
e=int(e)
if a==0:
  print('1')
elif b==0:
  print('2')
elif c==0:
  print('3')
elif d==0:
  print('4')
elif e==0:
  print('5')

Measured memory_bytes: 9184
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();

		int[] was = new int[n];
		boolean[] accepted = new boolean[n];
		int ac = 0;
		int wa = 0;

		for (int i = 0; i < m; i++) {
			int x = sc.nextInt() - 1;
			String s = sc.nextLine();
			if (accepted[x]) continue;
			if (s.contains("AC")) {
				accepted[x] = true;
				wa += was[x];
				ac++;
			} else {
				was[x]++;
			}
		}

		System.out.println(ac + " " + wa);
	}
}


Measured memory_bytes: 154464