akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
const int MAXN=10005,MOD=998244353;

int PowMod(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)
			res=1LL*res*a%MOD;
		a=1LL*a*a%MOD;
		b>>=1;
	}
	return res;
}

int N;
char A[MAXN],B[MAXN];
int dp[MAXN][MAXN];

int fac[MAXN],ifac[MAXN];
int C(int n,int r)
{return 1LL*fac[n]*ifac[n-r]%MOD*ifac[r]%MOD;}

int main()
{
	scanf("%s%s",A+1,B+1);
	N=strlen(A+1);
	int X=0,Y=0;
	for(int i=1;i<=N;i++)
	{
		if(A[i]=='1'&&B[i]=='1')
			X++;
		else if(A[i]=='1')
			Y++;
	}
	
	fac[0]=1;
	for(int i=1;i<=N;i++)
		fac[i]=1LL*fac[i-1]*i%MOD;
	ifac[N]=PowMod(fac[N],MOD-2);
	for(int i=N-1;i>=0;i--)
		ifac[i]=1LL*ifac[i+1]*(i+1)%MOD;
	
	for(int j=0;j<=Y;j++)
		dp[0][j]=1LL*fac[j]*fac[j]%MOD;
	for(int i=1;i<=X;i++)
		for(int j=1;j<=Y;j++)
			dp[i][j]=(1LL*dp[i-1][j]*i%MOD*j%MOD+1LL*dp[i][j-1]*j%MOD*j%MOD)%MOD;
	int ans=0;
	for(int i=0;i<=X;i++)
		ans=(ans+1LL*dp[X-i][Y]*fac[i]%MOD*fac[i]%MOD*C(X,i)%MOD*C(X+Y,i)%MOD)%MOD;
	printf("%d\n",ans);
	
	return 0;
}


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


void solve(long long K, long long A, long long B){
    bool flg = false;
    for (int i = A;i<=B;i++)
        if(i % K==0){
            flg = true;
            break;
        }
    if (flg)
        cout << "OK" << endl;
    else
    {
        cout << "NG" << endl;
    }
    
    

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long K;
    scanf("%lld",&K);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(K, A, B);
    return 0;
}


Measured memory_bytes: 3760
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
int H,W;
int ans=100000;
vector<string> field;
bool seen[110][110];
void dfs(int h,int w){
    string s;
    seen[h][w]=true;
    if(field[0][0]=='#') s+='a';
    for(int dir=0; dir<4;dir++){
        int nh=h+dx[dir];
        int nw=w+dy[dir];

        if(nh<0 || nh>=H ||nw<0 || nw>=W) continue;
        if(field[nh][nw]=='#'){
            s+='a';
           
        }
        if(seen[nh][nw]) continue;

        dfs(nh,nw);
       
    } 
    
    if(s.size()<ans) ans=s.size(); 
}


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

    cout<<(n*(n-1))/2+(m*(m-1))/2;

return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define lp(x,y) for(ll i=x;i<y;i++)
#define pb push_back
 
 
  
// Driver code 
int main() 
{ 
    int x,y;
    cin>>x>>y;
    set<int>s;
    int c=x,t=0;
    for(int i=1;i<=x+1;i++)
    {
        s.insert(2*c+ 4*t);
        c--;
        t++;
    }
    if(s.find(y)!=s.end() ) cout<<"Yes";
    else cout<<"No";
} 

Measured memory_bytes: 3632
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        List<Integer> averageList = new ArrayList<Integer>();
        while(num != 0) {
            int score[] = new int[num];
            for(int i = 0; i < num; i++) {
                score[i] = sc.nextInt();
            }
            int max = 0;
            int min = 1001;

            for(int i = 0; i < score.length; i++) {
//                System.out.println("配列全部" + score[i]);
            }

            for(int i = 0; i < score.length; i++) {
                min = Math.min(min, score[i]);
//                System.out.println("最小値もとｍれう" + min);
            }
//            for(int i = 0; i<score.length; i++) {
//                if(min == score[i]) {
//                    System.out.println("配列i" + score[i]);
//                    System.out.println("最小値" + min);
//                    score[i] = 0;
//                }
//            }
            for(int i = 0; i < score.length; i++) {
                max = Math.max(max, score[i]);

            }
//            System.out.println("さいだい" + max);

//            for(int i = 0; i < score.length; i++) {
//                if(max == score[i]) {
//                    System.out.println("配列i" + score[i]);
//                    System.out.println("最題値" + max);
//                    score[i] = 0;
//                }
//            }

            int sum = 0;
            for(int i = 0; i < score.length; i++) {
                sum += score[i];
            }
            int average = (sum-max-min) / (score.length-2);
            averageList.add(average);
//            System.out.println(average);
            num = sc.nextInt();
        }
        for( int i = 0; i<averageList.size(); i++) {
            System.out.println(averageList.get(i));
        }


    }

}



