akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>











string s;



void solve()
{
	cin >> s;
	if(s == "ABC")cout << "ARC\n";
	else cout << "ABC\n";
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt","r",stdin);
#endif
	solve();
	return 0;
}

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


using namespace std;

int main(void)
{
	int n,flag;
	int i;
	flag = 0;
	string str;
	cin >> str;
	sort(str.begin(), str. end());
	for (i = 0; i < str.length(); i++)
	{
		if (str[i] == str[i + 1])
		{
			flag = 1;
			break;
		}
		if (i == str.length() - 1)
		{
			flag = 2;
		}
	}
	if (flag == 1)
	{
		cout << "no" << endl;
	}
	else if (flag == 2)
	{
		cout << "yes" << endl;
	}
	return 0;
}


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

using namespace std;

long long num_bits(long long n)
{
    long long count = 0;
    while (n > 0) {
        ++count;
        n >>= 1;
    }

    return count;
}

int main()
{
    long long N, M;
    cin >> N >> M;
    priority_queue<long long> A;
    for (long long i = 0; i < N; ++i) {
        long long a;
        cin >> a;
        A.push(a);
    }

    auto remain = M;
    while (remain > 0) {
        const auto a = A.top() / 2;
        A.pop();
        A.push(a);
        --remain;
    }

    long long ans = 0;
    while (!A.empty()) {
        auto a = A.top();
        ans += a;
        A.pop();
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1400
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc =new Scanner(System.in);
		
		int Christmas = 25;
		int N = sc.nextInt();
		if(N ==25) {
			System.out.println("Christmas ");
			System.exit(0);
		}
		System.out.print("Christmas ");
		for(int i =0; i<Christmas-N; i++) {
			System.out.print("Eve ");
		}
	}

}


Measured memory_bytes: 35644
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;

void insertionSort(vector<int> &a, int n) {
  FOR(i, 1, n) {
    int m = a[i];
    FORR(j, i-1, -1) {
      if (j == -1) a[0] = m;
      else if (m < a[j]) {
        a[j+1] = a[j];
      }
      else {
        a[j+1] = m;
        break;
      }
    }
    rep(j, n) {
      if (j) cout << " ";
      cout << a[j];
    }
    cout << endl;
  }
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) {
    cin >> a[i];
    if (i) cout << " ";
    cout << a[i];
  }
  cout << endl;
  insertionSort(a, n);

  
  return 0;
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  vector<bitset<10>> info(n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 10; j++) {
      int f; cin >> f;
      info[i][j] = f;
    }
  }
  vector<vector<int>> p(n, vector<int>(11));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 11; j++) {
      cin >> p[i][j];
    }
  }
  int ans = -1001001001;
  for (int i = 1; i < (1 << 10); i++) {
    bitset<10> comb(i);
    int score = 0;
    for (int j = 0; j < n; j++) {
      score += p[j][(comb & info[j]).count()];
    }
    ans = max(ans, score);
  }
  cout << ans << '\n';
  return 0;

}

Measured memory_bytes: 256
#include <iostream>
//#include <iomanip>
#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
//using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int h,w,k ;

int DFS1(vector<vector<int>> &ans,int i,int j){
	if(ans.at(i).at(j)!=-1) return ans.at(i).at(j) ;
	if(i==h-1) return -1 ;
	return DFS1(ans,i+1,j) ;
}

int DFS2(vector<vector<int>> &ans,int i,int j){
	if(ans.at(i).at(j)!=-1) return ans.at(i).at(j) ;
	if(i==0) return -1 ;
	return DFS1(ans,i-1,j) ;
}

int main(){
	cin >> h >> w >> k ;
	vector<string> cake(h) ;
	vector<int> v(h,0) ;
	for(int i=0;i<h;i++) cin >> cake.at(i) ;
	for(int i=0;i<h;i++){
		bool ok = true ;
		for(int j=0;j<w;j++){
			if(cake.at(i).at(j)=='#') ok = false ;
		}
		if(ok) v.at(i) = 1 ;
	}
	vector<vector<int>> ans(h,vector<int>(w,-1)) ;
	int cnt = 1 ;
	for(int i=0;i<h;i++){
		if(v.at(i)) continue ;
		bool ok = false ;
		for(int j=0;j<w;j++){
			if(cake.at(i).at(j)=='.') ans.at(i).at(j) = cnt ;
			else{
				cnt += ok ;
				ok = true ;
				ans.at(i).at(j) = cnt ;
			}
		}
		cnt++ ;
	}
	for(int i=0;i<h;i++){
		if(v.at(i)){
			if(DFS2(ans,i,0)==-1){
				for(int j=0;j<w;j++){
					ans.at(i).at(j) = DFS1(ans,i,j) ;
				}
			}else{
				for(int j=0;j<w;j++){
					ans.at(i).at(j) = DFS2(ans,i,j) ;
				}
			}
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cout << ans.at(i).at(j) << (j==w-1?'\n':' ') ;
		}
	}
}


Measured memory_bytes: 1280
n = int(input())
lst = []
for i in range(n):
	lst.append(list(map(int,input().split())))

cnt = 0

for i in range(n):
	if lst[i][0]==lst[i][1]:
		cnt += 1
	else:
		cnt = 0
	if cnt == 3:
		print('Yes')
		exit()
