akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll ,ll>;
const ll INF = 1LL<<61LL;
const ll MOD = 1e9+7;

int main(){
	ll N;
	cin >> N;
	// AGC    
	// A*GC   
	// AG*C   
	// GAC    

	// ACG    

	// ACGT
	vector<vector<vector<vector<ll> > > > dp(4, vector<vector<vector<ll> > >(4, vector<vector<ll> >(4, vector<ll>(N+1))));
	dp[3][3][3][0] = 1;
	for(int s=0;s<N;s++){
		for(int i=0;i<4;i++)
			for(int j=0;j<4;j++)
				for(int k=0;k<4;k++){
					dp[j][k][0][s+1] = (dp[j][k][0][s+1] + dp[i][j][k][s]) % MOD;
					if(!(j == 2 && k == 0) && !(i ==0 && (j == 2 || k == 2)) && !(j == 0 && k == 2))
						dp[j][k][1][s+1] = (dp[j][k][1][s+1] + dp[i][j][k][s]) % MOD;
					if(!(j == 0 && k == 1))
						dp[j][k][2][s+1] = (dp[j][k][2][s+1] + dp[i][j][k][s]) % MOD;
					dp[j][k][3][s+1] = (dp[j][k][3][s+1] + dp[i][j][k][s]) % MOD;
				}
	}
	ll ans = 0;
	for(int i=0;i<4;i++)
		for(int j=0;j<4;j++)
			for(int k=0;k<4;k++)
				ans = (ans + dp[i][j][k][N]) % MOD;
	cout << ans << endl;
}


Measured memory_bytes: 256
#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<int,int>;


int main() {
    int N, Q;
    string S;
    cin >> N >> Q >> S;
    vector<int> l(Q), r(Q);
    rep(i,Q) {
        cin >> l.at(i) >> r.at(i);
    }
    vector<int> count(N+1,0);
    int sum = 0;
    for (int i = 1; i < N; ++i) {
        if (S.at(i-1) == 'A' && S.at(i) == 'C') ++sum;
        count.at(i+1) = sum;
    }
    rep(i,Q) {
        cout << count.at(r.at(i)) - count.at(l.at(i)) << endl;
    }
}


Measured memory_bytes: 4584
#include<bits/stdc++.h>
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using namespace std;