Measured memory_bytes: 29296
import java.util.*;

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

    int ans = 0;
    for(int i = 1; i<= N;i++ ){
      ans += i;
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 9680
using System;
using System.Linq;

namespace CSharp
{
    class Program
    {
        static void Main()
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var H = input[0];
            var A = input[1];

            Console.WriteLine(Math.Ceiling(H / (double)A));
        } 
    }
}

Measured memory_bytes: 13268
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include <random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define print(x) cout<<x<<'\n';
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ");
//#define double long double

template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int MAX = 200060;
const double pi = acos(-1);

int getdig(ll x) {
	int ret = 0;
	while (x > 0) {
		x /= 10;
		ret++;
	}
	return ret;
}
long long nCr(long long n, long long r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	long long i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}
void solve() {
	int N, A, B; cin >> N >> A >> B;
	map<ll, ll>mp;
	vector<int>v(N);
	int max_val = 0;
	REP(i, N) {
		cin >> v[i];
		mp[v[i]]++;
		chmax(max_val, v[i]);
	}
	VSORT(v); VREVERSE(v);
	double ans = 0;
	int cnt = 0;
	int val = 0;
	REP(i, A) {
		ans += v[i];
		if (i == A - 1) {
			cnt = mp[v[i]];
			val = v[i];
		}
	}
	ans /= A;
	int num = 0;
	ll ans2 = 0;
	REP(i, N) {
		if (v[i] == val) {
			int mn = A - i;
			int mx = min(B - i, cnt);
			if (v[i] == max_val) {
				for (int j = mn; j <= mx; j++) {
					ans2 += nCr(cnt, j);
				}
				goto END;
			}
			else {
				ans2 += nCr(cnt, mn);
				goto END;
			}
		}
	}
END:;
	cout << setprecision(20) << ans << endl;
	print(ans2);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	/*REP(i, 100) {
		test(i);
	}*/
	solve();
}

Measured memory_bytes: 256
import math

def f(x):
    count = 0
    while x % 2 == 0:
        x //= 2
        count += 1
    return count

def gcd(m, n):
    r = m % n
    return n if r == 0 else gcd(n, r)

def lcm(m, n):
    return m * n // gcd(m, n)


n, m = map(int, input().split())
A = list(map(int, input().split()))

F = set()
for a in A:
    F.add(f(a))
if len(F) != 1:
    print(0)
    exit()

LCM = [a // 2 for a in A]
for i in range(1, n):
    LCM[i] = lcm(LCM[i - 1], LCM[i])

answer = math.ceil(m // LCM[-1] / 2)
print(answer)


Measured memory_bytes: 18468
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>

#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

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

	int mxdis = k - a[n - 1] + a[0];
	
	for (int i = 1; i < n; i++)
	{
		mxdis = max(mxdis, a[i] - a[i - 1]);

	}
	cout << k - mxdis << endl;

	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define PI acos(-1)

int main(){
    string s,t;
    cin >> s >> t;
    vector<vector<int>> alfs(26),alft(26);

    for(int i = 0;i < (int)s.size();i++){
        alfs[s[i] - 'a'].push_back(i);
        alft[t[i] - 'a'].push_back(i);
    }

    for(int i = 0;i < (int)alfs.size();i++){
        for(int j = 0;j < alfs[i].size();j++){
            s[alfs[i][j]] = alfs[i].size();
        }
        for(int j = 0;j < alft[i].size();j++){
            t[alft[i][j]] = alft[i].size();
        }
    }
    cout << (s == t ? "Yes":"No") << endl;
}


Measured memory_bytes: 3080
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#define rep(i,k,n)for(ll i=k;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;
//int gcd(ll a, ll b) {
//
//	if (b == 0) {
//
//		return a;
//	}
//	else {
//		a = a%b;
//		gcd(b, a);
//	}
//}
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};/*
mint func(ll n, ll a,mint q,ll p,mint ans) {
	mint N = n;
	
	if (p == a) {

		return ans;
	}else{
		ans *=(N - q) / (q + 1);
		q += 1;
		p++;
		func(n, a, q, p,ans);
	}
	
}*/

int main() {
	//	ll N, K;
	//	cin >> N >> K;
	//	vector<ll>A(N);
	//	vector<ll>B;
	//	rep(i, 0, N) {
	//
	//		cin >> A[i];
	//		B.push_back(0);
	//	}
	//	ll tmp=A[0]-1;
	//	ll tmp2;
	//	ll check = 0;
	//	B[0] = 1;
	//	rep(i, 0, K-1) {
	//		if (B[tmp] != 0 && check ==0) {
	//			tmp2 = i +1-(B[tmp]-1);
	//			i = (K-B[tmp]+1)/(tmp2)*(tmp2)+B[tmp]-4;
	//			//cout << "i="<<i<<endl;
	//			check = 1;
	//			
	//		}
	//		B[tmp] = i+2;
	//		tmp = A[tmp]-1;
	//		//cout << tmp << endl;
	//
	//	}
	//	//cout << tmp2;
	//	cout << A[tmp];
	//
	//}	

	ll N, M, X;
	cin >> N >> M >> X;
	vector<ll>C(N);
	vector<vector<ll>>A(N, vector<ll>(M));
	rep(i, 0, N) {
		cin >> C[i];
		rep(j, 0, M) {
			cin >> A[i][j];

		}

	}
	ll ans= 100000000000;
	// {0, 1, ..., n-1} の部分集合の全探索
	for (int bit = 0; bit < (1 << N); ++bit) {
		vector<ll> S;
		for (int i = 0; i < N; ++i) {
			if (bit & (1 << i)) { // 列挙に i が含まれるか
				S.push_back(i);
			}
		}
		vector<ll>sum(M);
		rep(i, 0, M) {
			sum[i] = 0;
		}
		ll money=0;
		for (ll i = 0; i < S.size(); ++i) {
			rep(j, 0, M) {
				sum[j] += A[S[i]][j];

			}
			money += C[S[i]];
		}
		rep(i,0, M) {

			if (sum[i] < X) {

				break;
			}
			if (i == M - 1) {

				ans = min(ans, money);
			}
		}
	}
	if (ans == 100000000000) {

		cout << -1;
	}else{
		cout << ans;
	}
}

Measured memory_bytes: 3600
from functools import lru_cache
@lru_cache(maxsize=None)
def is_prime(x):
    if x==1:
        return False
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            return False
    return True

# @lru_cache(maxsize=None)
def like2017(x):
    return is_prime(i) and is_prime((i+1)//2)
    
table=[0,0]
for i in range(2,10**5):
    table+=table[i-1]+like2017(i),
        
n=int(input())
for _ in range(n):
    a,b=map(int,input().split())
    print(table[b]-table[a-1])
# print(table)


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

int main() {
	int a, b, c, i, count = 0;
	cin >> a >> b >> c;

	for (i = a; i < b + 1; i++) {

		if (c % i == 0) count++;

	}

	cout << count << endl;


	return 0;
}

Measured memory_bytes: 3100
N = int(input())
anagram_dict = {}
ans = 0

for i in range(N):
    s= ''.join(sorted(list(input())))
    if s in anagram_dict:
        ans += anagram_dict[s]
        anagram_dict[s] += 1
    else:
        anagram_dict[s]=1

print(ans)

Measured memory_bytes: 65752
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define alll(v) v.begin(),v.end()
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it;}cout<<endl;}

