akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
	ll ans=1;
	rep(i,n){
		ans*=2;
	}
	return ans;
}
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	
	ll n,d;cin>>n>>d;
	ll ans=0;
	rep(i,n){
	    ll x,y;cin>>x>>y;
	    if(d*d>=x*x+y*y)ans++;
	}
	
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
	vector<int> nvec(n);
	for (int i = 0; i < n; i++) {
	cin >> nvec.at(i);
	}
	sort(nvec.begin(), nvec.end());
	int f = 0;
	for (int i = 1; i < n; i++) {
		if(nvec.at(i) == nvec.at(i-1)){
        	f++;
        	break;
        };
	}
	if(f == 0){
	    cout << "YES" << endl;	
    }else{
	    cout << "NO" << endl;
    }
    return 0;
}

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


int main() {
    int N;
    cin >> N;//4
    vector<int> vec(N);
    int answer = 101;
    int count = 0;
    
    rep(i,N){
        cin >> vec.at(i);
    }
    sort(vec.begin(),vec.end());
    reverse(vec.begin(),vec.end());
    
    rep(i,N){
        if(vec.at(i) < answer){
            count++;
            answer = vec.at(i);
        }
    }

    cout << count << endl;

}


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

int main() {
  ll N, Q;
  cin >> N;
  ll sum = 0;
  vector<ll> A(N);
  map<ll,ll> mp;
  for (auto &e : A) {
    cin >> e;
    mp[e] += 1;
    sum += e;
  }
  cin >> Q;
  vector<pair<ll,ll>> BC(Q);
  for (auto &p : BC) {
    cin >> p.first >> p.second;
    if (mp.count(p.first)) {
      ll f = mp[p.first];
      mp.erase(p.first);
      mp[p.second] += f;
      sum += (p.second-p.first)*f;
    }
    cout << sum << endl;
  }
}

Measured memory_bytes: 9544
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int k, n;
int h[101010];

int main(){
    cin >> n >> k;
    REP(i, n)cin >> h[i];
    sort(h, h + n);
    int ans = HINF<int>();
    for(int i = k - 1;i < n;i++){
        ans = min(ans, h[i] - h[i - k + 1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
//#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<numeric>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<map>
#include<stack>
#include<queue>
#include<ctype.h>
#include <fstream>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}
int dy[4]={0,1,0,-1};
//----------program from here----------

int main(){
    string S="";
    cin >> S;
    int z=0, o=0;
    for(int i=0; i<S.length(); ++i){
        if(S[i]=='0') ++z;
        if(S[i]=='1') ++o;
    }
    cout << (z&&o?min(z, o)*2:0) << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include <boost/math/common_factor_rt.hpp>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    LL from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
int main(){
    LCIN(N);
    V<LL> vec;
    REP(a,N){
        LCIN(b);
        vec.pb(b);
    }
    LL ans = 1LL;
    REP(a,N){
        ans = boost::math::lcm(vec.at(a),ans);
    }
    COUT(ans);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  char a[100];
  for(int i=0;i<6;i++){
  scanf("%s",&a[i]);
  }
  if(a[2]==a[3] && a[4]==a[5]){
    printf("Yes");
  }
  else{
    printf("No");
  }
  return 0;
}

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

int main(){
    while(1){
        int H,W;
        cin>>H>>W;
        if(H==0&&W==0){
            break;
        }
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                cout<<"#";
            }
            cout<<endl;
        }
        cout<<endl;
    }
    return 0;
}


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

int main() {
	int N, M, C;
	int count = 0;
	cin >> N >> M >> C;
	vector <int> Bs(M);
	vector<vector<int>>  vec(N,vector<int>(M));

	for (int i = 0; i < M; i++) {
		cin >> Bs.at(i);
	}

	for (int i = 0; i < N; i++) {

		for (int j = 0; j < M; j++) {
				cin >> vec.at(i).at(j);
		}
	}
	
	//cout << "入力終了" << endl;
	for (int i = 0; i < N; i++) {

		int sum = 0;

		for (int j = 0; j < M; j++) {
			sum += vec.at(i).at(j) * Bs.at(j);
		}
		// for check
		//cout << sum << endl;

		if (sum + C > 0) {
			count++;
		}
		else {
			continue;
		}
	}

	cout << count << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main() {
	int n, a, num[100000] = {0}, x, sum, max = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a);
		num[a]++;
	}
	for (int i = 0; i < 1e5 - 2; i++) {
		sum = num[i] + num[i + 1] + num[i + 2];
		if (sum > max) max = sum;
	}
	printf("%d\n", max);
	return 0;
}

Measured memory_bytes: 512
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define SORTD(a) sort(a.rbegin(), a.rend());
#define ll long long
#define INF 1000000000000000000
#define INT_MAX 2147483647

#include <iostream>
#include <vector>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <utility>
#include <ios>
#include <iomanip>

using namespace std;

int main(){
    int N;
    cin >> N;
    priority_queue<ll> D;
    REP(i,N){
        ll d;
        cin >> d;
        D.push(d);
    }

    int M;
    cin >> M;
    priority_queue<ll> T;
    REP(i,M){
        ll t;
        cin >> t;
        T.push(t);
    }

    while(true){
        if(T.empty()){
            cout << "YES" << endl;
            break;
        }else if(D.empty()){
            cout << "NO" << endl;
            break;
        }else if(D.top()<T.top()){
            cout << "NO" << endl;
            break;
        }else if(D.top() == T.top()){
            D.pop();
            T.pop();
        }else{
            D.pop();
        }
    }
    return 0;
}


Measured memory_bytes: 4848
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BTapDance solver = new BTapDance();
        solver.solve(1, in, out);
        out.close();
    }

    static class BTapDance {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String x = in.next();
            for (int i = 0; i < x.length(); i++) {
                if (i % 2 == 1 && x.charAt(i) == 'R') {
                    out.println("No");
                    return;
                } else if (i % 2 == 0 && x.charAt(i) == 'L') {
                    out.println("No");
                    return;
                }
            }
            out.println("Yes");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using namespace std;
const long long INF = 1LL << 60;
ll mod = 1e9 + 7;

int main()
{
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i, n)
    {
        int A, B;
        cin >> A >> B;
        mp[B] += A;
    }
    int sum = 0;
    bool ans = true;
    for (auto i : mp)
    {
        sum += i.second;
        if (i.first < sum)
            ans = false;
    }
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}


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

using namespace std;

const double EPS = 1e-10;
typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
      return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
    }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
      push_back(a); push_back(b);
    }
};

