akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

void solve(){
    int l,r,d;
    cin >> l >> r >> d;
    int ans = 0;
    for(int i = d;i<=r;i=i+d){
        if(i>=l&&i<=r) ans++;
    }
    cout << ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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 C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_N 100'000
#define MAX_K 100
#define INF 10'000'000'000
i64 N, K;
i64 H[2 * MAX_N];
i64 dp[2 * MAX_N];

void solve() {
    fill(dp, dp + 2 * MAX_N, INF);
    dp[0] = 0;
    REP(i, N) {
        REPS(k, K) {
            chmin(dp[i + k], dp[i] + abs(H[i] - H[i + k]));
        }
    }
    cout << dp[N - 1] << endl;
}

int main() {
    fill(H, H + 2 * MAX_N, 0);
    cin >> N >> K;
    REP(i, N) cin >> H[i];

    solve();

    return 0;
}

Measured memory_bytes: 3328
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

#include<stdio.h>

int main() {
	char s[10000], m[10000];
	char c;
	int i, j, k = 0, l;
	m[0] = '\0';
	fgets(s, 10000, stdin);
	for (i = 0;i < strlen(s);i++) {
		switch (s[i])
		{
		case '0':
			m[k] = '0';
			k++;
			break;
		case '1':
			m[k] = '1';
			k++;
			break;
		case 'B':
			if (k == 0)break;
			m[k - 1] = '\0';
			k--;
			break;
		default:
			break;
		}
	}
	m[k] = '\0';

	printf("%s\n",m);

	return 0;
}
//改行注意

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

#define INF 1000000000

using namespace std;

int main() {
    int array[3];

    REP(i, 3)
    cin >> array[i];

    int odds = 0;

    REP(i, 3)
    if (array[i] % 2 == 1) odds++;

    int tries = 0;

    if (odds == 2) {
        tries++;
        REP(i, 3)
        if (array[i] % 2 == 1) array[i]++;
    } else if (odds == 1) {
        tries++;
        REP(i, 3)
        if (array[i] % 2 == 0) array[i]++;
    }

    int max_value = max(max(array[0], array[1]), array[2]);

    REP(i, 3)
    tries += (max_value - array[i]) / 2;

    cout << tries << endl;

    return 0;
}


Measured memory_bytes: 256
# input
N = gets.to_i
H = gets.split.map{|x| x.to_i}

# compute
moved_nums = {"0"=>0}
cnt = 0
for i in 0...N-1
    if H[i] >= H[i+1] 
        cnt += 1
        if i == N - 2
            index = i - cnt + 1
            moved_nums["#{index+1}"] =  cnt 
        end 
    else 
        if cnt > 0
            index = i - cnt
            moved_nums["#{index+1}"] =  cnt
            cnt = 0
        end
    end
end 

# output
puts moved_nums.max{|a, b| a[1] <=> b[1]}[1].to_i



Measured memory_bytes: 13964
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int mi=1010;

void solve() {
	int i,j,k,l,r,x,y; string s;
	cin>>N;
	FOR(i,N) {
		cin>>x;
		int cnt=0;
		while(x%2==0) x/=2,cnt++;
		mi=min(mi,cnt);
	}
	cout<<mi<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
hoge = []
for i in range(M):
    K = input().split()
    hoge.append(K)
P = input().split()
count = 0
for i in range(2**N):
    L = bin(i)[2:]
    leng = len(L)
    for pu in range(leng,N):
        L = "0" + L
    for j in range(M):
        hu = 0
        for a in hoge[j][1:]:
            if L[int(a)-1] == "1":
                hu += 1
        if hu % 2 != int(P[j]):
            break
        if j == M-1:
            count += 1
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, a[1001];
    cin >> n;
    for(int i = 1; i <= n; i++){
     cin >> a[i];   
    }
    for(int i = 1; i <= n; i++){
     if(a[i] % 2 == 0){
      if(a[i] % 3 != 0 && a[i] % 5 != 0){
          cout << "DENIED";
          return 0;
      }
     }
    }
    cout << "APPROVED";
 return 0;   
}

Measured memory_bytes: 256
#!/usr/bin/env python3
n, k, *P = map(int, open(0).read().split())
p = [(i + 1) / 2 for i in P]
c = sum(p[:k])
ans = c
for i in range(n - k):
    c = c + p[i + k] - p[i]
    ans = max(c, ans)
print(ans)


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

int main(){
  int N;
  cin >> N;
  vector<queue<int>> orders(N);
  rep(i,N){
    rep(j,N-1){
      int a;
      cin >> a;
      a--;
      orders[i].push(a);
    }
  }

  set<pair<int,int>> can_game_pair;
  set<int> done_persons;
  rep(i,N) done_persons.insert(i);

  int ret = 0;
  while(true){
    // per day
    set<int> done_today;
    FOR(it,done_persons){
      int a = *it;
      if(orders[a].empty()) continue;
      int b = orders[a].front(); orders[a].pop();
      if(a>b) swap(a,b);

      auto f = can_game_pair.find(make_pair(a,b));
      if(f != can_game_pair.end()){
        //play game
        can_game_pair.erase(f);
        done_today.insert(a);
        done_today.insert(b);
      }else{
        can_game_pair.insert(make_pair(a,b));
      }
    }

    if(done_today.empty() && !can_game_pair.empty()){
      cout << -1 << endl;
      return 0;
    }
    if(done_today.empty() && can_game_pair.empty()){
      cout << ret << endl;
      return 0;
    }

    ret++;
    swap(done_today, done_persons);
  }
  
  return 0;
}


Measured memory_bytes: 4736
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 998244353;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll N;
  std::string S;
  std::cin >> N >> S;

  std::vector<ll> bsum(N+1, 0LL);
  std::vector<ll> wsum(N+1, 0LL);
  for (ll i = 1; i <= N; i++) {
    wsum[i] = wsum[i-1];
    bsum[i] = bsum[i-1];
    if (S[i-1] == '.') wsum[i]++;
    if (S[i-1] == '#') bsum[i]++;
  }

  ll ans = std::min(bsum[N], wsum[N]);
  for (ll i = 1; i <= N; i++) {
    ll cnt = bsum[i-1] + (wsum[N] - wsum[i-1]);
    ans = std::min(ans, cnt);

  }
  print(ans);

  return 0;
}