int main() {
    ll a,b,c;
    vector<ll> v;
    cin>>a>>b>>c;
    if (b<a) {
        swap(a, b);
    }
    if (c<b) {
        swap(c, b);
    }
    if (b<a) {
        swap(a, b);
    }
    ll t = c-a;
    ll r = c-b;
    ll sum=0;
    sum+=t/2;
    t=t%2;
    sum+=r/2;
    r=r%2;
    if (r==0 && t == 0) {
        pr(sum);
    }else if (r==1 && t==1){
        pr(sum+1);
    }else pr(sum+2);
}


Measured memory_bytes: 888
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;

int fld[700][700];

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N,D[2];cin>>N>>D[0]>>D[1];
  int d[2]={0,0};
  repeat(k,2){
    while(!(D[k]&1)){
      d[k]++;
      D[k]/=2;
    }
    D[k]<<=d[k];
  }
  //debugArray(d,2);
  vector<Pii> ans;
  repeat(i,2*N){
    repeat(j,2*N){
      bool isok=true;
      repeat(k,2){
        if(d[k]&1){
          isok &= !((i/(1<<((d[k]-1)/2)))&1);
        }else{
          isok &= !((i/(1<<(d[k]/2))+j/(1<<(d[k]/2)))&1);
        }
      }
      if(isok){
        fld[i][j]=1;
        ans.push_back({i,j});
      }
    }
  }
  /*
  if(ans.size()<N*N){
    cerr<<"!!!!!!!"<<endl;
    return 0;
  }
  */
/*
  repeat(i,2*N){
    repeat(j,2*N){
      cerr<<fld[i][j];
    }
    cerr<<endl;
  }
*/
  repeat(i,N*N){
    cout << ans[i].first<<" "<<ans[i].second<<endl;
  }
  return 0;
}


Measured memory_bytes: 4080
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

int N;

