akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int64_t> count(5, 0);
    for (int i = 0; i < N; i++){
        string S;
        cin >> S;
        if (S.at(0) == 'M') count.at(0)++;
        if (S.at(0) == 'A') count.at(1)++;
        if (S.at(0) == 'R') count.at(2)++;
        if (S.at(0) == 'C') count.at(3)++;
        if (S.at(0) == 'H') count.at(4)++;
    }
    int64_t ans = 0;
    for (int i = 0; i < 3; i++){
        for (int j = i + 1; j < 4; j++){
            for (int k = j + 1; k < 5; k++){
                ans += count.at(i) * count.at(j) * count.at(k);
            }
        }
    }
    cout << ans << endl;
}

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

#define int long long
#define endl "\n"
#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 RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

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;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    Vi a(n);
    REP(i,0,n) cin>>a[i];
//    sort(ALL(a),greater<int>());
//    REP(i,0,n) cout<<a[i]<<endl;
    priority_queue<int> q;
    REP(i,0,n) q.push(a[i]);
    REP(i,0,m){
        int now=q.top();
        q.pop();
        q.push(now/2);
    }
    
    int ans=0;
    while(!q.empty()){
        ans+=q.top();
        q.pop();
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2168
import sys
import heapq
from math import ceil


def input(): return sys.stdin.readline().strip()


def main():
    N, M = map(int, input().split())
    A = list(map(lambda x: -int(x), input().split()))
    heapq.heapify(A)

    for _ in range(M):
        mx = heapq.heappop(A)
        heapq.heappush(A, ceil(mx / 2))

    ans = -sum(A)

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 14532
#include<iostream>
#include<cmath>
#include<iomanip>
#include<cstdio>
using namespace std;
#define EPS 1e-10
int equals(double a, double b) { return fabs(a - b) < EPS; };
class Point {
public:
	double x, y;
	Point(double x=0, double y=0) :x(x), y(y) { };
	Point operator + (Point& p) {
		return Point(p.x + x, p.y + y);
	}
	Point operator - (Point& p) {
		
		return Point(x - p.x, y - p.y);
	}
	Point operator * (double k) {
		return Point(k*x, k*y);
	}
	double abs() {					//向量长度;
		return sqrt(x * x + y * y);
	}
};
typedef Point Vector;
double dot(Vector a, Vector b) {			//内积 x1*x2 + y1*y2
	return a.x * b.x + a.y * b.y;
}
double cross(Vector a, Vector b) {		  //外积  x1*y2 - x2*y1
	return a.x * b.y - a.y * b.x;
}
struct Segment           //线段
{
	Point a, b;
};
typedef Segment Line;   //线段表示直线；
class Circle {
public:
	Point c;
	double r;
	Circle(Point c = Point(), double x = 0) :c(c), r(x) {};
};
void Parallel_Orthogonal() {				//判断平行或正交
	Point a, b,c,d;
	Point e, f;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a.x >> a.y >> b.x >> b.y>>c.x>>c.y>>d.x>>d.y;
		e = a - b;
		f = c - d;
		if (equals(dot(e, f), 0)) cout << "1" << endl;
		else if (equals(cross(e, f), 0))cout << "2" << endl;
		else cout <<"0" <<endl;
	}
}
Point Projection(Point& a, Point& b, Point& c) {		//计算投影点
	Point p;
	Vector v1 = b - a;
	Vector v2 = c - a;
	double len = dot(v1, v2);
	double len2 = len/ v1.abs();
	p.x = a.x + len2 / v1.abs() * v1.x;
	p.y = a.y + len2 / v1.abs() * v1.y;
	return p;
}
//int main(void) {				计算投影点
//	Point a, b, c,d;
//	cin >> a.x >> a.y >> b.x >> b.y;
//	int n;
//	cin >> n;
//	for (int i = 0; i < n; i++) {
//		cin >> c.x >> c.y;
//		d=Projection(a, b, c);
//		printf("%.10f %.10f\n", d.x, d.y);
//	}
//}
Point Reflection(Point& a, Point& b, Point& c) {	//算映像
	Point p = Projection(a, b, c);					//算出映射点
	return p*2 - c;									//映射点 是 该点与映像点中点  x + c = 2*p；
}
int main(void) {				
	Point a, b, c,d;
	Point f;
	cin >> a.x >> a.y >> b.x >> b.y;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> c.x >> c.y;
		f=Reflection(a, b, c);
		printf("%.10f %.10f\n", f.x, f.y);
	}
}


Measured memory_bytes: 3292
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
#include <numeric>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define fi first
#define se second