int main(){
    double xA, yA, xB, yB, xC, yC, xD, yD;
    while(cin >> xA >> yA >> xB >> yB >> xC >> yC >> xD >> yD){
        L a(P(xA, yA), P(xB, yB)), b(P(xC, yC), P(xD, yD));
        cout << (abs(dot(a[0]-a[1], b[0]-b[1])-0)<EPS?"YES":"NO") << endl;
    }
}

Measured memory_bytes: 1224
/* ex6_2
   KKOO  */

#include <stdio.h>
#include <string.h>

#define SIZE 256

int main(void){
    int length;
    char word[SIZE];

    //英単語を入力
    fgets(word, SIZE, stdin);

    //文字列の長さ
    length = strlen(word);

    if(length > 3){
        //”lengthー３”・・・単語の前後の文字とnull文字を引いた長さ
        //”word[lengthー2]”・・・word[lengthー1]はnull文字なので-2にする
        printf("%c%d%c\n", word[0], length-3, word[length-2]);
    }
    else{
        //2文字以下の単語はそのまま出力
        printf("%s",word);
    }

    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {

	int N, d;
	cin >> N;

	vector<int> vec;
	for (int i = 0; i < N; i++) {
		cin >> d;
		vec.push_back(d);
	}

	sort(vec.begin(), vec.end());
	vec.erase(unique(vec.begin(), vec.end()), vec.end());

	cout << vec.size() << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 5e2 + 10;
int a[N][N];
map<int, int> mc[4];
int ans[4][N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n, c;
	cin >> n >> c;
	for (int i = 1; i <= c; i++)
	{
		for (int j = 1; j <= c; j++)
		{
			cin >> a[i][j];
		}
	}
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			int x;
			cin >> x;
			mc[(i + j) % 3][x]++;
		}
	}
	for (int i = 0; i < 3; i++)
	{
		int minv = INF;
		for (int j = 1; j <= c; j++)
		{
			int sum = 0;
			for (auto& p : mc[i])
			{
				sum += a[p.first][j] * p.second;
			}
			ans[i][j] = sum;
		}
	}
	int res = INF;
	for (int i = 1; i <= c; i++)
	{
		for (int j = 1; j <= c; j++)
		{
			if (i == j) continue;
			for (int k = 1; k <= c; k++)
			{
				if (i == k || j == k) continue;
				res = min(res, ans[0][i] + ans[1][j] + ans[2][k]);
			}
		}
	}
	cout << res << endl;
	return 0;
}


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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.setf(ios::fixed);
    cout.precision(10);
    
    string s;
    cin >> s;
    if (s.find('A') != string::npos && s.find('B') != string::npos) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...)
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k; cin >> n >> k;
    vector<int> a(n), sp;
    map<int, int> m;
    rep (i, n) {
        cin >> a[i]; m[a[i]]++;
    }
    for (auto [p, q] : m) sp.push_back(q);
    sort(all(sp));
    ll ans = 0;
    rep (i, max(0LL, (ll)sp.size() - k)) ans += sp[i];
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 14248
#include <iostream>
#include <stdio.h>
#include <math.h>
 