signed main(void) {
    cin>>N;
    list<int> L;
    REP(i, 1, N) {
        int tmp; cin>>tmp;
        int k=i-tmp;
        if (k<0) {
            cout << -1 << endl;
            return 0;
        } else {
            auto itr=L.end();
            rep(j, k) --itr;
            L.insert(itr, tmp);
        }
//        for (auto e : L) {
//            cout << e << " ";
//        }
//        cout << endl;
    }
    for (auto e : L) {
        cout << e << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
    std::string s;
    std::cin >> s;

    int flag = 0;

    for (int i = 0; i < s.length(); i++) {
        if (flag == 0 && s[i] == 'C') {
            flag++;
        } else if (flag == 1 && s[i] == 'F') {
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }

    std::cout << "No" << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<l_l> vpl;
typedef vector<string> vs;
typedef pair<l_l,ll> lll;
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=1;i<=(n);i++)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=10100100100100100;
const ll dx[4]={1,-1,0,0};
const ll dy[4]={0,0,1,-1};
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;
}
ll n,m,N;
vector<l_l> interval[220000];
vl node,sum;
void init(){
    N=1;
    while(N<n)N*=2;
    node.resize(2*N,0);
    sum.resize(2*N,0);
}
void setval(ll l,ll r,ll val,ll bottom=0,ll top=-1,ll pos=1){
    if(top<0)top=N;
    if(r<=bottom||top<=l)return;
    if(l<=bottom&&top<=r){
        sum[pos]+=val;
        return;
    }
    ll mid=(top+bottom)/2;
    setval(l,r,val,bottom,mid,2*pos);
    setval(l,r,val,mid,top,2*pos+1);
    node[pos]=max(node[2*pos]+sum[2*pos],node[2*pos+1]+sum[2*pos+1]);
}
ll getmax(ll l,ll r,ll bottom=0,ll top=-1,ll pos=1){
    if(top<0)top=N;
    if(r<=bottom||top<=l)return -LINF;
    if(l<=bottom&&top<=r)return node[pos]+sum[pos];
    ll mid=(bottom+top)/2;
    ll vl=getmax(l,r,bottom,mid,2*pos);
    ll vr=getmax(l,r,mid,top,2*pos+1);
    return max(vl,vr)+sum[pos];
}
int main(){
    cin>>n>>m;
    n+=2;
    init();
    rep(i,m){
        ll l,r,a;cin>>l>>r>>a;
        interval[r].pb({l,a});
    }
    ll ans=0;
    rrep(i,n){
        ll mx=getmax(0,i);
        //cout<<mx<<endl;
        setval(i,i+1,mx);
        for(auto next:interval[i]){
            setval(next.fi,i+1,next.se);
        }
    }
    cout<<getmax(0,n+1)<<endl;
    return 0;
}

Measured memory_bytes: 22684
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
#define pb push_back

using ll = long long;
using namespace std;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
const int INFint = 1e9;
const ll INFll = 1e18;
ll MOD=1e9+7;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

// aのn乗をMODで割りながら計算する
ll modpow(ll a, ll n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1; // right shift
  }
  return res;
}

// MODを法としたaの逆元を計算する
ll modinv(ll a) {
  return modpow(a, MOD - 2);
}

int main(){
  ll a,b,c;
  cin>>a>>b>>c;
  if (c - a - b> 0){
    if ((c - a - b)*(c - a - b) > 4*a*b){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }else if(c - a - b == 0){
    cout << "No" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}



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

void dfs(vector<int> &A, vector<vector<int>>& As, int m, int n)
{
    if(A.size() == n)
    {
        As.push_back(A);
    }
    else
    {
        int b = A.size() > 0 ? A.back() : 1;
        for(int i = b; i <= m; i++)
        {
            A.push_back(i);
            dfs(A, As, m, n);
            A.pop_back();
        }
    }
}

void bruteForce(vector<vector<int>>& As, int m, int n)
{
    vector<int> A;
    dfs(A, As, m, n);
}

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

    vector<int> a(q), b(q), c(q);
    vector<long long> d(q);
    for(int i = 0; i < q; i++)
    {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }

    vector<vector<int>> As;
    bruteForce(As, m, n);
    long long maxScore = 0;
    for(int i = 0; i < As.size(); i++)
    {
        long long score = 0;
        for(int j = 0; j < q; j++)
        {
            if(As[i][b[j] - 1] - As[i][a[j] - 1] == c[j])
            {
                score += d[j];
            }
        }

        if(score > maxScore)
        {
            maxScore = score;
        }
    }

    cout << maxScore;

    return 0;
}

Measured memory_bytes: 9736
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int H,N,sum=0,x;
	cin>>H>>N;
	for(int i=0;i<N;i++)
	{
		cin>>x;
		sum+=x;
	}
	if(sum>=H)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
	return 0;
}


Measured memory_bytes: 256
from collections import Counter
n = int(input().strip())
a = list(map(int, input().strip().split()))
cnt1 = Counter(a[::2]).most_common(2)
c11, c12 = (cnt1 if len(cnt1) == 2 else cnt1+[('', 0)])
cnt2 = Counter(a[1::2]).most_common(2)
c21, c22 = (cnt2 if len(cnt2) == 2 else cnt2+[('', 0)])

if c11[0] != c21[0]:
    print(n - c11[1] - c21[1])
else:
    print(n - max(c11[1]+c22[1], c12[1]+c21[1]))


Measured memory_bytes: 15588
import bisect
def main():
    n,k=map(int,input().split())
    a=list(map(int,input().split()))
    a.sort()
    l=0
    r=n
    d = {}
    if sum(a)<k:
        print(n)
    else:
        while l!=r:
            i=(l+r)//2
            ta = a[i]
            if ta in d.keys():
                flag = d[ta]
            elif ta>=k:flag=True
            else:
                flag = False
                na = a[:i]+a[i+1:]
                dp = [False for _ in range(k+1)]
                dp[0]=True
                for j in range(n-1):
                    for m in range(k,0,-1):
                        if m-na[j]>=0:
                            dp[m]=dp[m] or dp[m-na[j]]
                        if m != k and m>=k-ta and dp[m]:
                            flag = True
                            break
                    if flag:break
                d[ta] = flag
            
            if flag:
                r=i
            else:
                l=i+1
        print(l)