Measured memory_bytes: 3732
h,w=map(int,input().split())
c=[]
for i in range(10):
    l=[int(i) for i in input().split()]
    c.append(l)
a=[]
for i in range(h):
    l=[int(i) for i in input().split()]
    a.append(l)
p=[0]*10
for i in range(10):
    if i==1: continue
    d=[1003]*10
    d[i]=0
    q=set([i])
    while 1:
        if len(q)==0: break
        x=q.pop()
        for j in range(10):
            if i==j: continue
            if (d[j]>d[x]+c[x][j]):
                d[j]=d[x]+c[x][j]
                q.add(j)
    p[i]=d[1]
ans=0
for i in range(h):
    for j in range(w):
        if a[i][j]==-1: pass
        else: ans+=p[a[i][j]]
print(ans)

Measured memory_bytes: 41308
#!/usr/bin/env python3
import sys


def solve(r: int):
    print(3 * r * r)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    r = int(next(tokens))  # type: int
    solve(r)


if __name__ == '__main__':
    main()


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

int main(){
    int n;
    while(cin>>n){
        int cnt = 0;
        for(int i=0; i<=9; i++)
            for(int j=0; j<=9; j++)
                for(int k=0; k<=9; k++)
                    for(int l=0; l<=9; l++){
                        if(i+j+k+l==n)
                            cnt++;
                    }
         cout << cnt <<endl;
    }
    
    return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <string.h>

int main(int argc, const char * argv[]) {
    char word[301],word2[301],word3[301];
    int h,i,j,r,sum;
    while (1) {
        scanf("%s",word);
        sum = strlen(word);
        if(word[0]=='-'){
            break;
        }
        scanf("%d",&h);
        for(i=0;i<h;i++){
            scanf("%d",&r);
            strcpy(word2,word);
            strcpy(word3,word);
            strcat(word2,word3);
            for(j=0;j<sum*2;j++){
                word2[j]=word2[j+r];
            }for(j=0;j<sum;j++){
                word[j]=word2[j];
            }
        }
        for(i=0;i<sum;i++){
            printf("%c",word[i]);
        }
        printf("\n");
    }
    return 0;
}

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

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

	for(int i = 0; i < 3; ++i) {
		int h, m, s, hh, mm, ss;
		cin >> h >> m >> s >> hh >> mm >> ss;

		int ah = hh - h, am = mm - m, as = ss - s;
		if(as < 0) {
			as += 60;
			--am;
		}

		if(am < 0) {
			am += 60;
			--ah;
		}

		cout << ah << " " << am << " " << as << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1192
while True:
    try:
        a,b,c,d,e,f=[float(i) for i in input().split()]
    except:
        break
    x=(c*e-b*f)/(a*e-b*d)
    y=(c*d-a*f)/(b*d-a*e)
    print("{0:.3f} {1:.3f}".format(x+0,y+0))

Measured memory_bytes: 7428
#include <bits/stdc++.h>
#define int long long
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
#define fi first
#define se second
#define all(a) a.begin(),a.end()
main(){
	int a,b;
	cin>>a>>b;
	int s=0;
	s+=a-1;
	if(a<=b)s++;
	cout<<s<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FIR first
#define SEC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

signed main(){
  string s;
  cin>>s;
  if((s[0]==s[1]&&s[1]==s[2])||(s[1]==s[2]&&s[2]==s[3])||(s[0]==s[1]&&s[1]==s[2]&&s[2]==s[3]))cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
const ll inf = 1e9;

int main(){
    int n; cin >> n;
    priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > >p;
    rep(i,n){
        int s, g;
        cin >> s >> g;
        p.push(make_pair(g, s));
    }
    int t = 0, task = 0;
    while(!p.empty()){
        if(p.top().second > t){
            task++;
            t = p.top().first;
        }
        p.pop();
    }
    cout << task << endl;
    return 0;
}


Measured memory_bytes: 3864
import math
a,b,C=map(float,input().split())
C*=math.pi/180
print('%.8f'%(a*b*math.sin(C)/2))
print('%.8f'%(a+b+(a*a+b*b-2*a*b*math.cos(C))**.5))
print('%.8f'%(b*math.sin(C)))

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

unsigned rewrite( string& original, const int loc, const string& write ){
	unsigned advance = 0;
	for ( unsigned i = 0; i < write.size(); ++i ){
		original[ loc + i ] = write[ i ];
		++advance;
	}
	return loc + advance;
}

int main(){
	unsigned loc1 = 0, loc2 = 0;
	string s, peach = "peach", apple = "apple";

	while ( getline( cin, s ) ){
		while ( 1 ){
			loc1 = s.find( peach, loc1 );
			loc2 = s.find( apple, loc2 );
			if ( loc1 == string::npos && loc2 == string::npos ){
				break;
			}else if ( loc1 < loc2 ){
				loc1 = rewrite( s, loc1, apple );
			}else{
				loc1 = rewrite( s, loc2, peach );
			}
			loc2 = loc1;
		}
		cout << s << endl;
	}

	return 0;
}

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

int main() {
    long long int M, K;
    cin >> M >> K;

    long long int TtoM = (1 << M);
    if (K > TtoM - 1 || (M == 1 && K == 1)) {
        cout << -1;
    } else if (K == 0){
        cout << 0 << " " << 0;
        for (int i = 1; i < TtoM; i++) {
            cout << " " << i << " " << i;
        }
    } else {
        vector<long long int> a(TtoM * 2);
        a[TtoM - 1] = K;
        a[TtoM * 2 - 1] = K;
        for (int i = 0; i < TtoM; i++) {
            if (i < K) {
                a[TtoM - 2 - i] = i;
                a[TtoM + i] = i;
            } else if (i > K) {
                a[TtoM - 1 - i] = i;
                a[TtoM + i - 1] = i;
            }
        }

        cout << a[0];
        for (int i = 1; i < TtoM * 2; i++) {
            cout << " " << a[i];
        }
    }
}

Measured memory_bytes: 4928
using System;
class Program
{
	static void Main(string[] args)
	{
        string input = Console.ReadLine();
        int N = int.Parse(input);

        int sames = 0;
        bool clear = false;
        for (int i = 0; i < N; i++)
        {
            string[] inputs = Console.ReadLine().Split(' ');
            if(inputs[0] == inputs[1])
            {
                sames++;
            }
            else
            {
                sames = 0;
            }

            if(sames == 3)
            {
                clear = true;
            }
        }

        if(clear)
        {
		    Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
	}
}

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

int main(){
	int N,A[100],a;
	cin>>N;
	A[0]=-1;
	for(int i=1;i<=N;i++){
		cin>>A[i];
	}
	for(int i=1;i<=N;i++){
		for(int j=i;j>0;j--){
			if(A[j]>=A[j-1]){
				break;
			}
			a=A[j];
			A[j]=A[j-1];
			A[j-1]=a;
		}
		for(int j=1;j<=N;j++){
			cout<<A[j];
			if(j==N){
				cout<<endl;
			}else{
				cout<<' ';
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1160
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,k;
    cin >> a >> b >> k;
    if(a>=k){
        cout<<a-k<<" "<<b<<endl;
        return 0;
    }else{
        ll f=k-a;
        cout<<0<<" "<<max((ll)0,b-f)<<endl;
    }
    
    
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int N, M;
    cin >> N >> M;
    vector<int> ball(N,1);
    vector<bool> red(N);
    red[0] = true;

    REP(i,M) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        if (red[x]) red[y] = true;
        ball[x]--; ball[y]++;
        if (ball[x] == 0) red[x] = false;
    }

    OUT(count(ALL(red),true));

    return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  long long N, M; cin >> N >> M;
  if(N == 1 && M == 1) cout << 1 << endl;
  else if(N == 1 || M == 1) cout << max(N, M) - 2 << endl;
  else cout << (long long)(N-2) * (M-2) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
#else
	#define DBG(X)
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

void solve() {
	ll a = fetch<ll>();
	ll b = fetch<ll>();

	if(a <= 0 && 0 <= b) {
		cout << "Zero\n";
	} else if(a > 0) {
		cout << "Positive\n";
	} else { // if(a < 0)
		ll cnt = b - a + 1;
		cout << (cnt & 1 ? "Negative\n" : "Positive\n");
	}
}

int main() {
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 256
from sys import stdin
import numpy as np
N = list(map(int, (stdin.readline().strip().split())))[0]
M = list(map(int, (stdin.readline().strip().split())))
num_list=np.array([0]*(2*10**5+1))
ans=0
for i in M:
    num_list[i-1]+=1
ans=sum(num_list*(num_list-1))//2
for k in range(N):
    num=num_list[M[k]-1]-1
    print(ans-num)

Measured memory_bytes: 34140
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

long long lcm(long long a, long long b){
    return (a / gcd(a, b)) * b;
}

struct Node {
    ll cost;
    int pos;

    Node(ll _totalCost, int _currentPos) {
        cost = _totalCost;
        pos = _currentPos;
    }
};

int findMinimumCost(const vvi& cost, vi& visited, int from, int to) {
    vector<Node> queue;
    queue.push_back(Node(0, from));
    while (queue.size() != 0) {
        vector<Node>::iterator candidate = queue.begin();
        vector<Node>::iterator itr = queue.begin();
        for (; itr != queue.end(); itr++) {
            if (candidate->cost > itr->cost) {
                candidate = itr;
            }
        }
        Node current = *candidate;
        queue.erase(candidate);
        if (visited[current.pos] != -1 && visited[current.pos] < current.cost) {
            continue;
        }
        visited[current.pos] = current.cost;
//        cout << "current pos: " << current.pos << " cost: " << current.cost << endl;
        if (current.pos == to) {
            return current.cost;
        }
        for (int i = 0; i < 10; ++i) {
            if (i == current.pos) {
                continue;
            }
            queue.push_back(Node(current.cost + cost[current.pos][i], i));
        }
    }
}

int main(){
    int H, W;
    cin >> H >> W;
    vvi cost(10, vi(10, -1));

    repeat(i, 10) {
        repeat(j, 10) {
            cin >> cost[i][j];
        }
    }

    int totalCost = 0;
    int number;
    repeat (i, H) {
        repeat (j, W) {
            cin >> number;
            vi visited(11, -1);
            if (number == -1) {
                continue;
            }
            totalCost += findMinimumCost(cost, visited, number, 1);
        }
    }
    cout << totalCost << endl;
    return 0;
}


Measured memory_bytes: 384
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n;
int a[200005];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=2;i<=n;i++) if(a[i-1] >= a[i]) goto nxt;
	cout<<1<<endl; return 0; nxt:;
	
	int lb = 0,ub = n+5;
	while(ub-lb > 1){
		int mid = (lb+ub)/2;
		vector<P>vec;
		int pre = a[1];
		for(int i=2;i<=n;i++){
		    if(pre < a[i]){
		        pre = a[i]; continue;
		    }
			int aa = POSL(vec,mp(a[i],-1));
			if(aa == vec.size() || vec[aa].fi != a[i]){
				while(vec.size() && vec[vec.size()-1].fi > a[i]) vec.pop_back();
				vec.pb(mp(a[i],1));
			}
			else{
				int x = vec[aa].sc; assert(vec[aa].fi == a[i]);
				if(x < mid){
					while(vec.size() && vec[vec.size()-1].fi > a[i]) vec.pop_back();
					vec.pop_back();
					vec.pb(mp(a[i],x+1));
				}else{
					while(vec.size() && vec[vec.size()-1].fi > a[i]) vec.pop_back();
					vec.pop_back();
					int nxt = a[i]-1;
					while(vec.size() && vec[vec.size()-1] == mp(nxt,mid)){
						vec.pop_back();
						nxt--;
					}
					if(nxt == 0){
						goto fail;
					}
					else{
						if(vec.size() && vec[vec.size()-1].fi == nxt) vec[vec.size()-1].sc++;
						else vec.pb(mp(nxt,1));
					}
				}
			}
			pre = a[i];
		}
		ub = mid; continue;
		fail:; lb = mid; 
	}
	cout<<ub+1<<endl;
}


Measured memory_bytes: 1024
main :: IO()
main = do
  n <- readLn :: IO Int
  let
    left = (0, 0)
    right = (100, 0)
  outputPoint left
  koch n left right
  outputPoint right



koch :: Int -> (Float, Float) -> (Float, Float) -> IO()
koch 0 _ _ = return ()
koch n left@(x1, y1) right@(x2, y2) = do
  let
    s = ((2 * x1 + x2) / 3, (2 * y1 + y2) / 3)
    t = ((x1 + 2 * x2) / 3, (y1 + 2 * y2) / 3)
    u =
      (
        (fst t - fst s) * (cos $ pi / 3) - (snd t - snd s) * (sin $ pi / 3) + fst s,
        (fst t - fst s) * (sin $ pi / 3) + (snd t - snd s) * (cos $ pi / 3) + snd s
      )
  koch (n - 1) left s
  outputPoint s
  koch (n - 1) s u
  outputPoint u
  koch (n - 1) u t
  outputPoint t
  koch (n - 1) t right

outputPoint :: (Float, Float) -> IO()
outputPoint (x, y) = putStrLn $ (show x) ++ " " ++ (show y)



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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define reps(i,s,e) for(int i=s; i<(int)e; i++)
#define coutd(i) cout << std::fixed << std::setprecision(i)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

template<class T>
using Set = std::set<T>;
template<class T, class U>
using Map = std::map<T, U>;

template<class T>
using Graph = vector<vector<T>>;

const int INT_BIG = 1<<28;

int main() {
    int A, B;
    cin >> A >> B;
    cout << A*B << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#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 PB push_back
#define MP make_pair
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;
  map<char,int> m;

  FOR(i,0,s.size()-1) ++m[s[i]];

  FOR(i,0,25){
    if(m[char('a'+i)]==0){
      cout << s << char('a'+i) << endl;
      return 0;
    }
  }

  FORD(i,25,1){
    if(s[i-1]>s[i]) --m[s[i]];
    else{
      --m[s[i]];
      if(i!=1){
        FOR(j,0,i-2) cout << s[j];
      }
      FOR(j,(s[i-1]-'a'+1),25){
        if(m[char('a'+j)]==0){
          cout << char('a'+j) << endl;
          return 0;
        }
      }
    }
  }

  cout << -1 << endl;

}

Measured memory_bytes: 764
#include <stdio.h>

int main(void)
{
    int a, b, c;

    scanf("%d %d %d", &a, &b, &c);
    if ((a < b) && (b < c))
    {
        puts("Yes");
    }
    else
    {
        puts("No");
    }

    return 0;
}


Measured memory_bytes: 2612
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
 

     String[] nyu=sc.nextLine().split(" ");

//     String nyu=sc.nextLine();
int A=Integer.parseInt(nyu[0]);
int B=Integer.parseInt(nyu[1]);
int C=Integer.parseInt(nyu[2]);
//int D=Integer.parseInt(nyu[3]);

HashSet<Integer> list=new HashSet<>();
list.add(A);
list.add(B);
list.add(C);


//StringBuffer sb = new StringBuffer(nyu);
//		String dst = sb.reverse().toString();

//     String nyu2=sc.nextLine();
//int E=Integer.parseInt(nyu2);



//double A=Double.parseDouble(nyu[0]);
//double B=Double.parseDouble(nyu[1]);
/*
switch(nyu){
case "H H":
System.out.println("H") ;
break;

case "D D":
System.out.println("H") ;
break;

case "H D":
System.out.println("D") ;
break;

case "D H":
System.out.println("D") ;
break;


default:
System.out.println("NO") ;

break;
}
*/

//int res=Math.min((A*B),C);

//for(String tem:bo){
//if(tem.equals(nyu))res="vowel";
//}
//int res=0;
//for(int i=0;i<300;i++){
//if(num[i]==1)res=i;
//}

//char[] c = nyu.toCharArray();


//System.out.println(nyu+"-"+line_r_2+"-"+nyu2+"-"+line_r_1);



//if(A+B==C || B+C==A || C+A==B){
//double res=Math.ceil((AB)/2);

//System.out.println("Yes");
//}else if(B<A){
//System.out.println("Alice");

//}else{
System.out.println(list.size());
//}




	}
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <cmath>
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; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}

int main(){
 int64_t x;
 cin>>x;
 if(x%11==0){cout<<x/11*2<<endl;}
 else if(x%11<=6){cout<<x/11*2+1<<endl;}
 else{cout<<x/11*2+2<<endl;}
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
const ll UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
const ll mn=2e5+4;
const ll mx=1e5+4;
ll p[mn],q[mn],cc[mn];
map<ll, vector<ll> > g[mn];
set<ll> cset[mn];
map<ll,ll> dist[mn];
bool vsn[mn];
typedef pair<ll,ll> pll;
const ll UNK=2e6;
inline ll MK(ll x,ll y) {return (x<<32)|y;}
inline ll getdist(ll u, ll c) {
	auto it=dist[u].find(c);
	if (it==dist[u].end()) return INF;
	else return it->second;
}
int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	ll n,m; cin>>n>>m;
	for (ll i=0;i<m;i++) {
		ll x,y,c;
		cin>>x>>y>>c;
		p[i]=x; q[i]=y; cc[i]=c;
		g[x][c].PB(y); g[y][c].PB(x);
		cset[x].insert(c); cset[y].insert(c);
	}
	for (ll x=1;x<=n;x++) vsn[x]=false;
	priority_queue<pll,vector<pll>,greater<pll> > pq;
	vsn[1]=true;
	for (auto &c:cset[1]) {
		dist[1][c]=1;
		pq.push(MP(1,MK(1,c)));
	}
	while(!pq.empty()) {
		pll top=pq.top(); pq.pop();
		ll u=top.second>>32;
		ll c=top.second&0xffffffff;
		ll du=top.first;
		//printf("u:%lld c:%lld du:%lld\n",u,c,du);
		if (du>getdist(u,c)) continue;
		if (!vsn[u]) {
			vsn[u]=true;
			for (auto &wc:cset[u]) {
				ll alt=du+1;
				if (alt<getdist(u,wc)) {
					dist[u][wc]=alt;
					pq.push(MP(alt,MK(u,wc)));
				}
			}
		}
		for (auto &v:g[u][c]) {
			ll alt=du;
			if (alt<getdist(v,c)) {
				dist[v][c]=alt;
				pq.push(MP(alt,MK(v,c)));
			}
		}
	}
	ll ans=INF;
	for (auto &cand:dist[n]) {
		chkmin(ans,cand.second);
	}
	if (ans>=INF) ans=-1;
	cout<<ans<<endl;
}

Measured memory_bytes: 122480
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
 
 
void solve(){
    ll n,tw;
    cin>>n>>tw;

    vector<ll> w(n),v(n);
    for(int i=0;i<n;i++)cin>>w[i]>>v[i];

    ll total_val_possible = 0;
    for(int val: v)total_val_possible+=val;

    vector<ll> dp(total_val_possible+1,1e9);
    dp[0]=0;

    for(int i=0;i<n;i++){
        for(int value_already=total_val_possible-v[i]; value_already>=0;value_already--){
            dp[value_already+v[i]]=min(dp[value_already+v[i]],dp[value_already]+w[i]);
        }
    }

    ll ans=0;
    for(int i=0;i<=total_val_possible;i++){
        if(dp[i]<=tw)ans=i;
    }

    cout<<ans<<endl;
}



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

    // while(n--)
    solve();

    return 0;
}

Measured memory_bytes: 1024
#include <ext/pb_ds/assoc_container.hpp> 	// Common file
#include <ext/pb_ds/tree_policy.hpp> 		// Including tree_order_statistics_node_update
#include<bits/stdc++.h>
#define int            		long long
#define x              		first
#define y              		second
#define all(aaa)       		(aaa).begin(),(aaa).end()
#define REP(i,sss,eee) 		for(int i=sss;i<=eee;++i)
#define pb             		push_back
#define pii            		pair<int,int>
#define vi             		vector<int>
#define speed          		ios_base::sync_with_stdio(0);cin.tie(0);
#define N              		1000000007
using namespace __gnu_pbds;
using namespace std;
template <class T>
T MAX(T a, T b){return ((a>b)?a:b);}
template <class T>
T MIN(T a, T b){return ((a<b)?a:b);}
template <class T>
T MOD(T a){return ((a>=0)?a:(-1*a));}
template <class T>
void SWAP(T &a,T &b){T temp=a;a=b;b=temp;}

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

long long ex(long long a, long long b){
	if(b==0||a==1){return 1;}
	if(a==0||b==1){return a;}
	long long tmp=ex(a,(b/2));
	if(b%2){return ((((tmp*tmp)%N)*a)%N);}
	else{return ((tmp*tmp)%N);}
}
long long inv(long long k){
	if(k==1){return 1;}
	else{return ex(k,N-2);}
}
/*****************default********************/
bool grtr(string s1,string s2)
{
	if(s1.length()>s2.length()){return 1;}
	if(s1.length()<s2.length()){return 0;}
	return (s1>s2);
}
int solve()
{
	std::vector<int> val={INT_MAX,2,5,5,4,5,6,3,7,6};
	int n,m;cin>>n>>m;
	std::vector<int> A(m,0);
	REP(i,0,m-1){cin>>A[i];}
	std::vector<string> f(n+1,"");
	for(int i=1;i<=n;++i)
	{
		REP(ix,0,m-1)
		{
			int dig=A[ix];
			if(i==val[dig])
			{
				string tmp;tmp+=char(dig+'0');
				if(grtr(tmp,f[i]))
				{
					f[i]=tmp;
				}
			}
			else
			{
				if(i-val[dig]<0){continue;}
				if(f[i-val[dig]]!="")
				{
					string tmp=f[i-val[dig]];tmp+=char(dig+'0');
					if(grtr(tmp,f[i]))
					{
						f[i]=tmp;
					}
				}
			}
		}
	}
	cout<<f[n]<<"\n";
	
}
signed main(){
	speed
	int tt=1;
	//cin>>tt;
	while(tt--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 41472
n,m = map(int,input().split())
sl=[]
for i in range(m):
    s =list(map(int,input().split()))
    s=s[1:]
    sl.append(s)
p = list(map(int,input().split()))

cnt=0
for i in range(2**n):
    # output=[False]*n
    flag=True
    for k in range(len(sl)):
        count=0
        for j in sl[k]:
            if((i>>(j-1))&1):
                count+=1
        if count%2!=p[k]:
            flag=False
            break
    if flag:
        cnt+=1

print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define pb push_back
const int N=20005;
const int MOD=1e9+7;
 

// lower_bound - which does not compare less than val
// upper_bound - which compares greater than val
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
 int a[N],b[N],c[N];
 
int32_t main()
{
  
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  /* stuff you should look for
  * int overflow, array bounds
  * special cases (n=1?)
  * do smth instead of nothing and stay organized
*/




int arr[5];
for(int i=0;i<5;i++)
{
	cin>>arr[i];
	
}
int x=0;
for(int i=0;i<5;i++)
{
	if(arr[i]==0)
	{
		x=i;
		break;
	}
	
}

cout<<x+1<<endl;
}



Measured memory_bytes: 3600
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

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

void solve() {
  int n;
  cin >> n;
  set<int> s;
  int rainbow = 0;
  while(n--) {
    int t;
    cin >> t;
    if(t/400 >= 8) rainbow++;
    else s.insert(t/400);
  }
  cout << max(1, (int)s.size()) << " " << s.size() + rainbow << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
  solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

int a[7];

int main()
{
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    if (a[0] == 5 && a[1] == 5 && a[2] == 7)
    {
        cout << "YES";
    }
    else
    {
        cout << "NO";
    }
}


Measured memory_bytes: 256
n=gets.to_i
a=gets.split.map(&:to_i)
b=a.dup
n.times do |i|
  a[i]=a[i]-i
  b[i]=-b[i]-i
end
h=Hash.new(0)
c=0
n.times do |i|
  c+=h[a[i]]
  h[b[i]]+=1
end
puts c



Measured memory_bytes: 38600
#include<iostream>
using namespace std;
int main(){
  int M,D;
  
  cin >> M >> D;
  
  int a,b;
  int count=0;
  for(int i=1; i<= M; i++){
    for(int j=1; j<=D; j++){
      a = j%10;
      b = j/10;
      if(a>=2 && b>=2 && a*b==i)count++;
    
    }
  }
  
  cout << count << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define f first
#define s second
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int a,b,c;
	cin>>a>>b>>c;
	int count=0,count2=0;
	if(a==5)
		count++;
	if(b==5)count++;
	if(c==5)count++;
	if(a==7||b==7||c==7)count2++;
	if(count2 && count==2)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

int gcd(int a, int b) {
    if(b > a) return gcd(b, a);
    else if(b == 0) return a;
    else return gcd(b, a % b);
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    int a[100010];
    rep(i, N) cin >> a[i];
    int k = 0;
    while(((a[0] >> k) << k) == a[0]) k++;
    rep(i, N) {
        int tmp = 0;
        while(((a[i] >> tmp) << tmp) == a[i]) tmp++;
        if(k != tmp) {
            cout << 0 << endl;
            return 0;
        }
    }
    int L = a[0];
    rep(i, N) {
        L = L * a[i] / gcd(L, a[i]);
        if((M + L/2) / L == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    cout << (M + L/2) / L << endl;




    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define big 998244353
#define ff first
#define se second
#define pb push_back
#define pii pair<int,int>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define mp make_pair
#define pi 3.141592653589
int power(int x,int y){
    int r=1,z=x;
    while(y){
        if(y & 1)r*=z;
        z*=z;y=y>>1;}
    return r;}
int powerm(int x,int y,int p){
    int r=1;
    while(y){
        if(y & 1)r=(r*x)%p;
        y=y>>1;
        x=(x*x)%p;}
    return r%p;}
int modinv(int x,int m){
    return powerm(x,m-2,m);}
int logarithm(int a,int b){
    int x=0;
    while(a>1){
        x++;
        a/=b;}
    return x;}
int p[5005],c[5005],vis[5005];
vector<int> temp;
void dfs(int i){
    vis[i]=1;
    temp.pb(i);
    if(!vis[p[i]])
        dfs(p[i]);
}
int32_t main(){
    fast;
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>p[i];
    for(int i=1;i<=n;i++)
        cin>>c[i];
    vector<vector<int> > comp;
    for(int i=1;i<=n;i++){
        temp.clear();
        if(!vis[i])
            dfs(i);
        if(temp.size())
            comp.pb(temp);
    }
    int fans=-1e18;
    for(auto p:comp){
        int sum=0;
        for(auto x:p)
            sum+=c[x];
        int ans=-1e18;
        int m=p.size();
        int mx=-1e18;
            for(int j=0;j<m;j++){
                int ss=0;
                int id=j;
                for(int xx=0;xx<min(m,k);xx++){
                    ss+=c[p[id%m]];
                    mx=max(mx,ss);
                    id++;
                }
            }
        if(sum<=0)
            ans=mx;
        else{
            ans=k/m*sum;
            int temp=-1e18;
            for(int j=0;j<m;j++){
                int ss=0;
                int id=j;
                for(int xx=0;xx<k%m;xx++){
                    ss+=c[p[id%m]];
                    temp=max(temp,ss);
                    id++;
                }
            }
            ans+=temp;
            ans=max(ans,sum*(k/m-1)+mx);
        }
        fans=max(fans,ans);
    }
    cout<<fans;
    return 0;
}

Measured memory_bytes: 4048
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    A,B=map(int,input().split())
    if A%2 and B%2:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define x1 jfkljfewlkjfwekl
#define x2 jkfwejklfwej
#define y1 kfewfe
#define y2 jfwekj3w3e
 
int bomb[50][50];
 
 
int a[4][4] = {
	{0,0,0,0},
	{0,0,0,0},
	{1,1,0,0},
	{1,1,0,0},
};
int myquery(int x1,int x2,int y1,int y2){
	int sum = 0;
	for(int i = y1 ; i <= y2 ; i++)
		for(int j = x1 ; j <= x2 ; j++)
			sum += a[i][j];
	return sum;
}
int query(int x1,int x2,int y1,int y2){
	cout << "? " << y1 << " " << x1 << " " << y2 << " " << x2 << endl;
	//return myquery(x1,x2,y1,y2);
	int sum;
	cin >> sum;
	return sum;
}
int dfs(int x1,int x2,int y1,int y2,int prv){
	if( x1 > x2 or y1 > y2 ) return 0;
	
	int ask = prv == -1 ? query(x1,x2,y1,y2) : prv;
	//cout << ask << endl;
	if( ask == (x2-x1+1) * (y2-y1+1) ){
		int ans = 0;
		for(int i = y1 ; i <= y2 ; i++)
			for(int j = x1 ; j <= x2 ; j++)
				bomb[i][j] = 1;
		return ask;
		
	}else if( ask == 0 ){
		 return 0;
	}
	int X = (x1+x2) / 2;
	int Y = (y1+y2) / 2;
	int a = dfs(x1,X,y1,Y,-1);
	int b = dfs(X+1,x2,y1,Y,-1);
	int c = dfs(x1,X,Y+1,y2,-1);
	int d = dfs(X+1,x2,Y+1,y2,ask-a-b-c);
	return ask;
	
}
signed main(){
	int H,W,N,K;
	cin >> H >> W >> N >> K;
	dfs(0,W-1,0,H-1,-1);
	long long ans = 0;
	long long w = 1;
	for(int i = 0 ; i < H ; i++){
		for(int j = 0 ; j < W ; j++){
			ans += w * bomb[i][j];
			ans %= K;
			w *= 2;
			w %= K;
		}
	}
	cout << "!" << " " << ans << endl;
}

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

using namespace std;

int main() {
    string s; cin >> s;
    if (int(s.size()) == 6) {
        if (s[2] == s[3] && s[4] == s[5]) {
            printf("Yes");
        } else {
            printf("No");
        }
    } else {
        printf("No");
    }
}

Measured memory_bytes: 768