akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define N 200010
#define pb push_back
#define fi first
#define se second
#define si size()
#define ll long long
#define mp make_pair
#define iter ::iterator
#define all(v) v.begin(), v.end()
#define pp pop_back
#define mapiter map<int, int>::iterator
#define forn(i, n) for(int i = 0; i < n; ++i)
#define forn1(i, n) for(int i = 1; i <= n; ++i)
#define forr(i, n)	for(int i = n - 1; i >= 0; --i)
#define forr1(i, n)	for(int i = n; i >= 1; --i)
#define form(l, r, i)	for(int i = l; i <= r; ++i)
#define forv(r, l, i)	for(int i = r; i >= l; --i)
#define r0 return 0
#define barnarnar ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lld long double
#define elif else if
#define getb __builtin_popcount

const ll inf = 1e15 + 7;
const lld EPS = 0.00000001;
const ll modw = 1e9 + 7;
 
using namespace std;

ll h[N], a[N];
ll dp[N]; // max beauty if last taken element was i
ll v[4 * N];

void upd(int l, int r, int u, pair<ll, ll> pos)
{
	if(l == r && pos.fi == l)
	{
		v[u] = pos.se;
		return;
	}
	int m = (l + r) / 2;
	if(pos.fi <= m)	upd(l, m, u * 2, pos);
	else	upd(m + 1, r, u * 2 + 1, pos);
	v[u] = max(v[u * 2], v[u * 2 + 1]);
}
ll get(int l, int r, int l1, int r1, int u)
{
	if(r < l1 || l > r1)	return 0;
	if(l1 <= l && r <= r1)	return v[u];
	int m = (l + r) / 2;
	return max(get(l, m, l1, r1, u * 2), get(m + 1, r, l1, r1, u * 2 + 1));
}

int main()
{
	barnarnar
	int n;
	cin >> n;
	forn(i, n)	cin	>> h[i];
	forn(i, n)	cin >> a[i];
	forn(flower, n)
	{
		//cout << get(0, n, 1, h[flower] - 1, 1) << endl;
		dp[h[flower]] = max(dp[h[flower]], get(0, n, 1, h[flower] - 1, 1) + a[flower]);
		upd(0, n, 1, mp(h[flower], dp[h[flower]]));
	}
	ll ans = 0;
	for(int i = 0; i <= n; i++)	ans = max(ans, dp[i]);
	cout << ans;
	return 0;
}

Measured memory_bytes: 11264
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>

#include<stdio.h>
#include<stdlib.h>

#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}

using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}

int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}

int vmax(vector<int> v) {
	int max = INT32_MIN;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}
	return B;
}

vector<ll> prime_factor(int64_t n) {
	//map< ll, ll > ret;
	vector<ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			//ret[i]++;
			ret.push_back(i);
			n /= i;
		}
	}
	if (n != 1)ret.push_back(n);// ret[n] = 1;
	return ret;
}

const int MAX = 1000000;
const int MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
ll COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct edge {
	ll to;
	ll cost;
};

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	ll N;
	cin >> N;

	cout << N * (N - 1) / 2 << endl;

ProgramEndPointLabel:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG


	return 0;
}




Measured memory_bytes: 504
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[0]*n
c=[0]*n
cnt=0
while cnt<min(k,101):
  cnt+=1
  for i in range(n):
    b[max(0,i-a[i])]+=1
    if i+a[i]<n-1:
      b[i+a[i]+1]-=1
    c[0]=b[0]
  for j in range(n-1):
    c[j+1]=c[j]+b[j+1]
  a=c
  b=[0]*n
  c=[0]*n
print(*a)

Measured memory_bytes: 220280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=100005;
const ll INF=1LL<<60;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,M;cin>>N>>M;
    vector<int> A,B;
    for(int i=0;i<M;i++){
        int a;cin>>a;
        if(a&1){
            B.push_back(a);
        }else{
            A.push_back(a);
        }
    }
    
    if(si(B)==0){
        for(int i=0;i<M;i++) cout<<A[i]<<" ";
        cout<<endl;
        cout<<M+1<<endl;
        for(int i=0;i<M;i++){
            if(i==0) cout<<A[i]-1<<" ";
            else cout<<A[i]<<" ";
        }
        cout<<1<<endl;
    }else if(si(B)==1){
        if(si(A)==0){
            if(N==1){
                cout<<1<<endl;
                cout<<1<<endl;
                cout<<1<<endl;
            }else{
                cout<<N<<endl;
                cout<<2<<endl;
                cout<<N-1<<" "<<1<<endl;
            }
        }else{
            for(int i=0;i<si(A);i++) cout<<A[i]<<" ";
            cout<<B[0]<<endl;
            cout<<M<<endl;
            for(int i=0;i<si(A);i++){
                if(i==0) cout<<A[i]-1<<" ";
                else cout<<A[i]<<" ";
            }
            cout<<B[0]+1<<endl;
        }
    }else if(si(B)==2){
        sort(all(B));
        if(si(A)==0){
            if(N==2){
                cout<<B[0]<<" "<<B[1]<<endl;
                cout<<1<<endl;
                cout<<N<<endl;
            }else{
                cout<<B[0]<<" "<<B[1]<<endl;
                cout<<2<<endl;
                cout<<B[1]-1<<" "<<B[0]+1<<endl;
            }
        }else{
            cout<<B[0]<<" ";
            for(int i=0;i<si(A);i++) cout<<A[i]<<" ";
            cout<<B[1]<<endl;
            
            vector<int> ans;
            if(B[0]-1) ans.push_back(B[0]-1);
            for(int i=0;i<si(A);i++) ans.push_back(A[i]);
            ans.push_back(2);
            if(B[1]-1) ans.push_back(B[1]-1);
            
            cout<<si(ans)<<endl;
            for(int a:ans) cout<<a<<" ";
            cout<<endl;
        }
    }else{
        cout<<"Impossible"<<endl;
    }
}


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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<ll, ll> ll_ll;
const int MOD = 1e9 + 7;
const ll INF = LLONG_MAX / 2;
struct edge { int i, v, w; };

