akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


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

ll inv(ll x){
    // MOD=10e9+7
	ll n=MOD-2,a=1;
	while(n>0){
		if(n%2) a=a*x%MOD;
		x=x*x%MOD;
		n=n/2;
	}
	return a;
}

vector<ll> facts(1,1);
ll factorial(ll n){
    if(facts.size() - 1 >= n)return facts[n];
    else{
        rep(i,facts.size(),n+1){
            facts.push_back((facts[i-1] * i)%MOD);
        }
        return facts[n];
    }
}

vector<ll> inv_facts(1,1);
ll inv_factorial(ll n){
    if(inv_facts.size() - 1 >= n)return inv_facts[n];
    else{
        rep(i,inv_facts.size(),n+1){
            inv_facts.push_back((inv_facts[i-1] * inv(i))%MOD);
        }
        return inv_facts[n];
    }
}

ll Comb(ll n,ll m){
    return (((factorial(n) * inv_factorial(m))%MOD) * inv_factorial(n-m))%MOD;
}

ll PowMod(ll N,ll P,ll M){
    ll ans = 1;
    while(P >= 1){
        if(P % 2)ans = ans * N % M;
        N = N*N %M;
        P /= 2;
    }
    ans %= M;
    return ans;
}



int main(){
    ll N,M;
    cin>>N>>M;
    ll ans = 0;
    rep(k,0,N+1){
        if(k%2 == 0)ans += (((factorial(M-k) * inv_factorial(M-N))%MOD) * Comb(N,k))%MOD;
        else{
            ans -= ((factorial(M-k) * inv_factorial(M-N))%MOD * Comb(N,k))%MOD;
            ans += MOD;
            ans %= MOD;
        }
    }
    ans *= factorial(M);
    ans %= MOD;
    ans *= inv_factorial(M-N);
    ans %= MOD;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=100000000000000000;

int main() {
    int n;
    string s;
    cin >> n >> s;
    vector<char> a(26);
    rep(i,26) a[i]='A'+i;
    rep(i,s.size()){
        int k;
        rep(j,26){
            if (s[i]==a[j]) k=j;
        }
        s[i]=a[(k+n)%26];
    }
    rep(i,s.size()) cout << s[i];
    cout << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


mod = 1000000007
inf = 1e10

# solve


def solve():
    n = II()
    a = LI()
    ans = 0
    x = 1
    for i in range(n):
        if a[i] == x:
            x += 1
        else:
            ans += 1
    if x == 1:
        print(-1)
    else:
        print(ans)
    return


# main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 71288
/*
ID: rchalam1
LANG: C++14
TASK:
*/
// For train.usaco.org, fill the template above.

// Competitive Coding Template

// GCC OPTIMIAZTION FLAGS
#ifdef ONLINE_JUDGE
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#endif

#include <bits/stdc++.h>

/*
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
*/
// All Includes for Competitive Coding Template

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

using vi = std::vector<int>;
using vll = std::vector<long long>;
using vull = std::vector<unsigned long long>;

#define FOR(i, a, b) for (auto i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (auto i = (a); i >= (b); --i)
#define R0F(i, a) ROF(i, a, 0)
#define ITR(a, x) for (auto& a: x)

#define FSRT(set) sort((set).begin(),(set).end())
#define RSRT(set) sort((set).rbegin(),(set).rend())
#define CSRT(set, function) sort((set).begin(),(set).end(), (function))
#define TRS(set) sort((set).begin(),(set).end(), greater<>())
#define REV(set) reverse((set).begin(),(set).end());

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

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// For stdio, call setIO() or setIO("").
void setIO(std::ifstream &readFile, std::ofstream &writeFile, const std::string &name = "", bool stdIO = false)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	if(!name.empty() && !stdIO)
	{
		readFile.open(name + ".in");
		if(readFile.fail()) return;
		writeFile.open(name + ".out");
		std::cin.rdbuf(readFile.rdbuf());
		std::cout.rdbuf(writeFile.rdbuf());
	}
}

// To time program, create object Timer  to start timing, and call Timer.elapsed().
#include <chrono>

class Timer
{
	std::chrono::time_point<std::chrono::high_resolution_clock> m_beg;
public:
	Timer() : m_beg(std::chrono::high_resolution_clock::now())
	{}

	void reset()
	{ m_beg = std::chrono::high_resolution_clock::now(); }

	[[nodiscard]] long double elapsed() const
	{
		return std::chrono::duration_cast<std::chrono::duration<long double, std::ratio<1> >>(
				std::chrono::high_resolution_clock::now() - m_beg).count();
	}
};

// Defines datatype
using dt = int;
// Defines MAXN value
constexpr dt MAXN = 1e5 + 1;
// Defines Modulus
constexpr dt MOD = 1e9 + 7;
// Defines Floating Point Correction
constexpr long double EPS = 1e-9;

//*****
//START CODE BELOW
//*****

int main(int argc, char *argv[])
{
	static std::ifstream readFile;
	static std::ofstream writeFile;
	setIO(readFile, writeFile);
	int n;
	cin >> n;
	int answer = -1, number;
	for(int i = 1; i <= n; ++i)
	{
		int j = i, result = 0;
		while(!(j % 2))
		{
			++result;
			j /= 2;
		}
		if(result > answer)
		{
			answer = result;
			number = i;
		}
	}
	cout << number << '\n';
}

Measured memory_bytes: 3664
//AtCoder 
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
#if LOCAL&0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll N;
    cin>>N;
    vector<pair<ll,ll>> tbl(N);
    for(auto&& t:tbl){
        cin>>t.first>>t.second;
    }
    map<pair<ll,ll>,ll> count;
    for(ll i=0;i<N;++i){
        for(ll j=0;j<N;++j){
            if (i==j) continue;
            ll dx=tbl[i].first - tbl[j].first;
            ll dy=tbl[i].second - tbl[j].second;
            count[make_pair(dx,dy)]++;
        }
    }
    pair<ll,ll> now; //選んだやつ
    ll max=0;
    for(auto&& c:count){
        if(max<c.second){
            now=c.first;
            max=c.second;
        }
    }
    //探索
    // ll num=0;
    // for(ll i=0;i<N;++i){
    //     auto nx=tbl[i].first + now.first;
    //     auto ny=tbl[i].second + now.second;
    //     auto it = std::find(tbl.begin(),tbl.end(),make_pair(nx,ny));
    //     if (it!=tbl.end()){
    //         ++num;
    //     }
    // }
    ll ans=tbl.size()-max;
    cout<<ans<<endl;
    return 0;
}

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