print('No')

Measured memory_bytes: 9136
n, k = map(int, input().split())
s = input()
a = s.count("RL")
ans = 0
for i in range(n - 1):
    if s[i] == s[i + 1]:
        ans += 1
for i in range(1, k + 1):
    if n - 1 - ans > 1:
        ans += 2
    else:
        ans += n - 1 - ans
        break
print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define CLR(a,b) memset(a,(b),sizeof(a))
const int N = 1e4;
bool vis[N], vps[N];
int main()
{
    int a, b, c, d;
    CLR(vis,false); CLR(vps,false);
    cin>>a>>b>>c>>d;
    for(int i = a; i <= b; i++) vis[i] = true;
    for(int i = c; i <= d; i++) vps[i] = true;
    int k = 0;
    for(int i = 0; i <= 100; i++) {
        if(vis[i] && vps[i]) k++;
    }
    if(k > 0) k--;
    cout<<k<<endl;
return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split())) 
E = []
for i in range(N):
    if A[i] % 2 == 0:
        E.append(A[i])

K = True
for j in range(len(E)):
    if E[j] % 5 == 0 and E[j] % 3 == 0:
        pass
    elif E[j] % 5 == 0:
        pass
    elif E[j] % 3 == 0:
        pass
    else:
        K = False

print('APPROVED' if K == True else 'DENIED')

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

int main(){

  char str[19];
  int i;

  scanf("%s",&str);

  for(i=0;i<19;i++){
    if(str[i]==','){
      str[i]=' ';
    }
  }
  printf("%s\n",str);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
/*
#ifndef ONLINE_JUDGE
    #define cin f
    #define cout g
    ifstream cin("a.in");
    ofstream cout("a.out");
#endif
*/
int k;
char a[3002],b[3002],S[3002];
int D[3002][3002];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>(a+1)>>(b+1);
    int N=strlen(a+1);
    int M=strlen(b+1);
    for(int i=1;i<=N;++i)
        for(int j=1;j<=M;++j) D[i][j]=(a[i]==b[j]?1+D[i-1][j-1]:max(D[i-1][j],D[i][j-1]));
    for(int i=N,j=M;i&&j;)
        if(a[i]==b[j]) S[++k]=a[i],--i,--j;
        else D[i-1][j]<D[i][j-1]?--j:--i;
    for(int i=k;i;--i) cout<<S[i];
    return 0;
}


Measured memory_bytes: 35456
import sys
sys.setrecursionlimit(100000)

N, M = map(int, input().split())
Edge = [[]for _ in range(N)]
Far = [-1]*N
for _ in range(M):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    Edge[x].append(y)


def long(x):
    if len(Edge[x]) == 0:
        Far[x] = 0
        return 0
    if Far[x] >= 0:
        return Far[x]
    r = 0
    for i in Edge[x]:
        l = long(i) + 1
        r = max(r, l)
    Far[x] = r
    return r


for i in range(N):
    long(i)
print(max(Far))




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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template<typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template<typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template<typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template<typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  i64 A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;
  f80 ma = 0;
  i64 w = 0, s = 0;
  rep(a, 31) rep(b, 31) {
    i64 wa = (A * a + B * b) * 100;
    rep(c, 1501) rep(d, 1501) {
      i64 su = C * c + D * d;
      if (wa + su > F) break;
      if (su > wa / 100 * E) break;
      if (100 * su / (f80) (wa + su) >= ma) {
        ma = 100 * su / (f80) (wa + su);
        w = wa + su, s = su;
      }
    }
  }
  cout << w << " " << s << '\n';
}


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

#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define out(a) cout << a << endl
#define PRINT(V) for (auto v : (V)) cout << v << " "

const int MOD = 1000000007;
const double PI = acos(-1.0);

void solve() {
    ll K;
    string S;
    cin >> K >> S;
    if(S.size() <= K) out(S);
    else{
        rep(i, K) cout << S[i];
        cout << "..." << endl;
    }
}
int main() {
    INCANT;
    solve();
    return 0;
}




Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define forn(i,a,b) for(int i =a;i<b;i++)
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);
using namespace std;

//for debugging 
/*
g++ -D_GLIBCXX_ASSERTIONS -DDEBUG -ggdb3 -std=c++14 
*/
int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
	os<<"[";
	for(auto& x:v){os<<x<<", ";}
	return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
	return os<<"{"<<p.first<<", "<<p.second<<"}";
}
// debugging ends here

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

const ll modi = 1e9+7;
const ll INV_TWO = (modi+1)/2;


void solve(){
	int n;
	cin >> n;
	ll a[n];
	ll sum = 0;
	ll squares = 0;
	for(int i =0;i<n;i++){
		cin >> a[i];
		sum+=a[i];
		sum%=modi;

		squares = (squares + a[i]*a[i]%modi)%modi;
		squares%=modi;
	}
	// ll store = sum;
	sum = sum*sum%modi;
	sum = (sum+modi - squares)%modi;
	cout << (sum*INV_TWO)%modi << endl;

}

int main(){
	fast;
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	// int t;cin >> t;while(t--)
		solve();
}


Measured memory_bytes: 5176
n, m, x, y = [int(i) for i in input().split(" ")]
x_range = [int(i) for i in input().split(" ")]
y_range = [int(i) for i in input().split(" ")]
war = True
for z in range(x, y):
    if x < z <= y and max(x_range) < z <= min(y_range[:m]):
        war = False
