akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main{

    public static void main(String args[]){

        // スキャナーの宣言
        Scanner sc = new Scanner(System.in);
        // 整数の入力
		int l = sc.nextInt();
        // スペース区切りの整数の入力
        int r = sc.nextInt();
        int o = Math.min(r - l, 2019);
        /*if(l < 2019 && r >= 2019){
            l = l % 2019;
            r = r % 2019 + 2019;
        }else{
            l = l % 2019;
            r = r % 2019;
        }*/
        l = l % 2019;
        r = l + o;
        //System.out.println(l + " " + r);
        int answer = 2018;
        // for文

        for(int i = l; i < r; i++){
            for(int j = i + 1; j < r + 1; j++){
                answer = Math.min(i * j % 2019, answer);
            }
        }
        // 出力
        System.out.println(answer);

    }

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
 using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
 int main(){
   int n;
   cin>>n;
   bool ans=false;
   rep(i,9){
    if(n%(i+1)==0&&n/(i+1)<=9)
      ans=true;
   }
   if(ans) cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define fill(a,val)  memset(a,val, sizeof (a))
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(cont) cont.begin(), cont.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MAX   1e9
#define MIN  -1e9
typedef map<int,int> mpi;
typedef set<int> seti;
typedef multiset<int> mseti;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
struct Interval {int start, end;};
bool compare(pll i1, pll i2) {return (i1.s < i2.s);}
int main()
{
    ll n,m;
    cin>>n>>m;
    vpll v;
    ll maxl=MIN;
    ll minr=MAX;
    rep(i,m)
    {
        ll l,r;
        cin>>l>>r;
        if(l>maxl)
            maxl=l;
        if(r<minr)
            minr=r;
    }
    if(maxl<=minr)
        cout<<minr-maxl+1;
    else
        cout<<0;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <string>
void dump(const std::list<int> &list) {
	bool isNotFirst = false;
	for (const auto &l : list) {
		if (isNotFirst) std::cout << ' ';
		std::cout << l;
		isNotFirst = true;
	}
	std::cout << std::endl;
}
int main() {
	int n, q;
	std::cin >> n >> q;
	std::vector<std::list<int>> list(n);
	for (auto i = 0; i < q; ++i) {
		int a, b, c;
		std::cin >> a;
		switch (a) {
		case 0:std::cin >> b >> c;
			list[b].insert(list[b].end(), c);
			break;
		case 1:  std::cin >> b; dump(list[b]);
			break;
		default: std::cin >> b >> c;
			list[c].splice(list[c].end(), std::move(list[b]));
			list[b] = std::list<int>();
		}
	}
}


Measured memory_bytes: 18708
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <set>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <cassert>
#include <climits>
#include <numeric>
#include <sstream>
using namespace std;
typedef long long ll;
#define DEBUG
#ifdef DEBUG
	#define debug printf
#else
	#define debug(...)
#endif
const int mod = 1e9 + 7;
const int maxn = 305;
void add(int &x,int y)
{
	x += y;
	if(x >= mod)
	{
		x -= mod;
	}
}
int n,m,ans,a[maxn << 1];
int cnt1,cnt2,f[maxn << 1][maxn][maxn];
int s[maxn << 1],vis[maxn << 1],book[maxn << 1];
int main(int argc, char const *argv[])
{
	scanf("%d",&n);
	for(int i = 1;i <= n + n; ++i)
	{
		scanf("%d",a + i);
	}
	for(int i = 1;i <= n + n;i += 2)
	{
		if(a[i] == -1 && a[i + 1] == -1)
		{
			++cnt1;
		}
		else if(a[i] > 0 && a[i + 1] > 0)
		{
			vis[a[i]] = vis[a[i + 1]] = 1;
		}
		else
		{
			++cnt2,book[a[i] == -1 ? a[i + 1] : a[i]] = 1;
		}
	}
	for(int i = n + n;i; --i)
	{
		if(!vis[i])
		{
			s[++m] = i;
		}
	}
	f[0][0][0] = 1;
	for(int i = 1;i <= m; ++i)
	{
		for(int j = 0;j <= cnt1 + cnt2; ++j)
		{
			for(int k = 0;k <= cnt2; ++k)
			{
				if(!f[i - 1][j][k])
				{
					continue;
				}
				if(!book[s[i]])
				{
					add(f[i][j + 1][k],f[i - 1][j][k]);
					if(j)
					{
						add(f[i][j - 1][k],f[i - 1][j][k]);
					}
					if(k)
					{
						add(f[i][j][k - 1],1ll * k * f[i - 1][j][k] % mod);
					}
				}
				else
				{
					add(f[i][j][k + 1],f[i - 1][j][k]);
					if(j)
					{
						add(f[i][j - 1][k],f[i - 1][j][k]);
					}
				}
			}
		}
	}
	ans = f[m][0][0];
	for(int i = 1;i <= cnt1; ++i)
	{
		ans = 1ll * ans * i % mod;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 217344
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

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

	map<int,int> m;
	rep(i,n){
		int x;
		cin >> x;
		m[x % 2]++;
	}
	if(m[1] % 2 == 1){
		cout << "NO" << endl;
	}else{
		cout << "YES" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int,int> pi;
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);

const int maxn = 100010;

string S,T;
int AS[maxn], BS[maxn];
int AT[maxn], BT[maxn];
int q;

pi trans(pi a) {
	return pi((a.f - 1 + 3) % 3, (a.s + 2) % 3);
}

int main() {
	FAST
	cin >> S >> T >> q;
	for (int i =1;i<=S.length();i++) {
		AS[i] = AS[i-1];
		BS[i] = BS[i-1];
		if (S[i-1] == 'A') AS[i]++;
		else if (S[i-1] == 'B') BS[i]++; 
	}
	
	for (int i =1;i<=T.length();i++) {
		AT[i] = AT[i-1];
		BT[i] = BT[i-1];
		if (T[i-1] == 'A') AT[i]++;
		else if (T[i-1] == 'B') BT[i]++;
	}
	
	for (int i =0;i<q;i++) {
		int a,b,c,d; cin >> a >> b >> c >> d;
		pi og = pi((AS[b] - AS[a-1])%3, (BS[b] - BS[a-1])%3);
		pi tcount = pi((AT[d] - AT[c-1])%3, (BT[d] - BT[c-1])%3);
		if (og == tcount) {
			cout << "YES\n";
			continue;
		}
		//~ cout << "OG: " << og.f << " " << og.s << "\n";
		pi newv = trans(og);
		bool works = false;
		while (newv != og) {
			//~ cout << newv.f << " " << newv.s << "\n";
			if (newv == tcount) {
				cout << "YES\n";
				works = true;
				break;
			}
			newv = trans(newv);
		}
		if (!works) cout << "NO\n";
	}
	
}


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

int main(){
  string s1,s2;
  cin >> s1 >> s2;
  int count=0;
  if(s1[1]==s2[1]) count++;
  if(s1[2]==s2[2]) count++;
  if(s1[0]==s2[0]) count++;
  cout<< count<< endl;


  return 0;
}

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

typedef long long ll;

int main()
{
  ll a1,a2,a3;
  cin>>a1>>a2>>a3;
  
  ll sum = a1+a2+a3;
  if(sum>=22)
  {
    cout<<"bust";
  }
  else
  {
    cout<<"win";
  }
  return 0;
}

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

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=n-1;i>=m;--i)
#define ALL(v) v.begin(),v.end()
#define PB(a) push_back(a)
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-9

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

using namespace std;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	string s;
	int x = 0;
	int ans = 0;
	cin >> n >> s;

	REP(i, n) {
		if (s[i] == 'I') {
			x++;
			ans = max(ans, x);
		}
		else {
			x--;
		}
	}
	cout << ans << endl;
	return 0;
}


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

					#define mp make_pair
					#define pb push_back
					#define sqr(x) (x) * (x)
					#define sors(s) sort(s.begin(), s.end())
					#define sz(s) s.size()
					#define B begin()
					#define E end()
					#define F first
					#define S second
					#define I insert
					#define N 222222
					#define M 1000000007
					
					using namespace std;
					typedef long long ll;
					typedef vector<int> vi;
					typedef pair<int,int> pii;
					typedef set<int> si;
					typedef set<string> ss;
					typedef multiset<int> mi;
					typedef map<string, int> msi;
     				typedef vector<pair<int, int>> vii;
     				int n;
     				double s;
					int main()
					{
						cin >> n;
						for(int i = 1; i <= n; i++)
							if(i & 1)
								s++;
						cout << setprecision(10) << fixed << s/n;  	
					}

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

using namespace std;

int main(){
    int n;
    cin>>n;
    int count[4]={};
    while(n--){
        string s;
        cin>>s;
        if(s=="AC"){
            count[0]++;
        }
        else if(s=="WA"){
            count[1]++;
        }
        else if(s=="TLE"){
            count[2]++;
        }
        else{
            count[3]++;
        }
    }
    cout<<"AC x "<<count[0]<<endl;
    cout<<"WA x "<<count[1]<<endl;
    cout<<"TLE x "<<count[2]<<endl;
    cout<<"RE x "<<count[3]<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>


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

    std::string sc(s);


    if(s.find(t) == std::string::npos) {
    for(int i = s.size() - t.size(); i >= 0; i--) {
        bool f = true;
        int ip = i;
        for(int j = 0; j < t.size(); j++) {
           

            if(s[ip] != t[j] && s[ip] != '?') {
               
                f = false;
                break;
            }

            ip++;
        }

        if(f) {

            int ipp = i;
            
            for(int j = 0; j < t.size(); j++) {
                s[ipp++]= t[j];
            }
            
            break;
        }


    }
    }

    std::string ans;

    if (sc == s && s.find(t) == std::string::npos)
    {
        ans = "UNRESTORABLE";
    }
    else
    {
        for (int i = 0; i < s.size(); i++)
        {
            if (s[i] == '?')
            {
                s[i] = 'a';
            }
        }

        ans = s;
    }

    std::cout << ans << std::endl;
}

    

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

const int N = 100010;
int n, m, a[N];

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	--a[1];
	for(int i = 2; i <= n; ++i) if(a[i] > a[i - 1]) --a[i];
	for(int i = 2; i <= n; ++i) if(a[i] < a[i - 1]) return puts("No"), 0;
	puts("Yes");
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <set>

using namespace std;
using ll = long long;
const int MOD = 1000000007;
const ll INF = 1LL << 60;

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

vector<vector<ll> > dp;
vector<vector<vector<int> > > vvvi;

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 GCD(int a, int b) { return b ? GCD(b, a%b) : a; }


int main(int argc, char**argv){
    const int MAX_V = 100100;
    int n, w;
    cin >> n >> w;
    vector<ll> weight(n), value(n);
    for (int i = 0; i < n; i++){
        cin >> weight[i] >> value[i];
    }

    dp = vector<vector<ll> >(n+1, vector<ll>(MAX_V+1, INF));
    dp[0][0] = 0;

    for (int i = 0; i < n; i++){
        for (int sum_v = 0; sum_v <= MAX_V; sum_v++){
            if (sum_v - value[i] >= 0) chmin(dp[i+1][sum_v], dp[i][sum_v - value[i]] + weight[i]);
            chmin(dp[i+1][sum_v], dp[i][sum_v]);
        }
    }
    ll res = 0;
    for (int sum_v = 0; sum_v < MAX_V; ++sum_v){
        if (dp[n][sum_v] <= w) res = sum_v;
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 80256
import java.util.*;

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans;

        if(a>b){
            int c = a-1;
                if(c>=b){
                    ans = a+a-1;
                    System.out.println(ans);
                }else{
                    ans = a+b;
                    System.out.println(ans);
                }
        }else if (a==b){
            ans = a+b;
            System.out.println(ans);
        }else if (a<b){
            int c = b-1;
                if(c>=a){
                    ans = b+b-1;
                    System.out.println(ans);
                }else if(c<a){
                    ans = a+b;
                    System.out.println(ans);
                }

        }
    }
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N, L;
    cin >> N >> L;

    ll sum = 0;
    REP(i, N) sum += (L+i);
    vector<pll> res;
    REP(i, N){
    	ll tmp = 0;
    	REP(j, N){
    		if(j != i) tmp += (L+j);
    	}
    	res.push_back({abs(sum-tmp), tmp});
    }
    sort(res.begin(), res.end());
    cout << res[0].second << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <vector>
#include <queue>

template <class T>
using greater_queue=std::priority_queue<T, std::deque<T>, std::greater<T>>;

template <class T>
constexpr T inf=(T(1)<<(8*sizeof(T)-3));

template <class Weight>
struct Edge {
  size_t src, dst;
  Weight cost;

  Edge(size_t src, size_t dst, Weight cost=1):
    src(src), dst(dst), cost(cost)
  {}

  bool operator <(const Edge<Weight> &rhs) const {
    if (cost != rhs.cost) return cost < rhs.cost;
    if (src != rhs.src) return src < rhs.src;
    return dst < rhs.dst;
  }
};

template <class Weight>
class Graph: public std::vector<std::vector<Edge<Weight>>> {
  bool neg_edge;
  std::vector<Weight> _dijkstra(size_t start) const {
    std::vector<Weight> res(this->size(), inf<Weight>);
    greater_queue<std::pair<Weight, size_t>> q;
    res[start] = 0;
    q.emplace(0, start);
    while (!q.empty()) {
      const Weight w=q.top().first;
      const size_t v=q.top().second;
      q.pop();
      if (res[v] < w) continue;
      for (const auto &e: (*this)[v]) {
        if (res[e.dst] > w + e.cost) {
          res[e.dst] = w + e.cost;
          q.emplace(res[e.dst], e.dst);
        }
      }
    }

    return res;
  }

  std::vector<Weight> _bellman_ford(size_t start) const {
    std::vector<Weight> res(this->size(), inf<Weight>);

    res[start] = 0;
    for (size_t k=0; k<res.size(); ++k)
      for (size_t i=0; i<res.size(); ++i)
        for (const auto &e: (*this)[i])
          if (res[e.dst] > res[e.src] + e.cost) {
            res[e.dst] = res[e.src] + e.cost;
            if (k+1 == res.size())
              res[e.dst] = -inf<Weight>;
          }

    return res;
  }

public:
  Graph(size_t v): std::vector<std::vector<Edge<Weight>>>(v), neg_edge(false)
  {}

  void connect_to(size_t s, size_t d, Weight c=1) {
    (*this)[s].emplace_back(s, d, c);
    if (c < 0)
      neg_edge = true;
  }

  void connect_with(size_t u, size_t v, Weight c=1) {
    connect_to(u, v, c);
    connect_to(v, u, c);
  }

  std::vector<Weight> distance_one(size_t start) const {
    return neg_edge? _bellman_ford(start):_dijkstra(start);
  }

  std::vector<std::vector<Weight>> distance_all() const {
    std::vector<std::vector<Weight>> res(
        this->size(), std::vector<Weight>(this->size(), inf<Weight>));

    for (size_t i=0; i<res.size(); ++i) {
      res[i][i] = 0;
      for (const auto &e: (*this)[i])
        res[i][e.dst] = e.cost;
    }

    for (size_t k=0; k<res.size(); ++k)
      for (size_t i=0; i<res.size(); ++i)
        for (size_t j=0; j<res.size(); ++j)
          res[i][j] = std::min(res[i][j], res[i][k]+res[k][j]);

    return res;
  }

  
};

int main() {
  size_t N, M;
  scanf("%zu %zu", &N, &M);

  Graph<intmax_t> g(N);
  for (size_t i=0; i<M; ++i) {
    size_t a, b;
    intmax_t c;
    scanf("%zu %zu %jd", &a, &b, &c);
    --a;
    --b;

    g.connect_to(a, b, -c);
  }

  intmax_t res=-g.distance_one(0)[N-1];
  if (res < inf<intmax_t>) {
    printf("%jd\n", res);
  } else {
    printf("inf\n");
  }
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define R 1000000007
#define MAX_N 100000

using namespace std;

int mult(int a, int b) {
    a %= R;
    int res = 0;
    for(int i = 0; i < b; ++i)
        res = (res + a) % R;
    return res;
}

int ct[26];
int main(int argc, char **argv) {
    int n;
    char str[MAX_N];
    scanf("%d", &n);
    scanf("%s", str);

    for(int i = 0; i < n; ++i)
        ct[str[i] - 'a']++;
    
    int res = 1;
    for(int i = 0; i < 26; ++i) {
        if(ct[i] == 0);
        else if(ct[i] == 1) {
            res = mult(res, 2);
        } else {
            res = mult(res, ct[i] + 1);
        }
    }

    printf("%d\n", res - 1);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

int change_to_i(string s){
   stringstream ss; int k;
   ss<<s; ss>>k;
   return k;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    int l;
    while(1){
        cin >> s >> l;
        if(s == "0" && l == 0) break;
        map<string, int> mp;
        mp[s] = 0;
        for(int i = 1;; i++){
            int sz = s.size();
            rep(j, 0, l - sz) s += "0";
            sort(all(s));
            string t = s;
            sort(all(t));
            reverse(all(t));
            int tmp = change_to_i(t) - change_to_i(s);
            string next = to_string(tmp);
            // cout << s << ' ' << t << ' ' << tmp << endl;
            if(mp.count(next)){
                cout << mp[next] << " " << tmp << ' ' << i - mp[next] << endl;
                break;
            } 
            mp[next] = i;
            s = next;
        }
    }
}


Measured memory_bytes: 3300
MOD = 10**9+7
l = input()
n = len(l)
dp = [    [0,0] for _ in range(n + 1)]
dp[0][0]  = 1
#dp[桁数][条件を満たすことが確定しているフラグ]
# 00 10 01

for i in range(1,n +1):
    # (dp[i][flag]のflag,dp[i-1][flag]のflag,i桁目の数字) で繊維は2**3の8通り
    dp[i][1] += dp[i - 1][1] * 3 # i桁目が (0,1) flag が 1 1
    #flag 0→1はない

    if l[i-1] == "1":
        dp[i][0] += dp[i -1][0] * 2 #1,0  or 0,1のときに相変わらず未定
        dp[i][1] += dp[i -1][0] # 0,0のときだけ確定させられる e.g. 101 10 のときに次に0が来れば確定 なので0,0
    else:
        dp[i][0] +=dp[i-1][0] # 0,0 の場合のみ
        # dp[i][1] への遷移は無し
    dp[i][0] %= MOD
    dp[i][1] %= MOD
ans = dp[-1][0] + dp[-1][1]
print(ans % MOD)


Measured memory_bytes: 19700
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			String np = "";
			int w = scanner.nextInt();
			int h = scanner.nextInt();
			Map<String, Page> pages = new HashMap<String, Main.Page>();
			while (n-- > 0) {
				Page p = new Page();
				String name = scanner.next();
				if (np.equals(""))
					np = name;
				int b = scanner.nextInt();
				while (b-- > 0) {
					int sx = scanner.nextInt();
					int sy = scanner.nextInt();
					int ex = scanner.nextInt();
					int ey = scanner.nextInt();
					String to = scanner.next();
					Button bn = new Button(sx, sy, ex, ey, to);
					p.buttons.add(bn);
				}
				pages.put(name, p);
			}
			int m = scanner.nextInt();
			List<String> buff = new ArrayList<String>();
			buff.add(np);
			int pi = 0;
			int br = 1;
			while (m-- > 0) {
				String op = scanner.next();
				if (op.equals("click")) {
					int x = scanner.nextInt();
					int y = scanner.nextInt();
					String to = pages.get(buff.get(pi)).click(x, y);
					if (!to.isEmpty()) {
						pi++;
						if (pi == buff.size())
							buff.add(to);
						else
							buff.set(pi, to);
						br = pi + 1;
					}
				} else if (op.equals("back")) {
					if (pi != 0)
						pi--;
				} else if (op.equals("forward")) {
					if (pi + 1 != br)
						pi++;
				} else
					System.out.println(buff.get(pi));
			}
		}
	}

	class Button {
		int sx, sy, ex, ey;
		String to;

		public Button(int sx, int sy, int ex, int ey, String to) {
			super();
			this.sx = sx;
			this.sy = sy;
			this.ex = ex;
			this.ey = ey;
			this.to = to;
		}

		@Override
		public String toString() {
			return "Button [sx=" + sx + ", sy=" + sy + ", ex=" + ex + ", ey="
					+ ey + ", to=" + to + "]";
		}

		boolean isHit(int x, int y) {
			return sx <= x && x <= ex && sy <= y && y <= ey;
		}
	}

	class Page {
		List<Button> buttons = new ArrayList<Main.Button>();

		String click(int x, int y) {
			for (int i = 0; i < buttons.size(); i++) {
				if (buttons.get(i).isHit(x, y))
					return buttons.get(i).to;
			}
			return "";
		}

		@Override
		public String toString() {
			return "Page [buttons=" + buttons + "]";
		}
	}
}

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

int main()
{
	long long n, m, x;
	long long ans = 1000000000000000;
	bool flag = false;
	std::cin >> n >> m >> x;
	std::vector<long long> C;
	std::vector<std::vector<long long> > A(n, std::vector<long long> (m));
	std::vector<int> N;
	for (int i = 0; i < n; i++)
	{
		N.push_back(i);
		long long c;
		std::cin >> c;
		C.push_back(c);
		for (int j = 0; j < m; j++)
			std::cin >> A[i][j];
	}
	
	for (int bit = 0; bit < (1 << n); bit++)
	{
		long long cost = 0;
		std::vector<long long> M(m, 0);
		for (int i = 0; i < n; i++)
		{
			if (bit & (1 << i))
			{
				cost += C[i];
				for (int j = 0; j < m; j++)
				{
					M[j] += A[i][j];
				}
			}
		}
		if (*(std::min_element(M.begin(),M.end())) >= x)
		{
			flag = true;
			ans = std::min(ans, cost);
		}
	}
	if(flag)
		std::cout << ans << '\n';
	else
		std::cout << -1 << '\n';
}

Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#define INF 1000000009
#define LINF 1000000000000000009
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmax(T &a, const T&b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T&b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

int main() {
	ll n;
	cin >> n;
	vector<ll> a(n);
	vector<ll> b(n + 1);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[a[i]] = i;
	}
	set<ll> st;
	st.insert(-1); st.insert(n);
	ll ans = 0;
	for (ll i = n; i >= 1; i--) {
		ll k = b[i];
		auto itr = st.lower_bound(k);
		ll r = *itr; itr--;
		ll l = *itr; itr++;
		if (r != n) {
			itr++;
			ll r2 = *itr;
			ans += (r2 - r)*(k - l)*i;
			itr--;
		}
		itr--;
		if (l != -1) {
			itr--;
			ll l2 = *itr;
			ans += (l - l2)*(r - k)*i;
			itr++;
		}
		st.insert(k);
		//cout << ans << endl;
	}
	cout << ans << endl;
}

Measured memory_bytes: 6528
import java.util.Scanner;

//Calender Colors
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		double[][] a = new double[n][3];
		for(int i=0;i<n;i++)for(int j=0;j<3;j++)a[i][j]=sc.nextDouble();
		double max = 0;
		for(int i=0;i<1<<n;i++){
			int c = 0;
			for(int j=0;j<n;j++)if((i>>j&1)>0)c++;
			if(c!=m)continue;
			double s = 0;
			for(int j=0;j<n;j++){
				if((i>>j&1)==0)continue;
				for(int k=j+1;k<n;k++){
					if((i>>k&1)==0)continue;
					double x = 0;
					for(int l=0;l<3;l++)x+=Math.pow(a[j][l]-a[k][l], 2);
					s+=x;
				}
			}
			max = Math.max(max, s);
		}
		System.out.printf("%.6f\n", max);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int main()
{
    int N;
    cin >> N;
    int L[N];
    int max=0,hoge;
    for(int i=0;i<N;i++){
        cin >> L[i];
        if(max<L[i]){
            max = L[i];
            hoge = i;
        }

    }
    int sum=0;
    for(int i=0;i<N;i++){
        if(i != hoge){
            sum += L[i];
        }
    }

    if(sum > L[hoge]){
        cout << "Yes" << "\n";
    }
    else{
        cout << "No" << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }

struct Tmp
{
public:
  Tmp(int N);
};

Tmp::Tmp(int N){}

void solve(void)
{
  int N; cin >> N;
  map<int, int> m{};
  for (int i = 0; i < N; ++i) {
    int a; cin >> a;
    ++m[a];
  }
  multiset<int> s{};
  s.emplace(0);
  s.emplace(0);
  for (const auto& p : m) {
    if (p.second >= 2) {
      s.emplace(p.first);
    }
    if (p.second >= 4) {
      s.emplace(p.first);
    }
  }
  ll ans = 1;
  auto it = s.end();
  --it;
  ans *= *it;
  --it;
  ans *= *it;
  cout << ans << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 4992
#include<cstdio>
#include<cstdlib>
#include<cassert>
using namespace std;

const int N = 2e5;
int a[N+3];
int f[N+3];
int n;

int check(int x)
{
	for(int i=1; i<=(n<<1)-1; i++) f[i] = a[i]<x?0:1;
//	printf("check %d\n",x);
//	printf("f: "); for(int i=1; i<=(n<<1)-1; i++) printf("%d ",f[i]); puts("");
	int l = n,r = n;
	while(l>1 && f[l]!=f[l-1]) l--;
	while(r<n+n-1 && f[r]!=f[r+1]) r++;
//	printf("l=%d r=%d\n",l,r);
	if(f[l]==f[r]) return f[l];
	else
	{
		int lenl = n-l,lenr = r-n;
		return lenl<lenr ? f[l] : f[r];
	}
}

int main()
{
	scanf("%d",&n);
	for(int i=1; i<=n+n-1; i++)
	{
		scanf("%d",&a[i]);
	}
	int left = 1,right = n+n-1;
	while(left<right)
	{
		int mid = (left+right+1)>>1;
		bool f = check(mid);
		if(f) {left = mid;}
		else {right = mid-1;}
	}
	printf("%d\n",left);
	return 0;
}
/*
4
7 3 2 1 5 4 6
*/

Measured memory_bytes: 1664
N = int(input())

a = int(N / 1.08)
if int(a * 1.08) == N:
    print(a)
elif int((a-1) * 1.08) == N:
    print(a-1)
elif int((a+1) * 1.08) == N:
    print(a+1)
else:
    print(':(')

Measured memory_bytes: 38256
//==========================Head files==========================
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
#include<iostream>
#include<map>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
    int x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
inline LL readl() {
    LL x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
int power(int a, int b) {
	int ans = 1;
	while (b) {
		if(b & 1) ans = ans * a;
		b >>= 1; a = a * a;
	}
	return ans;
}
int power_mod(int a, int b, int mod) {
	a %= mod;
	int ans = 1;
	while (b) {
		if(b & 1) ans = (ans * a) % mod;
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}
LL powerl(LL a, LL b) {
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = ans * a;
		b >>= 1ll;a = a * a;
	}
	return ans;
}
LL power_modl(LL a, LL b, LL mod) {
	a %= mod;
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = (ans * a) % mod;
		b >>= 1ll, a = (a * a) % mod;
	}
	return ans;
}
LL gcdl(LL a, LL b) {return b == 0 ? a : gcdl(b, a % b);}
LL abssl(LL a) {return a > 0 ? a : -a;}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
int abss(int a) {return a > 0 ? a : -a;}
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("YES\n")
#define ptn printf("NO\n")
//==========================Code here==========================
int len, n, a[100000 + 5], b[100000 + 5];
int main() {
	scanf("%d", &n);
        for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), a[i] = -a[i];
        b[1] = a[1], len = 1;
        for (int i = 2; i <= n; ++i) {
            if (a[i] >= b[len]) b[++len] = a[i];
            else {
                int p = upper_bound(b + 1, b + 1 + len, a[i]) - b; // ×¢Òâ upper_bound
                b[p] = a[i];
            }
        }
        printf("%d\n", len);
	return 0;
}

Measured memory_bytes: 1024
L2, R2= map(int, input().split())

L=L2%2019
R=R2%2019

hasamu=R2-L2
kotae=10000
if hasamu>2017:
  kotae=0
if L>R:
  kotae=0
else:
  for i in range(L,R):
    for j in range(i+1,R+1):
      seki=i*j
      amari=seki%2019
      if amari<kotae:
        kotae=amari
print(kotae)
  


Measured memory_bytes: 40300
#include <bits/stdc++.h>
#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 PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	int n;
	vector<int> v;
	cin >> n;
	if(n==0) break;
	FOR(i,1,n){
	    v.PB((i*i)%n);
	}
	sort(ALL(v));
	v.erase(unique(ALL(v)),v.end());
	vector<int> ans((n/2));
	REP(i,v.size())FOR(j,i+1,v.size()){
	    int m = v[i] - v[j];
	    if(m < 0) m += n;
	    if(m > (n-1)/2) m = n - m;
	    ans[m-1]++;
	}
	REP(i,ans.size()) cout << 2*ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 1324
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

struct Wifi {
	int x{ 0 }, y{ 0 }, w{ 0 };
};
int main() {
	int n, width, height;
	std::cin >> n >> width >> height;
	std::vector<Wifi> wifis(n);
	for (auto &wifi : wifis)std::cin >> wifi.x >> wifi.y >> wifi.w;
	std::sort(wifis.begin(), wifis.end(), [](const Wifi &a, const Wifi &b) {return a.x - a.w < b.x - b.w; });
	int leften{ 0 };
	bool is_covered_x{ true };
	for (auto i = 0; i < n; ++i) {
		if (leften >= wifis[i].x - wifis[i].w) {
			if (leften < wifis[i].x + wifis[i].w) leften = wifis[i].x + wifis[i].w;
		}
		else is_covered_x = false;
	}
	is_covered_x &= width <= leften;
	std::sort(wifis.begin(), wifis.end(), [](const Wifi &a, const Wifi &b) {return a.y - a.w < b.y - b.w; });
	int bottom{ 0 };
	bool is_covered_y = true;
	for (auto i = 0; i < n; ++i) {
		if (bottom >= wifis[i].y - wifis[i].w) {
			if (bottom < wifis[i].y + wifis[i].w) bottom = wifis[i].y + wifis[i].w;
		}
		else is_covered_y = false;
	}
	is_covered_y &= height <= bottom;
	if (is_covered_x || is_covered_y)
		std::cout << "Yes" << std::endl;
	else
		std::cout << "No" << std::endl;
}


Measured memory_bytes: 3892
h,w = map(int,input().split())

sll = []

for _ in range(h):
    sl = list(input())
    sll.append(sl)

for i in range(h):
    for j in range(w):
        if sll[i][j] == "#":
            flag = False
            if j+1 < w:
                if sll[i][j+1] == "#":
                    flag = True
            if j-1 >= 0:
                if sll[i][j-1] == "#":
                    flag = True
            if i+1 < h:
                if sll[i+1][j] == "#":
                    flag = True
            if i-1 >= 0:
                if sll[i-1][j] == "#":
                    flag = True
            if flag == False:
                print("No")
                import sys
                sys.exit()

print("Yes")

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


int combination(int n, int r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int main(){
    string str;
    cin >> str;
    bool check1 = false, check2 = false, check3 = false;
    check1 = checkKaibun(str);
    int length = str.length();
    string str1 = "";
    for(int i = 0; i < (length - 1) / 2; i++){
        str1.push_back(str.at(i));
    }
    check2 = checkKaibun(str1);
    string str2 = "";
    for(int i = (length  + 3) / 2 - 1; i < length; i++){
        str2.push_back(str.at(i));
    }
    check3 = checkKaibun(str2);

    if(check1 == true && check2 == true && check3 == true) cout << "Yes" << endl;
    else cout << "No" << endl;
    
}



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

int main() {
  int n, r;
  cin >> n >> r;
  int rate;
  if (n > 9) {
    rate = r;
  } else {
    rate = r + (100 * (10 - n));
  }
  cout << rate << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  double R;
  scanf("%lf", &R);
  printf("%.9lf\n", 2 * R * M_PI);

  return 0;
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;

int main()
{
	int n,x;
	cin >> n >> x;
	int now = 0;
	int hoge=0;
	rep(i,n)
	{
		int foo;
		cin >> foo;
		now= now + foo;
		hoge++;
		if(x<now){cout<<hoge<<endl;return 0;}
	}
	cout<<n+1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <map>
#include <numeric>
using namespace std;
typedef long long int ll;

constexpr ll mod=1e9+7;

struct UnionFind{
    vector<int> par,num;
    vector<bool> done;
    UnionFind(int n):par(n),num(n,1),done(n,false){
        iota(par.begin(),par.end(),0);  //include<numeric>
    }
    int find(int v){
        return (par[v]==v)?v:(par[v]=find(par[v]));
    }
    void unite(int u,int v){
        u=find(u),v=find(v);
        if(u==v)return;
        if(num[u]<num[v])swap(u,v);
        num[u]+=num[v];
        par[v]=u;
        done[u]=done[u]|done[v];
    }
    bool same(int u,int v){
        return find(u) == find(v);
    }
    bool ispar(int v){
        return v=find(v);
    }
    int size(int v){
        return num[find(v)];
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int m; cin >> m;
    UnionFind uf(n);
    while(m--){
        int a,b; cin >> a >> b;
        a--; b--;
        uf.unite(a,b);
    }
    int res=0;
    for(int i=0;i<n;i++){
        res=max(res,uf.size(i));
    }
    cout << res << endl;
}


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

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

    static class BCountABC {
        public void solve(int testNumber, Scanner sc, PrintWriter pw) {
            int n = sc.nextInt();
            String s = sc.next();
            int ans = 0;
            for (int i = 0; i < s.length() - 2; i++)
                if (s.substring(i, i + 3).equals("ABC"))
                    ans++;
            pw.println(ans);

        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

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

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
#include "bits/stdc++.h"
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<long long> power(N * 3);
  for(int i = 0; i < (N * 3); i++){
    cin >> power[i];
  }
  sort(power.begin(), power.end());
  long long sum = 0;
  for(int i = 0; i < N; i++){
    sum += power[N + i * 2];
  }
  cout << sum << endl;
}

Measured memory_bytes: 2560
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N,K = inputMap()
	H = inputList()

	H.sort()
	H = H[::-1]

	ans = 0
	for i,vol in enumerate(H):
		if K > 0:
			K -= 1
			#print(K)
			continue
		ans += vol

	print(ans)




if __name__ == "__main__":
	main()


Measured memory_bytes: 82160
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <limits.h>
#include <cstring>
#include <tuple>
#include <cassert>
#include <numeric>
#include <iomanip>
using namespace std;
// type alias
typedef long long LL;
typedef pair< int , int > II;
typedef tuple< int, int, int > III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))

// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');

// debug cerr
#define TRACE true
#define dump(x) if(TRACE) { cerr << #x << " = " << (x) << endl; }
#define dump2(x,y) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << endl; }
#define dump3(x,y,z) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << endl; }
#define dump4(x,y,z,a) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << ", " << #a << " = " << (a) << endl; }
#define dumpf(args...) if(TRACE) { fprintf(stderr, ##args); putchar('\n'); }
#define dumpAR(ar) if(TRACE) { FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
template<class Iter> void dumpc(Iter begin, Iter end) { if (TRACE) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; } }

// $ cp-batch ID | diff ID.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address ID.cpp && ./a.out

/*
 
 1/20/2019
 
 15:38-
 
 */

map<int,vector<II>> X;
int N,M;

void solve() {
  vector<string> res(M);
  FORR(kvp,X) {
    int p=kvp.first;
    string pp=to_string(p);
    while(SZ(pp)<6) pp="0"+pp;
    auto xs=kvp.second;
    sort(ALL(xs));
    REP(i,SZ(xs)) {
      string s=to_string(i+1);
      while(SZ(s)<6) s="0"+s;
      res[xs[i].second]=pp+s;
    }
  }
  FORR(s,res) cout<<s<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N>>M;
  REP(i,M) {
    int p,y; cin>>p>>y;
    X[p].emplace_back(y,i);
  }
  solve();
  
  return 0;
}


Measured memory_bytes: 14720
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000


int main(){
	
	int N,K;
	cin>>N>>K;
	
	int mini = 0;
	int maxi = 0;
	int ans = 0;
	
	for(int i=0;i<=N;i++){
		mini = mod(mini+i);
		maxi = mod(maxi+N-i);
		
		if(i>=K-1){
			ans = mod(ans + mod(maxi-mini+1));
		}
		
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 3620
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var n int
	scanner.Scan()
	n, _ = strconv.Atoi(scanner.Text())
	a := make([]int, n)
	for i := 0; i < n; i++ {
		var j int
		scanner.Scan()
		j, _ = strconv.Atoi(scanner.Text())
		a[i] = j
	}

	max1 := -1
	max2 := -1
	for _, v := range a {
		if v > max1 {
			max2 = max1
			max1 = v
		} else if v > max2 {
			max2 = v
		}
	}

	ans := make([]int, n)
	for i := 0; i < n; i++ {
		if a[i] != max1 {
			ans[i] = max1
		} else {
			ans[i] = max2
		}
	}

	for i := 0; i < n; i++ {
		fmt.Println(ans[i])
	}
}


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

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF ll 1 << 60
#define MOD 1000000007

typedef  long long ll;

using namespace std;

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

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

int gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return a;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    cout<<  ans << endl;
    }
}

void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}

int dig(int d){
    int ans = 1;
    if(d == 0) return ans;
    while(d != 0){
        d--;
        ans*=100;
    }
    return ans;
}
int c['z'+1];

void solve(void){
    int n,k;
    cin >> n >> k;
    cout << n-k+1;   
}

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

Measured memory_bytes: 256