akhauriyash/Code-Regression huggingface dataset:
from itertools import accumulate
mod=1000000007
n=int(input())
S=input()
Flag=[0]*(2*n)
for i,s in enumerate(S):
    if i%2:
        Flag[i]=int(s=='W')
    else:
        Flag[i]=int(s=='B')
Acc=list(accumulate(Flag))
if Acc[-1]!=n or Flag[-1]==1:
    print(0)
    exit()
ans=1
cnt=0
for i,f in enumerate(Flag):
    if f==0:
        tmp=Acc[i]-cnt
        ans*=tmp
        ans%=mod
        cnt+=1
for i in range(1,n+1):
    ans*=i
    ans%=mod
print(ans)

Measured memory_bytes: 56908
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>

#define INF 100000000

using namespace std;

int main()
{
    int a, b, k;
    cin >> a >> b >> k;
    if (b - a + 1 >= 2 * k)
    {
        for (int i = 0; i < k; i++)
        {
            cout << a + i << endl;
        }
        for (int i = k - 1; i >= 0; i--)
        {
            cout << b - i << endl;
        }
    }
    else
    {
        for (int i = 0; i < 2 * k; i++)
        {
            if (b < a + i)
            {
                return 0;
            }
            else
            {
                cout << a + i << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
#pragma GCC optimize "-O3"

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());

ll INF = (ll) 1e20;
int iINF = (int) 1e20;
ll mod = (ll) 1e9 + 7;
ll mod2 = (ll) 1e9 + 9;

signed main() {
    ll n;
    cin >> n;
    vector <ld> v(n);
    for(int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    ld ans = v[0];
    for(int i = 1; i < n; ++i) {
        ans = (ans + v[i]) / 2;
    }
    cout << ans;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String[] list = str.split(" ");

		if(list[0].equals("H")){
			if(list[1].equals("H")){
				System.out.println("H");
			}else{
				System.out.println("D");
			}
		}else{
			if(list[1].equals("H")){
				System.out.println("D");
			}else{
				System.out.println("H");
			}
		}

	}

}


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

int main() {
  int N;
  cin >> N;
  vector<int> P(N), Q(N), R(N);
  for(int i = 0; i < N; i++){
    cin >> P.at(i);
  }
  for(int i = 0; i < N; i++){
    cin >> Q.at(i);
  }

  for(int i = 1; i <= N; i++){
    R.at(i-1) = i;
  }
  
  int a = 0, b = 0, count = 0;
  do{
    if(R == P) a = count;
    if(R == Q) b = count;
    count++;
  }while(next_permutation(R.begin(), R.end()));

  int d = 0;
  d = abs(a - b);

  cout << d << endl;

}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define ll long long
#define br cout << endl ;
#define all(x) (x).begin() ,(x).end()
#define rall(x) (x).rbegin() ,(x).rend()
#define pb push_back
const int MOD = 1000* 1000 * 1000 + 7;
const int MAXN = 1000*1000 + 10 ; 
using namespace std;

int main() {
	int t = 1 ;
	// cin >> t ;
	while(t--){
	int n , m ;
	cin >> n >> m ;
	vector<int >v (n ) ;
	ll s = 0 ; 
	for(int &x : v )
	{cin >> x ;  s+= x ; }
		int cnt = 0 ; 
	
	for ( int x : v )
	{	ll k = m * 4 * x ; 
		if ( k >= s )
			cnt ++ ; 
	}
	
	if (cnt >= m )
		cout << "Yes" ;
	else
	cout <<"No" ;
	
	
	}

	


return 0 ; 
}		



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

int main(){
    int N, L;
    cin >> N >> L;
    int ans = N*L + (N*(N-1))/2;
    int d = 0;
    if(L + N - 1< 0) d = L + N -1;
    if(L > 0) d = L;
    cout << ans - d << endl; 
}

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

int main(){
    int n;
    int a;

    int cnt = 0;

    scanf("%d", &n);

    for (int i = 1; i <= n; i++){
        scanf("%d", &a);
        if(i % 2 == 0)
            continue;
        
        if((a % 2) != 0)
            cnt++;
    }

    printf("%d", cnt);

    return 0;
}


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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  int N; cin >> N;
  ll A[N]; rep(i,N) cin >> A[i];
  ll B[N]; rep(i,N) cin >> B[i];
  vector<ll> plus;
  ll diff = 0, result = 0;
  rep(i,N) {
    if (A[i]<B[i]) { diff += B[i]-A[i]; result++; }
    if (A[i]>B[i]) plus.push_back(A[i]-B[i]);
  }
  sort(plus.begin(), plus.end(), [](const ll &x, const ll &y){return x>y;});

  if (diff>0) rep(i,plus.size()) {
    diff -= plus[i];
    if (diff<=0) { result += i+1; break; }
  }
  if (diff>0) result = -1;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 2428
/*Bismillahir Rahmanir Rahim*/
#include<bits/stdc++.h>
using namespace std;
#define sf scanf
#define pf printf

#define sf1(a)			scanf("%d",&a);
#define sf2(a,b)		scanf("%d%d",&a,&b);

#define ll				long long

#define fin             freopen("input.txt","r",stdin);
#define fout            freopen("output.txt","w",stdout);

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int a,b;
	cin >> a >> b;
	if((a==1&&b==2) || (a==2&&b==1)){
		cout << 3 << endl;
	}
	else if((a==2&&b==3)||(a==3&&b==2)){
		cout << 1 << endl;
	}
	else if((a==1&&b==3 )||(a==3&&b==1)){
		cout << 2 << endl;
	}

	return 0;
}



Measured memory_bytes: 256
n=int(input())
s=input()
import sys
a=0
if n==1:
    print('No')
    sys.exit()
if n%2!=0:
    print('No')
    sys.exit()
else:
    for i in range(n//2):
        if s[i]==s[i+(n//2)]:
            pass
        else:
            a=1
            break
if a==0:
    print('Yes') 
else:
    print('No')       

Measured memory_bytes: 3064
class Dice():
    
    state = [0 for _ in range(6)]

    def __init__(self, dice_list):
        self.state[0] = dice_list[0]
        self.state[1] = dice_list[1]
        self.state[2] = dice_list[2]
        self.state[3] = dice_list[3]
        self.state[4] = dice_list[4]
        self.state[5] = dice_list[5]

    def north(self):
        tmp = self.state[0]
        self.state[0] = self.state[1]
        self.state[1] = self.state[5]
        self.state[5] = self.state[4]
        self.state[4] = tmp

    def west(self):
        tmp = self.state[0]
        self.state[0] = self.state[2]
        self.state[2] = self.state[5]
        self.state[5] = self.state[3]
        self.state[3] = tmp

    def south(self):
        tmp = self.state[0]
        self.state[0] = self.state[4]
        self.state[4] = self.state[5]
        self.state[5] = self.state[1]
        self.state[1] = tmp


    def east(self):
        tmp = self.state[0]
        self.state[0] = self.state[3]
        self.state[3] = self.state[5]
        self.state[5] = self.state[2]
        self.state[2] = tmp

    
if __name__ == '__main__':
    L = list(map(int, input().split()))
    N = int(input())
    querys = [list(map(int, input().split())) for _ in range(N)]

    for query in querys:
        dice = Dice(L)

        for i in range(3):
            for j in range(4):
                if dice.state[1] == query[1]:
                    break
                dice.north()
                
            if dice.state[1] == query[1]:
                break

            dice.west()
            

        for i in range(4):
            if dice.state[0] == query[0]:
                break
            dice.west()

        print(dice.state[2])



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

int main() {
    int N, K;
    cin >> N >> K;

    int x, sum = 0;
    for(int i = 0; i < N; i++){
        cin >> x;
        if(x < K - x) sum += 2 * x;
        else          sum += 2 * (K - x);
    }

    cout << sum << endl;
}


Measured memory_bytes: 3596
X = int(input())
i = 0
end_flag = 1
if X < 4:
    print(X)
else:
    while end_flag == 1:
        ii = 2
        while ii <= (X + i) // 2:
            if (X + i) % ii == 0:
                i = i + 1
                break
            elif ii == X // 2:
                print(X + i)
                end_flag = 0
                break
            ii = ii + 1

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
const int INF = (1LL << 31) - 1;
const int sqrtN = 512;
struct SqrtDecomposition {
  int N, K;
  vector<int> data;
  vector<bool> lazyFlag;
  vector<int> lazyUpdate;
  SqrtDecomposition(int n) : N(n) {
    K = (N + sqrtN - 1) / sqrtN;
    data.assign(K * sqrtN, INF);
    lazyFlag.assign(K, false);
    lazyUpdate.assign(K, 0);
  }
  void eval(int k) {
    if (lazyFlag[k]) {
      lazyFlag[k] = false;
      for (int i = k * sqrtN; i < (k + 1) * sqrtN; ++i) {
        data[i] = lazyUpdate[k];
      }
    }
  }
  // [s, t)
  void update(int s, int t, int x) {
    for (int k = 0; k < K; ++k) {
      int l = k * sqrtN, r = (k + 1) * sqrtN;
      if (r <= s || t <= l)
        continue;
      if (s <= l && r <= t) {
        lazyFlag[k] = true;
        lazyUpdate[k] = x;
      } else {
        eval(k);
        for (int i = max(s, l); i < min(t, r); ++i) {
          data[i] = x;
        }
      }
    }
  }
  int find(int i) {
    int k = i / sqrtN;
    eval(k);
    return data[i];
  }
};
 
signed main() {
  ios::sync_with_stdio(false);
  int N, Q;
  cin >> N >> Q;
  SqrtDecomposition decomp(N);
  while (Q--) {
    int c;
    cin >> c;
    if (c == 0) {
      int s, t, x;
      cin >> s >> t >> x;
      decomp.update(s, t + 1, x);
    } else {
      int i;
      cin >> i;
      cout << decomp.find(i) << endl;
    }
  }
}


Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		if(n%2==0){
			System.out.println(n*n/4);
		}else{
			n=n+1;
			System.out.println(n*(n-2)/4);

		}

	}}

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

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


Measured memory_bytes: 3604
N = int(input())
used = []
old = None
fail = False
for _ in range(N):
  str = input()
  
  if old is not None:
    if str[0] != old or str in used:
      fail = True
      break
  old = str[-1]
  used.append(str)
print("No" if fail else "Yes")


Measured memory_bytes: 2940
import kotlin.math.max

data class Infant(val a: Long, val origPos: Long)

fun main() {
    val builder = StringBuilder()

    val n = readInputLine().toInt()

    val aArr = readInputLine().split(" ").mapIndexed() { index, s ->
        Infant(s.toLong(), index.toLong() + 1L)
    }.sortedByDescending { it.a }.toTypedArray()

    val dp = Array(n + 1) { LongArray(n + 1) }

    dp[0][0] = 0L

    for ((index, infant) in aArr.withIndex()) {
        val numInfant = index + 1
        for (j in 1 until numInfant) {
            dp[j][numInfant - j] = max(
                dp[j - 1][numInfant - j] + infant.a * (infant.origPos - j),
                dp[j][numInfant - j - 1] + infant.a * ((n - (numInfant - j) + 1) - infant.origPos)
            )
        }

        dp[numInfant][0] = dp[numInfant - 1][0] + infant.a * (infant.origPos - numInfant)
        dp[0][numInfant] = dp[0][numInfant - 1] + infant.a * ((n - numInfant + 1) - infant.origPos)
    }

    var ans = 0L

    repeat(n) {
        ans = max(ans, dp[it][n - it])
    }

    builder.appendln(ans)

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}


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

using ll = long long;
using Vi = std::vector<int>;
using Vl = std::vector<ll>;
using Pii = std::pair<int, int>;
using Pll = std::pair<ll, ll>;

constexpr int I_INF = std::numeric_limits<int>::max();
constexpr ll L_INF = std::numeric_limits<ll>::max();

template <typename T1, typename T2>
inline bool chmin(T1& a, const T2& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, const T2& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        void operator()(const Args&... args) const { print(args...); }
        template <typename T>
        void pvec(const T& vec, size_t sz) const {
            for (size_t i = 0; i < sz; i++)
                std::cout << vec[i] << (i == sz - 1 ? term : sep);
        }
        template <typename T>
        void pmat(const T& mat, size_t h, size_t w) {
            for (size_t i = 0; i < h; i++)
                for (size_t j = 0; j < w; j++)
                    std::cout << mat[i][j] << (j == w - 1 ? term : sep);
        }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail>
        void print(const T& head, const Tail&... tail) const { std::cout << head, print_rest(tail...); }
        template <class T, class... Tail>
        void print_rest(const T& head, const Tail&... tail) const { std::cout << sep << head, print_rest(tail...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
};

Prints prints;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    string ans;
    int N;
    cin >> N;
    for (ll i = 0; i < N; i++) {
        ans += "ACL";
    }
    prints()(ans);
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    std::cin.tie(nullptr), std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    std::ifstream ifs("./in_out/input.txt");
    std::cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    std::ofstream ofs("./in_out/output.txt");
    std::cout.rdbuf(ofs.rdbuf());
#endif
    std::cout << std::setprecision(18) << std::fixed;
    solve();
    std::cout << std::flush;
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
const int MOD = (int)(1e9+7);
const int INF = (int)(1e9+1e7);
const ll INFL = (ll)(1e17);
const double EPS = 1e-8;
using namespace std;
int main()
{
  ll a,b,k;
  cin >> a >> b >> k;
  if(a>=k){cout << a-k << " " << b << endl;}
  else{cout << 0 << " " << max((ll)0,b-(k-a)) << endl;}
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
 
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
 
    int A = scanner.nextInt();
    int B = scanner.nextInt();
    int X = scanner.nextInt();
 
    if ( A <= X && X - A <= B ) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
}

Measured memory_bytes: 21844
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;


int main() {

	string s;
	cin >> s;

	sort(s.begin(), s.end());

	for (int i = 0; i < s.size()-1; i++) {
		if (s[i] == s[i + 1]) {
			cout << "no" << endl;
			return 0;
		}
	}
	cout << "yes" << endl;
	return 0;


}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<61;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

ll n,p;
vl a;

int main(){
	cin>>n>>p;
	ll sum=0;
	a=vl(n);
	for(int i=0;i<n;i++){
		ll w,b;
		cin>>w>>b;
		sum-=p*b;
		a[i]=(100-p)*w+p*b;
	}
	sort(a.rbegin(),a.rend());
	int I=0;
	while(sum<0){
		sum+=a[I];
		I++;
	}
	cout<<I<<endl;
}

Measured memory_bytes: 1024
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long t = sc.nextInt();
    long h = t/500;
    long g = t%500;
    long f = g/5;
    long ans = h*1000+f*5;
    System.out.println(ans);
  }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (n); i++)
 
 
int main(){
    string S;
    cin >> S;
    if(S == "zyxwvutsrqponmlkjihgfedcba"){cout << -1 << endl; return 0;}
    bool A[26] = {};
    if(S.size() < 26){
		rep(i,S.size()) A[S[i] - 'a'] = 1;
		rep(i,26) if(!A[i]){ cout << S << (char)('a' + i) << endl; return 0;}
	}
	for(int i=24;0<=i;i--){
		A[S[25] - 'a'] = 1;
		if(S[i] > S[i+1]){
			A[S[i] - 'a'] = 1;
		}else{
			rep(j,i) cout << S[j];
			for(int j=S[i]-'a';j<26;j++) if(A[j]){ cout << (char)('a' + j) << endl; return 0;}
		}
	}
 
    return 0;
}

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

char so[1299710];

int main(){
	
	int n,i,j,count;
	memset(so,0,sizeof(so));
	so[1]=1;
	for(i=2;i<6;i++){
		for(j=2*i;j<=29;j+=i){
			so[j]=1;
		}
	}
	
	for(i=29;i<1141;i+=2){
		if(i%23==0 ||i%7==0 || i%3==0 || i%5==0 || i%11==0 || i%13==0 || i%17==0 || i%19==0)continue;
		for(j=3*i;j<1299710;j+=(2*i)){
			so[j]=1;
		}
	}

	while(0<=scanf("%d",&n)){
		if(n==0)break;
		count=0;
		
		if(n==2 || n==3 || n==5 || n==7 || n==11 || n==13 || n==17 || n==23 || n==29){
			printf("0\n");
			continue;
		}
		
		for(i=n;;i--){
			if(i==2||i==3||i==5||i==7||i==11||i==17||i==19||i==23||i==29)break;
			if(i%2==0 ||i%23==0 ||i%7==0 || i%3==0 || i%5==0 || i%11==0 || i%13==0 || i%17==0 || i%19==0){
				++count;
				continue;
			}
			if(so[i]==0){
				break;
			}
			++count;
		}
		
		for(i=n;;i++){
			if(i==2||i==3||i==5||i==7||i==11||i==17||i==19||i==23||i==29)break;
			if(i%2==0 ||i%23==0 ||i%7==0 || i%3==0 || i%5==0 || i%11==0 || i%13==0 || i%17==0 || i%19==0){
				++count;
				continue;
			}
			if(so[i]==0){
				break;
			}
			++count;
		}
		
		
		
		printf("%d\n",count);

	}
	return 0;
}

Measured memory_bytes: 0
import sys
input = sys.stdin.buffer.readline

def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    A.append(A[-1])
    
    if A[0] != 0:
        print(-1)
        exit()
    else:
        ans = 0
        now = 0
        for i in range(N):
            i += 1
            if A[i] == now + 1:
                now = A[i]
            elif A[i] == now:
                ans += now
            elif now > A[i]:
                ans += now
                now = A[i]
            else:
                print(-1)
                exit()
                
    print(ans)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 11056
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
#define w1 first
#define w2 second
#define ls (x<<1)
#define rs (x<<1|1)
#define pb push_back
#define mid ((l+r)>>1)
#define SZ(x) ((x).size())
#define All(x) (x).begin(),(x).end()
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(int (p)=head[(x)];(p);(p)=nxt[(p)])
#define Rep2(p,x) for(int (p)=cur[(x)];(p);(p)=nxt[(p)])
template<class T>void read(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
int power(int x,int k,int p){int res=1;for(;k;k>>=1,x=1ll*x*x%p)if(k&1)res=1ll*res*x%p;return res;}
const int lim=1e7,maxn=1e7+5;
int n;
int x[maxn],p[maxn],vis[maxn];
vector<int>a[2];
namespace Network{
	const int maxn=1e3+5,maxm=1e6+5,inf=1e9;
	int S,T,tot;
	int head[maxn],from[maxm],des[maxm],nxt[maxm],f[maxm];
	int cur[maxn],h[maxn],pre[maxn],d[maxn];
	void init(int _S,int _T){
		memset(head,0,sizeof head);tot=1;
		S=_S;T=_T;
	}
	void adde(int x,int y,int z){
		from[++tot]=x;des[tot]=y;f[tot]=z;nxt[tot]=head[x];head[x]=tot;
		from[++tot]=y;des[tot]=x;f[tot]=0;nxt[tot]=head[y];head[y]=tot;
	}
	int isap(int n){
		int u=S,maxflow=0;
		rep(i,1,n)cur[i]=head[i],d[i]=pre[i]=0;
		h[0]=n;
		while(d[S]<n){
			if(u==T){
				int re=S,minflow=inf;
				for(;u!=S;u=from[pre[u]])if(f[pre[u]]<minflow)minflow=f[pre[u]],re=from[pre[u]];
				u=T;maxflow+=minflow;
				for(u=T;u!=S;u=from[pre[u]])f[pre[u]]-=minflow,f[pre[u]^1]+=minflow;
				u=re;
			}
			int flag=0;
			Rep2(p,u){
				if(f[p]&&d[des[p]]==d[u]-1){
					flag=1;u=des[p];pre[u]=p;
					break;
				}
				cur[u]=p;
			}
			if(flag)continue;
			cur[u]=head[u];int mind=n;
			Rep2(p,u)if(f[p]&&d[des[p]]<mind)mind=d[des[p]],cur[u]=p;
			h[d[u]]--;if(!h[d[u]])break;
			d[u]=mind+1;h[d[u]]++;
			if(u!=S)u=from[pre[u]];
		}
		return maxflow;
	}
}
int main(){
	int tot=0;
	vis[1]=1;
	rep(i,2,lim){
		if(!vis[i])p[++tot]=i;
		rep(j,1,tot){
			if(p[j]*i>lim)break;
			vis[p[j]*i]=1;
			if(i%p[j]==0)break;
		}
	}
	x[0]=-1;
	read(n);
	rep(i,1,n){
		read(x[i]);
		if(x[i]!=x[i-1]+1){
			a[x[i]&1].pb(x[i]);
			if(i>1)a[(x[i-1]+1)&1].pb(x[i-1]+1);
		}
		if(i==n)a[(x[i]+1)&1].pb(x[i]+1);
	}
//	rep2(i,0,SZ(a[0]))cerr<<a[0][i]<<" ";cerr<<endl;
//	rep2(i,0,SZ(a[1]))cerr<<a[1][i]<<" ";cerr<<endl;
	int n1=SZ(a[0]),n2=SZ(a[1]),S=n1+n2+1,T=n1+n2+2;
	Network::init(S,T);
	rep2(i,0,n1)rep2(j,0,n2)if(!vis[abs(a[0][i]-a[1][j])])Network::adde(i+1,j+1+n1,1);
	rep2(i,0,n1)Network::adde(S,i+1,1);
	rep2(i,0,n2)Network::adde(i+1+SZ(a[0]),T,1);
	int cnt=Network::isap(T);n1-=cnt,n2-=cnt;
	int ans=cnt;
	if(n1&1)ans+=3,n1--,n2--;
	ans+=n1+n2;
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)

typedef long long ll;

int main() {
    int A, B; cin >> A >> B;
    int a = A+B;
    int ans = max(a, A-B);
    ans = max(ans, A*B);
    cout<<ans<<endl;
}

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

using namespace std;
using ll = long long;

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

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

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;

    ll output = b - a + 1;
    output -= b / c - (a - 1) / c;
    // cout << b / c - (a - 1) / c << endl;
    output -= b / d - (a - 1) / d;
    // cout << b / d - (a - 1) / d << endl;
    // cout << lcm(a, b) << endl;
    output += b / lcm(c, d) - (a - 1) / lcm(c, d);

    cout << output << endl;

    return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n;
string s;

bool NextA(bool now, bool be, bool ans) {
  if(now && ans) return be;
  else if(now && !ans) return !be;
  else if(!now && ans) return !be;
  else return be;
}

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

  cin >> n >> s;

  REP(i, (1 << 2)) {
    vector<bool> c(n);
    c[0] = (i & 1);
    c[1] = (i & 1 << 1);
    bool n_a = NextA(c[0], c[1], (s[0] == 'o'));

    FOR(i, 1, n - 1) {
      c[i + 1] = NextA(c[i], c[i - 1], (s[i] == 'o'));
    }
    bool l_a = NextA(c[n - 1], c[n - 2], (s[n - 1] == 'o'));
    if(c[n - 1] == n_a && c[0] == l_a) {
      REP(i, n) cout << (c[i] ? 'S' : 'W');
      cout << endl;
      return 0;
    }
  }

  cout << -1 << endl;
}


Measured memory_bytes: 592
# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

import fractions as math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def solve():
    n = II()
    T = [II() for _ in range(n)]

    t1 = T[0]
    l = t1
    for t2 in T[1:]:
        l = lcm(t1, t2)
        t1 = l
    print(l)


if __name__ == '__main__':
    solve()


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

using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;

#define out(a) cout << a << endl
#define out1(a) cout << a
#define in(a) cin >> a
#define in2(a, b) cin >> a >> b
#define in3(a, b, c) cin >> a >> b >> c
#define rep(i, N) for (ll i = 0; i < (ll)N; i++)
#define rep1(i, N) for (ll i = 1; i <= (ll)N; i++)
#define repi(i, j, N) for (ll j = (ll)i + 1; j < (ll)N; j++)
#define all(v) v.begin(), v.end()
#define pb(a) push_back(a)

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

constexpr int inf = 1e9;
constexpr ll linf = 1e18;
constexpr ll mod = 1e9 + 7;
constexpr int MAX = 200020;

void solve()
{
    int n;
    in(n);
    vi a(n), b(n), c(n);
    rep(i, n)
    {
        in(a[i]);
    }
    sort(all(a));
    rep(i, n)
    {
        in(b[i]);
    }
    rep(i, n)
    {
        in(c[i]);
    }
    sort(all(c));
    ll ans = 0;
    rep(i, n)
    {
        ll low = lower_bound(all(a), b[i]) - a.begin();
        ll up = c.end() - upper_bound(all(c), b[i]);
        ans += low * up;
    }
    out(ans);
}

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

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1L << 30
#define long long long

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


int main(){
	int N;
	cin >> N;
	int ans = 0;
	if (N%2 == 0){
		ans = N/2;
	}else{
		ans = N/2+1;
	}
	cout << ans << endl;


}



Measured memory_bytes: 256
#!/usr/bin/env python3
# n,m = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(sys.stdin.readline() for _ in range(n)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# n = int(sys.stdin.readline())
# INF = float("inf")
# sys.setrecursionlimit(10000)
import sys,collections,math
sys.setrecursionlimit(100000)
N = int(sys.stdin.readline())
i = 2
lim = N**0.5
res = []
while i <= lim:
    if N%i != 0:
        i += 1
        continue
    ex = 0
    while N%i == 0:
        ex += 1
        N = N/i
    res.append((i,ex))
    i += 1
if N != 1: res.append((N,1))
def num(n):
    s = 1
    ret = 1
    while s+ret < n: # 1 ok #2 ok
        ret += 1
        s += ret
    return ret

# for i in range(11):
#     print(num(i))

#print(res,[num(x) for _,x in res])
print(sum(num(x) for _,x in res))


Measured memory_bytes: 9720
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

vector<int> vec;
int max_length = 0;
int e = 0;
int f = 0;

int main(){
    int n;
    cin>>n;
    for(int i = 0 ; i < n ; i++){
        int k;
        cin>>k;
        vec.push_back(k);
    }
    while(f < n - 1){
        //cout<<f<<" "<<n<<" "<<endl;
        int cur = vec[f];
        int len = 0;
        for(int j = f + 1 ; j < n ; j++){
            if(vec[j] > cur){
                f = j;
                break;
            }    
            len++;
            max_length = max(max_length,len);
            cur = vec[j];
            e = j;
        }
        if(e == n - 1)
            break;
    }
    cout<<max_length<<endl;
	return 0;
}

Measured memory_bytes: 892
# coding: utf-8

S = input()

ok = "Yes"
for i in range(len(S)):
    if i % 2 == 1:
        if S[i] not in "LUD":
            ok = "No"
            break
    else:
        if S[i] not in "RUD":
            ok = "No"
            break

print(ok)


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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = (a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (a); i <= (long long)(n); i++)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std;

struct Edge {
    int cost, to;
    Edge(int to_, int cost_) : 
        to(to_), cost(cost_) { } 
};
using Graph = vector<vector<Edge> >;

void dijkstra(Graph& g, int s, v_int &dist, v_int &prev)
{
    int n = g.size();
    dist.assign(n, INF);
    prev.assign(n, -1);
    priority_queue<pii, vector<pii>, greater<pii> > que;

    dist[s] = 0;
    que.push(pii(0, s));
    
    while(!que.empty()) {
        pii p = que.top(); que.pop();
        int node = p.second;
        //if(dist[node] < p.second) continue;

        for(int i = 0; i < g[node].size(); i++) {
            Edge e = g[node][i];
            if (dist[e.to] > dist[node] + e.cost) {
                dist[e.to] = dist[node] + e.cost;
                que.push(pii(dist[e.to], e.to));
                prev[e.to] = node;
            }
        }
    }
}

int main(void)
{
    int n, m;
    cin >> n >> m;
    Graph node(n);
    map<pii, bool> used_path;

    irep(i, m) {
        int a, b, c;
        cin >> a >> b >> c;
        node[a-1].push_back(Edge(b-1, c));
        node[b-1].push_back(Edge(a-1, c));
        used_path[pii(a-1,b-1)] = false;
    }

    irep(start, n) {
        v_int prev;
        v_int dist;

        dijkstra(node, start, dist, prev);

        irep(i, n) {
            v_int path;
            if(i == start) { continue; }
            for (int cur = i; cur != -1; cur = prev[cur]) {
                path.push_back(cur);
            } 
            irep(j, path.size()-1) {
                used_path[pii(path[j], path[j+1])] = true;        
                used_path[pii(path[j+1], path[j])] = true;        
            }
        }
    }

    int ans = 0;
    for(auto path : used_path) {
        if(!path.second) { ans++; }
    }

    cout << ans << endl;

    return 0;
}
/** atcoder **/


Measured memory_bytes: 384
INF = 10 ** 9
a, b, c, x, y = map(int, input().split())

ans = INF
for i in range(10 ** 5 + 1):
    ans = min(ans, i * 2 * c + max((x - i), 0) * a + max((y - i), 0) * b)
print(ans)


Measured memory_bytes: 39536
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

N,i = inputIL()

print(N-i+1)


Measured memory_bytes: 63980
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int A,B,K;
    cin >> A >> B >> K;
    if(2*K<=B-A+1){
    for(int i=A; i<=min(A+K-1,B); i++)
        cout << i << endl;
    for(int i=max(B-K+1,A+K); i<=B; i++)
        cout << i << endl;
    }
    else{
        for(int i=A; i<=B; i++){
            cout << i << endl;
        }
    }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const long double EPS = 1E-10;

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



int main(){
    int N, K, d, A; std::cin >> N >> K;
    std::vector<bool> have(N, false);
    for(int i(0); i < K; ++i){
        std::cin >> d;
        for(int j(0); j < d; ++j){
            std::cin >> A;
            have[A-1] = true;
        }
    }
    int cnt(0);
    for(int i(0); i < N; ++i){
        if(!have[i]) ++cnt;
    }
    std::cout << cnt << std::endl;
    return 0;
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
    int MAX = 2000000;
    long MOD = 1000000007L;
    long[] fac,finv,inv;

    Main(){
        init();

        Scanner scanner = new Scanner(System.in);
        long K = scanner.nextLong();
        long S = scanner.next().length();

        long R = 0;
        for (long i = 0L; i <= K; i++) {
            R = ( R +
                ( ( (modPow(26, i) * modPow(25,K-i)) % MOD)
                * COM((int)(S+K-i-1),(int)(S-1)))%MOD ) % MOD;
        }

        System.out.println(R);
    }

    void init(){
        fac  = new long[MAX];
        finv = new long[MAX];
        inv  = new long[MAX];

        fac[0]  = fac[1]  = 1;
        finv[0] = finv[1] = 1;
        inv[1]  = 1;
        for(int i =2 ; i < MAX; i++){
            fac[i]  = fac[i-1] * i % MOD;
            inv[i]  = MOD - inv[(int)(MOD%i)] * (MOD/i) % MOD;
            finv[i] = finv[i-1] * inv[i] % MOD;
        }
    }

    long COM(int n, int k){
        if(n < k)return 0;
        if(n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
    }

    long modPow(long a, long b){
        long R = 1L;

        a %= MOD;
        while(b > 0){
            if( (b & 1) == 1)
                R = (R * a) % MOD;
            a = (a * a) % MOD;
            b = b >> 1;
        }

        return R;
    }

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


Measured memory_bytes: 103680
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: chars,
    }
    println!("{}", s.iter().filter(|c| **c == '1').count())
}


Measured memory_bytes: 4352
//  IT'S NEVER TOO LATE...

		    #include <bits/stdc++.h>
			#include <complex>
		    #define ll long long

			#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
			#define forn(i, n) fore(i, 0, n)
			#define fori(i, l, r) fore(i, l, (r) + 1)
			#define sz(v) int((v).size())
			#define all(v) (v).begin(), (v).end()
			#define pb push_back
			#define mp make_pair
		    #define ff first
		    #define ss second
			#define inf 1e9
		    
			#define C complex<int>
			#define X real()
			#define Y imag()

		    using namespace std; 

		    const double PI = atan(1)*4;


		    bool isprime(int n)
		    {
		        for(int i=2;i*i<=n;i++)
		            if(n%i==0)
		                return false;
		        return true;
		    }
		     
		    bool comp(pair<int,int> a, pair<int,int> b)
		    {
		    	return b.ff < a.ff ;
		    }

		    int modpow(int b,int p,int m)
		    {
		    	if(p==0) return 1%m;
		    	if(p%2) return (b*modpow(b,p-1,m))%m;
		    	int u=modpow(b,p/2,m);
		    	return (u*u)%m;
		    }

		    vector<pair<int,int>> ar[100005];
		    int vis[100005],from[100005];
		    double dis[100005];
		    
		     
		    void dikstra(int s,int n)
		    {
		    	forn(i,n+3)
		    	{
		    		dis[i]=inf;
		    		vis[i]=0;
		    		from[i]=-1;
		    	}

		    	dis[s]=0;
		    	priority_queue<pair<int,int>> q;
		    	q.push({0,s});
		    	from[s]=s;

		    	while(!q.empty())
		    	{
		    		pair<int,int> a;
		    		a=q.top();
		    		q.pop();
		    		//cout<<a.ss<<" ";

		    		if(vis[a.ss]) continue;
		    		vis[a.ss]=1;

		    		for(pair<int,int> b:ar[a.ss])
		    		{
		    			if(dis[b.ff]>dis[a.ss] + b.ss)
		    			{
		    				dis[b.ff]=dis[a.ss] + b.ss;
		    				from[b.ff]=a.ss;
		    				q.push({-dis[b.ff],b.ff});
		    			}
		    		}
		    	}
		    }


		    int main()
		    {
		    //	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
		     
		    	#ifndef ONLINE_JUDGE
		        freopen("input.txt","r", stdin);
		        freopen("output.txt", "w", stdout);
		        #endif
		     
		    	int t=1;
		    	//cin>>t;
		    	
		    	while(t--)
		    	{
		    		int n,k;
		    		cin>>n>>k;

		    		set<int> s;
		    		forn(i,k)
		    		{
		    			int d,x;
		    			cin>>d;

		    			forn(i,d)
		    			{
		    				cin>>x;
		    				s.insert(x);
		    			}
		    		}

		    		cout<<n-s.size();
		    	}

		    	cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";

		    	return 0;
		    }
		    				//              NOW IT'S TIME TO WAKE UP...

Measured memory_bytes: 6108
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int n;
  cin>>n;
  int x=n;
  int f=0;
  REP(i,10){
    f += n%10;
    n /= 10;
  }
  if(x%f==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<string.h>
#include<queue>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<cstdlib>
#include<math.h>
#include<set>
#include<array>
using namespace std;

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; }



#define rep(n) for(int i=0;i<(n);i++)
typedef pair<int, int> pii;

typedef long long ll;
typedef pair<ll, ll>pll;
const int MOD = 1000000007;
const int INF = 1 << 29;




int main() {
	ll l, r;
	cin >> l >> r;
	if (l == 0 || r == 0 || (r - l) >= 673)cout << 0 << endl;
	else {
		ll mi = l % 2019 * (l + 1) % 2019;
		for (ll i = l; i < r; i++) {
			for (ll j = l + 1; j <= r; j++) {
				mi = min(mi, i % 2019 * j % 2019);
			}
		}
		cout << mi << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#pragma once
#include <stdio.h>
#include <sstream>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const ll MAX = 210000;
const ll MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

// res[i][c] := i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
vector<vector<int> > calcNext(const string & S) {
	int n = (int)S.size();
	vector<vector<int> > res(n + 1, vector<int>(26, n));
	for (int i = n - 1; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j];
		res[i][S[i] - 'a'] = i;
	}
	return res;
}
// mod 1000000007 の世界で a += b する関数
void add(long long& a, long long b) {
	a += b;
	if (a >= MOD) a -= MOD;
}
const ll ainf = 998244353;

void solv() {
	int a,b,t;
	cin >> a >> b >> t;
	cout << (t / a) * b << endl;

}

int main() {
	//COMinit();
	solv();

	return 0;
}


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

using namespace std;

#define YES(n) cout << (n?"YES":"NO")<<endl;
#define Yes(n) cout << (n?"Yes":"No")<<endl;

int main() {
    string S;
    cin >> S;
    S[0] = '2';
    S[1] = '0';
    S[2] = '1';
    S[3] = '8';
    cout << S << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fr first
#define se second
#define pb push_back

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

int N,M;
string S;

signed main(){
  cin>>S;
  if(S.at(1)=='R'){
    print("ABC");
  }
  else{
    print("ARC");
  }
  

}


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

int x[101];

int ch(int a){

  int ans=1000000000,as=0;
  for(int i=1;i<=100;i++){
      as=0;
    for(int j=0;j<a;j++){
      as += (x[j]-i)*(x[j]-i);
    }
    ans = min(ans,as);
  }
  return ans;
}

int main() {

  int n;
  for(int i=0;i<101;i++){
    x[101]=0;
  }
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> x[i];
  }
  cout << ch(n) << endl;
  return 0;

}


Measured memory_bytes: 256