main()

Measured memory_bytes: 42284
#include<stdio.h>
int main(){
    int x,y,i,j;
    int group1[7]={1,3,5,7,8,10,12};
    int group2[4]={4,6,9,11};
    scanf("%d%d",&x,&y);
    if(x==y){
        printf("Yes\n");
        return 0;
    }
    else if(x==2||y==2){
        printf("No\n");
        return 0;
    }
    else {
        for(i=0;i<7;i++){
            if(group1[i]==x){
                for(j=0;j<7;j++){
                    if(group1[j]==y){
                        printf("Yes\n");
                        return 0;
                    }
                }
                if(j>=7){
                    printf("No\n");
                    return 0;
                }
            }
        }
        for(i=0;i<4;i++){
            if(group2[i]==x){
                for(j=0;j<4;j++){
                    if(group2[j]==y){
                        printf("Yes\n");
                        return 0;
                    }
                }
                if(j>=4){
                    printf("No\n");
                    return 0;
                }
            }
        }
    }
   return 0;
}

Measured memory_bytes: 128
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}
var mod = 1e9+7;

console.log(main());
function main(){
  var n = o.a();
  var k = o.a();
  var mx = Math.min(n*n>>1,k);
  if(k%2 !== 0 || k > mx)return 0;
  var n2 = n>>1;
  var dp = xArray(0,n+2,n2+2,mx+n+2);
  dp[0][0][0] = 1;
  for(var i = 0; i < n; i++)
  for(var j = 0; j <= n2; j++)
  for(var x = 0; x <= mx; x += 2){
    dp[i][j][x] %= mod;
    dp[i+1][j][x+j+j] += dp[i][j][x] * (j+j+1);
    if(j)dp[i+1][j-1][x+j+j-2] += dp[i][j][x] * j * j;
    dp[i+1][j+1][x+j+j+2] += dp[i][j][x];
  }
  return dp[n][0][k]%mod;
}

Measured memory_bytes: 62724
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c,d,e;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
	printf("%d\n",min(a,min(b,c))+min(d,e)-50);
}

Measured memory_bytes: 0
inpl = lambda: list(map(int,input().split()))
N, M ,K = inpl()
MOD = 10**9+7

def mod_inv(a, m=MOD):
    def mod_inv_sub(a, m):
        if a == 1:
            return 1, 0
        else:
            d, r = m//a, m % a
            x, y = mod_inv_sub(r, a)
            return y - d*x, x

    x = mod_inv_sub(a,m)[0]
    if x < 0:
        x += (-x//m + 1) * m
    return x

factor = 1
# MN-2 C K-2 = MN-2 C MN-K = MN-2 C L
L = min(K-2,M*N-K)
for i in range(M*N-L-1,M*N-1):
    factor = factor * i % MOD
for i in range(1,L+1):
    factor = factor * mod_inv(i) % MOD
ans = ((M*(N-1)*(N+1) + N*(M-1)*(M+1))*M*N //6 * factor) % MOD
print(ans)

Measured memory_bytes: 68716
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

// BEGIN NO SAD
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef vector<int> vi;
// END NO SAD

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

void solve() {
  int n, k;
  cin >> n >> k;
  int ret = 0;
  while(n > 0) {
    ret++;
    n /= k;
  }
  cout << ret << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
}


Measured memory_bytes: 256
#include <functional>
#include <algorithm>
#include <stdexcept>
#include <iostream>
#include <sstream>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <cctype>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <queue>
#include <stdint.h>
#include <stdio.h>
#include <stack>
#include <ctime>
#include <list>
#include <map>
#include <set>
#include <tuple>
#include <unordered_set>
#include <assert.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define TR(i,x) for(__typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define ALL(x) x.begin(),x.end()
#define SORT(x) sort(ALL(x))
#define CLEAR(x) memset(x,0,sizeof(x))
#define FILL(x,c) memset(x,c,sizeof(x))

using namespace std;

#define PB push_back
#define MP make_pair

typedef map<int,int> MII;
typedef map<string,int> MSI;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<long double> VD;
typedef pair<int,int> PII;
typedef long long int64;
typedef long long LL;
typedef unsigned int UI;
typedef long double LD;
typedef unsigned long long ULL;

int main() {
    int n, t;
    cin >> n >> t;
    VI a(n);
    REP(i, n) scanf("%d", &a[i]);
    LL answer = t;
    REP(i, n - 1) {
        answer += min(a[i + 1] - a[i], t);
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 1024
#!/usr/bin/env python3
n = int(input())
ans = 0
for i in range(1, n + 1):
    if i % 3 == 0 and i % 5 == 0:
        pass
    elif i % 3 == 0:
        pass
    elif i % 5 == 0:
        pass
    else:
        ans += i
print(ans)

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

int main(){
    int min,max;
    int N,n;
    vector<int> v;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> n;
        v.push_back(n);
    }
    min=v[0];
    max=v[0];
    for(int i=0;i<N;i++){
        if(v[i]>max){
            max=v[i];
        }
        if(v[i]<min){
            min=v[i];
        }
    }
    cout << max-min;
}

Measured memory_bytes: 256
#include <stdio.h>

/*
	ax + by = c
	dx + ey = f

	ax = c - by
	x = (c - by) / a

	dx = f - ey
	x = (f - ey) / d

	(c - by) / a = (f - ey) / d
	d(c - by) = a(f - ey)
	dc - bdy = af - aey
	aey - bdy = af - dc
	y(ae - bd) = af - dc
	y = (af - dc) / (ae - bd)
*/

int main() {
	double a, b, c, d, e, f, x, y;
	while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) {
		y = (a * f - d * c) / (a * e - b * d);
//		x = (f - e * y) / d;
		x = (c - b * y) / a;

		if (x > (double)-0.001 && x <= (double)0) x = 0;
		if (y > (double)-0.001 && y <= (double)0) y = 0;

		printf("%.3lf %.3lf\n", x, y);
	}
	return 0;
}

Measured memory_bytes: 652
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <utility>
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
	int n;
	string s;
	int k;
	scanf("%d", &n);
	cin >> s;
	scanf("%d", &k);
	
	char c = s[k - 1];
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != c) s[i] = '*';
	}

	cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int t;
    cin>>t;
    int n=t%10;
    if(n==2 || n==4 || n==5 || n==7 || n==9)
        cout<<"hon";
    else if(n==0 || n==1 || n==6 || n==8)
        cout<<"pon";
    else
        cout<<"bon";
    return 0;
}