using namespace std;
 
double length(double x1, double y1, double x2, double y2){
  return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
 
bool intersection(double x1, double y1, double x2, double y2, double ret[2][2]){
  double l = length(x1,y1,x2,y2);
  if(l>2.0) return false;
  double theat = atan2(y2-y1, x2-x1);
  double alpha = acos(l/2.0);
  ret[0][0]=x1+cos(theat+alpha);
  ret[0][1]=y1+sin(theat+alpha);
  ret[1][0]=x1+cos(theat-alpha);
  ret[1][1]=y1+sin(theat-alpha);
  return  true;
}
int main(){
  int n;
  double seals[100][2]={{0}};
  while (true){
    cin >> n;
    if (n == 0) break;
    for(int i = 0; i < n; i++){
      scanf("%lf,%lf", &seals[i][0], &seals[i][1]);
    }
    int max_seals=0;
    for(int i = 0; i < n - 1; i++){
      for(int j = i + 1; j < n; j++){
	double ret[2][2] = {{0}};
	if(intersection(seals[i][0], seals[i][1], seals[j][0], seals[j][1], ret)){
	  int counter = 0;
	  for(int k = 0; k < n; k++){
	    double l = length(ret[0][0], ret[0][1], seals[k][0], seals[k][1]);
	    if(l <= 1.000009)counter++;
	  }
	  max_seals = max(counter,max_seals);
	  counter = 0;
	  for(int k = 0; k < n; k++){
	    double l = length(ret[1][0], ret[1][1], seals[k][0], seals[k][1]);
	    if(l <= 1.000009)counter++;
	  }
	  max_seals = max(counter,max_seals);
	}
      }
    }
    if (max_seals == 0)
      printf("%d\n", 1);
    else
      printf("%d\n", max_seals);
  }
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N, Z, W; scanf("%d %d %d", &N, &Z, &W);
  vector<int> A(N);
  for (int i = 0; i < N; ++i) {
    scanf("%d", &A[i]);
  }
  int ans = abs(A[N - 1] - W);
  if (N > 1) { ans = max(ans, abs(A[N - 2] - A[N - 1])); }
  printf("%d\n", ans);
  return 0;
}


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

#define MOD (1000000000+7)
#define MAX 1000000

long long power( long long x, long long n )
{
	long long res = 1;
	while( n > 0 ) {
		if( n % 2 ) res = res * x % MOD;
		x = x * x % MOD;
		n /= 2;
	}
	return res;
}

int main()
{
	int X, Y;
	cin >> X >> Y;

	long long ans = 0;
	if( (X + Y) % 3 == 0 ) {
		int n = ( 2 * X - Y ) / 3;
		int m = ( 2 * Y - X ) / 3;
		if( n >= 0 && m >= 0 ) {
			vector<long long> fac( MAX + 1 );
			fac[0] = 1;
			for( int i = 1; i < MAX + 1; i++ ) {
				fac[i] = fac[i - 1] * i % MOD;
			}
			vector<long long> ifac( MAX + 1 );
			ifac[MAX] = power( fac[MAX], MOD - 2 );
			for( int i = MAX; i > 0; i-- ) {
				ifac[i - 1] = ifac[i] * i % MOD;
			}
			ans = fac[n + m] * ifac[n] % MOD * ifac[m] % MOD;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 15872
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
	int n,a,b;
	scanf("%d %d %d",&n,&a,&b);
	printf("%d",min((n*a),b));
	return 0;
}

Measured memory_bytes: 256
// Problem : C - Shopping Street
// Contest : AtCoder - AtCoder Beginner Contest 080
// URL : https://atcoder.jp/contests/abc080/tasks/abc080_c
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
	int n;cin>>n;
	int open[n][5][2];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<5;j++)
		{
			for(int k=0;k<2;k++)
			cin>>open[i][j][k];
		}
	}
	int profit[n][11];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<=10;j++)
		cin>>profit[i][j];
	}
	int ans=INT_MIN;
	for(int i=1;i<(1<<10);i++)
	{
		int common[n]={0};
		for(int j=0;j<10;j++)
		{
			if(i&(1<<j))
			{
				int x=j/2;
				for(int k=0;k<n;k++)
				common[k]+=open[k][x][j%2];
			}
		}
		int cnt=0;
		for(int i=0;i<n;i++)
		cnt+=profit[i][common[i]];
		ans=max2(ans,cnt);
	}
	cout<<ans;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>