int main() {
	string s; cin >> s;
	vector<int> a(4);
	rep(i, 4) a[i] = s[i] - '0';
	rep(S, 1<<3) {
		int ans = a[0];
		rep(i, 3) if (S>>i & 1) ans += a[i + 1]; else ans -= a[i + 1];
		if (ans == 7) {
			string s = "0-0-0-0=7";
			rep(i, 4) s[i * 2] = '0' + a[i];
			rep(i, 3) if (S>>i & 1) s[i * 2 + 1] = '+';
			cout << s << endl;
			return 0;
		}
	}
}


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

using P = pair<int, int>;

constexpr int INF = 1e9;

P memo[201][201];

P rec(int l, int r, string const& s) {
    P& res = memo[l][r];
    if(res != P{-INF, INF}) {
        return res;
    }
    if(l == r) {
        int v = s[l] - '0';
        return res = make_pair(v, v);
    }
    if(s[l] == '(' && r-l >= 3) {
        P p = rec(l+1, r, s);
        res.first = max(res.first, p.first);
        res.second = min(res.second, p.second);
    }
    if(s[r] == ')' && r-l >= 3) {
        P p = rec(l, r-1, s);
        res.first = max(res.first, p.first);
        res.second = min(res.second, p.second);
    }
    for(int i=l+1; i<r; ++i) {
        char op = s[i];
        if(op == '+' || op == '-') {
            P rl = rec(l, i-1, s);
            P rr = rec(i+1, r, s);
            if(op == '+') {
                res.first = max(res.first, rl.first + rr.first);
                res.second = min(res.second, rl.second + rr.second);
            } else {
                res.first = max(res.first, rl.first - rr.second);
                res.second = min(res.second, rl.second - rr.first);
            }
        }
    }
    return res;
}

int main() {
    string s;
    cin >> s;
    for(int i=0; i<s.size(); ++i) {
        for(int j=0; j<s.size(); ++j) {
            memo[i][j] = make_pair(-INF, INF);
        }
    }
    cout << rec(0, s.size()-1, s).first << endl;
}


Measured memory_bytes: 3504
#include <iostream>
using namespace std;
typedef long long ll;

int main() {
    string s; cin >> s;
    ll k; cin >> k;
    for (int i = 0; i < min((ll)s.size(), k); i++) {
        if (s[i] >= '2') { cout << s[i] << endl; return 0; }
    }
    puts("1");
}

Measured memory_bytes: 256
def make_divisors(n):
    div = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            div.append(i)
            if i*i != n: 
                div.append(n/i)
    return div

N = int(input())
ans = 0
for x in make_divisors(N):
    if (x == 1):
        continue
    tmp = N
    while(tmp%x == 0):
        tmp /= x
    tmp %= x
    if tmp == 1:
        ans += 1
        
ans +=  len(make_divisors(N-1)) -1
print(ans)


Measured memory_bytes: 3188
#include <stdio.h>

int main(void)
{
  int coordinate[5];
  int limit;
  int i, j;
  for(i = 0; i < 5; i++) {
    scanf("%d", &coordinate[i]);
  }
  scanf("%d", &limit);

  for(i = 0; i < 5; i++)
    {
      for(j = i + 1; j < 5; j++)
        {
          if(i == j)
            continue;

          if(coordinate[j] - coordinate[i] > limit) {
            printf(":(\n");
            return 0;
          }
        }
    }

  printf("Yay!\n");
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long ll;
#define dbg(x) cout<<#x<<" = "<<x<<endl
#define dbg2(x,y) cout<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<endl
#define dbg3(x,y,z) cout<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<", "<<#z<<" = "<<z<<endl
#define dbg4(x,y,z,q) cout<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<", "<<#z<<" = "<<z<<", "<<#q<<" = "<<q<<endl
#define dbg_array(x,sz) for (int i = 0; i < sz; ++i) cout << x[i] << " \n"[i==sz-1]
using namespace std;

const ll N = 1000 + 9, M = 400 - 9, Max_ans = 1LL * (1e16);
int a[N];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
#ifdef ECLIPSE
	freopen("input.in", "rt", stdin);
	//freopen("output.out", "wt", stdout);
#endif
	int cnt = 0;
	string a, b;
	cin >> a >> b;
	for (int i = 0; i < a.size(); ++i)
		if (a[i] != b[i])
			++cnt;
	printf("%d\n", cnt);
	return 0;
}