Measured memory_bytes: 3604
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        for(int i=0;i<N;i++){
            A[i]=sc.nextInt();
        }
        Arrays.sort(A);
        int ans = Integer.MAX_VALUE;
        for(int i=A[0];i<=A[N-1];i++){
            ans = Math.min(ans,help(A,i));
        }
        System.out.println(ans);
    }
    static int help(int[] a, int tar){
        int ans=0;
        for(int i=0;i<a.length;i++){
            ans += (a[i]-tar)*(a[i]-tar);
        }
        return ans;
    }
}


Measured memory_bytes: 23764
#include<algorithm>
#include<chrono>
#include<climits>
#include<functional>
#include<numeric>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<random>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<vector>
#include<cassert>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
// #include<bits/stdc++.h>
using namespace std;
 
struct Debug{
    int cnt = 0;
    bool on = false;
    char debug[10] = "debug";
    template<class T>
    Debug & operator<<(const T & v) {
        if(on && cnt++ == 0) cerr << "debug: ";
        if(on) cerr << v << ' ';
        return *this;
    }
    Debug & operator<<(ostream&(*pManip)(ostream&)) {
        if(on) cerr << (*pManip);
        cnt = 0;
        return *this;
    }
} debug;
#define rep(i, a, b) for(auto i = (a); i < (b); i++)
#define rrep(i, a, b) for(auto i = (a); i > (b); i--)
#define all(v) (v).begin(), (v).end()
#define print(v) {if(debug.on){for(auto x : v) debug << x; debug << endl;}}
#define printn(v, n) {if(debug.on){for(int _i = 0; _i < n; _i++) debug << *(v + _i); debug << endl;}}
 
typedef unsigned long long ull;
typedef long long ll;
 
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

const int MAXN = 1e5 + 20;

long long gcd(long long x, long long y) {
	return y ? gcd(y, x % y) : x;
}
int main(int argc, char * argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    if(argc > 1 && !strcmp(argv[1], debug.debug)) debug.on = true;
 	
    long long a, b, d;
    cin >> a >> b;
    d = gcd(a, b);

    int res = 1;
    for(long long i = 2; i <= d / i; i++) {
    	if(d % i == 0) res++;
    	while(d % i == 0) d /= i;
    }
    if(d > 1) res++;
    cout << res << endl;

    return 0;
}























Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) begin(x), end(x)

const int N = 1002;
int n, m, a, b;

int needi[N], needj[N];

int main() {
#ifdef LC
	assert(freopen("input.txt", "r", stdin));
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m >> a >> b;
    for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			cout << ((j < a) ^ (i < b));
		}
		cout << "\n";
	}
    return 0;
}


Measured memory_bytes: 1280
// Attention

#include <iostream>

using namespace std;

int main(){
	int N;
	string S;
	cin >> N >> S;
	int costl = 0, costr = 0;
	for (int i = 1; i < N; ++i)
		if (S[i] == 'E')
			costr++;

	int res = costl + costr;

	for (int i = 1; i < N; ++i){
		if (S[i] == 'E')
			costr--;
		if (S[i-1] == 'W')
			costl++;
		res = min(res, costl+costr);
	}
	cout << res << endl;

	return 0;
}


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

int main(void){
  int n,k,q;
  int ary[100000]={0};
  
  cin >> n >> k >> q;
  for (int i=0; i<q; i++){
    int t; cin >> t;
    ary[t-1]++;
  }
  for (int i=0; i<n; i++){
    cout << (k-(q-ary[i])>0?"Yes":"No") << endl;
  }
  return 0;
}