print("War" if war else "No War")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
typedef unsigned long long int ull;
typedef long double ldb;
typedef long long int ll;
 
#define for01(k,n)  for (ll i=k; i<n; i++)
#define for02(k,n)  for (ll j=k; j<n; j++)
#define for03(k,n)  for (ll k=k; k<n; k++)
#define for11(k,n)  for (ll i=k; i<=n; i++)
#define for12(k,n)  for (ll j=k; j<=n; j++)
#define for13(k,n)  for (ll k=k; k<=n; k++)

#define pb push_back
#define mp make_pair
#define pf push_front
#define popf pop_front
#define popb pop_back
#define vll vector<ll>
#define F first
#define S second
#define pp pair <ll, ll>
#define lb lower_bound
#define ub upper_bound
#define emp empty()
#define beg begin()
#define en end()
#define si size()
#define bk back()
#define deci(n)  fixed<<setprecision(n)

#define p0(a) cout << a << " "
#define p1(a) cout << a << "\n"

#define mem(a,n) memset(a, n, sizeof(a)); // n = 0 OR -1 only

#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define MOD 1000000007
#define MOD2 998244353

#include <boost/algorithm/string/replace.hpp>

using namespace std;

int fast_pow(ll base, ll n, ll M)   // calculate the value of base^p in O(log p)
{
    if(n==0)
       return 1;
    
    if(n==1)
        return base;
    
    ll halfn = fast_pow(base, n/2, M);
    
    if(n%2==0)
        return ( halfn * halfn ) % M;
    else
        return ( ( ( halfn * halfn ) % M ) * base ) % M;
}


int main()
{
  ll n;
  cin >> n;
  
  ll *a = new ll[n];
  
  for01(0,n)
    cin >> a[i];
  
  ll *b = new ll[n];
  
  for01(0,n)
    b[i] = abs(n-2*i-1);
  
  sort(b,b+n);
  sort(a,a+n);
  
  //for01(0,n)
   // cout << a[i] << " " << b[i] << endl;
  
  for01(0,n)
  {
    if(a[i] != b[i])
    {
      p1(0);
      return 0;
    }
  }
  
  p1(fast_pow(2, n/2, MOD));
  
 
  return 0;
}


Measured memory_bytes: 1792
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_time = [0]
b_time = [0]

for i in range(n):
    a_time.append(a_time[-1] + a[i])
for j in range(m):
    b_time.append(b_time[-1] + b[j])

j = m
cnt = 0

for i in range(n+1):
    if a_time[i] > k:
        continue

    while j > 0 and a_time[i] + b_time[j] > k:
        j -= 1
    cnt = max(cnt, i + j)

print(cnt)

Measured memory_bytes: 47548
#include<bits/stdc++.h>
using namespace std;
typedef long long llint;
const llint MOD = 1'000'000'007;

int main() {
    llint N, K;
    cin >> N >> K;
    vector<int> v(N + 1), broj_manjih_poslije(N + 1), broj_manjih_sve(N + 1);
    for(int i = 0; i < N; i++) {
        cin >> v[i];
    }
    llint rez = 0;
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            if(v[j] < v[i]) {
                broj_manjih_sve[i]++;
                if(j > i)
                    broj_manjih_poslije[i]++;
            }
        }
        rez += ((((K * (K - 1)) / 2) % MOD) * broj_manjih_sve[i] + K * broj_manjih_poslije[i]);
        rez %= MOD;
    }
    cout << rez;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

////////////////////////////////////////////////////////


int main() {
    ll n; cin >> n;
    string s, t; cin >> s >> t;
    ll a = 2*n;
    ll ans = a;
    rep(i, 0, n){
        string ss = s.substr(n-1-i, i+1), tt = t.substr(0, i+1);
        if(ss == tt) chmin(ans, a-i-1);
    }

    co(ans);

    return 0;
}


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