Measured memory_bytes: 3876
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		char s[][] = new char[3][n];
		s[0] = sc.next().toCharArray();
		s[1] = sc.next().toCharArray();
		s[2] = sc.next().toCharArray();
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			if (s[0][i] == s[1][i] && s[1][i] == s[2][i]) {
			} else if (s[0][i] == s[1][i] || s[1][i] == s[2][i] || s[2][i] == s[0][i]) {
				cnt++;
			} else {
				cnt += 2;
			}
		}
		System.out.println(cnt);
	}
}


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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <class T, T op(T, T)>
class segtree {
public:
    int n, size_;
    vector<T> dat;
    T id_;
    segtree() = default;
    segtree(int size, T id, T initial_value) { init(size, id, initial_value); }
    void init(int size, T id, T initial_value) {
        size_ = size;
        id_ = id;
        n = 1;
        while (n < size) n *= 2;
        dat.assign(2 * n - 1, id);
        for (int i = 0; i < size; ++i) update(i, initial_value);
    }
    int size() const { return size_; }
    void update(int k, T a) {
        k += n - 1;  // leaf
        dat[k] = a;
        while (k > 0) {
            k = (k - 1) / 2;
            dat[k] = op(dat[k * 2 + 1], dat[k * 2 + 2]);
        }
    }
    T at(int index) { return dat[index + n - 1]; }
    void add(int k, T a) { update(k, at(k) + a); }
    T query(int a, int b) { return query(a, b, 0, 0, n); }
    T query(int a, int b, int k, int l, int r) {
        if (r <= a or b <= l) return id_;
        if (a <= l and r <= b) return dat[k];
        int m = (l + r) / 2;
        return op(query(a, b, k * 2 + 1, l, m), query(a, b, k * 2 + 2, m, r));
    }
};

i64 max_(i64 a,i64 b){
    return max(a,b);
}