Measured memory_bytes: 1024
N = int(input())
A = list(map(int,input().split()))

# 累積和
Asum = [0]*N
Asum[0] = A[0]
for i in range(1,N):
    Asum[i] += Asum[i-1] + A[i]

answer = float("inf")
for i in range(N):
    answer = min(answer, abs(Asum[-1]-Asum[i]*2))

print(answer)

Measured memory_bytes: 25508
#include<stdio.h>
int digitsum(int a) {
	int sum = 0;
	while (a > 0){
		sum += a % 10;
		a = a / 10;

	}

	return sum;
}
int main(void)
{
	int a, sum;
	scanf("%d", &a);

	sum = digitsum(a);

	if (a % sum == 0)
		printf("Yes");
	else
		printf("No");


	return 0;
}

Measured memory_bytes: 128
#include"bits/stdc++.h"

using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	int A[51];
	int B[51];

	for (int i = 0; i < M; i++) {
		cin >> A[i] >> B[i];
	}

	int ans[51];
	for (int i = 0; i < N; i++) {
		ans[i] = 0;
	}

	for (int i = 0; i < M; i++) {
		ans[A[i] - 1] += 1;
		ans[B[i] - 1] += 1;
	}

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

	return 0;
}

Measured memory_bytes: 256
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    ll n,k;
    std::cin >> n>>k;
    if(k==1){
        std::cout << 0 << std::endl;
    }else{
        std::cout << n-k << std::endl;
    }
}


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

#define REP(i,n) for(int i = 0; i < (n); ++i)
#define REP1(i,n) for(int i = 1; i <= (n); ++i)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
#define ALL(a) begin(a), end(a)
#define MP(a,b) make_pair((a), (b))
#define ROUNDUP(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))
#define X first
#define Y second
#define DEBUG(a) cout << #a << ": " << a << "\n"
// #define DEBUG(a) {}

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;

constexpr int MOD = 1e9 + 7;
constexpr int INF = 1e9 + 1;
constexpr ll LLINF = 4 * 1e18 + 1;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int dp[2][5001][2]; // n%2 a last(a/b)

template<typename T>
T debug(T x) {
	DEBUG(x);
	return x;
}

/*
struct Edge{
	int to, cost;
	Edge(int _to, int _cost){
		to = _to;
		cost = _cost;
	}
};


vector<Edge> g[100];
*/


int d[100][100];
int dd[100][100];

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

	int n, m;
	cin >> n >> m;
	REP(i, n){
		REP(j, n){
			if(i == j) d[i][j] = 0;
			else d[i][j] = INF;
		}
	}

	vector<tiii> e;
	REP(i, m){
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		e.push_back(tiii{a, b, c});
		d[a][b] = c; d[b][a] = c;
	}

	REP(k, n){
		REP(i, n){
			REP(j, n){
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}

	REP(i, n){
		REP(j, n){
			//cout << d[i][j] << " ";
		}
		//cout << "\n";
	}

	int ans = 0;
	REP(l, m){
		int a = get<0>(e[l]), b = get<1>(e[l]), c = get<2>(e[l]);
		bool needed = false;
		REP(i, n){
			if(d[a][i] == c + d[b][i])needed = true;
		}
		ans += needed;
	}
	cout << m - ans << "\n";
	return 0;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  vint d(n);
  rep(i,n){
    cin>>d[i];
  }
  sort(all(d));
  int ans=d[n/2]-d[n/2-1];
  cout<<ans<<'\n';
  return(0);
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int k,i;
		int s = 0;
		Scanner in = new Scanner(System.in);
		int n = Integer.parseInt(in.nextLine());
		int array[] = new int[n];
		for(i=0;i<n;i++)array[i] = Integer.parseInt(in.next());
		for (k=0;k<n;k++){
			if (isprime(array[k])){
				s++;
		}
	}
		System.out.println(s);
}

	public static boolean isprime(int x) {
		int i = 3;
		if (x == 2)
				return true;
		if (x < 2 || x % 2 == 0 )
				return false;
		while (i <= Math.sqrt(x)){
			if (x % i == 0){
				return false;
			}
			i = i+2;
		}
		return true;
	}
}

Measured memory_bytes: 40864
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String str1 = "CODEFESTIVAL2016";
		String str2 = scanner.next();
		int count = 0;
		for(int i = 0; i < str1.length(); i++){
			if(str1.charAt(i) != str2.charAt(i))
				++count;
		}
		System.out.println(count);
		scanner.close();
	}

}


Measured memory_bytes: 9044
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    tl=list(map(int,input().split()))
    tlsum=sum(tl)
    m=int(input())
    for i in range(m):
        p,x=map(int, input().split())
        print(tlsum-tl[p-1]+x)
resolve()

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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define w(x)  int x; cin>>x; while(x--)
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"
#define watch4(x,y,z,q) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<" and "<<(#q)<<" is "<<(q)<<"\n"
#define MOD 1000000007
#define INF 1000000007;
#define F first
#define S second
#define pb(x) push_back(x);