void print(bool a)
{
    if (a == true)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

ll gcd(ll a, ll b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << a * b / 2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz size()
#define all(a)  a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mod 1000000007
#define _for(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)

using namespace std;

int main(){
   string s;
   cin >> s;
   int i = 0;
   int W = 0;
   int B = 0;
   int k = 0;
   while(i < s.sz){
      if(s[i] == 'W'){
         int j = i;
         ++W;
         while(j < s.sz && s[j] == 'W'){
            ++j;
         }
         i = j;
      }
      else{
         int j = i;
         ++B;
         while(j < s.sz && s[j] == 'B'){
            ++j;
         }
         i = j;
      }
      ++k;
   }
   cout << k - 1 << endl;
   return 0;
}

Measured memory_bytes: 512
#include <cmath>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int n, m, x, y;

	while (true)
	{
		cin >> n;

		if (n == 0) { break; }

		vector<vector<pair<long double, long double> > > L(2 * n + 2);

		long double theta, theta2, x4, y4;

		for (int i = 0; i <= n; i++)
		{
			cin >> m;

			for (int j = 0; j < m; j++)
			{
				cin >> x >> y;

				L[2 * i].push_back(make_pair(x, y));
			}

			L[2 * i + 1] = L[2 * i]; reverse(L[2 * i + 1].begin(), L[2 * i + 1].end());
		}

		for (int i = 0; i < 2 * n + 2; i++)
		{
			int zx = -L[i][0].first;
			int zy = -L[i][0].second;

			for (int j = 0; j < L[i].size(); j++)
			{
				L[i][j].first += zx; L[i][j].second += zy;
			}

			theta = -atan2l(L[i][1].second, L[i][1].first);

			for (int j = 1; j < L[i].size(); j++)
			{
				theta2 = atan2l(L[i][j].second, L[i][j].first) + theta;

				x4 = cosl(theta2) * sqrtl(L[i][j].first * L[i][j].first + L[i][j].second * L[i][j].second);
				y4 = sinl(theta2) * sqrtl(L[i][j].first * L[i][j].first + L[i][j].second * L[i][j].second);

				L[i][j].first = x4; L[i][j].second = y4;
			}
		}

		for (int i = 1; i <= n; i++)
		{
			bool ok1 = (L[0].size() == L[2 * i].size());
			bool ok2 = (L[0].size() == L[2 * i + 1].size());
			bool ok3 = (L[1].size() == L[2 * i].size());
			bool ok4 = (L[1].size() == L[2 * i + 1].size());

			for (int j = 0; j < min(L[0].size(), L[2 * i].size()); j++)
			{
				if (!(-1e-6 < L[2 * i][j].first - L[0][j].first && L[2 * i][j].first - L[0][j].first < 1e-6 && -1e-6 < L[2 * i][j].second - L[0][j].second && L[2 * i][j].second - L[0][j].second < 1e-6))
				{
					ok1 = false;
				}
			}

			for (int j = 0; j < min(L[0].size(), L[2 * i + 1].size()); j++)
			{
				if (!(-1e-6 < L[2 * i + 1][j].first - L[0][j].first && L[2 * i + 1][j].first - L[0][j].first < 1e-6 && -1e-6 < L[2 * i + 1][j].second - L[0][j].second && L[2 * i + 1][j].second - L[0][j].second < 1e-6))
				{
					ok2 = false;
				}
			}

			for (int j = 0; j < min(L[1].size(), L[2 * i].size()); j++)
			{
				if (!(-1e-6 < L[2 * i][j].first - L[1][j].first && L[2 * i][j].first - L[1][j].first < 1e-6 && -1e-6 < L[2 * i][j].second - L[1][j].second && L[2 * i][j].second - L[1][j].second < 1e-6))
				{
					ok3 = false;
				}
			}

			for (int j = 0; j < min(L[1].size(), L[2 * i + 1].size()); j++)
			{
				if (!(-1e-6 < L[2 * i + 1][j].first - L[1][j].first && L[2 * i + 1][j].first - L[1][j].first < 1e-6 && -1e-6 < L[2 * i + 1][j].second - L[1][j].second && L[2 * i + 1][j].second - L[1][j].second < 1e-6))
				{
					ok4 = false;
				}
			}

			if (ok1 || ok2 || ok3 || ok4)
			{
				cout << i << endl;
			}
		}

		cout << "+++++" << endl;
	}

	return 0;
}

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

int main(){
    int a,b;
    string ans = "";
    cin >> a >> b;
    if (a % 2 == 0){
        ans = "Even";
    }else if(b % 2 == 0){
        ans = "Even";
    }else{
        ans = "Odd";
    }
    cout << ans << endl;
}

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

int main() {
    int N,M,P,X;
    cin>>N;
    int T[N];
    for (int i = 0; i <N ; ++i) {
        cin>>T[i];
    }
    cin>>M;
    int sum[M];

    for (int j = 0; j <M ; ++j) {
        int arr[N];
        for (int i = 0; i <N ; ++i) {
            arr[i]=T[i];
        }
        cin>>P>>X;
        arr[--P]=X;
        int z=0;
        for (int g = 0; g <N ; ++g) {
            z+=arr[g];
        }
        sum[j]=z;
    }
    for (int k = 0; k <M ; ++k) {
        cout<<sum[k]<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
//DONE
#include<stdio.h>
#include<iostream>
#include<cmath>
using namespace std;

int main(){
	long long int da[100001] = {0};
	int m, n, now = 0;
	unsigned long long int out = 0;
	scanf("%d%d", &m, &n);
	for(int i = 1; i < m;i++){
		int buf;
		scanf("%d", &buf);
		if(i == 0)da[i] = buf;
		else da[i] = da[i-1] + buf;
	}

		//DONE INPUT
	for(int i = 0;i <n;i++){
		int buf;
		scanf("%d", &buf);
		out += abs((long double)(da[now + buf] - da[now]));
		now+=buf;
		if(out > 100000)out = out%100000;

	}
	printf("%d\n", out);
	return 0;


}

Measured memory_bytes: 1628
#include<stdio.h>
#include<stdlib.h>
int main(){
  long long x;
  int i,j;
  scanf("%lld",&x);
  long long a[4001],y;
  for(i=0;i<4000;i++){
    a[i]=i*i;
    a[i]*=a[i];
    a[i]*=i;
  }
  for(i=0;i<4000;i++){
    y=a[i]-x;
    if(y<0)
      y=-y;
    j=0;
    while(a[j]<y){
      j++;
    }
    if(a[j]==y){
      if(a[i]-x<0)
        printf("%d %d\n",i,-j);
      else
        printf("%d %d\n",i,j);
      return 0;
    }
  }
  return 0;
}


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

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif

    int num = 0;
    string str;
    cin >> str;
    for(int i = 0; i < (int) str.size(); ++i) {
        if(str[i] == '+') {
            num++;
        }
        else {
            num--;
        }
    }
    cout << num << endl;
    return 0;
}


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

int f(int n) {
  return n * (n - 1) / 2;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  int m;
  cin >> m;
  cout << f(n) + f(m) << endl; 
  return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) (a).begin(),(a).end()
#define SORT(a) sort(all(a))
using ll = long long;
constexpr ll INF = 10000000000;
constexpr ll MOD = 1000000007;

using namespace std;

int main() {
	//#define int ll
	cin.tie(0); ios::sync_with_stdio(false);
	
	int n; cin >> n;
	vector<int>a(n);
	rep(i, n)cin >> a[i];

	SORT(a);
	cout << a[n - 1] - a[0] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> A;
bool g(int nc, int n) {
	if (nc == 0 && n == 0) return true;
	if (nc < 0 || n < 0) return false;
	if (!(nc > 0 && n > 0)) return false;
	return n >= nc*2;
}
bool f() {
	int ma = *max_element(A.begin(), A.end());
	int mi = *min_element(A.begin(), A.end());
	if (ma == 1) return true;
	if (mi == N-1) return true;

	int n1 = 0;
	for (int x : A) {
		if (x == ma-1) ++ n1;
		else if (x != ma) return false;
	}
	return g(ma-n1, N-n1);
}
int main() {
	cin >> N;
	A.resize(N);
	for (auto& x : A) cin >> x;
	
	cout << (f() ? "Yes" : "No") << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define per(i,n) for(int i=(n)-1; i>=0; i--)
#define chmin(a,b) a = min(a,b)
#define chmax(a,b) a = max(a,b)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vv = vector<vi>;
const int MOD = 1000000007;

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

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

string expr;

vector<vector<int>> decode(string e) {
    int L = e.size();
    int width = 0, idx = 0;
    while (idx < L && e[idx] != '/') {
        if (e[idx] == 'b') width += 1;
        else width += e[idx] - '0';
        ++idx;
    }
    int height = 1;
    for (char ch : e) if (ch == '/') ++height;

    vector<vector<int>> res(height, vector<int>(width, 0));

    int row = 0, column = 0;
    for (char ch : e) {
        if (ch == '/') {
            row++;
            column = 0; 
        } else if (ch == 'b') {
            res[row][column++] = 1;
        } else {
            column += ch - '0';
        }
    }

    return res;
}

string encode(vector<vector<int>> b) {
    int height = b.size();
    int width = b[0].size();
    string res = "";
    for (int i = 0; i < height; ++i) {
        if (i > 0) res += "/";
        int count = 0;
        for (int j = 0; j < width; ++j) {
            if (b[i][j] == 1) {
                if (count > 0) res += string(1, count + '0');
                count = 0;
                res += "b";
            } else {
                ++count;
            }
        }
        if (count > 0) res += string(1, count + '0');
    }

    return res;
}

int main(void) {
    while (true) {
        cin >> expr;
        if (expr == "#") break;
        vector<vector<int>> board = decode(expr);
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        --a; --b; --c; --d;
        board[a][b] = 0;
        board[c][d] = 1;
        cout << encode(board) << endl;
    }
    return 0;
}



Measured memory_bytes: 3116
/**
*    created: 21.06.2020 01:20:27
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define mod 1000000007
#define pi acos(-1.0)
using namespace std;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    map<int,int> mp;
    rep(i,n) {
        int a, b;
        cin >> a >> b;
        mp[a] += b;
    }
    int now = 0;
    for (auto itr = mp.begin(); itr != mp.end(); itr++) {
        now += itr->second;
        if (now >= k) {
            cout << itr->first << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 7496
#include<bits/stdc++.h>
#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define per(i,n,j) for(int i=(n)-1;i>=(j);i--)
using ll=long long;
using namespace std;
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; }
const ll INF=1LL<<60;

ll h,w;
vector<vector<char>> s(100,vector<char>(100));

int main(){
    cin>>h>>w;
    rep(i,1,h+1) rep(j,1,w+1) cin>>s[i][j];
    bool flag=true;
    int cnt=0;
    rep(i,1,h+1){
        rep(j,1,w+1){
            if(s[i][j]=='#'){
                cnt++;
                if(s[i-1][j]!='#' && s[i+1][j]!='#' && s[i][j-1]!='#' && s[i][j+1]!='#') flag=false;
            }
        }
    }
    if(cnt!=0){
        if(flag) cout<<"Yes"<<"\n";
        else cout<<"No"<<"\n";
    }
    else cout<<"Yes"<<"\n";
    return 0;
}

Measured memory_bytes: 3640
import sys
readline = sys.stdin.readline

N = int(readline())
F = [list(map(int, readline().split())) for _ in range(N)]
P = [list(map(int, readline().split())) for _ in range(N)]

ans = -10**18
for S in range(1, 1<<10):
    res = 0
    for i in range(N):
        cnt = 0
        for j in range(10):
            if (1<<j) & S and F[i][j]:
                cnt += 1
        res += P[i][cnt]

    ans = max(ans, res)

print(ans)

Measured memory_bytes: 91472
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
ll gcd(ll a, ll b){if (a%b == 0)  return(b);else  return(gcd(b, a%b));}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
/* map<string,int> */
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
/* 辞書順 next_permutation(a.begin(),a.end()) */
 
int main () {
	int n,d;
	cin >> n >> d;
	double ans = (double)n / (2*d+1);
    if (ans > (int)ans) {
        ans++;
    }
	cout << (int)ans << endl;
}

Measured memory_bytes: 760
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for (ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
bool chmin(ll& a, ll b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
bool chmax(ll& a, ll b) {
    if (b > a) {
        a = b;
        return 1;
    }
    return 0;
}
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
int main() {
    string s;
    ll renzoku, zenbu;
    cin >> n >> zenbu >> renzoku;
    cin >> s;

    vl kanarazu(n, 1);

    vl A;
    rep(i, n) {
        if (s[i] == 'o')
            A.push_back(i);
        else
            kanarazu[i] = 0;
    }

    t = 0;
    p = zenbu;
    vl mae(n, 0), usiro(n, 0);
    rep(i, p) {
        mae[A[t]] = i + 1;
        t = lower_bound(all(A), A[t] + renzoku + 1) - A.begin();
    }

    t = A.size()-1;
    p = zenbu;
    rep(i, p) {
        usiro[A[t]] = i + 1;
        t = lower_bound(all(A), A[t] - renzoku) - A.begin() - 1;
    }

    rep(i, n){
        if(mae[i]>0&&usiro[i]>0&&mae[i]+usiro[i]<=zenbu+1)
            cout << i + 1 << endl;
    }
}

Measured memory_bytes: 8052
#include<stdio.h>

int main(void)
{
	int a;
	int b;
	int c;
	
	scanf("%d %d %d",&a,&b,&c);

	if((a + b >= c)&&(a,b>=1)&&(a,b<=500)&&(c>=1)&&(c<=1000)){
		printf("Yes");
	}
	else{
		printf(" No");
	}
	return(0);
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#include <sstream>
#include <iterator>
#include <sstream>
#include <iomanip>
#include <istream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main()
{
   int n;
   cin >> n;
   if(floor(n/100) == floor(n%10)) cout << "Yes" << endl;
   else cout << "No" << endl;
}


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

using vi = vector<int>;
using ii = pair<int, int>;

int main() {
  cin.sync_with_stdio(false);
  cin.tie(NULL);

  string s, t;

  cin >> s >> t;

  int ans = INT_MAX;
  for (int i = 0; i < s.length() - t.length() + 1; i++) {
    int cnt = 0;

    for (int j = 0; j < t.length(); j++)
      cnt += s[i + j] != t[j];

    ans = min(ans, cnt);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3660
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int K = Integer.parseInt(sc.next());
      long result = 0;

      for (int i = 1; i <= K; i++) {
        for (int j = 1; j <= K; j++) {
          for (int k = 1; k <= K; k++) {
            result += gcd(i, j, k);
          }
        }

      }

      System.out.println(result);
    }
  }

  public static final int gcd(int a, int b) {
    if (a < b) {
      int tmp = a;
      a = b;
      b = tmp;
    }

    int r = -1;
    while (r != 0) {
      r = a % b;
      a = b;
      b = r;
    }

    return a; 
  }

  public static final int gcd(final int... param) {
    final int len = param.length;
    int g = gcd(param[0], param[1]);
    for (int i = 1; i < len - 1; i++) {
      g = gcd(g, param[i + 1]);
    }
    return g;
  }
}


Measured memory_bytes: 30440
#include<iostream>
using namespace std;
int main()
{
	int a,b; cin>>a>>b;
	float c=(a-b-1)*(1.0)/(b*2+1);
	c*=100;
	int d=c;
	d%100 < 50 ?cout<<d/100 + 1:cout<<d/100 + 2;
}


Measured memory_bytes: 3128
//ProblemC

#ifdef _MYPC
#include "mypc.h"
#endif // _MYPC

#include <iostream>
#include <string>
#include <vector>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <memory>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;

//ProblemC

#define MAXN 100010

class Solve {
private:
	int n;
	int a[MAXN];
	void solve() {
		cin >> n;
		for (int i = 1; i <= n; i++) cin >> a[i];
		a[n+1] = a[0] = 0;

		int s = 0;
		for (int i = 1; i <= n + 1; i++) {
			s += abs(a[i] - a[i-1]);
		}

		for (int i = 1; i <= n; i++) {
			int t = s;
			t += abs(a[i + 1] - a[i - 1]);
			t -= abs(a[i + 1] - a[i]) + abs(a[i - 1] - a[i]);
			cout << t << endl;
		}
	}

public:
	Solve() { solve(); }
};

int main(int argc, char* argv[]) {
	unique_ptr<Solve> solve = make_unique<Solve>();
	return 0;
}


Measured memory_bytes: 1664
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

static const long long mod = 1000000007;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll h, w;
  cin >> h >> w;
  vector<string> mp(h);

  rep(i, h) { cin >> mp[i]; }

  rep(i, h) rep(j, w) {
    ll cnt = 0;
    if (mp[i][j] == '#') continue;
    rep(k, 8) {
      ll y = i + dy[k];
      ll x = j + dx[k];
      bool cond = 0 <= y && y < h && 0 <= x && x < w;
      if (cond && mp[y][x] == '#') cnt++;
    }
    mp[i][j] = '0' + cnt;
  }

  rep(i, h) { cout << mp[i] << endl; }

  return 0;
}


Measured memory_bytes: 256
while(1):
    try:
        a, b = map(int, input().split())
    except:
        break

    x = max(a, b)
    y = min(a, b)
    if x % y == 0:
        gcd = y
    else:
        while x % y != 0:
            z = x % y
            x = y
            y = z
        else:
            gcd = z

    lcm = a * b // gcd

    print(gcd, lcm)


Measured memory_bytes: 5600
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {

	lli N;
	cin >> N;

	cout << (double)((N + 1) / 2) / (N) << endl;



	return 0;
}

Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define i_inf int(1e9)
#define i_half_inf int(1e5)
#define ll_inf ll(1e9)*ll(1e9)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const int mod = 1000000007;

const int max_n = i_half_inf * 3;
ll n, a[max_n];

void solve() {
    sort(a, a + 3 * n);
    ll ans = 0;
    for (int i = 3 * n - 2; i >= n; i -= 2) ans += a[i];
    cout << ans << endl;
}

int main() {
    cin >> n;
    rep(i, 3 * n) cin >> a[i];
    solve();
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
const ll N=100005;
ll n,m,c[N],b[N],a[N],d[N];
vector<ll> g[N];
void dfs1(ll x){
    b[x]=1,a[x]=1;
    for(int i=0;i<g[x].size();i++){
    	if(b[g[x][i]])continue;
    	dfs1(g[x][i]),a[x]=a[x]*a[g[x][i]]%m;
	}
    a[x]++;
}
void dfs(ll x,ll y){
    c[x]=1,d[x]=y;
    vector<pair<ll,ll> > v;
    for(int i=0;i<g[x].size();i++){
    	if(c[g[x][i]])continue;
    	v.push_back({g[x][i],a[g[x][i]]});
		d[x]=d[x]*a[g[x][i]]%m;
	}
    if(v.size()==0)return;
    v.push_back({-1,y});
    vector<ll> e(v.size()+2),f(v.size()+2);
    e[0]=1;
    for(int i=0;i<v.size();i++)
        e[i+1]=e[i]*v[i].second%m;
    f[v.size()+1]=1;
    for(int i=v.size();i>0;i--)
        f[i]=f[i+1]*v[i-1].second%m;
    for(int i=0;i<v.size()-1;i++)
        dfs(v[i].first,(e[i]*f[i+2]+1)%m);
}
int main(){
	n=read(),m=read();
	for(int i=1;i<n;i++){
		ll x=read(),y=read();
		g[x].push_back(y);
		g[y].push_back(x);
	}
	dfs1(1),dfs(1,1);
	for(int i=1;i<=n;i++)
		printf("%d\n",d[i]);
	return 0;
}

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

int main()
{
    int n,m,y=0,ma=0;
    cin>>n;
    string blue[n];
    for(int i=0;i<n;i++)
    {
        cin>>blue[i];
    }
    cin>>m;
    string red[m];
    for(int i=0;i<m;i++)
        {
            cin>>red[i];
        }

        for(int i=0;i<n;i++)
        {
            y=0;
            string tem = blue[i];
            for(int j=i;j<n;j++)
            {
               if(tem==blue[j]) y++;
            }
             for(int k=0;k<m;k++)
            {
               if(tem==red[k]) y--;
            }
            if(ma<y) ma=y;
        }

        cout<<ma;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m-1); i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;


int main() {
  ll n, m; cin >> n >> m;
  Vll a(n), x(m); cin >> a;
  rep(i, n) --a[i];

  ll ans = 0;
  rep(i, n-1) {
    ll y = a[i+1] - a[i];
    if (y < 0) {
      y += m;
      x[0] += m - a[i] - 1;
      x[1] -= m - a[i] - 2;
    }
    ans += y;
    if (a[i]+2 < m) x[a[i]+2] += 1;
    if (a[i+1]+1 < m) x[a[i+1]+1] -= y;
    if (a[i+1]+2 < m) x[a[i+1]+2] += y-1;
  }
  
  rep(i, m-1) x[i+1] += x[i];
  rep(i, m-1) x[i+1] += x[i];

  ans -= *max_element(all(x));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cmath>
#include <cstdio>
#include <vector>
#include <string>
#include <set>
#include <set>
#include <cstring>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <ctime>
#include <cmath>
#include <sstream>
#include <cstdlib>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int maxn = 4e5 + 10;
ll fac[maxn],inv[maxn];
ll pow_mod(ll a,ll n)
{
    ll ret =1;
    while(n)
    {
        if(n&1) ret=ret*a%mod;
          a=a*a%mod;
          n>>=1;
    }
    return ret;
}
void init()
{
    fac[0]=1;
    for(int i=1;i<maxn;i++)
    {
        fac[i]=fac[i-1]*i%mod;
    }
}
ll Cc(ll x, ll y)
{
    return fac[x]*pow_mod(fac[y]*fac[x-y]%mod,mod-2)%mod;
}

int main() {
	init();
	ll n, k, ans;
	cin >> n >> k;
	
	ans = Cc(2*n-1, n);
	for (int i = 1; i <= n - k - 1; i++) ans = (ans - Cc(n, i) * Cc(n-1, i-1) % mod) % mod;
	cout << (ans % mod + mod) % mod<< endl;
}


Measured memory_bytes: 4480
char a[2][204];n,m,i,j,c,p;main(s){for(;i=scanf(m="%d %[^\n] %[^\n]",&n,a,a+1)>2;printf(m>210?"NA\n":"%d\n",m)){for(;~i;m>c?m=c:0,--i)for(j=i,c=p=0;s=a[j][p+p]-50,c<220&&!s|n+~p;)p+=p<n&&s?~s|a[j][p+p+2]-49?j=!j,++c,2:1:-1;}}

Measured memory_bytes: 0
use std::collections::VecDeque;

pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let v: Vec<u32> = read_vec();
    let n = v[0];
    let q = v[1];

    let m: Vec<Vec<String>> = read_vec2(n);

    let mut queue: VecDeque<(&str, u32)> = VecDeque::new();

    for i in 0..n {
        let name = &m[i as usize][0];
        let time: u32 = m[i as usize][1].parse().unwrap();
        queue.push_back((name, time));
    }

    let mut total: u32 = 0;

    loop {
        let tmp = queue.pop_front();
        if let Some((n, t)) = tmp {
            if t > q {
                total += q;
                queue.push_back((n, t - q));
            } else {
                total += t;
                println!("{} {}", n, total);
            }
        } else {
            break;
        }
    }
}



Measured memory_bytes: 11064
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int N; cin >> N;
    unordered_map<int64,int64> ht_valNum;
    for(int i=0; i<N; ++i){
        int a; cin >> a;
        ++ht_valNum[ a ];
    }
    
    int sum=0;
    for(auto itr=ht_valNum.begin(); itr!=ht_valNum.end(); ++itr){
        int val = itr->first;
        int num = itr->second;
        if      (num > val){ sum += num - val;
        }else if(num < val){ sum += num; }
    }
    
    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 4260
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define piii pair<int, pii>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpii vector<pii>
#define vpiii vector<piii>
#define vpll vector<pll>
#define vplll vector<plll>
#define mod 1000000007

int modInverse(ll a, ll m) 
{ 
    ll m0 = m; 
    ll y = 0, x = 1; 
    if (m == 1) 
      return 0; 
    while (a > 1) 
    { 
        ll q = a / m; 
        ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    } 
    if (x < 0) 
       x += m0; 
    return x; 
} 
 ll dp[200000];

int po(ll x,ll y)
{
	ll res=1;
	while(y>0)
	{
		if(y&1)
			res=(res*x)%mod;
		y=y>>1;
		x=(x*x)%mod;
	}
	return res;
}

ll nck(ll n, ll k) {
	ll ans=1;
	for(int i=1; i<=k; ++i)
		ans=ans*(n-i+1)%mod*dp[i]%mod;
	return ans;
}
int main()
{
	ll n,a,b;
	cin>>n>>a>>b;
	ll an=(po(2,n))%mod;
	an--;

    dp[0] = dp[1] = 1; 
    for (int i = 2; i <= 200000; i++)  
        dp[i] = dp[mod % i] *  
               (mod - mod / i) % mod;   
	cout<<(an-nck(n,a)%mod-nck(n,b)%mod+2*mod)%mod;
	
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    int N;
    cin >> N;
    vector<ll> X(N), L(N);
    vector<pair<ll, ll>> right_left(N);
    REP(i, N) {
        cin >> X[i] >> L[i];
        right_left[i] = {X[i] + L[i], X[i] - L[i]};
    }
    SORT(right_left);
    int i = 0;
    ll limit = -1e9;
    int res = 0;
    while (i < N) {
        while (i < N && right_left[i].second < limit) ++i;
        if (i == N) break;
        limit = right_left[i].first;
        ++res;
        ++i;
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 6360
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define INF 1e9
typedef long long ll;
using namespace std;

int main() {
    int r; cin >> r;
    cout << 3*r*r << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

void CSort(int *a, int n);

int main(){
    int A = 0, B = 0, pos = 0, N;
    scanf("%d", &N);

    int a[N];
    for(int i = 0; i < N; i++){
        scanf("%d", &a[i]);
    }

    CSort(a, N);

    for(int i = N - 1; i >= 0; i--){
        switch(pos % 2){
            case 0:
                A += a[i];
                break;
            default:
                B += a[i];
                break;
        }
        pos++;
    }

    printf("%d\n", A - B);
    return 0;
}

void CSort(int *a, int n){
    int keys[100], pos = 0;
    for(int i = 0; i < 100; i++){
        keys[i] = 0;
    }

    for(int i = 0; i < n; i++){
        keys[a[i] - 1]++;
    }
    
    for(int i = 0; i < 100; i++){
        while(keys[i] > 0){
            a[pos] = i + 1;
            keys[i]--;
            pos++;
        }
    }
}

Measured memory_bytes: 128
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        c: i32,
        b: [i32; m],
    };

    let mut count = 0;
    for _ in 0..n {
        input! {
            a: [i32; m],
        };

        let a: Vec<i32> = a;

        let mut sum: i32 = 0;
        for (ai, bi) in a.iter().zip(b.iter()) {
            sum += ai * bi;
        }
        sum += c;

        if sum > 0 {
            count += 1;
        }
    }

    println!("{}", count);
}


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

int	main(void)
{
  int a, b, judge_num;
  cin >> a >> b;
  judge_num = a * b;
  if (judge_num % 2 == 0)
    cout << "Even" << endl;
  else
    cout << "Odd" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int n,i,k;char c;long long f0,f1,f2;
int main(){
	scanf("%d%d",&n,&f0);
	for (f1=f2=-1e18,n--;n--;){
		scanf(" %c%d",&c,&k);
		if (c=='-') k=-k;
		long long v0=f0+k,v1=f1-k,v2=f2+k;
		f0=max(v0,max(v1,v2));
		if (c=='+') f1=max(v1,v2),f2=v2;
		else f1=max(v0,max(v1,v2)),f2=max(v1,v2);
	}
	printf("%lld",f0);
}

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

using CP = complex<long double>;
#define X real()
#define Y imag()
const long double PI = acos(-1.0L);
const long double EPS = 1e-10;
// conj(x) : complex conjugate,(0,1)->(0,-1)
// abs(x) : dist between(0,0) and x
// norm(x) : abs(x) * abs(x)
// arg(x) : argment

// dot(a,b) = |a||b|cos x
long double dot(CP a, CP b) { return (a * conj(b)).X; }
// cross(a,b) : area of parallelogram
long double cross(CP a, CP b) { return (a * conj(b)).Y; }
long double corner(CP a, CP b) {
  //[0,pi]
  return acos(dot(a, b) / (abs(a) * abs(b)));
}
CP projection(CP p, CP s, CP t) {
  CP base = t - s;
  long double r = dot(p - s, base) / norm(base);
  return s + base * r;
}
CP reflection(CP p, CP s, CP t) {
  CP tmp = (projection(p, s, t) - p);
  tmp *= 2;
  return p + tmp;
}

CP intersection(CP a, CP b, CP c, CP d) {
  return a + (b - a) * (cross(d - c, c - a) /
                        cross(d - c, b - a));
}

bool on_seg(CP a, CP b, CP p) {
  // if not use end point, dot(a - p, b - p) < 0
  return abs(cross(a - p, b - p)) <= 1e-10 &&
         dot(a - p, b - p) <= 0;
}

// crossing lines? (a,b) and (c,d)
bool iscross(CP a, CP b, CP c, CP d) {
  // parallel
  if(abs(cross(a - b, c - d)) <= 1e-10) {
    return on_seg(a, b, c) || on_seg(a, b, d) ||
           on_seg(c, d, a) || on_seg(c, d, b);
  }
  CP isp = intersection(a, b, c, d);
  return on_seg(a, b, isp) && on_seg(c, d, isp);
}

long double distLP(CP a, CP b, CP p) {
  return abs(cross(b - a, p - a) / abs(b - a));
}

// segmentver.
long double distSP(CP a, CP b, CP p) {
  if(dot(b - a, p - a) < 0) return abs(p - a);
  if(dot(a - b, p - b) < 0) return abs(p - b);
  return distLP(a, b, p);
}

// segment and segment
long double distSS(CP a, CP b, CP c, CP d) {
  long double res = 1e18;
  res = min(res, distSP(a, b, c));
  res = min(res, distSP(a, b, d));
  res = min(res, distSP(c, d, a));
  res = min(res, distSP(c, d, b));
  return res;
}

struct convex_hull {
  vector<CP> ch;
  int psize;
  convex_hull() {}
  convex_hull(vector<CP> &ps) { calculation(ps); }
  void calculation(vector<CP> &ps) {
    auto lmd = [&](const CP &l, const CP &r) {
      if(l.X != r.X) return l.X < r.X;
      return l.Y < r.Y;
    };
    psize = ps.size();
    sort(ps.begin(), ps.end(), lmd);
    int k = 0;
    ch.resize(psize * 2);
    for(int i = 0; i < psize; ++i) {
      while(k > 1 && cross(ch[k - 1] - ch[k - 2],
                           ps[i] - ch[k - 1]) <= 0)
        --k;
      ch[k++] = ps[i];
    }
    for(int i = psize - 2, t = k; i >= 0; --i) {
      while(k > t && cross(ch[k - 1] - ch[k - 2],
                           ps[i] - ch[k - 1]) <= 0)
        --k;
      ch[k++] = ps[i];
    }
    ch.resize(k - 1);
    psize = ch.size();
  }
};

CP s, t, p;

int main() {
  cout << fixed << setprecision(10);
  long long a, b, c;
  cin >> a >> b >> c;
  s = CP(a, 0);
  t = CP(cos(c * PI / 180), sin(c * PI / 180));
  t /= abs(t);
  t *= b;
  p = projection(t, CP(0, 0), s);
  cout << abs(s) * abs(t - p) / 2.0L << endl;
  cout << a + b + abs(s - t) << endl;
  cout << abs(t - p) << endl;
  return 0;
}


Measured memory_bytes: 3524
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

template <class T>
class SegTree {
    int n;
    vector<T> data;
    T def;
    function<T(T, T)> operation;
    function<T(T, T)> update;

    T _query(int a, int b, int k, int l, int r) {
        if (r <= a or b <= l) return def;
        if (a <= l and r <= b) return data[k];
        else {
            T c1 = _query(a, b, 2*k+1, l, (l+r)/2);
            T c2 = _query(a, b, 2*k+2, (l+r)/2, r);
            return operation(c1, c2);
        }
    }

    public:
    SegTree(size_t _n, T _def, function<T(T, T)> _operation, function<T(T, T)> _update) : def(_def), operation(_operation), update(_update) {
        n = 1;
        while (n <= _n) {
            n *= 2;
        }
        data = vector<T>(2*n-1, def);
    }

    void change(int i, T x) {
        i += n-1;
        data[i] = update(data[i], x);
        while (i > 0) {
            i = (i-1) / 2;
            data[i] = operation(data[i*2+1], data[i*2+2]);
        }
    }

    T query(int a, int b) {
        return _query(a, b, 0, 0, n);
    }

    T operator[] (int i) {
        return data[i+n-1];
    }
};

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

    ll N, x;
    cin >> N >> x;
    vec a(N);
    SegTree<ll> st(N, inf, [](ll a, ll b){return min(a, b);}, [](ll a, ll b){return b;});
    Rep (i, N) {
        cin >> a[i];
        st.change(i, a[i]);
    }

    ll ans = inf;
    Rep (i, N) {
        ll tmp = x * i;
        Rep (j, N) {
            tmp += min(st.query(max<ll>(0, j-i), j+1), st.query(j-i+N, N));
        }
        // cout << i << " " << tmp << "\n";
        chmin(ans, tmp);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let odd_chars  = read::<String>().chars().collect::<Vec<_>>();
    let mut even_chars = read::<String>().chars().collect::<Vec<_>>();
    if odd_chars.len() > even_chars.len() {
        even_chars.push(' ');
    }
    let password   = odd_chars.into_iter().zip(even_chars.into_iter()).flat_map(|tuple| { vec![tuple.0, tuple.1] }).collect::<String>();
    println!("{}", password);
}

Measured memory_bytes: 4352
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			if(n == 0){
				break;
			}
			int m = scan.nextInt() - 2*n;
			char[] ch = (scan.next()).toCharArray();
			int count = 0;
			for(int i = 0;i < m;i++){
				if(ch[i] == 'I'){
					for(int j = 0;j < n;j++){
						if(ch[i+1+2*j] != 'O' || ch[i+2*(j+1)] != 'I'){
							break;
						}else if(j == n-1){
							count++;
						}
					}
				}
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 32672
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n;
    cin>>n;
    string s[n];
    ll a[n];
    rep(i,n){
        cin>>s[i]>>a[i];
    }
    bool ok=false;
    ll ans = 0;
    string t;
    cin>>t;
    rep(i,n){
        if(ok)ans+=a[i];
        ok|=s[i]==t;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
N, K = map(int,input().split())
MOD = 10**9 + 7
ans = 0
for i in range(K,N+2):
    # iこ えらぶ
    ans += (N+1)*N//2-(N-i)*(N-i+1)//2-i*(i-1)//2+1
    ans %= MOD
print(ans)


Measured memory_bytes: 9112