void solve() {
    //const i64 mod = 1'000'000'007;
    i64 N;
    cin >> N;
    vector<pair<i64,i64>> hi(N);
    vector<i64> a(N);
    rep(i,0,N){
        cin >> hi[i].first;
        hi[i].second=i;
    }

    rep(i,0,N){
        cin >> a[i];
    }

    sort(begin(hi),end(hi));

    segtree<i64,max_> dp(N,0,0);
    for(auto p:hi){
        i64 h=p.first,i=p.second;
        i64 val=dp.query(0,i);
        dp.update(i,val+a[i]);
    }

    cout << dp.query(0,N) << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 9088
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
N = int(input())
b = list()
flag = False
for i in range(N):
  b.append(int(input()))
for i in range(N):
  for j in range(3):
    if b[i] == A[j]:
      A[j] = 0
for i in range(N):
  for j in range(3):
    if b[i] == B[j]:
      B[j] = 0
for i in range(N):
  for j in range(3):
    if b[i] == C[j]:
      C[j] = 0
for i in range(3):
  if A[i] == B[i] == C[i] ==0:
    flag = True
if A[0] == A[1] == A[2] == 0:
  flag = True
if B[0] == B[1] == B[2] == 0:
  flag = True  
if C[0] == C[1] == C[2] == 0:
  flag = True
  
if A[0] == B[1] == C[2] ==0:
  flag = True
if C[0] == B[1] == A[2] ==0:
  flag = True

if flag == True:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#include<iostream>
#include<string>
using namespace std;
int main(){
    int men[12];
    string dir;
    for(int i=0;i<6;i++){
        cin>>men[i];
    }
   
    cin>>dir;
    int l=dir.size();
    for(int i=0;i<l;i++){
        for(int j=6;j<12;j++){
            men[j]=0;
        }
        men[6]=men[0];
        men[7]=men[1];
        men[8]=men[2];
        men[9]=men[3];
        men[10]=men[4];
        men[11]=men[5];
        
        if(dir[i]=='E'){
            men[0]=men[9];
            men[2]=men[6];
            men[3]=men[11];
            men[5]=men[8];
        }
        else if(dir[i]=='W'){
            men[0]=men[8];
            men[2]=men[11];
            men[3]=men[6];
            men[5]=men[9];
        }
        else if(dir[i]=='S'){
            men[0]=men[10];
            men[1]=men[6];
            men[4]=men[11];
            men[5]=men[7];
        }
        else if(dir[i]=='N'){
            men[0]=men[7];
            men[1]=men[11];
            men[4]=men[6];
            men[5]=men[10];
        }
            
        
    }
    
    cout<<men[0]<<endl;
    return 0;
}


Measured memory_bytes: 3164
#include<iostream>
#include<algorithm>
using namespace std;
int a[1000000];
signed main(){
  int n,y,x;
  while(1){
    y=0;
    x=0;
    cin>>n;
    if(n==0) break;
    for(int i=0;i<n;i++){
      cin>>a[i];
      if(a[i]>=1){
	y=y+1;
      }
      if(a[i]>=2){
	x=x+1;
      }
    }
    if(x==0){
      cout<<"NA\n";
    }
    else{
      cout<<y+1<<"\n";
    }
  }
  return(0);
}


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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int p, s;
  char c;
  vector<pii> v;
  while (cin >> p >> c >> s, p) {
    v.emplace_back(p, s);
  }
  sort(v.begin(), v.end(), [&](pii a, pii b) {
    return a.second != b.second ? a.second > b.second : a.first < b.first;
  });
  int q;
  while (cin >> q) {
    int last = 1 << 30, ans = 0;
    for (auto i : v) {
      if (i.second != last) {
        last = i.second;
        ans++;
      }
      if (i.first == q) {
        cout << ans << endl;
        break;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 3096
#include <iostream>
using namespace std;
int main(){
  long long int n,m;
  cin >> n >> m;
 if(n==1&&m==1) cout <<1 <<endl;
 else if(n==1)cout << (m-2)<<endl;
 else if(m==1) cout <<(n-2)<<endl;
 else{
   cout << (n-2)*(m-2)<<endl;
 }
}


Measured memory_bytes: 256
#include <bits/stdc++.h> //STL include
typedef long long ll;// long long int
const ll INF = 10000000000;//INFinity
using namespace std;//namespace

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}//transform
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//#define int long long // yabai

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)// for macro
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPM(i,n) for(int i=n;i>=0;i--)

#define ALL(obj) (obj).begin(),(obj)// iterator

#define pb(a) push_back(a)end()//push_back
#define mp make_pair// make_pair


int main(){

    // kokoni kaku
    int n,a,b;
    int sum=0;
    cin>>n>>a>>b;
    REP(i,n+1){
        int sumsum=0;
        int m=i;
        while(m!=0){
            sumsum+=m%10;
            m/=10;
        }
        if(sumsum >= a && sumsum <= b)sum+=i;
    }
    cout<<sum<<endl;
    return 0;
}


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

int main()
{
  string s;

  cin>>s;

  int n=s.length();

  for(int i=0;i<n-1;i++){
    if(s[i]==s[i+1]){
      cout<<i+1<<" "<<i+2<<endl;
      return 0;
    }
    if(i!=n-3 && s[i]==s[i+2]){
      cout<<i+1<<" "<<i+3<<endl;
      return 0;
    }
  }
  cout<<-1<<" "<<-1<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstring>
#include <regex>
#include <sstream>

typedef long long ll;
constexpr double PI = 3.141592653589793;
constexpr ll INF = 1e18 + 10;
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;
}

using namespace std;
//    cout << setprecision(20) << ans << "\n";

int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    string s;
    cin >> s;
    ll numW = 0;
    ll sumB = 0;
    for (size_t i = 0; i < s.size(); i++)
    {
        if (s[i] == 'W')
        {
            sumB += i - numW;
            numW++;
        }
    }
    cout << sumB << endl;

    return 0;
}


Measured memory_bytes: 3768
dur=int(input())
c=list(map(int,input().split()))
d=[0]*26
r=2
for i in range(dur):
  t=0
  s=list(map(int,input().split()))
  m=-1<<64
  for j in range(26):
    alt=s[j]+r*c[j]*(i+1-d[j])+sum([-r*c[k]*(i+1-d[k]) for k in range(26)])
    if alt>m:
      m=alt
      t=j
  print(t+1)
  d[t]=i+1


Measured memory_bytes: 69580
import math


def trial_division(n):
    # 素因数を格納するリスト
    factor = set()
    # 2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2, tmp):
        while n % num == 0:
            n //= num
            factor.add(num)
    # リストが空ならそれは素数
    if not factor:
        return set((1, n))
    else:
        factor.add(n)
        factor.add(1)
        return factor


A, B = map(int, input().split())
# print(trial_division(A))
# print(trial_division(B))
print(len(trial_division(A) & trial_division(B)))


Measured memory_bytes: 38640
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	n, m := readInt(), readInt()

	s := make([]int, m)
	c := make([]int, m)
	for i := 0; i < m; i++ {
		s[i] = readInt()
		c[i] = readInt()
	}

	for i := 0; i < 1000; i++ {
		str := strconv.Itoa(i)
		rstr := []rune(str)
		if len(rstr) != n {
			continue
		}

		ok := true
		for j := 0; j < m; j++ {
			if string(rstr[s[j]-1]) != strconv.Itoa(c[j]) {
				ok = false
			}
		}
		if ok {
			fmt.Println(i)
			return
		}
	}
	fmt.Println("-1")
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int mod=1000000007;
typedef long long ll;
int n,ansx,ansy=1;
int inv(int x){return x==1?1:mod-mod/x*(ll)inv(mod%x)%mod;}
int main(){
	cin>>n;
	int pw=n;
	for(int i=1;i<=n;++i){
		pw=(ll)pw*3%mod;
		ansx=((ll)ansx*pw%mod*(n-i+1)+ansy)%mod;
		ansy=(ll)ansy*pw%mod*(n-i+1)%mod;
	}
	cout<<(ll)ansx*inv(ansy)%mod<<endl; 
	return 0;
}



Measured memory_bytes: 256
use proconio::{input, fastout, marker::Usize1};
#[fastout]
fn main() {
    input!{
        n: usize,
        k: usize,
        a: [Usize1; n],
    }

    let mut vec = vec![vec![0;64]; n];
    for i in 0..n {
        vec[i][0] = a[i];
    }

    for j in 1..64 {
        for i in 0..n {
            vec[i][j] = vec[vec[i][j-1]][j-1];
        }
    }

    let mut current = 0;
    for i in 0..64 {
        if (k >> i) & 1 == 1 {
            current = vec[current][i];
        }
    }

    println!("{}", current + 1);

}


Measured memory_bytes: 112824
h, w = map(int, input().split())
data = []
for _ in range(h):
    data.append( list(input()) )

next_data = []
# 横列処理
for d in data:
    if "#" in d:
        next_data.append( d )

next_next_data = []
origin_v_data = []
# 縦列処理
for i in range( len(next_data[0]) ):
    # 縦配列生成
    v_data = []
    for j in range( len(next_data) ):
        v_data.append( next_data[j][i] )

    # 配列チェック
    if "#" in v_data:
        origin_v_data.append( v_data )

ans_data = []
for i in range( len(origin_v_data[0]) ):
    join_data = []
    for j in range( len(origin_v_data) ):
        join_data.append( origin_v_data[j][i] )
    ans_data.append( join_data )

# 標準出力
for a in ans_data:
    print("".join(a))


Measured memory_bytes: 9224
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a[] = new int[4];
		for (int i=0;i<N;i++) {
			String temp = sc.next();
			if ("AC".equals(temp)) {
				a[0]++;
			} else if  ("WA".equals(temp)) {
				a[1]++;
			} else if("TLE".equals(temp)) {
				a[2]++;
			} else {
				a[3]++;
			}
		}
		System.out.println("AC x "+a[0]);
		System.out.println("WA x "+a[1]);
		System.out.println("TLE x "+a[2]);
		System.out.println("RE x "+a[3]);
	}
}