int main(){
    ll n;
    cin >> n;
    ll a,b;
    cin >> a >> b;
    ll c = a+b;
    ll ans = a*(n/c);
    ans += min(n%c,a);
    cout << ans << endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define AC cout << "AC" << endl;
#define WA cout << "WA" << endl;

#define out(s) cout << s << endl;

#define ll long long
#define ull unsigned long long

const unsigned int BIT_FLAG_0 = (1 << 0);  // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1);  // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2);  // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3);  // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4);  // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5);  // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6);  // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7);  // 0000 0000 1000 0000

const double PI = 3.14159265358979323846;

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

#define H_MAX 500
#define W_MAX 500
#define INF 1e9 + 7

int main() {
    int N;
    cin >> N;
    if (N % 1000 > 0) {
        cout << 1000 - N % 1000 << endl;
    } else {
        cout << 0 << endl;
    }
}


Measured memory_bytes: 3524
#include <iostream>

using namespace std;

int main (void) {
    long long N, M;
    cin >> N >> M;

    long long ans;
    if ( N == 1 && M == 1 )
        ans = 1;
    else if ( N == 1 )
        ans = M - 2;
    else if ( M == 1 )
        ans = N - 2;
    else if ( N == 2 || M == 2 )
        ans = 0;
    else {
        /*
         * どちらも 1 でないとき、
         * 四隅 : 表
         * 内部 : 裏
         * 辺上 : 表
         */
        ans = (N - 2) * (M - 2);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import sys

M = 1046527
def h1(key):
    return key % M

def h2(key):
    return 1 + (key %(M-1))

def h3(key, i):
    return (h1(key) + i*h2(key)) % M

word_dic = {'A': 1, 'T': 2, 'G': 3, 'C': 4}
def getkey(text):
    sum = 0
    p = 1
    for c in text:
        sum += p*word_dic[c]
        p *= 5
    return sum

dict = [None for i in range(M)]
def find(text):
    key = getkey(text)
    i = 0
    while i < M:
        h = h3(key, i)
        if dict[h] == None:
            break
        elif dict[h] == text:
            return True
        i += 1
    return False

def insert(text):

    key = getkey(text)
    i = 0
    while i < M:
        j = h3(key, i)
        if dict[j] == None:
            dict[j] = text
            break
        else:
            i += 1

n = int(input())
operations = sys.stdin.readlines()
for ope in operations:
    op, text = ope.rstrip().split(' ')
    if op == 'insert':
        insert(text)
    elif op == 'find':
        rst = find(text)
        if rst:
            print('yes')
        else:
            print('no')



Measured memory_bytes: 123220
/*
*/

#define _CRT_SECURE_NO_WARNINGS

#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds

#define eps 1e-6
#define M_PI 3.141592653589793
#define bs 1000000007
#define bsize 337

using namespace std;

const int INF = 1e9;
const int N = 101231;

int n;
int ans;

int solve(int x)
{
	return x*(x + 1) / 2;
}

int main(){
	//freopen("fabro.in","r",stdin);
	//freopen("fabro.out","w",stdout);
	//freopen("F:/input.txt", "r", stdin);
	//freopen("F:/output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	//cin.tie(0);
	
	cin >> n;

	for (int r = 1; r <= n; r++)
	{
		if (solve(r) >= n)
		{
			ans = r;
			break;
		}
	}

	long long here = solve(ans);

	if (here == n)
	{
		//cout << ans << endl;
		for (int i = 1; i <= ans; i++)
		{
			cout << i << endl;
		}
	}
	else
	{
		int ohead = here - n;
		//cout << ans - 1 << endl;
		for (int i = 1; i <= ans; i++)
		{
			if (i != ohead)
				cout << i << endl;
		}
	}

	cin.get(); cin.get();
	return 0;
}

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

typedef long long ll;

int main() {
    ll x;
    cin >> x;
    ll ans = 0;
    ans += (x/11)*2;
    x -= (ans/2)*11;
    if (x <= 0) {
        cout << ans << endl;
        return 0;
    }
    ans += 1;
    x -= 6;
    if (x <= 0) {
        cout << ans << endl;
        return 0;
    }
    ans += 1;
    x -= 5;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
using namespace std;
int main() {
  int K;
  cin >>K;
  if(K%2 == 0) cout<<(K/2)*(K/2)<<endl;
  else cout  << ((K+1)/2)*((K+1)/2-1)<<endl; 
}


Measured memory_bytes: 256
n,a,b = map(int,input().split())
mod = 10 ** 9 + 7
fact = [1]
fact_inv = [1]
for i in range(2*(10**5)+5):
    new_fact = fact[-1]*(i+1)%mod
    fact.append(new_fact)
    fact_inv.append(pow(new_fact,mod-2,mod))
fact2 = 1
for i in range(n,n-a,-1):
    fact2 = fact2 * i %mod
fact3 = fact2
for i in range(n-a,n-b,-1):
    fact3 = fact3 * i %mod
#print(fact2,fact3,fact_inv[a],fact_inv[b])
ans = (2 ** n - 1) % mod
ans -= fact2 * fact_inv[a] % mod
if ans < 0:
    ans += mod
ans -= fact3 * fact_inv[b] % mod
if ans < 0:
    ans += mod
print(ans)

Measured memory_bytes: 285464
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Console;

namespace CPLib
{
    class Atria
    {
        const long mod = 1000000000 + 7;
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            int i = 0;
            int tmp = 0;
            while (tmp < n)
            {
                i++;
                tmp += i;
            }

            for (int j = 1; j <= i; j++)
            {
                if (tmp - n != j) WriteLine(j);
            }
        }
    }
}


Measured memory_bytes: 13140
#pragma region Header

#include <iostream>
#include <iomanip>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional>
#include <cmath>
#include <numeric>
#include <bitset>
#include <cstdint>
#include <stdexcept>
using namespace std;

// 整数型

using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;

// [0,n)を昇順/降順でループ

#define rep(i, n) for (int i = 0; i < static_cast<int>(n); ++i)
#define repd(i, n) for (int i = static_cast<int>(n) - 1; i >= 0; --i)

// [a,b)を昇順/降順でループ

#define FOR(i, a, b) for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define FORD(i, a, b) for (int i = static_cast<int>(b) - 1; i >= static_cast<int>(a); --i)

template <typename T>
int SZ(T x)
{
    return static_cast<int>(x.size());
}

#pragma endregion

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);

    int n;
    cin >> n;
    map<string, int> m;
    int max_cnt = 0;
    rep(i, n)
    {
        string s;
        cin >> s;
        ++m[s];
        max_cnt = max(max_cnt, m[s]);
    }
    for (auto &[s, cnt] : m)
    {
        if (cnt == max_cnt)
        {
            cout << s << "\n";
        }
    }

    return 0;
}


Measured memory_bytes: 19256
import string
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


a = S()
if a in string.ascii_lowercase:
    print('a')
else:
    print('A')


Measured memory_bytes: 9908
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int n,k, ans = 0;
    cin >> n >> k;
    rep(i, 0, n){
        int a;
        cin >> a;
        if (a >= k)
            ans++;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
n=int(input())
#a,b=map(int,input().split())
xl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
l2d=[]
for i in range(n):
    l2d.append([i,xl[i]])

xlsort=sorted(xl)
v1=xlsort[n//2-1]
v2=xlsort[n//2]

l2d.sort(key=lambda x: x[1])
dic={}
for i in range(n):
    dic[l2d[i][0]]=i
thre=n//2
for i in range(n):
    if dic[i]<thre:
        print(v2)
    else:
        print(v1)



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

int main(void){
  int N;
  int k;
  cin >> N;
  int M;
  M = N - 1;
  vector<double> num(N);
  for(int i = 0; i < N; i++){
    cin >> num.at(i);
  }
  
  sort(num.begin(), num.end());
  
  for(int j = 0; j < M; j++){
    k = j + 1;
    num.at(j) = (num.at(j) + num.at(k)) / 2.0;
    num.at(k) = 0;
    sort(num.begin(),num.end());
  }
  cout << fixed << setprecision(8);
  
  cout << num.at(M);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <math.h>
#include <queue>
#include <algorithm>
#include <utility>
#include <vector>
#include <tuple>
#include <numeric>
using namespace std;

struct UnionFind{
	vector<int> parent;
	UnionFind(int N) : parent(N){
		for(int i=0; i<N; i++){
			parent[i] = i;
		}
	}
	int getParent(int x){
		return parent[x];
	}

	int root(int x){
		if(parent[x]==x){
			return x;
		}else{
			return parent[x] = root(parent[x]);
		}
	}
	void unite(int x, int y){
		int rx = root(x);
		int ry = root(y);
		if(rx!=ry){
			parent[ry] = rx;
		}
	}
	bool same(int x, int y){
		int rx = root(x);
		int ry = root(y);
		return rx==ry;
	}
};

int main(int argc, char* argv[]){
	int N,M;
	scanf("%d %d", &N, &M);
	vector<int>A(M);
	vector<int>B(M);
	UnionFind tree(N);
	for(int i=0; i<M; i++){
		scanf("%d %d", &A[i], &B[i]);
		if(A[i]>B[i]){
			int tmp;
			tmp =  B[i];
			B[i] = A[i];
			A[i] = tmp;
		}
		tree.unite(A[i]-1, B[i]-1);
	}
	int count = 0;
	for(int i=0; i<N; i++){
		if(tree.getParent(i)==i){
			count++;
		}
	}
	printf("%d\n", count-1);

}



Measured memory_bytes: 4500
import java.io.*;
import java.util.*;

public class Main {
	FastScanner in = new FastScanner(System.in);
	PrintWriter out = new PrintWriter(System.out);

	String s;
	int idx;
	
	boolean parse(int next) {
		char c = s.charAt(idx++);
		switch (c) {
		case 'T': return true;
		case 'F': return false;
		case '-':
			return !parse(next);
		case '(':
			boolean b1 = parse(next);
			char c2 = s.charAt(idx++);
			boolean b2;
			switch (c2) {
			case '*':
				b2 = parse(next);
				idx++;
				return b1 && b2;
			case '+':
				b2 = parse(next);
				idx++;
				return b1 || b2;
			case '-':
				idx++;
				b2 = parse(next);
				idx++;
				return !b1 || b2;
			}
		default:
			if ((next >> (c - 'a') & 1) == 0) 
				return true;
			else
				return false;
		}
	}
	
	public void run() {
		loop : while (true) {
			s = in.next();
			idx = 0;
			if (s.matches("#")) break;
			
			for (int i = 0; i < (1 << 11); i++) {
				idx = 0;
				boolean b1 = parse(i);
				idx++;
				boolean b2 = parse(i);
				if (b1 != b2) {
					System.out.println("NO");
					continue loop;
				}
			}
			System.out.println("YES");
		}
		out.close();
	}

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

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}

		System.out.println("----------------------------");
		System.out.println();
	}

	public void debug(Object... obj) {
		System.out.println(Arrays.deepToString(obj));
	}

	class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
			//stream = new FileInputStream(new File("dec.in"));

		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

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

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}

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

int main() {
	string S;
	int X, Y, count = 0;
	bool lr = true;
	vector<int> UD, LR;
	cin >> S >> X >> Y;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'F') {
			count++;
		}
		else {
			if (lr) LR.push_back(count);
			else UD.push_back(count);
			count = 0;
			lr = !lr;
		}
	}
	if (lr) LR.push_back(count);
	else UD.push_back(count);
	static bool LR_DP[4010][16010] = {}, UD_DP[4010][16010] = {};
	LR_DP[0][8000 + LR[0]] = true;
	for (int i = 1; i < LR.size(); i++) {
		for (int j = 0; j <= 16000; j++) {
			if (j - LR[i] >= 0 && j + LR[i] <= 16000) LR_DP[i][j] = (LR_DP[i - 1][j - LR[i]] || LR_DP[i - 1][j + LR[i]]);
			else if (j - LR[i] >= 0) LR_DP[i][j] = LR_DP[i - 1][j - LR[i]];
			else if (j + LR[i] <= 16000) LR_DP[i][j] = LR_DP[i - 1][j + LR[i]];
		}
	}
	UD_DP[0][8000] = true;
	for (int i = 0; i < UD.size(); i++) {
		for (int j = 0; j <= 16000; j++) {
			if (j - UD[i] >= 0 && j + UD[i] <= 16000) UD_DP[i + 1][j] = (UD_DP[i][j - UD[i]] || UD_DP[i][j + UD[i]]);
			else if (j - UD[i] >= 0) UD_DP[i + 1][j] = UD_DP[i][j - UD[i]];
			else if (j + UD[i] <= 16000) UD_DP[i + 1][j] = UD_DP[i][j + UD[i]];
		}
	}
	if (LR_DP[LR.size() - 1][X + 8000] && UD_DP[UD.size()][Y + 8000]) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 125184
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ctoi(x) x-'0'
#define pshb(a) cin >> x;a.push_back(x)
#define fr(i,n) for(ll i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false);
using namespace std;
bool a[3] ;
int main()
{
    vector<ll> a ;
    ll n , x  , cnt=0 ;
    ll prev =1  ;
    cin>>n ;
    for (int i =0 ; i< n ; i++)
    {
        cin>>x ;
        a.push_back(x) ;
        if (prev==a[i])
        {
            prev++ ;
            cnt++ ;
        }
    }
    if (prev==1)
        cout<<-1 ;
    else
        cout<<n-cnt ;
}




Measured memory_bytes: 2420
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mod 1000000007
const long long INF = 1LL<<60;

int main() {
	string S;
	cin >> S;
	int a = S.length();
	char s[101000];
	for(int i = 0; i < a; i++){
		s[i] = S[i];
	}
	bool abc[26];
	for(int i = 0; i < 26; i++){
		abc[i] = false;
	}
	for(int i = 0; s[i] != '\0'; i++){
		abc[s[i] - 'a'] = true;
	}
	for(int i = 0; i < 26; i++){
		if(!abc[i]){
			cout << (char)(i + 'a') << endl;
			return 0;
		}
	}
	cout << "None" << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(){
    int ans =0;
    string S,T;
    cin >> S >>T;
    for(int i=0;i<S.size();i++){
        if(S[i]!=T[i]){
            ans++;
        }
    }
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 3856
#include<bits/stdc++.h>
using namespace std;
#define M 200005
int n,q;
vector<int>E[M];
int a,b;
int t[M];
int L[M],R[M],Cnt;
void Add(int x,int k) {
	while(x<=n)t[x]+=k,x+=x&-x;
}
int Query(int x) {
	int res=0;
	while(x)res+=t[x],x-=x&-x;
	return res;
}
void dfs(int x,int f) {
	L[x]=++Cnt;
	for(int i=0; i<(int)E[x].size(); ++i) {
		int u=E[x][i];
		if(u==f)continue;
		dfs(u,x);
	}
	R[x]=Cnt;
}
int main() {
	scanf("%d%d",&n,&q);
	for(int i=1; i<n; ++i) {
		scanf("%d%d",&a,&b);
		E[a].push_back(b);
		E[b].push_back(a);
	}
	dfs(1,0);
	while(q--) {
		scanf("%d%d",&a,&b);
		Add(L[a],b);
		Add(R[a]+1,-b);
	}
	for(int i=1; i<=n; ++i)printf("%d ",Query(L[i]));
}

Measured memory_bytes: 31104
info=gets.chomp.split(" ").map(&:to_i)
count=0
(0..(info[0]<info[1] ?info[1]: info[0])).reverse_each do|i|
	if(info[0]% i==0 and info[1]% i==0)
		count+=1
		if(count==info[2])
			print i
			break
		end
	end
end

Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
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 = 1e9;
const LL LLINF = 1e16;

using Graph = vector<vector<int>>;

int h, w, r, c;
int s[550][550], t[550][550];
int GL;
queue<int> que;

bool bfs(vector<Graph> &G, int st){
    vector<int> win(h*w+1, 0);
    win[GL] = 1;
    while(!que.empty()){
        int v = que.front(); que.pop();
        if(win[v]) continue;
        int tmp = 0;
        rep(i,2)for(auto &&x : G[i][v]){
            if(win[x]){
                tmp++;
                break;
            }
        }
        if(tmp == 2){
            win[v] = 1;
            rep(i,2)for(auto &&x : G[i][v]){
                if(!win[x]) que.push(x);
            }
        }
    }

    repe(i, G[0][st]) if(win[i]) win[st] = 1;
    return win[st];
}

int main(){
    cin >> h >> w >> r >> c;
    while(h > 0){
        GL = h*w;
        rep(i, w) cin >> s[0][i];
        rep(j, h){
            rep(i, w+1) cin >> t[j][i];
            rep(i, w) cin >> s[j+1][i];
        }
        vector<Graph> G(2, Graph(h*w));
        rep(y, h)rep(x, w){
            int i = y*w + x;
            int j = (s[y][x] == 1);
            if(y == 0) G[j][i].push_back(GL);
            else G[j][i].push_back((y-1)*w + x);
            j = (s[y+1][x] == 1);
            if(y == h-1) G[j][i].push_back(GL);
            else G[j][i].push_back((y+1)*w+x);
            j = (t[y][x] == 1);
            if(x == 0) G[j][i].push_back(GL);
            else G[j][i].push_back(y*w + x - 1);
            j = (t[y][x+1] == 1);
            if(x == w-1) G[j][i].push_back(GL);
            else G[j][i].push_back(y*w + x + 1);
            if(x == 0 || x == w-1 || y == 0 || y == h-1){
                que.push(i);
            }
        }
        r--; c--;
        int st = r*w + c;
        cout << (bfs(G, st) ? "Yes" : "No") << endl;
        cin >> h >> w >> r >> c;
    }
}


Measured memory_bytes: 33372
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
int main(){
  ll n;
  cin>>n;
  ll a[n+1];
  for(int i=1;i<=n;i++)cin>>a[i];
  vector<vector<ll>> dp(n+1,vector<ll>(21,-1));
  dp[0][0]=1;
  for(int i=1;i<=n;i++){
    for(int j=0;j<=20;j++){
      if(j-a[i]>=0){
        if(dp[i-1][j]!=-1){
         if(dp[i][j-a[i]]==-1)dp[i][j-a[i]]=dp[i-1][j];
          else dp[i][j-a[i]]+=dp[i-1][j];
        }
      }
      if(j+a[i]<=20){if(i==1&&a[i]==0)break;
        if(dp[i-1][j]!=-1){
       if(dp[i][j+a[i]]==-1)dp[i][j+a[i]]=dp[i-1][j];
          else dp[i][j+a[i]]+=dp[i-1][j];
        }
      }
    }
  }
  cout<<dp[n][0]<<endl;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define sz(x) ((x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(ll a, ll b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmax(T &a, const T &b){ if(a < b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(a > b){ a=b; return 1; } return 0; }

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

  string s, t;
  cin >> s >> t;

  s = s + s;
  if(s.find(t) != string::npos) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
sx,sy,tx,ty = map(int,input().split())

x = tx - sx
y = ty - sy

ret = ''

#first
ret += 'U' * y
ret += 'R' * x
ret += 'D' * y
ret += 'L' * x

#second
ret += 'L'

ret += 'U' * (y + 1)
ret += 'R' * (x + 1)

ret += 'DR'

ret += 'D' * (y + 1)
ret += 'L' * (x + 1)

ret += 'U'

print(ret)


Measured memory_bytes: 38384
A, B = [int(i) for i in input().split(' ')]

count = B - A + 1

res = 0
if count % 2:
    ones = (count - 1) / 2
    seed = A if A % 2 else B
    res = 1 ^ seed if ones % 2 else seed
else:
    ones = count / 2
    if A % 2:
        res = A ^ B ^ (0 if ones % 2 else 1)
    else:
        res = 1 if ones % 2 else 0

print(res)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x ,n) for(int i = x; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
    int n,k;
    cin >> n >> k;
    int l[n];
    rep(i,n)cin >> l[i];
    sort(l,l+n,greater<int>());
    int ans=0;
    rep(i,k)ans+=l[i];
    cout << ans;
}

Measured memory_bytes: 3596
var
 i,a,b,c,d,e,s,n,m,k:longint;
begin
 read(k,n,m);
 for i:=1 to k do 
  begin
   a:=i div 10000;
   b:=i mod 10000 div 1000;
   c:=i mod 1000 div 100;
   d:=i mod 100 div 10;
   e:=i mod 10;
   if (a+b+c+d+e>=n) and (a+b+c+d+e<=m) then s:=s+i;
  end;
  writeln(s);
  end.

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

int main()
{
    int n;
    cin >>n;
    int g=n*(n-1)/2;
    int a,b,c,d;
    vector<pair<int,int> > p(n);
    int x[n]={0};
    for(int i=0;i<g;i++){
        cin >>a>>b>>c>>d;
        if(c==d){
            x[a-1]++;
            x[b-1]++;
        }
        else if(c>d)x[a-1]+=3;
        else x[b-1]+=3;
    }
    for(int i=0;i<n;i++){
        p[i]=make_pair(x[i],i+1);
    }
    sort(p.rbegin(),p.rend());
    vector<pair<int,int> > q(n);
    for(int i=0;i<n;i++){
            int k=i;
            if(i==0){
            q[i]=make_pair(p[i].second,i+1);}
            else {
            while(k>=0){
                      if(p[k].first!=p[k-1].first)break;
                      k--;
                    }
            q[i]=make_pair(p[i].second,k+1);
            }
    }
    sort(q.begin(),q.end());
    for(int i=0;i<n;i++){
        cout << q[i].second<<endl;
    }

    return 0;


}



Measured memory_bytes: 3092
main(i,j,k,n,c){
	int a[3][3];
	for(i=0;i<3;i++)for(j=0;j<3;j++)scanf("%d",&a[i][j]);
	scanf("%d",&n);
	int b[n];
	for(i=0;i<n;i++) scanf("%d",&b[i]);
	for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<n;k++)if(b[k]==a[i][j])a[i][j]=0;
	for(i=0;i<3;i++)if((a[i][0]==a[i][1])&&(a[i][1]==a[i][2])) c=1;
	for(i=0;i<3;i++)if((a[0][i]==a[1][i])&&(a[1][i]==a[2][i])) c=1;
	if((a[0][0]==a[1][1])&&(a[1][1]==a[2][2])) c=1;
	if((a[0][2]==a[1][1])&&(a[1][1]==a[2][0])) c=1;
	if(c==1) puts("Yes");
	else puts("No");
}



Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < n; i++)
#define rrep(i, n) for(i = n - 1; i >= 0; i--)
using namespace std;

int main() {
	int a, b, c, x;
	cin >> a >> b >> c >> x;
	
	int i, j, k;
	int ans = 0;
	rep(i, a + 1) {
		rep(j, b + 1) {
			rep(k, c + 1) {
				int s = 500 * i + 100 * j + 50 * k;
				if (s == x) ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
	int n, x; cin >> n >> x;
	
	vector<int> l(n + 1); for (int i = 0; i < n; i++) { cin >> l[i + 1]; }
		
	int tmp = 0;
	int cnt = 1;

	for (int i = 2; i <= n + 1; i++) {

		tmp += l[i - 1];

		if (tmp <= x) {
			cnt++;
		}

	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
<?php
function sum($n){
  $s = 0;
  while($n > 0){
    $s += $n % 10;
    $n /= 10;
  }
  return $s;
}

list($n, $a, $b) = explode(' ', fgets(STDIN));
$total = 0;
for($i = 1; $i <= $n; $i++){
  $s = sum($i);
  if($s >= $a && $s <= $b){
    $total += $i;
  }
}
echo $total;
?>


Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
const int MAX=1e9;

int N, K, S;
void input(){
    cin>>N>>K>>S;
    if(S!=MAX){
        rep(_, K){
            cout<<S<<" ";
        }
        rep(_, N-K){
            cout<<S+1<<" ";
        }
    }
    else{
        rep(_, K){
            cout<<S<<" ";
        }
        rep(_, N-K){
            cout<<S-1<<" ";
        }      
    }
}
void solve(){

}

void output(){
  
}

int main(){
  input();
  solve();
  output();
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define MOD 998244353

struct llm{
    ll value=0;
    llm(const ll& val=0){this->value = (MOD + val % MOD) % MOD;}
    llm(const int& val){this->value = (MOD + val % MOD) % MOD;}
    llm(const llm& a) { llm(a.value); }
    llm inv(){ll a = 1;ll b = this->value;for(ll m=MOD-2;m>0;m/=2){if(m&1){a=a*b%MOD;}b=b*b%MOD;}return llm(a);}
    llm &operator+=(const llm &a) {this->value = (this->value + a.value) % MOD;return *this;}
    llm &operator-=(const llm &a) {this->value = (this->value - a.value + MOD) % MOD;return *this;}
    llm &operator*=(const llm &a) {this->value = (this->value * a.value) % MOD; return *this; }
    explicit operator ll() const{return (ll)value;}
    explicit operator int() const{return (int)value;}
};
llm operator+(const llm &a, const llm &b) { return llm(a.value + b.value); }
llm operator-(const llm &a, const llm &b) { return llm(a.value - b.value); }
llm operator*(const llm &a, const llm &b) { return llm(a.value * b.value); }
#define pllm pair<llm,llm>
#define FAN 5050505
llm Fa[FAN+4],iFa[FAN+4];
llm FaInit(){
    ll i;
    Fa[0] = 1;
    fornum(i,0,FAN){
        Fa[i + 1] = Fa[i] * (i + 1);
    }
    iFa[FAN] = Fa[FAN].inv();
    for (i = FAN - 1; i >= 0;--i)
    {
        iFa[i] = iFa[i + 1] * (i + 1);
    }
}
llm C(const ll& a,const ll& b){
    if(a<b||a<0||b<0)
        return 0;
    return Fa[a] * iFa[b] * iFa[a - b];
}


ll N,M;
ll i,j,k;
llm ans;
int main(){
    scanf("%lld%lld", &N, &M);
    FaInit();
    ans = C(N - 1 + M * 3, N - 1);
    //printf("%lld\n", (ll)ans);
    fornum(i,0,N+1){
        if(i>M*3)
            break;
        if ((M * 3 - i) % 2)
            continue;
        if(i<=M){
            ans -= C(N - 1, i) * N * C(N - 1 + (M - i - 2) / 2, N - 1);
            ans -= C(N - 1, i - 1) * N * C(N - 1 + (M - i) / 2, N - 1);
        }else{
            ans -= C(N, i) * C(N - 1 + (M * 3 - i) / 2, N - 1);
        }
    }
    printf("%lld", (ll)ans);
    return 0;
}

Measured memory_bytes: 79104
N, K = [int(n) for n in input().split(' ')]
dic = {}
for i in range(1, N+1):
  dic[i] = 0
for i in range(K):
  d = int(input())
  A = [int(n) for n in input().split(' ')]
  for j in A:
    dic[j] += 1

ans = 0

for i in dic.keys():
  if dic[i] == 0:
    ans += 1

print(ans)

Measured memory_bytes: 9208