int main()
{
    string a;
    cin>>a;
    if(a[0]==a[1] || a[1]==a[2] ||a[2]==a[3])
    {
        cout<<"Bad\n";
    }
    else
    {
        cout<<"Good\n";
    }
    return 0;
}


Measured memory_bytes: 384
#!/usr/bin/env python3
n, m = map(int, input().split())
a = max(n, m)
b = min(n, m)
if b == 1:
    print((a - 2) if a > 1 else 1)
elif b == 2:
    print(0)
else:
    print((a - 2) * (b - 2))


Measured memory_bytes: 9116
#include<bits/stdc++.h>
using namespace std;
string a[11];
int main()
{
	int n,m,k;
	cin>>n>>m>>k;
	for(int i=0;i<n;i++)
		cin>>a[i];
	int ans=1e9;
	for(int mask=0;mask<(1<<(n-1));mask++){
		vector<int> p;
		p.push_back(0);
		for(int i=1;i<n;i++)
			if(mask>>(i-1)&1)
				p.push_back(i);
		p.push_back(n);
		int cur=p.size()-2;
		int l=0;
		int r=0;
		while(l<m){
			vector<int> c(p.size()-1);
			while(r<m){
				for(int t=0;t<p.size()-1;t++)
					for(int i=p[t];i<p[t+1];i++)
						c[t]+=(a[i][r]=='1');
				if(*max_element(c.begin(),c.end())>k)
					break;
				r++;
			}
			if(l==r){
				cur=1e9;
				break;
			}
			l=r;
			cur+=l<m;
		}
		ans=min(cur,ans);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define li long
#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pii pair<int,int>
#define pli pair<li,li>
#define pll pair<ll,ll>
#define pb push_back
#define fori(i,k,n) for(int i = k;i<n; i++)
#define rfori(i,k,n) for(int i = k; i>=n; i--)
#define tc int t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
void fastio()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
} 
class dsu{
    public:
    unordered_map<int,int> p,sz;
    void make_set(int x)
    {
        p[x] = x;
        sz[x]+=1;
    }
    int find(int x)
    {
        if(x == p[x])return x;
        return p[x] = find(p[x]);
    }
    void merge(int a,int b)
    {
        a = find(a);
        b = find(b);
        if(a == b)return;
        if(sz[a]<sz[b])swap(a,b);
        p[b] = a;
        sz[a]+=sz[b];
        sz.erase(b);
    }
};
template<class T>
T power(T a,T b){
    T res = (T)1;
    while(b>0){
        if(b&1)res = (res*a);
        b>>=1;
        a*=a;
    }
    return res;
}


int kmp(string s){
    vector<int> lps(s.size(),0);
    for(int i = 1; i<lps.size(); ++i){
        int prev_index = lps[i-1];
        while(prev_index>0&&s[i]!=s[prev_index]){
            prev_index = lps[prev_index-1];
        }
        lps[i] = prev_index+(s[i] == s[prev_index]?1:0);
    }
    return lps[lps.size()-1];
}

int main()
{
    fastio();
    ll n,k;
    cin>>n>>k;
    if(n>=k){
        cout<<min(abs(n-k*(n/k)),abs(n-k*(n/k+1)));
    }
    else{
        cout<<min(abs(n-k),abs(abs(n-k)-k));
    }
}


Measured memory_bytes: 256
using System;
using static System.Console;

namespace abl
{
    class Program
    {
        static void Main()
        {
            var nk = ReadLine().Split(' ');
            var n = int.Parse(nk[0]);
            var k = int.Parse(nk[1]);
            var aList = new int[n];
            for (var i = 0; i < n; ++i)
            {
                aList[i] = int.Parse(ReadLine());
            }
            WriteLine(FS(k, aList));
        }
        static int FS(int k, int[] aList)
        {
            var tree = new MaxSegmentTree(300010);
            foreach (var a in aList)
            {
                var sMin = Math.Max(0, a - k);
                var sMax = Math.Min(300000, a + k);
                var len = tree.Find(sMin, sMax + 1);
                if (len < 0)
                {
                    len = 0;
                }
                tree.Update(a, len + 1);
            }
            return tree.Find(0, 300001);
        }
        class MaxSegmentTree
        {
            public int[] tree { get; private set; }
            int INF = int.MinValue;
            public MaxSegmentTree(int _n)
            {
                var x = 1;
                while (_n > x)
                {
                    x *= 2;
                }
                var n = x * 2;
                tree = new int[n];
                for (var i = 0; i < n; ++i)
                {
                    tree[i] = INF;
                }
            }
            public void Update(int index, int value)
            {
                var idx = index + tree.Length / 2;
                tree[idx] = value;
                while (idx > 1)
                {
                    var parent = idx / 2;
                    var siblings = idx + 1 - (idx % 2) * 2;
                    tree[parent] = Math.Max(tree[idx], tree[siblings]);
                    idx = parent;
                }
            }
            public int Find(int a, int b)
            {
                return Find(a, b, 1, 0, tree.Length / 2);
            }
            int Find(int a, int b, int k, int l, int r)
            {
                if (r <= a || b <= l)
                {
                    return INF;
                }
                else if (a <= l && r <= b)
                {
                    return tree[k];
                }
                else
                {
                    return Math.Max(
                        Find(a, b, k * 2, l, (l + r) / 2),
                        Find(a, b, k * 2 + 1, (l + r) / 2, r)
                    );
                }
            }
        }
    }
}


Measured memory_bytes: 43900
#include<stdio.h>

int main(void){
    int i,ans,tmp;
    char s[11];
    scanf("%s",s);

    ans = 0, tmp = 0;

    for(i = 0; i < 10; i++){
    
    while(s[i] == 'A' || s[i] == 'C' || 
          s[i] == 'G' || s[i] == 'T'){
              tmp++;
              i++;
          }

          if(ans < tmp){ 
          ans = tmp;
          }
          tmp = 0;
        }
    printf("%d\n",ans);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const double EPS = 1e-10;
const ll mod=1000000007;
//const ll mod=998244353;

int main(void){
    ll x,y,d,n,ans=0;
    cin>>n>>d;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        if(x*x+y*y<=d*d) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define ALL(C) (C).begin(),(C).end()
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));

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

	int N;
	cin>>N;
	VI A(N);
	VI B(N);
	VI C(N);
	REP(i,N)cin>>A[i];
	REP(i,N)cin>>B[i];
	REP(i,N)cin>>C[i];
	SORT(A);
	SORT(B);
	SORT(C);
	
	VI Bcnt(N);
	VI Acnt(N);
	ll ans=0;
	REP(i,N){
		//if(B[i]<C[0]){Bcnt[i]=N; continue;}
		
		auto pos=upper_bound(ALL(A),B[i]-1)-A.begin();
		//idx=distance(C,pos);
		//if(C[N-pos]==B[i])pos--;
		auto poss=N-(lower_bound(ALL(C),B[i]+1)-C.begin());
		//if(B[i]==A[N-poss-1])poss--;
		ans+=poss*pos;
		//cout<<pos<<" "<<poss<<endl;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 2304
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
using namespace std;

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

    vector<int> b(m);

    for(int i = 0; i < m; ++i){
        cin >> b[i];
    }

    int out = 0;

    for(int i = 0; i < n; ++i){
        
        int sum = 0;

        for(int j = 0; j < m; ++j){
            int a;
            cin >> a;
            sum += a* b[j];
        }

        if(sum + c > 0)++out;
    }

    cout << out << endl;

}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

def dfs(iNow):
    if len(adjL[iNow]) == 0:
        return 0
    Bs = [dfs(i2) for i2 in adjL[iNow]]
    Bs.sort()
    ans = max([B-i for i, B in enumerate(Bs)])
    return ans + len(Bs)

N = int(input())
adjL = [[] for v in range(N)]
for i in range(1, N):
    A = int(input())
    adjL[A-1].append(i)

print(dfs(0))


Measured memory_bytes: 228016
#include <bits/stdc++.h> 
using namespace std;
const int mod = 1000000007;

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

vector<int> oks(n+1,true);
for(int i=0; i<m; i++){
    int a; cin >> a;
    oks[a] = false;
}

vector<long long int> dp(n+1);
dp[0]=1;
for(int now=0; now<n; now++){
    for(int next=now+1; next<=min(n,now+2); next++){
        if(oks[next]){
            dp[next] += dp[now];
            dp[next] %= mod;
        }
    }
}

cout << dp[n] << endl;
return 0;
}