#define ll  long long
#define all(c) (c).begin(),(c).end()
#define endl "\n"

typedef vector<int> vl;
typedef vector< vl > vvl;
typedef pair< int, int> pll;
typedef map< int, int> mll;


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif





void c_p_c()
{
#ifndef ONLINE_JUDGE
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
void parray(int a[],int n){
    for(int i=0;i<n;i++){
    cout<<a[i]<<" ";
    }
    cout<<endl;
}
int no=1,n1;
int recu(int n,int k,int val){


	if(n==n1){
		return min(val*2,val+k);
	}
	return min( recu(n+1,k,2*val),recu(n+1,k,val+k)              );


}

int main() {
    int i,m,n,k,sum=0;
    c_p_c();
    // cout<<"Sd"<<endl;>
	  cin>>n;
	  for (int i = n; i>=1; --i)
	  {
	  	/* code */
	  	// watch2(i,(long double )sqrt(i)-floor((long double )sqrt(i)));
	  	if((long double )sqrt(i)-floor((long double )sqrt(i))==0){
	  		cout<<i<<endl;
	  		break;
	  	}
	  }

   }

Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int main(){
	long n = 0;
	cin >> n;
	//n = 1;
	vector< pair<long, long> > a(n);
	string b = "";
	long c = 0;
	long d = 0;

	for (long i = 0; i < n; i++){
		cin >> b >> c;
		//b = "S";
		//c = 2;
		if (b == "S"){
			d = 0;
		}
		else if (b == "H"){
			d = 1;
		}
		else if (b == "C"){
			d = 2;
		}
		else if (b == "D"){
			d = 3;
		}
		else {
			cout << "something error occurred";
		}
		a[i] = make_pair(d, c);
		//cout << a[i].first << " " <<  a[i].second << endl; // OK
	}

	sort(a.begin(), a.end());
	//cout << a[0].first << " " << a[0].second << endl; // OK
	
	vector< pair <long, long> > f(52);
	for (long i = 0; i < 4; i++){
		for (long j = 0; j < 13; j++){
			f[i * 13 + j] = make_pair(i, j + 1);
			//cout << f[i * 13 + j].first << " " << f[i * 13 + j].second << endl; // OK
		}
	}

	vector<long> o(52, 0);
	for (long i = 0; i < 52; i++){
		for (long j = 0; j < n; j++){
			if (a[j] == f[i]){
				o[i] = 1;
				//cout << f[j].first << " " << f[j].second << endl; // NG
				//break;
			}
		}
	}

	for (long i = 0; i < 52; i++){
		//cout << o[i] << " ";
	}

	string e;
	for (long i = 0; i < 52; i++){
		if (o[i] != 1){
			switch (f[i].first){
				case 0:
					e = "S";
					break;
				case 1:
					e = "H";
					break;
				case 2:
					e = "C";
					break;
				case 3:
					e = "D";
					//cout << f[i].second << endl;
					break;
				default:
					e = "NULL";
					break;
			}
			cout << e << " " << f[i].second << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1212
#include<stdio.h>

int binarySearch(int);

int n,ori[100000];

int main()
{
  int key[50000],i,j,count=0,m;
  
   scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&ori[i]);
  }

  scanf("%d",&m);
   for(j=0;j<m;j++){
    scanf("%d",&key[j]);
    count+=binarySearch(key[j]);
   }

   printf("%d\n",count);

   return 0;
}

int binarySearch(int key)
{
  int mid,right,left;
  left=0;
  right=n;

  while(left<right){
    mid=(int){(left+right)/2};
      if(ori[mid]==key) return 1;
      else if(key<ori[mid]) right=mid;
      else left=mid+1;
  }
  return 0;
}



Measured memory_bytes: 2268
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>

int main(void){
    int i,j;
    int N,K,h[100001];
    int answer = 0;
   
    scanf("%d %d",&N,&K);
    for(i = 0;i < N-1;i++){
        scanf("%d\n",&h[i]);
    }
    scanf("%d",&h[i]);
    
    for(i = 0;i < N;i++){
        if(h[i] >= K){
            answer++;
        }
    }
    
    printf("%d\n",answer);
    
    return 0;
}

Measured memory_bytes: 512
import fractions
from functools import reduce

def gcd(*numbers):
  return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
  return reduce(fractions.gcd, numbers)

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input())
A = tuple(map(int, input().split()))

mod = 10 ** 9 + 7

l = lcm_list(A)

ans = 0

for i in range(N):
  ans += l // A[i]

ans = ans % mod

print(ans)


Measured memory_bytes: 6100
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <climits>
#include <utility>
typedef long long ll;
using namespace std;

int main(void){
  int a,b,c;
  cin>>a>>b>>c;
  int cnt=0;
  if(a==b){
    cnt++;
  }
  if(b==c){
    cnt++;
  }
  if(c==a){
    cnt++;
  }

  if(cnt==1){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }

  return 0;
}


Measured memory_bytes: 256