int main(){
  ll n,q;cin>>n>>q;
  string s;cin>>s;
  int t[n];t[0]=0;
  rep(i,n-1){
    t[i+1]=t[i];
    if(s[i]=='A'&&s[i+1]=='C')t[i+1]++;
  }

  int l,r;
  rep(i,q){
    cin>>l>>r;l--,r--;
    cout<<t[r]-t[l]<<endl;
  }
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位

int main(void) {
    ll n, m;
    cin >> n >> m;
    vector<ll> a;
    ll MIN = 1e+10;
    for(ll i = 0; i < n; i++){
        ll b;
        cin >> b;
        a.push_back(b);
    }
    vector<p> vp;
    for(ll i = 0; i < m; i++){
        ll c, d;
        cin >> c >> d;
        vp.push_back(p(d, c));
    }
    sort(a.begin(), a.end());
    sort(vp.begin(), vp.end());
    ll now = 0;
    for(ll i = m-1; i >= 0; i--){
      //  cout << i << " " << now << endl;
        for(ll j = now; j < n; j++){
            if(a[j]<vp[i].first){
                a[j] = vp[i].first;
                vp[i].second--;
                now++;
            }
            else if(a[j]>=vp[i].first) break;
            if(vp[i].second==0) break;
        }
    }
    ll ans = 0;
    for(ll i = 0; i < n; i++)
        ans += a[i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3188
// Igorjan94, template version from 13 October 2017. C++17 version, modified 18 march 2020 (writeln<tuple>, whole->all) {{{
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <iomanip>

using namespace std;

#define FOR(i, m, n) for (int i = m; i <  (int) (n); ++i)
#define ROF(i, m, n) for (int i = m; i >= (int) (n); --i)
#define forn(i, n)   for (int i = 0; i < (int) (n); ++i)
#define  fori1(n)    for (int i = 1; i < (int) (n); ++i)
#define  forj1(n)    for (int j = 1; j < (int) (n); ++j)
#define   fori(n)    for (int i = 0; i < (int) (n); ++i)
#define   forj(n)    for (int j = 0; j < (int) (n); ++j)
#define     SZ(a)    int(size(a))

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

#define pb push_back
#define all(a) begin(a), end(a)
#define ints(a...) int a; readln(a)

[[maybe_unused]] const int MOD = 1000000007;
[[maybe_unused]] const int INTMAX = numeric_limits<int>::max();

#define ttt12i template<class T1, class T2> inline
#define  ttti  template<class T> inline

void writeln(){cout<<"\n";}ttti void print(T&& a);ttti void priws(T&& a);ttti void read(T& a);
template<class... Args> inline void readln(Args&... args){(read(args),...);}
template<class H, class...T> inline void writeln(H&& h,T&&...t){priws(h);(print(t),...);writeln();}

//Igorjan
//}}}

void run()
{
    ints(n);
    vector<int> a(n);
    int x;
    FOR(i, 2, n + 1)
        readln(x),
        a[x - 1]++;
    fori(n)
        writeln(a[i]);
}

//{{{
int main()
{
    ios_base::sync_with_stdio(false);
    run();
    cerr << fixed << setprecision(0) << "Execution time = " << 1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}

#define a _a
#define n _n
ttt12i ostream&operator<<(ostream&os,pair<T1,T2>const&a);
template<typename T,typename D=decltype(*begin(declval<T>())),typename enable_if<!is_same<T,basic_string<char>>::value>::type* =nullptr>
ostream&operator<<(ostream&os,T const&a){auto it=begin(a);if(it!=end(a))os<<*it++;while(it!=end(a))os<<"\n "[is_fundamental<typename T::value_type>::value]<<*it++;return os;}
ttt12i ostream&operator<<(ostream&os,pair<T1,T2>const&a){return os<<a.first<<" "<<a.second;}
ttt12i istream&operator>>(istream&is,pair<T1,T2>&a){return is>>a.first>>a.second;}
ttti   istream&operator>>(istream&is,vector<T>&a){fori(a.size())is>>a[i];return is;}
ttti void print(T&&a){cout<<" "<<a;}
ttti void priws(T&&a){cout<<a;}
ttti void read(T&a){cin>>a;} //}}}


Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        if (y % 2 != 0 || y < (2*x) || y > (4*x)) {
          System.out.println("No");
        } else {
          System.out.println("Yes");
        }
    }
}

Measured memory_bytes: 35828
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
struct UnionFind{
    vector<int> parent;
    vector<int> s;

    UnionFind(int n){
        parent.resize(n);
        s.resize(n, 1);
        for(int i = 0; i < n; i++) parent[i] = i;
    }

    int root(int node){
        if(parent[node] == node){
            return node;
        } else {
            return parent[node] = root(parent[node]);
        }
    }

    void unite(int x, int y){
        int rootx = root(x);
        int rooty = root(y);
        if(rootx == rooty) return;
        if(s[rootx] < s[rooty]) swap(rootx, rooty);
        s[rootx] += s[rooty];
        parent[rooty] = rootx;
    }

    bool isSame(int x, int y){
        return root(x) == root(y);
    }

    int size(int x){
        return s[root(x)];
    }
};

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

    vector<int> p(n + 1);
    for(int i = 0; i < n; i++) cin >> p[i];

    vector<pair<int,int>> xy(m);
    for(int i = 0; i < m; i++){
        cin >> xy[i].first >> xy[i].second;
    }
    UnionFind uf(n + 1);

    for(int i = 0; i < m; i++){
        uf.unite(xy[i].first, xy[i].second);
    }

    ll ans = 0;
    for(int i = 0; i < n; i++){
        if(uf.isSame(i + 1, p[i])){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 2176
#!/usr/local/bin/python3
# coding: utf-8
import numpy as np
#!/usr/local/bin/python3
# coding: utf-8
import numpy as np
hairu = int(input())
ac = 0
wa = 0
re = 0
tle = 0

for i in range(hairu):
    s = input()
    if s == "AC":
        ac += 1
    if s == "WA":
        wa += 1
    if s == "RE":
        re += 1
    if s == "TLE":
        tle += 1

print("AC x ",ac)
print("WA x ",wa)
print("TLE x ",tle)
print("RE x ",re)

Measured memory_bytes: 27140
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
#include <memory>
#include <time.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-3;
const double PI  = acos(-1.0);


typedef vector<double>vec;
typedef vector<vec>mat;
vec gaussJordan(const mat& A,const vec& b){
	int n=A.size();
	mat B(n,vec(n+1));
	for (int i=0;i<n;i++)
		for (int j=0;j<n;j++) B[i][j]=A[i][j];
	for (int i=0;i<n;i++) B[i][n]=b[i];
	for (int i=0;i<n;i++){
		int pivot=i;
		for (int j=i;j<n;j++){
			if (abs(B[j][i])>abs(B[pivot][i])) pivot=j;
		}
		swap(B[i],B[pivot]);
		if (abs(B[i][i])<EPS) return vec();
		for (int j=i+1;j<=n;j++) B[i][j]/=B[i][i];
		for (int j=0;j<n;j++){
			if (i!=j){
				for (int k=i+1;k<=n;k++) B[j][k]-=B[j][i]*B[i][k];
			}
		}
	}
	vec x(n);
	for (int i=0;i<n;i++) x[i]=B[i][n];
	return x;
}

int main(){
	int n;
	while(cin>>n,n){
		vec v(n+3);
		REP(i,n+3){
			cin>>v[i];
		}
		int ans=-1;
		REP(i,n+3){
			vec vv;
			mat m;
			REP(j,n+3){
				if(i!=j){
					vv.push_back(v[j]);
					m.push_back(vec());
					REP(k,n+1){
						m[m.size()-1].push_back(pow(j,k));
					}
					if(vv.size()==n+1){
						break;
					}
				}
			}
			vec cand=gaussJordan(m,vv);
			if(cand.size()){
				double val=0;
				int last=(i==n+2?n+1:n+2);
				REP(j,cand.size()){
					val+=cand[j]*pow(last,j);
				}
				if(abs(val-v[last])<EPS){
					ans=i;
					break;
				}
			}
		}
		assert(ans!=-1);
		cout<<ans<<endl;
	}
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N, M; cin >> N >> M;

	vector<int>a(M), b(M);
	vector<vector<int>>c(M);

	rep(i, 0, M) {
		cin >> a[i] >> b[i];
		loop(b[i]) {
			int x; cin >> x; x--;
			c[i].emplace_back(x);
		}
	}

	vector<int>dp(1ll << N, INF);
	dp[0] = 0;

	rep(bits, 0, (1ll << N)-1) {
		rep(i, 0, M) {
			int mask = 0;
			for (auto x : c[i]) {
				mask |= (1ll << x);
			}
			chmin(dp[bits | mask], dp[bits] + a[i]);
		}
	}
	if (dp.back() == INF)dp.back() = -1;
	cout << dp.back() << endl;

	return 0;
}


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

int main() {
  int currentRating;
  int targetRating;
  
  int targetPerformance;

  cin >> currentRating;
  cin >> targetRating;
  
  targetPerformance = targetRating * 2 - currentRating;
  cout << targetPerformance << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n, s) for (int i = (s); i < (n); i++)
typedef long long int ll;
using namespace std;
using Graph = vector<vector<int>>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B;
    cin >> A >> B;
    map<int, int> divsA, divsB;
    set<int> primes;
    reps(i, A + 1, 2)
    {
        while (A % i == 0)
        {
            divsA[i] += 1;
            primes.insert(i);
            A /= i;
        }
    }
    reps(i, B + 1, 2)
    {
        while (B % i == 0)
        {
            divsB[i] += 1;
            primes.insert(i);
            B /= i;
        }
    }
    ll ans = 1;
    for (auto v : primes)
    {
        ll num = max(divsA[v], divsB[v]);
        rep(i, num)
        {
            ans *= v;
        }
    }
    cout << ans << endl;
//    system("pause");
    return 0;
}

Measured memory_bytes: 256
// 2011/05/24 Tazoe

#include <iostream>
using namespace std;

void bom(char fld[8][8], int x, int y)
{
	if(fld[y][x]=='0')
		return;

	fld[y][x] = '0';

	if(x-1>=0)
		bom(fld, x-1, y);
	if(x-2>=0)
		bom(fld, x-2, y);
	if(x-3>=0)
		bom(fld, x-3, y);
	if(x+1<8)
		bom(fld, x+1, y);
	if(x+2<8)
		bom(fld, x+2, y);
	if(x+3<8)
		bom(fld, x+3, y);
	if(y-1>=0)
		bom(fld, x, y-1);
	if(y-2>=0)
		bom(fld, x, y-2);
	if(y-3>=0)
		bom(fld, x, y-3);
	if(y+1<8)
		bom(fld, x, y+1);
	if(y+2<8)
		bom(fld, x, y+2);
	if(y+3<8)
		bom(fld, x, y+3);
}

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

	for(int i=0; i<n; i++){
		char fld[8][8];
		for(int j=0; j<8; j++)
			for(int k=0; k<8; k++)
				cin >> fld[j][k];

		int x, y;
		cin >> x;
		cin >> y;
		x--;
		y--;

		bom(fld, x, y);

		cout << "Data " << i+1 << ":" << endl;
		for(int j=0; j<8; j++){
			for(int k=0; k<8; k++)
				cout << fld[j][k];
			cout << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const  ll INF = 1e9;
const  ll MOD = 1e9 + 7;
#define repi(i,n,init) for(ll i=init;i<(n);i++)

int main()
{
    int n,q;
    string s;
    cin >> n >> q >> s;
    vector<int> cnt(n,0);
    repi(i,n,1){
        if(s[i-1] == 'A' && s[i] == 'C')cnt[i]++;
        cnt[i] += cnt[i - 1];
    }
    repi(i,q,0){
        int l,r;
        cin >> l >> r;
        l--;
        r--;
        cout << cnt[r] - cnt[l] << endl;
    }
    return 0;
}

Measured memory_bytes: 3816
#include <cstdio>
#include <vector>
#include <utility>
#include <map>

/*
\cap_{u,v} \cup_{i\in (u,v) path} E_i

g(N) = |{E | {u,v\in M | \cup_{i\in (u,v) path} E_i} = N}|
G(N) = |{E | {u,v\in M | \cup_{i\in (u,v) path} E_i} \subseteq N}|
     = |{E | {u,v\in M-N | \cap_{i\in (u,v) path} !E_i}}|
*/

int n, m;
std::vector<int> E[50];

long long int M[20];
long long int A[1<<20];
std::map<std::pair<int, int>, int> edges;

long long int dfs(int u, int v, int p){
  if(u == v) return 0;
  for(int x: E[u]){
    if(x == p) continue;
    long long int b = dfs(x, v, u);
    if(b != -1) return (1LL << edges[{u, x}]) | b;
  }
  return -1;
}

int main(){
  scanf("%d", &n);
  for(int i = 0; i < n-1; i++){
    int a, b;
    scanf("%d%d", &a, &b);
    E[a-1].push_back(b-1);
    E[b-1].push_back(a-1);
    edges[{a-1,b-1}] = i;
    edges[{b-1,a-1}] = i;
  }
  scanf("%d", &m);
  for(int i = 0; i < m; i++){
    int a, b;
    scanf("%d%d", &a, &b);
    M[i] = dfs(a-1, b-1, -1);   
  }
  long long int ans = 1LL << (n-1);
  for(int i = 1; i < (1<<m); i++){
    A[i] = A[i&(i-1)] | M[__builtin_ctzll(i)];
    long long int x = 1LL << (n-1-__builtin_popcountll(A[i]));
    if(__builtin_parity(i)) x = -x;
    ans += x;
  }

  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 9080
#include <bits/stdc++.h>
  
using namespace std;
 
#define endl "\n"
#define JAM(x) cout<< #x <<" = "<<x<<"\n"
#define II() ( { int a ; read(a) ; a; } )
#define LL() ( { ll a ; read(a) ; a; } )
#define DD() ({double a; scanf("%lf", &a); a;})
 
 
//Fast Reader
template<class T>inline bool read(T &x){
    int c=getchar();int sgn=1;
    while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}
    for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; 
    x*=sgn; return ~c;
}
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> PII;
typedef vector<PII> VPI;
 
const int INF=2e9;
const int MX=100005;
const int MOD=1000000007;
const double PI=acos(-1.0);

vector<int> sieve(100001);


long long int power(long long int a,long long int b)
{
    a %= MOD;
    long long int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}
bool isprime(int n)
{
    if(n==1)
    return 0;
    int i;
    for(i=2;i*i<=n;i++)
    {
        if(n%i==0)
        return false;
    }
    return true;
}

void SIEVE()
{
    int i,j;
    for(i=0;i<=100000;i++)
    sieve[i]=i;
    for(i=2;i*i<=100000;i++)
    {
        if(sieve[i]!=i)
        continue;
        for(j=i*i;j<=100000;j=j+i)
        {
            if(sieve[j]==j)
            sieve[j]=i;
        }
    }
}


/*_______________________________________________*/


int main()
{
    string s;
    cin>>s;
    long long int ans=0;
    for(auto i : s)
    {
        ans+=i-'0';
        ans%=9;
    }
    if(ans)
    cout<<"No";
    else
    {
        cout<<"Yes";
    }
    
}


Measured memory_bytes: 3980
//Induber
//PRAVEEN FULERA

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

typedef long long int ll;
#define mod 1000000007
#define speed ios_base::sync_with_stdio(false);
#define up cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define T int t; cin >> t; while(t--)

int main(){
  int n , k , j  = 1;
  cin >> n >> k;
  string s;
  cin >> s;
  for(int i = 0; i < n; i++){
      if(j==k){
          s[i] = s[i]+32;
          break;
      }
      j++;
  }
  cout << s << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d,p,n;
	cin>>a>>b>>c>>d>>p;
	a=a*p;
	//cout<<a<<endl;
	while(p-c>0){
		b+=d;
		p--;
		//cout<<b<<endl;
	}
	cout<<min(a,b)<<endl;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
typedef vector<int>    VI;   typedef vector<VI>   VVI;   typedef vector<VVI>   VVVI;
#define EB emplace_back
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define MINUD(orig, target) orig = min(orig, target)
const int    INF  = 0x3f3f3f3f;

int main(void) {
    int V, E;
    cin >> V >> E;
    vector<tuple<int, int, int>> es; // a, b, cost
    rep(i, E) {
        int a, b, c;
        cin >> a >> b >> c;
        --a; --b;
        es.EB(a, b, c);
    }

    VVI dists(V, VI(V, INF));
    rep(i, V) dists[i][i] = 0;
    for (auto &e : es) {
        int a, b, cost;
        tie(a, b, cost) = e;
        dists[a][b] = cost;
        dists[b][a] = cost;
    }

    rep(k, V) rep(i, V) rep(j, V) {
        MINUD(dists[i][j], dists[i][k] + dists[k][j]);
    }

    int cnt = 0;

    rep(i, E) {
        bool use = false;
        rep(j, V) {
            int a, b, c;
            tie(a, b, c) = es[i];
            use |= dists[j][a] + c == dists[j][b];
        }
        cnt += !use;
    }

    cout << cnt << endl;

    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N; cin >> N;
    vector<ll> A(N); for(auto& in:A) cin >> in;
    
    if(count(A.begin(),A.end(),0)){
        return 0;
    }
    ll x = 1;
    for(int i = 0; i < N; i++){
        if(A[i] > LINF/x){
            x = -1;
            break;
        }
        x *= A[i];
    }
    res = x;
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 3988
using System;
using System.Linq;
using System.Collections.Generic;

class Class{

  static void Main(){
    string[] input = Console.In.ReadToEnd().Split(' ');
    if (0 <= Array.IndexOf(input, "Y")){
      Console.Write("Four");
    }else{
      Console.Write("Three");
    }
  }

}


Measured memory_bytes: 13024
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
int n,ans,x,a[111111];
int gcd(int a,int b)
{
	if (!b) return a;
	return gcd(b,a%b);
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	sort(a+1,a+n+1);ans=1;
	for (int i=1;i<=n;i++) 
	{
		ans=1ll*ans*gcd(a[i],i-1)%mod;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
_, q = [int(i) for i in input().split()]
s = input()

ac = [0]
for c, d in zip(s[0:], s[1:]):
    if c == 'A' and d == 'C':
        ac.append(ac[-1] + 1)
    else:
        ac.append(ac[-1])

for _ in range(q):
    l, r = [int(i)-1 for i in input().split()]
    print(ac[r] - ac[l])


Measured memory_bytes: 6148
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}

int main() {
  ll n;
  cin >> n;
  vector <ll> a(n+1), b(n+1);
  vector <ll> c(10001, 0);
  rep(i, n) cin >> a.at(i+1);
  rep(i, n) c.at(a.at(i+1))++;
  for (ll i = 1; i < c.size(); i++) {
    c.at(i) += c.at(i-1);
  }
  for (ll i = n; i >= 1; i--) {
    b.at(c.at(a.at(i))) = a.at(i);
    c.at(a.at(i))--;
  }
  for (ll i = 1; i < n+1; i++) {
    if (i-1) {
      cout << ' ' << b.at(i);
    } else {
      cout << b.at(i);
    }
  }
  cout << endl;
}


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

int main() {
	int n,x,t,a,b,val;
	cin>>n>>x>>t;
	a=n/x;

	if(n%x==0)
	{
	    b=a;
	}
	else
	{
	    b=a+1;
	}
	val=b*t;
	cout<<val;
	
	return 0;
}

Measured memory_bytes: 3632
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Main main = new Main();
		main.solveC();
	}

	private void solveC() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long K = sc.nextLong();

		Map<Integer, Long> map = new HashMap<>();

		for (int i = 0; i < N; i++) {
			int key = sc.nextInt();
			long value = sc.nextLong();
			if (map.containsKey(key)) {
				value += map.get(key);
			}
			map.put(key, value);
		}
		long index = 0;
		for (Integer key : map.keySet().stream().sorted().toArray(Integer[]::new)) {
			index += map.get(key);
			if (K <= index) {
				System.out.println(key);
				break;
			}
		}
	}
}

Measured memory_bytes: 89160
#include <bits/stdc++.h>
using namespace std;
  int f(int n){
    int sum = 0;
    while (n>0){
      sum += n % 10;
      n /= 10;
    }
    return sum;
  }
    
  int main() {   
    int N, A, B;
    cin >> N >> A >> B;
    
    int total = 0;
    for (int i=1; i<=N; i++){
      int sum = f(i);
      if ( A<=sum && sum<=B) {
        total += i;
      }
    }
      cout << total << endl;
  }

Measured memory_bytes: 256
def FindPrime(X):
    while(True):
        if isPrime(X):
            break
        else:
            X += 1

    print(X)

def isPrime(X):
    ans = True
    for i in range(2, X//2):
        if(X % i == 0):
            ans = False
            break
    return ans

if __name__ == '__main__':
    X = int(input())
    FindPrime(X)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var ar1 = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var q = ToInt32(ReadLine());
        var ar2 = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        WriteLine(ar2.Count(v => ar1.Contains(v)));
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 20428
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
 
const int INF = 10000000;


const int MAX_SIZE = 100;

int d[MAX_SIZE];
int ans = 0;


void selection_sort(int n){
	for(int i = 0; i < n; i++){
		int minj = i;
		for(int  j = i; j < n; j++){
			if(d[j] < d[minj]){
				minj = j;
			}
		}
		if(d[i] != d[minj]) ans++;
		swap(d[i],d[minj]);
	}
}

int main(){
	int n;
	cin>>n;
	for(int i = 0; i < n; i++) cin>>d[i];
	selection_sort(n);
	for(int i = 0; i < n; i++){
		if(i != 0) cout<<" ";
		cout<<d[i];
	}
	cout<<endl;
	cout<<ans<<endl;
}

Measured memory_bytes: 1160
#!/usr/bin/env fsharpi

open System;

let ParseIntN ( str : string ) =
    str.Split(' ')
    |> Array.map System.Int32.Parse

let ParseInt1 ( str : string ) =
    ParseIntN str |> fun arr -> arr.[0]

let ParseInt2 ( str : string ) =
    ParseIntN str |> fun arr -> (arr.[0],arr.[1])

let ParseInt3 ( str : string ) =
    ParseIntN str |> fun arr -> (arr.[0],arr.[1],arr.[2])

let ReadLinesN ( n : int ) =
    fun _ -> Console.ReadLine()
    |> Seq.initInfinite
    |> Seq.take n

let ReadLines =
    fun _ -> Console.ReadLine()
    |> Seq.initInfinite
    |> Seq.takeWhile ((<>) null)

let rec pi a b =
    if b = 0 then 1 else a * pi a (b-1)

let (n,k) = ParseInt2 <| Console.ReadLine()
let res = k * (pi (k - 1) (n-1))
printfn "%d" res


Measured memory_bytes: 14160
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    int n; cin >> n;
    vector<pair<int, int>> v(n);
    rep(i, n) {
        int t, a; cin >> t >> a;
        v[i] = {t, a};
    }

    long long x = 1, y = 1;
    for (int i = 0; i < n; i++) {
        auto t = v[i].first;
        auto a = v[i].second;
        long long nx = x / t;
        long long ny = y / a;

        if (x % t != 0) nx++;
        if (y % a != 0) ny++;
        long long co = max(nx, ny);
        x = co * t;
        y = co * a;
    }

    cout << x + y << endl;
}


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

int main() {
  for(int q1, b, c1, c2, q2; cin >> q1 >> b >> c1 >> c2 >> q2 && q1;) {
    try {
      for(int s = q2; s > 0; --s) {
        int rem = b - s * c1;
        if(rem < 0) continue;
        int t = rem / c2;
        if(s+t >= q1) {
          cout << s << " " << t << endl;
          throw 0;
        }
      }
      cout << "NA" << endl;
    } catch(...) {}
  }
  return 0;
}

Measured memory_bytes: 1260
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;

struct Edge{int to,from,cost;};

#ifdef DEBUGLOCAL
#define debug cout
#else
stringstream __ss__;
#define debug __ss__
#endif

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;i--)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);i--)
#define rep0(i,n) for(i=0;i<(n);++i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define SS stringstream
#define X second
#define Y first
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

int c,n,m,s,d;
int edge[1111][1111];
int cost[111][1111];

int main() {
	IL{
		cin>>c>>n>>m>>s>>d;
		--s,--d;
		if(c==0)break;
		int fr,to,co;
		rep(i,111)rep(j,111)edge[i][j]=INF;
		rep(i,m){
			cin>>fr>>to>>co;
			--fr,--to;
			chmin(edge[fr][to],co);
			chmin(edge[to][fr],co);
		}
		rep(i,11)rep(j,111)cost[i][j]=INF;
		priority_queue<pair<int,pint>,vector<pair<int,pint> >,greater<pair<int,pint> > > que;
		que.push(MP(0,MP(0,s)));
		while(!que.empty()){
			pair<int,pint> p;
			p=que.top();
			que.pop();
			if(p.second.first>c)continue;
			if(cost[p.second.first][p.second.second]<=p.first)continue;
			cost[p.second.first][p.second.second]=p.first;
			rep(i,n){
				if(edge[p.second.second][i]==INF)continue;
				pair<int,pint> next=p;
				next.first+=edge[p.second.second][i]/2;
				++next.second.first;
				next.second.second=i;
				que.push(next);
				next.first+=edge[p.second.second][i]/2;
				--next.second.first;
				que.push(next);
			}
		}
		int res=INF;
		repn(i,0,c){
			chmin(res,cost[i][d]);
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
N=int(input())
A=[[int(x) for x in input().split()] for _ in range(2)]

ans = A[0][0] + A[1][N-1]

for i in range(1, N):
	ans = max(ans, sum(A[0][:i]) + sum(A[1][i-1:]))

print(ans)


Measured memory_bytes: 38512
N, M = map(int, input().split())
bridges = [list(map(lambda x: int(x)-1, input().split())) for i in range(M)]
l = [None for i in range(N)]
for a, b in bridges:
  if l[b] is None:
    l[b] = a
  else:
    l[b] = max(l[b], a)

now = 0
res = 0
for dist in range(N):
  src = l[dist]
  if src is None:
    continue
  if src >= now:
    now = dist
    res += 1

print(res)


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

int main(void) {
  int N, M;
  cin >> N >> M;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }

  int cnt = 0;
  map<int, long long> amari;
  long long ret = 0, sum = 0;
  for (int i = 0; i < N; i++) {
    sum += a[i];
    ret += amari[sum % M];
    if (sum % M == 0) ret++;
    amari[sum % M]++;
    // cerr << i << " " << ret << " " << sum << " " << sum % M << endl;
  }

  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n);(i)>0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}
int main(){
  lint N,sum=0;
  cin>>N;
  lint M[N],X[N];

  rep(i,N){
      cin>>M[i];
        sum+=M[i];
        if(i==0)X[i]=M[i];
        else X[i]=X[i-1]+M[i];
  }
  lint g=sum,ans=INF;
  rep(i,N-1){
        ans=min(ans,abs(sum-2*X[i]));
       
  }
 cout<<ans;
}

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

using namespace std;
long long n,N[100];
int main()
{
 cin>>n;
 N[0]=2;
 N[1]=1;
 for(int i=2;i<=n;i++)N[i]=N[i-1]+N[i-2];
 cout<<N[n]<<endl;
 return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll n,a[300000],p[300000];
set <ll> S;
int main(){
	cin >> n;

	REP(i,n) {
		cin >> a[i];
		a[i]--;
		p[a[i]] = i;
	}


	ll ans = 0;
	REP(i,n) {
		ll j = p[i];
		S.insert(j);
		auto itr = S.find(j);

		ll l = 0,r = n - 1;
		if(itr != S.begin()) {
			itr--;
			l = *itr + 1;
			itr++;
		}
		auto com = S.end();
		com--;
		if(itr != com) {
			itr++;
			r = *itr - 1;
		}

		ans += (r - j + 1)  * (j - l + 1) * (a[j] + 1);

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


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

int main()
{
	long long N;
	cin >> N;

	long long ans = 0;
	if( N % 2 == 0 ) {
		long long n = 10;
		while( N / n ) {
			ans += N / n;
			n *= 5;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 3612
#include<stdio.h>                                                 
#include<string.h>                                                
                                                                  
int main(void){                                                   
   int N,cnt,i;                                                   
   scanf("%d",&N);                                                
   char s[N];                                                     
   scanf("%s",s);                                                 
                                                                  
   cnt = 0;                                                       
   for(i = 0; i < N-2; i++){                                      
      if(s[i] == 'A' && s[i+1] == 'B'&& s[i+2] == 'C'){           
         cnt++;                                                   
         i+=2;                                                    
      }                                                           
   }                                                              
   printf("%d",cnt);                                              
   return 0;                                                      
}

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

using namespace std;

int main(){
 	int n,ac=0,wa=0,tle=0,re=0;
  	cin>>n;
  	while(n--){
      	string s;
      	cin>>s;
      	if(s=="AC"){
          ac++;
        }else if(s=="WA"){
          wa++;
        }else if(s=="TLE"){
          tle++;
        }else{
          re++;
        }
    }
  	printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n",ac,wa,tle,re);
  	return 0;
}

Measured memory_bytes: 3708
using System;
using System.Linq;
using System.Collections.Generic;

public class Example {
    public static void Main() {
        List<double> mountains = new List<double>();
        while(true) {
            string str = Console.ReadLine();
            if (str == null) break;
            mountains.Add(double.Parse(str));
        }
        Console.WriteLine(mountains.Max() - mountains.Min());
    }
}

Measured memory_bytes: 9444
n,m=map(int,input().split())
t_max=10**9
t_min=0
for i in range(m):
  l,r=map(int,input().split())
  t_min=max(l,t_min)
  t_max=min(r,t_max)
print(max(t_max-t_min+1,0))

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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

using ll = long long;

int main() {
    int n, m, ans = 0;
    int k[10], s[10][10], p[10];
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        cin >> k[i];
        for (int j = 0; j < k[i]; ++j) {
            cin >> s[i][j];
        }
    }
    for (int i = 0; i < m; ++i) {
        cin >> p[i];
    }

    for (int i = 0; i < (1 << n); ++i) {
        bool f = true;
        for (int j = 0; j < m; ++j) {
            int cnt = 0;
            for (int l = 0; l < k[j]; ++l) {
                if ((i & (1 << (s[j][l] - 1))) > 0)
                    cnt++;
            }
            if (cnt % 2 != p[j])
                f = false;
        }
        if (f) {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

void mergeSort(int *, int, int);
void merge(int *, int, int, int);

long long cnt = 0;

int main(){
  int S[200000], n, i, j, temp;

  scanf("%d", &n);
  for(i=0; i<n; i++) scanf("%d", &S[i]);

  mergeSort(S, 0, n);

  printf("%lld\n", cnt);
  
  return 0;
  
}

void mergeSort(int *A, int left, int right){
  int mid;
  if (left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

void merge(int *A, int left, int mid, int right){
  int n1, n2, L[100001], R[100001], n, j, k;

  n1 = mid - left;
  n2 = right - mid;

  for(n=0; n<n1; n++) L[n] = A[left + n];
  for(n=0; n<n2; n++) R[n] = A[mid + n];
  L[n1] = 1000000001;
  R[n2] = 1000000001;
 n = 0;
  j = 0;

  for(k = left; k < right; k++){
    if(L[n] <= R[j]){
      A[k] = L[n];
      n++;
    }
    else{
      A[k] = R[j];
      j++;
      cnt += n1 - n;
    }
  }
}



Measured memory_bytes: 3296
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a, b, c, count = 0;
    cin >> a >> b >> c;
    for(int i = a;i <= b; i++){
        if(c % i == 0){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3128
#include<stdio.h>
int main(void)
{
	int a, b, c, d,e=0;
	scanf("%d %d %d", &a, &b, &c);
	if (a > b)
	{
		d = a;
		a = b;
		b = d;
	}
	while (a <= b)
	{
		if (c%a == 0)
		{
			e++;
		}
		a++;
	}
	printf("%d\n", e);
	return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    rep(i,7) {
        int a,b; cin >> a >> b;
        cout << a-b << endl;
    }

    return 0;
}


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

int main() {
    int n, a, b; cin >> n >> a >> b;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int tt = i, j = 0;
        while (tt) {
            j += tt % 10;
            tt /= 10;
        }
        if (a <= j && j <= b) ans += i;
    }
    cout << ans << endl;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#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) a.begin(), a.end()

int main() {
  bool is_prime[200001];
  REP1(i, 200000) is_prime[i] = true;
  is_prime[1] = false;
  for (int i = 2; i * i <= 200000; ++i) {
    if (is_prime[i]) {
      for (int j = 2; i * j <= 200000; ++j) {
        is_prime[i * j] = false;
      }
    }
  }
  bool is_like_prime[200001];
  for (int i = 1; i <= 200000; i += 2) {
    if (is_prime[i] && is_prime[(i + 1) / 2]) {
      is_like_prime[i] = true;
    }
  }
  int sum[200001] = {};
  REP(i, 200000) sum[i + 1] = sum[i] + is_like_prime[i + 1];
  int q;
  cin >> q;
  REP(i, q) {
    int l, r;
    cin >> l >> r;
    cout << sum[r] - sum[l - 1] << endl;
  }
  return 0;
}

Measured memory_bytes: 1792
x = int(input())

for a in range(-118, 120):
    a_5 = a*a*a*a*a
    for b in range(-119, 119):
        b_5 = b*b*b*b*b
        if a_5 - b_5 == x:
            print(a, b)
            break
    else:
        continue

    break

Measured memory_bytes: 9088
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
#define int long long
const int MAXN=1e2+9;
signed main()
{
    int k;
    char str[MAXN];
    scanf("%s",str);
    scanf("%lld",&k);
    bool flag=true;
    char ans;
    for(int i=0;i<strlen(str)&&i<k;++i)
    {
        if(str[i]!='1')
        {
            flag=false;
            ans=str[i];
            break;
        }
    }
    if(flag) printf("1\n");
    else printf("%c\n",ans);
    return 0;
}


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

#define isNum(a) (a >= '0' && a <= '9')
#define SP putchar(' ')
#define EL putchar('\n')
#define File(a) freopen(a ".in", "r", stdin), freopen(a ".out", "w", stdout)

template<class T>
void read(T&);
template<class T>
void write(const T&);

typedef long long ll;
typedef const long long & cll;
typedef const int & ci;
typedef std::pair<int, int> pii;
const int iinf = 2147483647;
const ll llinf = 9223372036854775807ll;
using std::min;
using std::max;
using std::abs;
using std::sort;

int main () {
  ll n;
  read(n);
  write(n * (n - 1) / 2), EL;
  return 0;
}

template<class T>
inline void read(T &Re) {
  T k = 0;
  char ch = getchar();
  int flag = 1;
  while (!isNum(ch)) {
    if (ch == '-') {
      flag = -1;
    }
    ch = getchar();
  }
  while (isNum(ch)) {
    k = (k << 1) + (k << 3) + ch - '0';
    ch = getchar();
  }
  Re = flag * k;
}
template<class T>
inline void write(const T &Wr) {
  if (Wr < 0) {
    putchar('-');
    write(-Wr);
  } else {
    if (Wr < 10) {
      putchar(Wr + '0');
    } else {
      write(Wr / 10);
      putchar((Wr % 10) + '0');
    }
  }
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import numpy as np
N,K,Q = map(int,input().split())
point_list = [K-Q]*N

for i in range(Q):
    point_list[int(input())-1] += 1 


for i in range (N):
    if point_list[i] > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 15572
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <utility>
using namespace std;
//#define local
int main()
{
#ifdef local
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
#endif
    int a[3],b,c;
    b=c=0;
    for(int i=0; i<3; i++)
    {
        scanf("%d",&a[i]);
        if(a[i]==5) b++;
        else if(a[i]==7) c++;
    }
    if(b==2&&c==1) printf("YES");
    else printf("NO");
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        
        long sum = 0;
        for(long i = 1; i <= n; i++)
        {
            if(i % 5 != 0 && i % 3 != 0)
            {
                sum += i;
            }
        }
        
        System.out.println(sum);
        
        
    }
}


Measured memory_bytes: 35780
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	void doIt() {
		while(true){
			int n = sc.nextInt();
			if(n==0)break;
			int a[] = new int[n];
			for(int i=0;i<n;i++){
				a[i]=sc.nextInt();
			}
			int x = sc.nextInt();
			int s = 0;
			int g = n-1;
			int cnt = 0;
			while(s<=g){
				cnt++;
				int m = (s+g)/2;
				if(g<=s)break;
				if(a[m]<x)s=m+1;
				else if(a[m]>x)g=m-1;
				else break;
			}
			System.out.println(cnt);
		}
	}
	public static void main(String[] args) {
    	// TODO Auto-generated method stub
    	new Main().doIt();
    }
}

Measured memory_bytes: 20340