Measured memory_bytes: 1408
a,b=gets.split.map &:to_i
if a==2 then a=2
elsif (a<=7&&a%2==1)||(a>=8&&a%2==0) then a=0
else a=1 end
if b==2 then b=2
elsif (b<=7&&b%2==1)||(b>=8&&b%2==0) then b=0
else b=1 end
puts a==b ? "Yes":"No"


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const ll INF = 1LL << 58;
const ll MOD = 1000000007;
struct Edge
{
    ll s, t, d;
};
typedef vector<vector<Edge>> Graph;
typedef vector<pii> vpii;
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;
}

signed main()
{
    int N, M;
    cin >> N >> M;
    UM<int, int> um;
    int a = 0;
    int tmp;
    REP(i, N)
    {
        cin >> tmp;
        a += tmp;
        um[a % M]++;
    }
    int ans = 0;
    for (auto i = um.begin(); i != um.end(); ++i)
    {
        tmp = i->second;
        if (i->first == 0)
            ans += tmp;

        if (tmp > 1)
            ans += tmp * (tmp - 1) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
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
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define Q1 first
#define Q2 second.first
#define Q3 second.second.first
#define Q4 second.second.second


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

#define MOD 1000000007

int x[111111];

int main(){
	//init
	int n;
	scanf("%d", &n);
	REP(i,n)scanf("%d", &x[i]);
	int x_now = -1;
	LL way = 1;
	LL rem = 0;
	REP(i,n){
		if(x[i] - x_now == 1){
			way = (way*(rem+1))%MOD;
		}else{
			rem++;
			x_now = max(x_now+2, 1);
		}
	}
	REP(i,rem){
		way = (way*(i+1))%MOD;
	}
	cout << way << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
using namespace __gnu_pbds;

typedef tree<pair<long long int,long long int>,null_type,less<pair<long long int,long long int> >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

void go()
{
    int n;
    cin>>n;
    if(n >=400 && n <=599)
        cout<<8<<endl;
    if(n >=600 && n <=799)
        cout<<7<<endl;
    if(n >=800 && n <=999)
        cout<<6<<endl;
    if(n >=1000 && n <=1199)
        cout<<5<<endl;
    if(n >=1200 && n <=1399)
        cout<<4<<endl;
    if(n >=1400 && n <=1599)
        cout<<3<<endl;
    if(n >=1600 && n <=1799)
        cout<<2<<endl;
    if(n >=1800 && n <=1999)
        cout<<1<<endl;
}
int main()
{
    FIO;
//    int t;
//    cin>>t;
//    while(t--)
        go();
    return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());

		if (a <= x && x <= a+b){
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 22740
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int V[50];

int main()
{
	int N, K, ans = 0;

	cin >> N >> K;
	rep(i, N) cin >> V[i];

	repc(dispose, 0, K / 2) {
		int get = min(N, K - dispose);

		repc(left, 0, get) {
			int sum = 0;
			priority_queue<int, vector<int>, greater<int> > PQ;

			rep(i, left) {
				if (V[i] < 0) PQ.push(V[i]);
				sum += V[i];
			}
			rep(i, get - left) {
				if (V[N - 1 - i] < 0) PQ.push(V[N - 1 - i]);
				sum += V[N - 1 - i];
			}

			rep(i, dispose) {
				if (PQ.empty()) break;
				sum -= PQ.top();
				PQ.pop();
			}

			ans = max(ans, sum);
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
/*
    Ujjawal Pabreja [cuber_coder]
*/
#include <bits/stdc++.h> 
#include <functional> 
using namespace std;
#define speed_cubing    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll              long long
#define ld              long double
#define rep(i,a)        for(ll i = 0 ; i < a ; i++)
#define repe(i,a,b)     for(ll i = a ; i < b ; i++)
#define bac(i,a)        for(ll i = a ; i >= 0 ; i--)
#define bace(i,a,b)     for(ll i = a ; i >= b ; i--)
#define pb              push_back
#define in              insert
#define ff              first
#define ss              second
#define setbit(x)       __builtin_popcountll(x)
#define init(c,a)       memset(c,a,sizeof(c))
#define all(c)          c.begin(),c.end()
#define sz(c)           (ll)c.size()
#define lb              lower_bound
#define ub              upper_bound
#define maxe            *max_element
#define mine            *min_element
#define rev             reverse
#define Y				"YES"
#define N 				"NO"
#define endl            "\n"
#define debug(x)        cout << #x << " : " << x << endl;
const ll inf = 1e18;  
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll MAX = 2e5 + 1;

inline ll add(ll a,ll b) {return ((a % mod) + (b % mod)) % mod;}
inline ll sub(ll a,ll b) {return ((a % mod) - (b % mod) + mod) % mod;}
inline ll mul(ll a,ll b) {return ((a % mod) * (b % mod)) % mod;}
ll pwr(ll x,ll n){
    if(n == 0){
        return 1;
    }
    if(n&1){
        return mul(x, pwr(mul(x, x), (n - 1) / 2));
    } else {
        return pwr(mul(x, x), n / 2);
    }
}
ll modInv(ll n){ 
    return pwr(n, mod - 2); 
}
ll gcd(ll a,ll b) {
    if(b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
// ====== Useful functions end ======
 
// ====== Global Variables begin ======

// ====== Global Variables end ======
void speed_solve(){
    string s, t;
    cin >> s >> t;
    ll n = sz(s), m = sz(t), ans = inf;
    rep(i,n - m + 1){
        string c = s.substr(i,m);
        ll change = 0;
        rep(j,m) change += (c[j] != t[j]);
        ans = min(ans, change);
    }
    cout << ans;
}

int main(){
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    speed_cubing;
    ll test_cases = 1;
    // cin >> test_cases;
    rep(i,test_cases){
        // cout << "Case #" << i + 1 << ": ";
        speed_solve();
    }
    return 0;
}

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

using namespace std;

int main(void)
{
    int n;
    cin >> n;
    vector<int> num(n);
    unsigned int ans=0;


    for (int i = 0; i < n; i++){
        cin >> num.at(i);
        ans += num.at(i) - 1;

    }
    cout <<ans << endl;

    return 0;
}

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

int vis[105];

int main()
{
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=k;i++)
	{
		int d1,v;
		cin>>d1;
		for(int j=1;j<=d1;j++)
		{
			cin>>v;
			vis[v]=1;
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(vis[i]==0) ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3608
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << (x) << '\n'

using namespace std;
using Graph = vector<vector<int>>;

typedef int64_t Int;
const double pi = M_PI;

vector<bool> seen;
vector<vector<int>> timestamp; // タイムスタンプ

void dfs(const Graph &G, int v, int &time_ptr) {
    // 発見時刻
    timestamp[v][0] = time_ptr++;

    seen[v] = true; // v を探索済みにする

    // v から行ける各頂点について
    for (auto next_v : G[v]) {
        if (seen[next_v])
            continue; // 探索済みなら飛ばす

        dfs(G, next_v, time_ptr); // 再帰探索
    }

    // 完了時刻
    timestamp[v][1] = time_ptr++;
}

int main() {
    // 入力
    int N;
    cin >> N;

    // グラフの入力
    Graph G(N);
    for (int u = 0; u < N; u++) {
        int ig, k, v;
        cin >> ig >> k;
        for (; k >= 1; k--) {
            cin >> v;
            v--;
            G[u].push_back(v);
        }
    }

    // 初期化
    seen.assign(N, false);
    timestamp.assign(N, vector<int>(2, 0));
    int time_ptr = 1;
    // 探索開始
    for (int v = 0; v < N; v++) {
        if (seen[v])
            continue;

        dfs(G, v, time_ptr);
    }

    // 出力
    for (int v = 0; v < N; v++) {
        cout << v + 1 << ' ' << timestamp[v][0] << ' ' << timestamp[v][1] << endl;
    }
}



Measured memory_bytes: 3152
#include <stdio.h>
#include <stdlib.h>
static int n, a[100000];
int cmp(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}
int main(void) {
    int i, j;
    scanf("%d", &n);
    for (i = 0; i < n; ++i)
        scanf("%d", a + i);
    qsort(a, n, sizeof(int), cmp);
    for (i = 1; i < n; ++i)
        if (a[i] == a[i - 1])
            a[i] = -1;
    for (i = 0; i < n - 1; ++i)
        if (a[i + 1] != -1)
            a[i] = -2;
    a[n - 1] = -2;
    qsort(a, n, sizeof(int), cmp);
    if (a[n - 1] > 0 && a[n - 2] > 0)
        printf("%ld\n", (long)a[n - 1] * a[n - 2]);
    else
        puts("0");
    return 0;
}


Measured memory_bytes: 896
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

MOD = 1000000007
def repeatSquares(x, n):  # x^n
    res = 1
    while n != 0:
        if n % 2 == 1:
            res *= x
            res %= MOD  # MOD演算ないなら消していい
        x *= x
        n //= 2
        x %= MOD      # MOD演算ないなら消していい
    return res

bi = input()

ans = 0
l = len(bi)
##
if l > 1:
    for i in range(2, l+1):
        tmp = repeatSquares(3, l - i)

        ans += tmp * 2
        ans %= MOD
    ans += 1


    tmp = makelist(l, 2)
    tmp[0][0] = 0
    tmp[0][1] = 2
    for i in range(1, l):
        if bi[i] == '1':
            tmp[i][0] = (tmp[i-1][0] * 3 + tmp[i-1][1]) % MOD
            tmp[i][1] = tmp[i-1][1] * 2
        else:
            tmp[i][0] = (tmp[i-1][0] * 3) % MOD
            tmp[i][1] = tmp[i-1][1]
        tmp[i][0] %= MOD
        tmp[i][1] %= MOD

    ans += tmp[-1][0] + tmp[-1][1]
    ans %= MOD
else:
    ans = int(bi) * 2 + 1
    
print(ans)


Measured memory_bytes: 55900
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <functional>
#include <cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

int main()
{
    char c;
    cin >> c;
    if ('A' <= c && c <= 'Z') {
        cout << 'A' << endl;
    }
    else
    {
        cout << 'a' << endl;
    }
    
}

Measured memory_bytes: 3068
/*
for (int i = 0; i < N; ++i){}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<int,int> point;
#define rep(i,n) for(i,0,n)
 
int main() {
	// 入力
	int N;
	cin >> N;
	
	bool ans = false;
	for (int i = 0; i < N/7+1; ++i){
		int amari = N-7*i;
		if (amari%4==0){
			ans = true;
			break;
		}
	}
	
	if (ans) printf("Yes\n");
	else printf("No\n");
	
}
 


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

typedef long long ll;

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

    string s;
    cin >> s;
    string days[] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
    for(int i=0;i<7;i++){
        if(days[i]==s){
            cout << 7 - i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

///Restrictive Filesystem
public class Main{

	class R implements Comparable<R>{
		int id, s, t;
		public R(int id, int s, int t) {
			this.id = id;
			this.s = s;
			this.t = t;
		}
		public int compareTo(R o) {
			return s-o.s;
		}
	}

	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			int n = sc.nextInt();
			if(n==0)break;
			List<R> l = new LinkedList<R>();
			l.add(new R(-1, 0, 1000000000));
			Map<Integer, List<R>> ref = new HashMap<Integer, List<R>>();
			while(n--!=0){
//				System.out.println("DEBUG");
//				List<R> d = new LinkedList<R>();
//				d.addAll(l);
//				for(int k:ref.keySet())for(R r:ref.get(k))d.add(r);
//				Collections.sort(d);
//				for(R r:d)System.out.println(r.s+"-"+r.t+" :"+r.id);
				char cmd = sc.next().charAt(0);
				if(cmd=='R'){
					int p = sc.nextInt(), res = -1;
					for(int k:ref.keySet())for(R r:ref.get(k)){
						if(res!=-1)break;
						if(r.s<=p&&p<=r.t)res = r.id;
					}
					System.out.println(res);
				}
				else if(cmd=='W'){
					int id = sc.nextInt(), len = sc.nextInt();
					List<R> list = new LinkedList<R>();
					for(int i=0;i<l.size();i++){
						R r = l.get(i);
						int L = r.t-r.s+1;
						if(L<len){
							list.add(new R(id, r.s, r.t));
							l.remove(i); i--;
							len-=L;
						}
						else if(L==len){
							list.add(new R(id, r.s, r.t));
							l.remove(i);
							ref.put(id, list);
							break;
						}
						else{
							l.remove(i);
							list.add(new R(id, r.s, r.s+len-1));
							l.add(i, new R(-1, r.s+len, r.t));
							ref.put(id, list);
							break;
						}
					}
				}
				else{
					int id = sc.nextInt();
					if(ref.containsKey(id)){
						for(R r:ref.get(id)){
							l.add(new R(-1, r.s, r.t));
						}
						ref.remove(id);
						Collections.sort(l);
						for(int i=0;i+1<l.size();i++){
							R r1 = l.get(i), r2 = l.get(i+1);
							if(r1.t+1!=r2.s)continue;
							R r = new R(r1.id, r1.s, r2.t);
							l.remove(i); l.remove(i); l.add(i, r);
							i--;
						}
					}
				}
			}
			System.out.println();
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

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

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> w(n);
    int aw=0;
    for (int i = 0; i < n; ++i) {
        cin>>w[i];
    }
    for(auto i:w)aw+=i;
    int tw=0;
    int ans=1000000;
    for (int i = 0; i < n; ++i) {
        tw+=w[i];
        ans=min(ans,abs(tw-(aw-tw)));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
from itertools import product

direction = []
for i in range(4):
    dx = 5 % (i + 1) - 1
    dy = 5 % (i + 2) - 1
    direction.append((dx, dy))
H, W = map(int, input().split())
grid = [input() for _ in range(H)]
visited = [[False for _ in range(W)] for _ in range(H)]
ans = 0
for i, j in product(range(H), range(W)):
    if visited[i][j]: continue
    stack = [(i, j)]
    black = 0; white = 0;
    while stack:
        x, y = stack.pop()
        if visited[x][y]: continue
        visited[x][y] = True
        if grid[x][y] == '#': black += 1
        else: white += 1
        for dx, dy in direction:
            temp_x, temp_y = min(max(x + dx, 0), H-1), min(max(y + dy, 0), W-1)
            if visited[temp_x][temp_y]: continue
            if grid[x][y] != grid[temp_x][temp_y]: stack.append((temp_x, temp_y))
    ans += black * white
print(ans)

Measured memory_bytes: 19580
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val inputs = in.readLine().split("\\s+").map(_.toInt)

    out.println(
      if (inputs.map(input => List(
        List(1, 3, 5, 7, 8, 10, 12),
        List(4, 6, 9, 11),
        List(2)
      ).indexWhere(_.contains(input))).distinct.length == 1) {
        "Yes"
      } else {
        "No"
      }
    )

    out.flush()
  }
}


Measured memory_bytes: 27332
import java.util.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int ans = 999;
        for(int i = 0; i < s.length() - 2; i++){
        	String str = s.substring(i, i + 3);
            int n = Integer.parseInt(str);
            n = 753 - n;
            if(Math.abs(n) < ans){
            	ans = Math.abs(n);
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35564
#include<stdio.h>
int main(){
  int k,t=101,i;
  char s[101];
  scanf("%d %s",&k,s);
  for(i=0;i<=k;i++){
    if(s[i]=='\0'){
      t=i;
      break;
    }
    if(i<k){printf("%c",s[i]);}
  }
  if(t-1<=k){printf("\n");}
  else{printf("...\n");}
}

Measured memory_bytes: 1620
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author HARSHAD
 */

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

#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)

class BCakesAndDonuts {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n; in >> n;
		f(i, 1000){
		    f(j, 1000){
		        if(i*4 + j*7 == n){
					out << "Yes";
					return;
				}
		    }
		}
		out << "No";
	}
};


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	BCakesAndDonuts solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>
#define INF 1e9
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  return s;
}

template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
  s << vv[i] << endl;
  }
  return s;
}

int D,N;
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> D >> N;
  if(N==100){
    N++;
  }
  if(D == 0){
    cout << N << endl;
  }
  else if(D == 1){
    cout << 100 * N << endl;
  }
  else{
    cout << 10000 * N << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007ll
#define INF 1000000000ll
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin>>s;
	if(s[0]=='A') {
		ll cnt=0;
		FOR(i,1,s.size()) {
			if(s[i]<'a'||s[i]>'z') {
				if(cnt>0) {
					cout<<"WA"<<endl;
					return 0;
				}
				if(s[i]=='C') {
					if(i>=2&&i<s.size()-1) {
					cnt++;
					} else {
						cout<<"WA"<<endl;
						return 0;
					}
				} else {
					cout<<"WA"<<endl;
					return 0;
				}
			}
		}
		if(cnt==1) cout<<"AC"<<endl;
		else cout<<"WA"<<endl;
	} else cout<<"WA"<<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;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    int ans = 0;
    rep(i, n){
        cin >> h[i];
        if(h[i] >= k) ans++;
    }
    cout << ans << endl;    

    return 0;
}

Measured memory_bytes: 640
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
 

int main() {
	// 入力
	ll count[6];
	for (ll i = 0; i < 3; ++i) cin >> count[2*i]>>count[2*i+1];
 
	// 解法
	// REP(i,6) printf("%lld\n", count[i]);
	ll max_count = 0;
	REP(i,4){
		ll tmp_count = 0;
		REP(j,6){
			if (i+1==count[j]) tmp_count++;
		}
		// printf("%lld\n", tmp_count);
		if (tmp_count>max_count) max_count = tmp_count;
	}
	// cout << max_count << endl;
	
	//出力
	if (max_count==2) printf("YES\n");
	else printf("NO\n");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int64_t N,i=0,j,k,r=0,g=0,b=0,count=0;
  string S;
  cin>>N>>S;
  for(char c:S){if(c=='R')r++;else if(c=='G')g++;else b++;}
  count=r*g*b;
  while(i<N)
  {
    j=1;k=2*j;
    while(i+k<N)
    {
      if((S.at(i)^S.at(i+j)^S.at(i+k))==87)count--;
      j++;k=2*j;
    }
    i++;
  }
  return cout<<count<<endl,0;
}

Measured memory_bytes: 3584
using System;
using System.Collections.Generic;
using System.Text;

namespace AtcoderTest.BeginnerContest124
{
    class A
    {
        public static void Main()
        {
            string line = Console.ReadLine();
            var str = line.Split(' ');
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);

            int sum = 0;
            for(int i = 0; i < 2; i++)
            {
                if (A >= B)
                {
                    sum += A;
                    A--;
                }
                else
                {
                    sum += B;
                    B--;
                }
            }

            Console.WriteLine(sum);

        }
    }
}

Measured memory_bytes: 11092
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

A = [0]
B = [0]
ans = 0

for i in range(n):
    A.append(A[i] + a[i])

for i in range(m):
    B.append(B[i] + b[i])

j = m

for i in range(n + 1):
    if A[i] > k:
        break
    while A[i] + B[j] > k:
        j -= 1
    ans = max(ans, i + j)

print(ans)

Measured memory_bytes: 47684
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(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 main() {
    string s;
    cin >> s;

    int cnt = 0; char before = s[0];
    for(int i=1; i<s.size(); i++){
        if(before != s[i]) cnt++;
        before = s[i];
    }
    cout << cnt << ln;
}

Measured memory_bytes: 512
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),i,sum=0,max=0,min=1000;
        while(true){
            int[] s = new int[n];
            for(i=0;i<n;i++) {
                s[i] = sc.nextInt();
                sum += s[i];
                if(s[i]>max) max = s[i];
                if(s[i]<min) min = s[i];
            }
            System.out.println((sum-max-min)/(n-2));
            sum = 0;
            max = 0;
            min = 1000;
            n = sc.nextInt();
            if(n==0) break;
        }
    }
}


Measured memory_bytes: 28984
while 1:
    n, m = map(int, input().split())
    if n == 0:
        break

    rec = [0] * (m+1)
    for _ in range(n):
        d, v = map(int, input().split())
        if rec[d] < v:
            rec[d] = v

    print(sum(rec))



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

// vector <int> h;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	// h.resize(n);
	int ans = 0, Q = 0;
	for (int i = 0; i < n; i++){
		int h;
		cin >> h;
		if (h >= Q){
			ans ++;
			Q = h;
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Extentions;

class IO
{
    int idx;
    string[] input = In.ReadToEnd().Split(new[] { " ", "\n", "\r" },
        StringSplitOptions.RemoveEmptyEntries);

    T Get<T>(Func<string, T> parser) => parser(input[idx++]);

    public string S => Get(s => s);
    public char C => Get(char.Parse);
    public int I => Get(int.Parse);
    public long L => Get(long.Parse);
    public double F => Get(double.Parse);
    public decimal D => Get(decimal.Parse);
    public BigInteger B => Get(BigInteger.Parse);

    T[] Gets<T>(int n, Func<string, T> parser)
        => input.Skip((idx += n) - n).Take(n).Select(parser).ToArray();

    public string[] Ss(int n) => Gets(n, s => s);
    public char[] Cs(int n) => Gets(n, char.Parse);
    public int[] Is(int n) => Gets(n, int.Parse);
    public long[] Ls(int n) => Gets(n, long.Parse);
    public double[] Fs(int n) => Gets(n, double.Parse);
    public decimal[] Ds(int n) => Gets(n, decimal.Parse);
    public BigInteger[] Bs(int n) => Gets(n, BigInteger.Parse);

    public void Write<T>(params T[] xs) => WriteLine(string.Join(" ", xs));
    public void Write(params object[] xs) => WriteLine(string.Join(" ", xs));
}

static class Extentions
{
}

static class Program
{
    public static void Main()
    {
        var sw = new StreamWriter(OpenStandardOutput()) { NewLine = "\n" };
#if DEBUG
        sw.AutoFlush = true;
#else
        sw.AutoFlush = false;
#endif
        SetOut(sw);
        Solve(new IO());
        Out.Flush();
    }

    static void Solve(IO io)
    {
        var h = io.I;
        var w = io.I;
        var s = new bool[h][];
        for (var i = 0; i < h; i++) s[i] = io.S.Select(c => c == '#').ToArray();

        var ans = new int[h + 2, w + 2];

        for (var i = 0; i < h; i++)
        {
            for (var j = 0; j < w; j++)
            {
                if (!s[i][j]) continue;

                ans[i    , j    ]++;
                ans[i    , j + 1]++;
                ans[i    , j + 2]++;
                ans[i + 1, j    ]++;
                ans[i + 1, j + 1]++;
                ans[i + 1, j + 2]++;
                ans[i + 2, j    ]++;
                ans[i + 2, j + 1]++;
                ans[i + 2, j + 2]++;
            }
        }

        for (var i = 0; i < h; i++)
        {
            for (var j = 0; j < w; j++)
            {
                if (s[i][j]) Write('#');
                else Write(ans[i + 1, j + 1]);
            }
            WriteLine();
        }
    }
}

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

using namespace std;

const int MAXN = 100100;

int arr[MAXN];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int n, i;
	
	cin>>n;
	
	for (i = 0; i < n; ++i)
		cin>>arr[i];
	
	int mn = *min_element(arr, arr + n);
	int mx = *max_element(arr, arr + n);
	
	if (mx - mn > 1)
	{
		cout<<"No\n";
		return 0;
	}
	
	if (mn == mx && mx == n - 1)
	{
		cout<<"Yes\n";
		return 0;
	}
	
	if (mx - mn == 1)
	{
		int cnt = count(arr, arr + n, mn);
		
		if (mn < cnt)
		{
			cout<<"No\n";
			return 0;
		}
		
		mx -= cnt;
		n -= cnt;
	}
	
	cout<<(2 * mx <= n ? "Yes" : "No")<<'\n';
}


Measured memory_bytes: 640