int main()
{
   long int a,b,c,x,y=0,flag=0,i,j,count,sum,max;
 
   scanf("%ld%ld",&a,&b);
   if(a>=b && a%500<=100 && a>500)
   {
       printf("Yes");
   }else{
       if(b%500<=100 && b>500)
       {
           printf("Yes");
       }else{
       printf("No");
   }}
   
     return 0;
}


Measured memory_bytes: 128
package main

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

const (
	SIGN = "CODEFESTIVAL2016"
)

func main() {
	fsc := NewFastScanner()
	S := fsc.NextLine()
	var res int
	res = 0
	N := len(S)
	for i := 0; i < N; i++ {
		if SIGN[i] != S[i] {
			res++
		}
	}
	fmt.Println(res)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *FastScanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,t = map(int, input().split())
    res = 100000000000
    for _ in range(n):
        a,b = map(int, input().split())
        if b<=t:
            res = min(res, a)
    if res ==100000000000:
        print('TLE')
    else:
        print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
//priority_queue<int, vector<int>, greater<int> > pq;
#define _CRT_SECURE_NO_DEPRECATE
const int N = 330030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =  1e9+7;
using namespace std;

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

    int N, K;
    cin >> N >> K;

    vector<int> V(N+1, 0);
    for (int i = 1; i <= N; ++i) {
        cin >> V[i];
    }

    int M = min(N, K);
    int ans = 0;
    for (int l = 0; l <= M; ++l) {
        for (int r = 0; l + r <= M; ++r) {
            int sum = 0;
            vector<int> x;
            for (int i = 1; i <= N; ++i) {
                if (l < i && i < N - r + 1) continue;
                x.push_back(V[i]);
                sum += V[i];
            }
            sort(x.begin(), x.end());
            for (int i = 0; i < min((int)x.size(), K - l - r) && x[i] < 0; ++i) {
                sum -= x[i];
            }
            ans = max(ans, sum);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  string S;
  
  cin >> S;
  
  if(S.size() % 2 == 0){
    for(int i = 0;i < S.size();++i){
      if(i % 2 == 0){
        if(S[i] == 'h'){
        }
        else{
          cout << "No" << endl;
          return 0;
        }
      }
      else{
        if(S[i] == 'i'){
        }
        else{
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }
  else{
    cout << "No" << endl;
    return 0;
  }
  
  cout << "Yes" << endl;
}
        

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

// x未満が何個あるか
ll solve(ll x, const vector<ll>& v, const vector<ll>& w, const vector<ll>& rv, const vector<ll>& rw){
  ll ret = 0;
  rep(i,rw.size()){
    ll lb = i, ub = rw.size();
    while(ub-lb>1){
      ll mid = (ub-lb)/2+lb;
      if(mid<=i) lb = mid;
      else{
        if(rw[mid]*rw[i] < x) lb = mid;
        else ub = mid;
      }
    }
    ret += lb-i;
  }

  rep(i,w.size()){
    ll lb = -1, ub = rv.size();
    while(ub-lb>1){
      ll mid = (ub-lb)/2+lb;
      if(mid<0) lb = mid;
      else{
        if(rv[mid]*w[i] < x) lb = mid;
        else ub = mid;
      }
    }
    ret += ub;
  }

  rep(i,v.size()){
    ll lb = i, ub = v.size();
    while(ub-lb>1){
      ll mid = (ub-lb)/2+lb;
      if(v[mid]*v[i] < x) lb = mid;
      else ub = mid;
    }
    ret += lb-i;
  }
  return ret;
}


int main(){
  ll N, K;
  cin >> N >> K;
  vector<ll> v, w, rv, rw;
  rep(i,N){
    ll a;
    cin >> a;
    if(a >= 0){
      v.push_back(a);
      rv.push_back(a);
    }else{
      w.push_back(a);
      rw.push_back(a);
    }
  }
  sort(ALLOF(v));
  sort(ALLOF(w));
  sort(ALLOF(rv));
  reverse(ALLOF(rv));
  sort(ALLOF(rw));
  reverse(ALLOF(rw));

  ll lb = -2000000000000000005LL, ub = 2000000000000000005LL;  
  while(ub-lb>1){
    ll mid = (ub-lb)/2+lb;

    ll res = solve(mid, v,w,rv,rw);
    if(res < K) lb = mid;
    else ub = mid;
  }

  cout << lb << endl;
  
  return 0;
}


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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)


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

    int n, m;
    while(cin >> n >> m) {
        if(n == 0 && m == 0) break;

        vector<int> field(n);
        rep(i, n) cin >> field[i];
        vector<int> order(m);
        rep(i, m) cin >> order[i];
        int idx = 0, ans = 0;
        rep(i, m) {
            ans++;
            idx += order[i];
            if(idx >= n) break;
            idx += field[idx];
            if(idx >= n) break;
        }
        cout << ans << '\n';
    }
    return 0;
}


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


int main(){
    // あとで消す
    //std::ifstream in("bin1.txt");
    //std::cin.rdbuf(in.rdbuf());

    int N,ai;
    cin >> N;

    while(N!=0){
        cin >> ai;
        if(ai%2==0){
            if(ai%3==0 || ai%5==0){

            }else{
                cout << "DENIED" << endl;
                return 0;
            }
        }
        N--;
    }

    cout << "APPROVED" << endl;

    return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))

mx = [0] * N
cnts = [0] * N
for i in range(N):
  if mx[i] == 0:
    nxt = P[i]-1
    tmp = 0
    l = [nxt]
    for j in range(N):
      tmp += C[nxt]
      nxt = P[nxt]-1
      l.append(nxt)
      if nxt == i:
        tmp += C[nxt]
        cnt = j+2
        break
    for k in l:
      cnts[k] = cnt
      n = ((K//cnt)-1) * tmp
      if tmp > 0:
        mx[k] += n
    
for i in range(N):
  nxt = P[i]-1
  tmp = 0
  m = min(C) - 1
  for j in range((K%cnts[i])+cnts[i]):
    tmp += C[nxt]
    m = max(m, tmp)
    nxt = P[nxt]-1
  mx[i] += m

ans = max(mx)
print(ans)

Measured memory_bytes: 78532
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + (ll)b) % mod
#define MUL(a, b) a = (a * (ll)b) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rer(i, a, b) for(int i = a - 1; i >= b; i--)
#define all(a) (a).begin(), (a).end()
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef pair<pi, pi> ppi;
typedef vector<ll> vec;

const int MAX_N = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;

void Debug() {cout << '\n'; }

template<class FIRST, class... REST> 
void Debug(FIRST arg, REST... rest) { cout << arg << " "; Debug(rest...); }

template<class T>
ostream& operator<< (ostream& out, const vector<T>& v) {
	out << "[";
	if(!v.empty()) {
		rep(i, 0, (int)v.size() - 1) out << v[i] << ", ";
		out << v.back();
	}
	out << "]";
  return out;
}

template<class S, class T>
ostream& operator<< (ostream& out, const pair<S, T>& v) {
	out << "(" << v.first << ", " << v.second << ")";
	return out;
}

///g++ -g3 -std=c++0x -DLOCAL -Wall -ftrapv -D_GLIBCXX_DEBUG -Wl,-stack,268435456 -o
///g++ -O2 -std=c++0x -DLOCAL -Wall -Wl,-stack,268435456 -o

///////////////////////////////////////////////////////////////////////

int N;
string str;

bool ok(vector<int> res) {
	for(int i = 1; i < N + 1; i++) {
		//debug(i, res);
		if(res[i % N] == 0 && str[i % N] == 'x') {
			int a = res[(i + 1) % N];
			res[(i + 1) % N] = 1 - res[(i - 1 + N) % N];
			if(a != -1 && res[(i + 1) % N] != a) return false;
		}
		if(res[i % N] == 0 && str[i % N] == 'o') {
			int a = res[(i + 1) % N];
			res[(i + 1) % N] = res[(i - 1 + N) % N];
			if(a != -1 && res[(i + 1) % N] != a) return false;
		}
		if(res[i % N] == 1 && str[i % N] == 'x') {
			int a = res[(i + 1) % N];
			res[(i + 1) % N] = res[(i - 1 + N) % N];
			if(a != -1 && res[(i + 1) % N] != a) return false;
		}
		if(res[i % N] == 1 && str[i % N] == 'o') {
			int a = res[(i + 1) % N];
			res[(i + 1) % N] = 1 - res[(i - 1 + N) % N];
			if(a != -1 && res[(i + 1) % N] != a) return false;
		}
	}
	for(int i = 0; i < N; i++) {
		if(res[i] == 0) cout << "S";
		else cout << "W";
	}
	cout << "\n";
	return true;
}

void solve() {
	cin >> N;
	cin >> str;
	for(int i = 0; i < 8; i++) {
		vector<int> res(N, -1);
		for(int j = 0; j < 3; j++) {
			if((1 << j) & i) res[j] = 0;
			else res[j] = 1;
		}
		if(ok(res)) return;
	}
	cout << "-1\n";
}

int main() {
	ios::sync_with_stdio(false);
    cin.tie(0);	
    cout << fixed;
	cout.precision(20);
#ifdef LOCAL
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 1296
#ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip> 
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'


void solve(){
  int a, b, c;
  cin >> a >> b >> c;
  int cnt = 0;
  while (a%2==0 and b%2==0 and c%2==0){
    debug() << imie(a) << imie(b) << imie(c);
    int aa = a, bb = b, cc = c;
    a = bb / 2 + cc / 2;
    b = aa / 2 + cc / 2;
    c = aa / 2 + bb / 2;
    cnt++;
    if (cnt > 100){
      cout << -1;
      return;
    }
  }
  cout << cnt << endl;
  
}

int main() {
  ios::sync_with_stdio(false);
  int t = 1;
  // cin >> t;
  forn(i, t){
    solve();
  }
}

/* 

1
322123


n - 1
0 ... (n-1) [res ... res] S - (n-1) ... S


 */

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

const int N = 1000010;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int k;
  cin >> k;

  set<int> st;
  int answer = 0;
  int mod = 0;
  for (int i = 1; i < N; i++) {
    mod = (mod * 10 + 7) % k;
    if(mod == 0) {
      answer = i;
      break;
    }
    if(st.count(mod)) {
      answer = -1;
      break;
    }
    st.insert(mod);
  }

  cout << answer << endl;

}

Measured memory_bytes: 50528
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef long int				int32;
typedef unsigned long int		uint32;
typedef long long int			int64;
typedef unsigned long long int  uint64;
typedef pair<int, int>			PII;
typedef vector<int>				VI;
typedef vector<long long>		VLL;
typedef vector<string>			VS;
typedef vector<PII>				VII;
typedef vector<VI>				VVI;

#define MEM(a, b)				memset(a, (b), sizeof(a))
#define calctime				std::cout << setprecision(5) << fixed << "Time to completed program: " << (double)(clock() - start)/(CLOCKS_PER_SEC) << "s.\n";
#define FOR(i, j, k, in)		for (int i = (j); i < (k); i += (in))
#define FORW(i, j, k, in)		for (int i = (j); i <= (k); i += (in))
#define RFOR(i, j, k, in)		for (int i = (j); i >= (k); i -= (in))
#define RFORW(i, j, k, in)		for (int i = (j); i > (k); i -= (in))
#define aint64(cont)			cont.begin(), cont.end()
#define raint64(cont)			cont.end(), cont.begin()
#define sz(cont)				int((cont).size())
#define PB						push_back
#define MP						make_pair
#define EPS						1e-9
#define MOD						1000000007
#define PI						3.1415926535897932384626433832795
#define Ff						first
#define Ss						second
#define FastIO					ios_base::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL);
#define fileIO(name)			ifstream iFs(name".inp"); ofstream oFs(name".out");
#define fileio(name)			ifstream cin(name".inp"); ofstream cout(name".out");
#define endl					'\n'

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

int a[1005][1005] = {};
int dp[1005][1005] = {};

int n, m;

int check(int i, int j) {
	return ((0 <= i) && (i < n) && (0 <= j) && (j < m));
}

int add(int64 a, int64 b, int mod) {
	return (a + b >= mod ? (a + b) % mod : a + b);
}

int main() {
	FastIO;
#ifndef ONLINE_JUDGE
	fileio("input");		//Remember to change this
#endif

	cin >> n >> m;

	FOR(i, 0, n, 1)FOR(j, 0, m, 1) {
		char c; cin >> c;
		a[i][j] = (c == '.' ? 0 : -1);
	}

	if (a[0][0] == -1) { cout << 0 << endl; return 0; }

	FOR(i, 1, n, 1) {
		if (a[i][0] == 0)
			a[i][0] = 1;
		else break;
	}
	FOR(j, 1, m, 1)
		if (a[0][j] == 0) a[0][j] = 1;
		else break;

	FOR(i, 1, n, 1) FOR(j, 1, m, 1) {
		if (a[i][j] == -1) continue;
		if (a[i - 1][j] > 0)
			a[i][j] = add(a[i][j], a[i - 1][j], 1e9 + 7);
		if (a[i][j - 1] > 0)
			a[i][j] = add(a[i][j], a[i][j - 1], 1e9 + 7);
	}

	cout << (a[n - 1][m - 1] > 0 ? a[n - 1][m - 1] : 0) << endl;


	//calctime
	return 0;
}

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

using namespace std;

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

	int k, s;
	cin >> k >> s;
	int res = 0;
	for (int x = k; x >= 0; x--) {
		for (int y = k; y >= 0; y--) {
			if (s - x - y <= k
			    && s - x - y >= 0) {
				res++;
			}
		}
	}
	cout << res << '\n';

	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
void aprint(int[],int);
void insertionSort(int[],int);
int main(){
  int N;
  int i;
  int A[100];

  scanf("%d",&N);
  while(N<0&&N>100){
    scanf("%d",&N);
  }
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  aprint(A,N);
  insertionSort(A,N);
  return 0;
}

void insertionSort(int A[],int N){
  int i,j,v;

  for(i=1;i<N;i++){
    v=A[i];
    j=i-1;
    while(j>=0&&A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;
    aprint(A,N);
  }
}

void aprint(int A[],int N){
  int i;
  for(i=0;i<N;i++){
    if(i>0)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}



Measured memory_bytes: 2140
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
using lint = long long int;
#define FOR(x,to) for(x=0;x<(to);x++)

int main() {
	int i, j, k, l;
	string s, t;
	cin >> s >> t;
	vector<int> a(26), b(26);
	int n = s.size();
	FOR(i, n) {
		a[s[i] - 'a']++;
		b[t[i] - 'a']++;
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	
	bool same = true;
	FOR(i, 26) {
		if (a[i] != b[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

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

void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}
 
void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long
#define end puts("NO"),exit(0)

const int maxn = 1e6+10;
const int inf = 1e9;
const lf eps = 1e-8;
const int mod = 924844033;

int add(int x,int y) {return x+y>mod?x+y-mod:x+y;}
int del(int x,int y) {return x-y<0?x-y+mod:x-y;}
int mul(int x,int y) {return 1ll*x*y-1ll*x*y/mod*mod;}

int qpow(int a,int x) {
    int res=1;
    for(;x;x>>=1,a=mul(a,a)) if(x&1) res=mul(a,res);
    return res;
}

int fac[maxn],ifac[maxn],inv[maxn],pos[maxn],N,mxn,bit,n;
int w[maxn],rw[maxn],f[maxn],g[maxn],h[maxn],head[maxn],tot,sz[maxn];
struct edge{int to,nxt;}e[maxn<<1];

void ins(int u,int v) {e[++tot]=(edge){v,head[u]},head[u]=tot;}

void dfs(int x,int fa) {
    sz[x]=1;
    for(int i=head[x];i;i=e[i].nxt) 
        if(e[i].to!=fa) dfs(e[i].to,x),sz[x]+=sz[e[i].to],g[sz[e[i].to]]++;
    g[n-sz[x]]++;
}

void ntt_init() {
    w[0]=rw[0]=1,w[1]=qpow(5,(mod-1)/mxn);
    for(int i=2;i<=mxn;i++) w[i]=mul(w[i-1],w[1]);
    rw[1]=qpow(w[1],mod-2);
    for(int i=2;i<=mxn;i++) rw[i]=mul(rw[i-1],rw[1]);
}

void ntt_get(int len) {
    for(bit=0,N=1;N<=len;N<<=1,bit++);
    for(int i=0;i<N;i++) pos[i]=pos[i>>1]>>1|((i&1)<<(bit-1));
}

void ntt(int *r,int op) {
    for(int i=1;i<N;i++) if(pos[i]>i) swap(r[i],r[pos[i]]);
    for(int i=1,d=mxn>>1;i<N;i<<=1,d>>=1) 
        for(int j=0;j<N;j+=i<<1) 
            for(int k=0;k<i;k++) {
                int x=r[j+k],y=mul((op==-1?rw:w)[k*d],r[i+j+k]);
                r[j+k]=add(x,y),r[i+j+k]=del(x,y);
            }
    if(op==-1) {int d=qpow(N,mod-2);for(int i=0;i<N;i++) r[i]=mul(r[i],d);}
}

int main() {
    read(n);for(int x,y,i=1;i<n;i++) read(x),read(y),ins(x,y),ins(y,x);
    dfs(1,0);fac[0]=ifac[0]=inv[0]=inv[1]=1;
    for(int i=1;i<=n;i++) fac[i]=mul(fac[i-1],i);
    for(int i=2;i<=n;i++) inv[i]=mul(mod-mod/i,inv[mod%i]);
    for(int i=1;i<=n;i++) ifac[i]=mul(ifac[i-1],inv[i]);
    for(int i=0;i<=n;i++) h[i]=ifac[i],g[i]=mul(g[i],fac[i]);
    g[0]=0;
    
    reverse(g,g+n+1);for(mxn=1;mxn<=n<<1;mxn<<=1);
    // for(int i=0;i<=n;i++) printf("%d ",g[i]);puts("");
    // for(int i=0;i<=n;i++) printf("%d ",h[i]);puts("");
    ntt_init(),ntt_get(n<<1),ntt(g,1),ntt(h,1);//printf("N :: %d\n",N);
    for(int i=0;i<N;i++) f[i]=mul(g[i],h[i]);
    ntt(f,-1);
    // for(int i=1;i<=n;i++)
    //     for(int j=i;j<=n;j++) 
    //         f[i]=add(f[i],mul(g[j],h[j-i]));
    // for(int i=0;i<=n;i++) printf("%d ",f[i]);puts("");
    for(int i=1;i<=n;i++) write(del(mul(n,mul(fac[n],mul(ifac[i],ifac[n-i]))),mul(ifac[i],f[n-i])));
    return 0;
}


Measured memory_bytes: 55168
n = int(input())
F = {}
tmp = n
i = 2
while i**2 <= tmp:
    cnt = 0
    while tmp % i == 0:
        cnt += 1
        tmp //= i
    if cnt > 0:
        F[i] = cnt
    i += 1
if tmp != 1 or F == {}:
    F[tmp] = 1
G = []
for p in F:
    for i in range(F[p]):
        G.append(str(p))
G = ' '.join(G)
print(f'{n}: {G}')



Measured memory_bytes: 5612
#include <iostream>
using namespace std;
int main(void){
    int n,k,p;
    cin>>n;
    for(int i=0;i<n;i++){
    cin>>k>>p;
    if(k%p>=1){
        cout<<k%p<<endl;
    }
    else if(k%p==0){
        cout<<p<<endl;
    }
    }
}


Measured memory_bytes: 3116
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    S =     _in[0]   # type:str
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    TF = 'Yes' if S[2]==S[3] and S[4]==S[5] else 'No'
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(TF)


Measured memory_bytes: 38384
import sys
n=10**6
p=[1]*n
p[0],p[1]=0,0
for i in xrange(2,int(n**0.5)+1):
    if p[i]==1:
        for j in xrange(i**2,n,i):
            p[j]=0
for i in xrange(2,n):
    p[i]+=p[i-1]
for line in sys.stdin.readlines():
    print p[int(line)]

Measured memory_bytes: 38124
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <unordered_map>
#include <queue>
#include <set>
using namespace std;


long long gcd(long long a, long long b){
    if (a < b) return gcd(b, a);
    if (b == 0) return a;
    return gcd(b, a % b);
}


long long findDiv(long long x){
    long long divisor = 2;
    set<long long> divs;
    while(divisor * divisor <= x){
        if (x % divisor == 0){
            divs.insert(divisor);
            while(x % divisor == 0){
                x /= divisor;
            }
        }
        divisor++;
    }
    if (x > 1){
        divs.insert(x);
    }
    return divs.size();
}


int main(){
    long long a, b;
    cin >> a >> b;
    long long divisor = gcd(a, b);
    cout << findDiv(divisor) + 1 << endl;
    return 0;
}

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

int main() {
  int num;
  string n;
  bool ans = 0;
  
  cin >> num;
  
  n = to_string(num);
  
  for (int i = 0; i < n.size(); i++) {
    if (n.at(i) == '9') {
      ans = 1;
    }
  }
  
  if (ans == 1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
}
  

Measured memory_bytes: 256
def run(N):
    ret = []
    if N == 1:
        ret.append('Yes')
        ret.append(2)
        ret.append([[1, 1], [1, 1]])
    elif N < 3:
        ret.append('No')
    else:
        for i in range(3, N+1):
            if N * 2 < i * (i-1):
                ret.append('No')
                break
            elif N * 2 == i * (i-1):
                ret.append('Yes')
                ret.append(i)
                S = []
                for j in range(1, i+1):
                    '''
                    j列の1行目は、1列目のj行目
                    j列の2行目は、2列目のj行目
                    j列のk行目は、k列目のj行目
                    j列のj行目以降は、j-1列目の最後の行の数+1から1ずつ増加
                    '''
                    tmp = [i-1]
                    for k in range(1, i):
                        if k < j:
                            tmp.append(S[k-1][j-1])
                        else:
                            if j < 2:
                                tmp.append(k-j+1)
                            else:
                                tmp.append(S[j-2][i-1]+k-j+1)
                    S.append(tmp)
                ret.append(S)
    return ret


def main():
    N = int(input())
    ret = run(N)
    print(ret[0])
    if len(ret) > 1:
        k = ret[1]
        print(k)
        for s in ret[2]:
            s = [str(si) for si in s]
            print(' '.join(s))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9028
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,d=0;
    cin>>n;
    int a[n],i,maxx;
    for(i=0;i<n;i++)
        cin>>a[i];
        sort(a,a+n);
        for(i=0;i<n-1;i++)
        {
            d=d+a[i];
        }
        cout<<d+a[n-1]/2;
        return 0;
}


Measured memory_bytes: 256