Measured memory_bytes: 58472
#include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
#include <vector>

using namespace std;
struct YY{
	bool f;
	string str;
};

int main(){

	int N[101]={};
	int ans[101]={};

	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++)
		cin>>ans[i];

	for(int i=0;i<m;i++)
	{
		int t=0;
		for(int j=0;j<n;j++){
			int r;
			cin>>r;
			if(r==ans[i]){
				N[j+1]++;
			}
			else t++;
		}
		N[ans[i]]+=t;
	}
	for(int i=1;i<n+1;i++){
		cout<<N[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<cstdlib>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i,k) for(int i=0;i<k;i++)
ll n, m, i, j, k,o,p,l,z;
ll a[100005], b[100005],inf=1000000000000;
string s;
ll t[100005], xx[100005];

ll tansaku(ll x,ll n,ll* s) {
	int max,min, mid ;
	min = 0; 	max = n + 1; 
	while (max - min > 1) {
		mid = (min + max) / 2;
		
		if (s[mid] > x) {
			max = mid;
		}
		else {
			min = mid;
		}
	//	cout << max << "\n";
	}	
	return max;

}

ll hikaku(ll* s, ll* t, ll o, ll p,ll k) {
	ll z = min((abs(s[o] - k) + abs(s[o] - t[p])), (abs(t[p] - k) + abs(s[o] - t[p])));
	ll zz = min((abs(s[o] - k) + abs(s[o] - t[p-1])), (abs(t[p-1] - k) + abs(s[o] - t[p-1])));
	ll za = min((abs(s[o - 1] - k) + abs(s[o - 1] - t[p])), (abs(t[p] - k) + abs(s[o - 1] - t[p])));
	ll zb = min((abs(s[o - 1] - k) + abs(s[o - 1] - t[p-1])), (abs(t[p-1] - k) + abs(s[o - 1] - t[p-1])));
	z = min(z, zz);
	return min(z, min(za, zb));
}


int main() {
	cin >> n >> s;
	z = 0;
	rep(i, s.size()-2) {
		if ((s[i] == 'A' && s[i + 1] == 'B') && s[i + 2] == 'C')z++;
	}
	cout << z;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
    int n,m;
    cin >> n >> m;
    string s;
    cin >> s;
    vector<int> ans;
    int now = n;
    while(now != 0){
        for(int i = max(now - m, 0); i < now; i++){
            if(s[i] == '0'){
                ans.emplace_back(now - i);
                now = i;
                goto ok;
            }
        }
        cout << -1 << endl;
        return 0;
        ok:;
    }
    reverse(ALL(ans));
    REP(i,ans.size()){
        cout << ans[i] << " ";   
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1144
#include<stdio.h>


int main(){
    int a[128], b, i,  j, count, temp, flag, times;
    
    scanf("%d", &b);
    
    for(i = 0; i < b; i++){
        scanf("%d", &a[i]);
    }
    times = b;
    count = 0;
    flag = 1;    
    while(flag){
        flag = 0;
        for (j = 0; j < times-1; j++){
            if ( a[ j ]  > a[j +1] ) {
                temp = a[j];
                a[j] = a[j +1];
                a[j + 1] = temp;
                count++;
                flag = 1;
                } 
        }
        times--;
    }
    for( i = 0; i < b; i++){
        
        if(i != 0){
            printf(" ");
        }
        
        printf("%d", a[i]);
    }
        
    printf("\n%d\n", count);
    
    return 0;
}



Measured memory_bytes: 1928
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  string s;
  cin >> s;
  ll q;
  cin >> q;
  bool a = true;
  rep(i, q){
    ll t;
    cin >> t;
    if(t==1){
      if(a){
        a = false;
      }
      else{
        a = true;
      }
    }
    else{
      ll f;
      cin >> f;
      if((f==1&&a)||(f==2&&!a)){
        string c;
        cin >> c;
        s.insert(0, c);
      }
      else{
        char c;
        cin >> c;
        s.pb(c);
      }
    }
  }
  if(!a){
    reverse(all(s));
  }
  print(s);
}

Measured memory_bytes: 3904
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#define FOR(i, first, last) for (int i = (first); i < (last); ++i)
#define REP(i, n) FOR(i, 0, n)
#define CLR(a) memset((a), 0, sizeof(a))
#define DUMP(x) std::cerr << #x << " = " << (x) << std::endl;
#define DUMPR(v) REP(_i,v.size()){std::cerr<< #v << "[" << _i << "] = " << (v[_i]) << std::endl;}
#define CIN_VEC(v,N) {v.clear(); v.reserve(N); REP(i,N){typename decltype(v)::value_type x; cin>>x; v.emplace_back(x);}};

inline int to_int(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string to_string(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

typedef unsigned long long ull;
typedef unsigned long ul;

int main() {
  int N, T, A;
  cin>>N>>T>>A;

  vector<pair<int,double>> v;
  REP(i,N) {
    int h;
    cin>>h;
    double t = T - h * 0.006;
    v.emplace_back(i+1, abs(t-A));
  }

  sort(v.begin(), v.end(), [](const auto& l, const auto& r) {return l.second < r.second;});

  auto ans = v.begin()->first;
  cout << ans <<endl;
  
  return 0;
}


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

int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
    int z=max(a,c);
    int e=min(b,d);
    int f=e-z;
    if(f>0){
      cout<<f;
    }
    else{
      cout<<0;
    }
}


Measured memory_bytes: 256
N, M = STDIN.gets.split.map(&:to_i)
An = STDIN.gets.split.map(&:to_i).sort.reverse
Bm = STDIN.gets.split.map(&:to_i).sort.reverse

MOD = 10**9 + 7

x = 0 # number of An bigger than i
y = 0 # number of Bm bigger than i
res = 1
(N*M).downto(1) do |i|
  if An[x] == i && Bm[y] == i
    x += 1
    y += 1
    res *= 1
  elsif An[x] == i
    x += 1
    res *= y
  elsif Bm[y] == i
    y += 1
    res *= x
  else
    res *= x * y - (N*M - i)
  end
  
  res %= MOD
end

p res


Measured memory_bytes: 3960
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

llint n;
vector<llint> vec[105];

void calc(llint l, llint r)
{
	llint n = r-l+1;
	if(n%2){
		for(int i = 0; i < n; i++){
			for(int j = 1; j <= n-1; j++){
				vec[l+i].push_back(l+(i+j)%n);
			}
		}
		return;
	}
	
	if(n == 4){
		vec[l].push_back(l+2);
		vec[l].push_back(l+1);
		vec[l].push_back(l+3);
		
		vec[l+1].push_back(l+0);
		vec[l+1].push_back(l+2);
		vec[l+1].push_back(l+3);
		
		vec[l+2].push_back(l+3);
		vec[l+2].push_back(l+0);
		vec[l+2].push_back(l+1);
		
		vec[l+3].push_back(l+0);
		vec[l+3].push_back(l+1);
		vec[l+3].push_back(l+2);
		return ;
	}
	
	calc(l, (l+r)/2);
	for(int i = 0; i < n/2; i++){
		for(int j = 0; j < n/2-1; j++){
			vec[l+n/2+i].push_back(l+(i+j)%(n/2));
		}
	}
	
	calc((l+r)/2+1, r);
	for(int i = 0; i < n/2; i++){
		for(int j = 0; j < n/2-1; j++){
			vec[l+i].push_back(l+n/2+(i+j+1)%(n/2));
		}
	}
	
	for(int i = 0; i < n/2; i++) vec[l+i].push_back(l+n/2+(i+(n/2-1)+1)%(n/2));
	for(int i = 0; i < n/2; i++) vec[l+n/2+i].push_back(l+(i+(n/2-1))%(n/2));
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	if(n == 2){
		cout << -1 << endl;
		return 0;
	}
	
	calc(0, n-1);
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < vec[i].size(); j++) cout << vec[i][j]+1 << " ";
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 384
def solve():
    from sys import stdin
    input_lines = stdin
    
    from math import log10
    
    for line in input_lines:
        a, b = map(int, line.split())
        
        if (a == 0 and b == 0):
            break
        
        print(int(log10(a + b)) + 1)

solve()


Measured memory_bytes: 5688
/* 
 * Project: AtCoder Beginners Contest 069 B - i18n
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/04
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;

string s;

void solve() {
    
    printf("%c%d%c\n",s[0],(int)(s.size()-2),s[s.size()-1]);

}

int main() {

    cin >> s;

    solve();

}

Measured memory_bytes: 256
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define ms multiset
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("board.in");ofstream out("board.out");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); //uid u1(5, 10); u1(rnd);

int main() {
    fast;
    int a; cin>>a;
    vec<pair<int, pair<str, int>>> m(a);
    for(int q=0; q<a; q++){
        str t; int i; cin>>t>>i;
        m[q] = {q, {t,i}};
    }
    sort(m.begin(), m.end(), [](pair<int, pair<str, int>> p1, pair<int, pair<str, int>> p2){return p1.S.F!=p2.S.F ? p1.S.F<p2.S.F : p1.S.S>p2.S.S;});
    for(int q=0; q<a; q++) cout<<m[q].F+1<<endl;
}

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

int main(){
    int n,k,i,count=0,tmp=0;
    cin >> n >> k;
    vector<int> a(n);
    for(i=0;i<n;i++){
        cin >> a.at(i);
    }
    for(i=0;;i++){
        if(i==0){count++;tmp+=k;}
        else {count++;tmp+=k-1;}
        if(tmp>=n)break;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int n;
  cin>>n;
  vector<pair<ll,int>> v;
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    v.push_back(make_pair(a,i));
  }
  sort(v.begin(),v.end());
  reverse(v.begin(),v.end());

  int it=0;
  int target=n+1;
  ll ans[n+1]={};
  while(it<n){
    if(it<n-1&&v[it].first==v[it+1].first) it++;
    else{
      ll dif=0;
      if(it==n-1) dif=v[n-1].first;
      else dif=v[it].first-v[it+1].first;
      target=min(target,v[it].second);
      ans[target]+=(it+1)*dif;
      it++;
    }
  }

  for(int i=0;i<n;i++){
    cout<<ans[i]<<endl;
  }

  return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define LL long long

void work()
{
    int x; cin >>x;
    for(int i = 1; i < 10; i++)
    {
        int c = i * 111;
        if(c >= x)
        {
            cout <<c <<endl;
            return ;
        }
    }
}

int main()
{
#ifdef yukihana0416
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif // yukihana0416
    work();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
long long f[87];
int main() {
	f[0] = 2, f[1] = 1;
	for (int i = 2; i < 87; i++)
		f[i] = f[i - 1] + f[i - 2];
	cin >> n;
	cout << f[n] << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
  ll n,a,b;
  cin >> n >> a >> b;
  
  ll tmp = n / (a + b);
  ll tmp2 = n % (a + b);
  ll ans = tmp * a;
  cout << ans + min(tmp2,a) << endl;
  
}


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

int main(){
	string s,t;
	int num[30]={},num2[30]={};
	vector<int> v,v2;
	int count=0,count2=0;
	char c='a';
	cin>>s>>t;
	REP(i,s.size()){
		num[s[i]-'a']++;
	}
	REP(i,t.size()){
		num2[t[i]-'a']++;
	}
	sort(num,num+26);
	sort(num2,num2+26);
	REP(i,26){
		if(num[i]==num2[i]){
			count++;
		}
	}
	if(count==26){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 776
// Problem : Multiplication 1
// Contest : Virtual Judge - AtCoder
// URL : https://vjudge.net/problem/AtCoder-abc169_a
// Memory Limit : 1048 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")  // disable
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define lll __int128
#define lp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define vec(v, type, sz) vector<type> v(sz)
#define in(v) \
    for (auto &i : v) cin >> i
#define all(v) v.begin(), v.end()
#define prv(v)                         \
    for (auto i : v) cout << i << " "; \
    cout << "\n"
#define MOD 1000000007
#define INF 1000000000
#define INFL 1000000000000000000ll
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define vi vector<int>
#define vl vector<ll>
#define vii(v, n, m, val) vector<vector<int>> v(n, vector<int>(m, val))
#define viii(v, i, j, k, val)        \
    vector<vector<vector<int>>> v(i, \
                                  vector<vector<int>>(j, vector<int>(k, val)))
#define pii pair<int, int>
#define pb push_back
#define file_io                       \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define testcases \
    int tcc;      \
    cin >> tcc;   \
    for (int tc = 1; tc <= tcc; tc++)
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while (!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
    cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if (idx > 0)
        cerr << ", ";
    else
        cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss;
    ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef DB
#define debug(...) \
    debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

int main() {
    fast_io;
    ll a,b; cin>>a>>b; cout<<a*b;
}

Measured memory_bytes: 3584
#include <stdio.h>

int main() {
	int n, a, b;
	scanf ("%d %d %d", &n, &a, &b);
	int sum = 0;
	for (int i = 1; i <= n; i++){
		int digitsum = 0;
		int temp = i;
		while (temp != 0){
			digitsum = digitsum + temp % 10;
			temp /= 10;
		}
		if (digitsum >= a && digitsum <= b){
			sum += i;
		}
	}
	printf ("%d\n", sum);
	return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
 
const int N = 105;
int n;
char str[N];
int cnt1, cnt2;
bool vis[N];
 
int main() {
	scanf("%d", &n);
	scanf("%s", str + 1);
	for (int i = 1; i <= n; i++)
		if (!vis[i] && str[i] == ')') {
			cnt1++;
			if (cnt2 > 0) cnt1--, cnt2--;
		} else if (!vis[i] && str[i] == '(') {
			cnt2++;
		}
	for (int i = 1; i <= cnt1; i++) putchar('(');
	for (int i = 1; i <= n; i++) putchar(str[i]);
	for (int i = 1; i <= cnt2; i++) putchar(')');
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		sc.close();

		long ans = 0;

		for (int b = 1; b <= N; b++) {
			int div = N / b;
			int mod = N % b;
			ans += div * Math.max(0, b - K) + Math.max(0, mod - K + 1);
		}
		if (K == 0)
			ans -= N;

		System.out.println(ans);
	}
}

Measured memory_bytes: 22228
#include <stdio.h>

int main(void)
{
    char ring[200], p[100], s[100];
    
    scanf("%s", s);
    scanf("%s", p);
    
    strcpy(ring, s);
    strcat(ring, s);
    
    if (strstr(ring, p)) 
      printf("Yes\n");
    else                
      printf("No\n");
    
    return 0;
}



Measured memory_bytes: 2088
/**************** Geometrical Library ****************/

#include<cmath>

#define	EPS	1e-9

using namespace std;

class Point{
public:
	double x,y;
	Point(){}
};

double dot(const Point &a,const Point &b){
	return a.x*b.x+a.y*b.y;
}

double cross(const Point &a,const Point &b){
	return a.x*b.y-a.y*b.x;
}

double norm2(const Point &a){
	return dot(a,a);
}

/**************** Library END ****************/

#include<cstdio>

int main(){
	for(double d;scanf("%lf",&d),d;){
		Point p,v;	scanf("%lf%lf%lf%lf",&p.x,&p.y,&v.x,&v.y);
		if(abs(cross(p,v))<EPS){
			double dis;
			if(dot(p,v)<0)	dis=sqrt(norm2(p));
			else			dis=2-sqrt(norm2(p));
			printf(dis<d+EPS?"%.9f\n":"impossible\n",dis);
		}
		else	puts("impossible");
	}

	return 0;
}

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

int main(void){
    int a, b;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a >> b;
    if (9 < a || 9 < b) {
        cout << -1 << "\n";
    } else {
        cout << a * b << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;

int main(){
    int S;
    cin >> S;
    int a = S/100;
    int b = S%100;
    string ans;
    if(1 <= a && a <= 12){
        ans = "MMYY";
        if(1 <= b && b <= 12){
            ans = "AMBIGUOUS";
        }
    }
    else if(1 <= b && b <= 12){
        ans = "YYMM";
    }
    else{
        ans = "NA";
    }
    cout << ans <<  "\n";
    return 0;
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n,a,b;
    cin>>n>>a>>b;
    cout << (n-a+1)*(n-b+1)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <vector>

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

int main ()
{
	int N, K;
	cin >> N >> K;
	ll a[N + 1], pre[N + 1];
	pre[0] = 0;
	for ( int i = 1; i <= N; i++ )
		cin >> a[i], pre[i] = pre[i - 1] + a[i], pre[i] %= K;
	map < ll, deque < int > > DS;
	ll ans = 0;
	DS[0].push_back ( 0 );
	for ( int i = 1; i <= N; i++ )
	{
		while ( !DS[((pre[i] - i)%K+K)%K].empty() && DS[((pre[i] - i)%K+K)%K].front() <= i - K )
			DS[((pre[i] - i)%K+K)%K].pop_front();
		ans += DS[((pre[i] - i)%K+K)%K].size();
		DS[((pre[i] - i)%K+K)%K].push_back ( i );
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 147072
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    /*ll t;
    cin>>t;
    while(t--)*/
        ll x,i,j,c;
    cin>>x;
     for(i=x;i<=1000000;i++)
     {
         c=0;
         for(j=2;j<i;j++)
         {
             if(i%j==0)
                {c++;break;}
         }
         if(c==0)
         {cout<<i<<endl;
         break;}

     }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void solve(long long N, long long M, std::vector<long long> a, std::vector<long long> b){
  vector<pair<ll, ll>> v;
  for(ll i=0; i<M; i++) {
    v.push_back(make_pair(b[i], a[i]));
  }
  sort(v.begin(), v.end());
  ll ans=0;
  ll x=0;
  for(auto p: v) {
    if(p.second < x and x <= p.first)
      continue;
    else {
      x=p.first;
      ans++;
    }
  }
  std::cout << ans << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  long long M;
  scanf("%lld",&M);
  std::vector<long long> a(M);
  std::vector<long long> b(M);
  for(int i = 0 ; i < M ; i++){
    scanf("%lld",&a[i]);
    scanf("%lld",&b[i]);
  }
  solve(N, M, std::move(a), std::move(b));
  return 0;
}



Measured memory_bytes: 3956
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
using namespace std;
static const int MAX_N = 100000;

int N, M;
int num[MAX_N];

int main(void){
	cin >> N >> M;
	for(int i = 1; i <= M; i++){
		int a, b;
		cin >> a >> b;
		num[a]++; num[b]++;
	}
	bool def = true;
	for(int i = 0; i < N; i++){
		if(num[i] % 2 != 0) def = false;
	}
	cout << (def ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 768
N=input()

s_li = []

for i in range(int(N)):
	S,P=map(str,input().split())
	s_li_tmp = {'Num':i+1, 'Point':int(P), 'Shop':S}
	s_li.append(s_li_tmp)

s_li_sorted = sorted(s_li, key=lambda x:(x['Shop'],-x['Point']))

for k in range(int(N)):
	print(s_li_sorted[k].get('Num'))


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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            long ans = 0;
            for(var i=0;i<=N;i++)
            {
                if (i % 3 == 0 || i % 5 == 0) continue;
                ans += i;
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 17664
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
const ll ATCODER_AMARI = 1000000007; //10^9 + 7
const ll INF = 10000000000000;

//階乗関数　ATCODER_AMARIに注意
ll factorial(ll k){
  ll sum = 1;
  for(int i = 1 ; i < k + 1; i++) {
    sum *= i;
    //sum = sum % ATCODER_AMARI;
  }
  return sum;
}

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

  vector<ll> a(n);
  rep(i,n) cin >> a.at(i);

  ll sum = 0;

  rep(i,n) {
    if(i == 0) continue;

    if(a.at(i) < a.at(i - 1)) {
      ll sa = a.at(i - 1) - a.at(i);
      sum += sa;
      a.at(i) += sa;
    }
  }

  cout << sum << endl;
}


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

int main(){
	int n,d; cin>>n>>d;
	int cnt=0;
	rep(i,n){
		double p,q; cin>>p>>q;
		if(sqrt(pow(p,2)+pow(q,2))<=d) cnt++;
	}
	cout<<cnt<<endl;
}


Measured memory_bytes: 3840