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

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		boolean[] judge = new boolean[n];
		
		for( int i = 0; i < k; i++) {
			int d = scan.nextInt();
			for(int j = 0; j < d; j++) {
				int a = scan.nextInt();
				judge[a-1] = true;
			}
		}
		int ans = 0;
		for(int i = 0; i < judge.length; i++) {
			if(judge[i] == false) {
				ans++;
			}
		}
		System.out.print(ans);
		
	}

}


Measured memory_bytes: 46156
N=input()
S=input()
Sn=[]
R=0
G=0
B=0
for i in range(len(S)):
    if S[i]=='R':
        R+=1
        Sn.append(1)
    elif S[i]=='G':
        G+=1
        Sn.append(2)
    else:
        B+=1
        Sn.append(3)

count=0
for start in range(len(S)):
        for diff in range(1,int((len(S)-start+1)/2)):
            #int(start,diff)
            if (Sn[start]-Sn[start+diff])*(Sn[start+diff]-Sn[start+(2*diff)])*(Sn[start]-Sn[start+(2*diff)])!=0: 
                count+=1
                
print(str((R*G*B)-count))


Measured memory_bytes: 68376
#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define ll  long long
#define endl '\n'
void solve()
{
  ll n, a,m=0,b=1, c,k=0, i, j,l=1e9+7;
  string s, r, y;
  cin>>n;
 cout<<n+pow(n,2)+pow(n,3);
}
int main()
{
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
   //cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

Measured memory_bytes: 4096
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#define lim 1000000007ll
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T& a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T& b,T a){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template <class T> T gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T lcm(T a, T b){return a * b / gcd(a, b);}
inline bool operator<(const pii &lhs,const pii &rhs){return(lhs.second<rhs.second);}
template<class T> vector<pair<T,T>> duplicator(const vector<T>& input){vector<pair<T,T>> out(input.size()-1);rep(i,input.size()-1){out[i].first =input[i  ];out[i].second=input[i+1];}return(out);}
vector<char> String_to_vector_char(const string& input){vector<char> out(input.size());rep(i,input.size()){out[i]=input[i];}return out;}
int n,k;
string s;
void input(){
    cin>>n>>k;
    cin>>s;
}
void src(){
    s[k-1]=tolower(s[k-1]);
    cout<<s;
}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
    //ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

template<typename T>
vector<vector<T>> Make2DVector(int d1, int d2, T default_value) {
  return vector<vector<T>>(d1, vector<T>(d2, default_value));
}

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

constexpr int64 P = 1000000007;

struct FiniteField {
 private:
  int64 x;
  static inline int64 Normalize(int64 x) {
    if (0 <= x && x < P) return x; x %= P; if (x < 0) x += P; return x;
  }
 public:
  FiniteField(int64 x) : x(Normalize(x)) {}
  FiniteField() : x(0) {}
  int64 Value() const { return x; }
  inline FiniteField operator+(FiniteField o) const {
    FiniteField r(*this); r += o; return r;
  }
  inline FiniteField operator-(FiniteField o) const {
    FiniteField r(*this); r -= o; return r;
  }
  inline FiniteField operator* (FiniteField o) const {
    FiniteField r(*this); r *= o; return r;
  }
  inline FiniteField operator/ (FiniteField o) const {
    FiniteField r(*this); r /= o; return r;
  }
  inline void operator+= (FiniteField o) { x = (x + o.x) % P; }
  inline void operator-= (FiniteField o) { x = (x + P - o.x) % P; }
  inline void operator*= (FiniteField o) { x = (x * o.x) % P; }
  void operator/=(FiniteField o) {
    int64 p = P - 2; while (p) { if (p % 2) { *this *= o; } o *= o; p /= 2; }
  }
};

ostream& operator<<(ostream& s, const FiniteField& v) { s << v.Value(); return s; }

int Sum(const deque<int>& q) {
  int r = 0;
  for (int v : q) r += v;
  return r;
}

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

  int n, x, y, z;
  cin >> n >> x >> y >> z;

  auto is_valid_fn = [&](const deque<int>& vs) -> bool {
    if (Sum(vs) > x + y + z) return false;

    int c = 0;
    for (int v : vs) {
      if (c < x && c + v > x) return false;
      if (c < x + y && c + v > x + y) return false;
      c += v;
    }
    return true;
  };

  auto is_target_fn = [&](const deque<int>& vs) -> bool {
    return Sum(vs) == x + y + z && is_valid_fn(vs);
  };

  FiniteField ans = 0;

  vector<map<deque<int>, FiniteField>> dp(n + 1);
  dp[0][deque<int>()] = 1;
  for (int i = 0; i < n; i++) {
    for (const auto& kv : dp[i]) {
      for (int d = 1; d <= 10; d++) {
        deque<int> vs = kv.first;
        vs.push_back(d);
        while (!is_valid_fn(vs)) {
          vs.pop_front();
        }

        if (is_target_fn(vs)) {
          FiniteField m = 1;
          int p = n - (i + 1);
          for (int q = 0; q < p; q++) m *= 10;
          ans += kv.second * m;
        } else {
          dp[i + 1][vs] += kv.second;
        }
      }
    }

    // cout << i << " " << dp[i + 1].size() << endl;
  }
  cout << ans << endl;
}

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

int main() {
    long long int n,i,sum,min;
    scanf("%lld",&n);
    long long int a[n+1];
    sum=1;
    for(i=1;i<=n;i++)
    scanf("%lld",&a[i]);
    min=a[1];
    for(i=2;i<=n;i++)
    {
        if(min>=a[i])
        {
            sum++;
            min=a[i];
        }
        
    }
    cout<<sum;
    
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);
 int x,q,f,r;
 r=0;
 char p;
 string s,t;
 cin >> s >> q;
 while(q--)
 {
  cin >> x;
  if(x==1)
  r=(r+1)%2;
  else
  {
   cin >> f >> p;
   f=(f+r)%2;
   if(f==0)
   s.append(1,p);
   else
   {
    t="";
    t.append(1,p);
    t.append(s);
    s=t;
   }
  }
 }
 if(r==1)
 reverse(s.begin(),s.end());
 cout << s;
 return 0;
}

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

int main(){
  int a, b; cin >> a >> b;
  int integer = a / b;
  int rem = a % b;
  double c = a, d = b;
  double dec = c / d;

  cout << integer << " " << rem << " " << fixed << setprecision(5) << dec << endl;
  return 0;
}


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

#define pb push_back
#define ff first
#define ss second

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

int n, k;

void to() {
	for (int i = 0; i < (1 << n); i++)
		if (i != k) cout << i << ' ';
	cout << k << ' ';
}
void torev() {
	for (int i = (1 << n) - 1; ~i; i--)
		if (i != k) cout << i << ' ';
	cout << k << ' ';
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> k;
	if (k >= (1 << n))
		return cout << -1 << endl, 0;
	if (n == 1) {
		if (k == 1)
			return cout << -1 << endl, 0;
		else
			return cout << "0 1 1 0" << endl, 0;
	}
	to();
	torev();
	return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
int main(){
    int n,t,i,las=0,x;
    long long ans=0;
    scanf("%d %d",&n,&t);
    for(i=1;i<=n;i++){
        scanf("%d",&x);
        if(x>las+t) ans+=t;
        else ans+=x-las;
        las=x;
    }
    printf("%lld\n",ans+t);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <list>
# include <algorithm>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

char s[100];
int main() {
    int n,x;
    cin>>n;
    list<int>ls;
    string s;
    rep(i, n) {
        cin>>s;
        if (s=="insert") {
            cin>>x;
            ls.push_front(x);
        }
        else if (s== "delete") {
            cin>>x;
            auto it = find(ls.begin(), ls.end(), x);
            if (it != ls.end())ls.erase(it);
        }
        else if (s== "deleteFirst")ls.pop_front();
        else ls.pop_back();
    }
    for (auto it = ls.begin(); it != ls.end(); it++) {
        cout<<*it;
        if (it != --ls.end())cout<<" ";
    }
    cout<<endl;
}


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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] as = br.readLine().split(" ");
		int a = Integer.parseInt(as[0]);
		int b = Integer.parseInt(as[1]);
		int pStart = b*10;
		int pEnd = b*20;
		int result = -1;
		for(int i = pStart ; i< pEnd ;i++) {
			if( ((int)(i * 0.08)) == a  && ((int)(i * 0.1)) == b) {
				result = i;
				break;
			}
		}
		System.out.println(result);
	}

}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    ll x;
    cin >> x;
    ll n = 0;
    vll d;
    while (1) {
        d.pb(n*n*n*n*n);
        for (ll i=n; i>=0; --i) {
            for (ll j=n; j>=0; --j) {
                if (i<n&&j<n) break;
                if (d[i]+d[j]==x) {
                    printf("%lld %lld\n", i, -j);
                    return 0;
                }
                if (d[i]-d[j]==x) {
                    printf("%lld %lld\n", i, j);
                    return 0;
                }
                if (-d[i]+d[j]==x) {
                    printf("%lld %lld\n", -i, -j);
                    return 0;
                }
            }
        }
        ++n;
    }
    return 0;
}


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

int gcd(int a, int b);
int gcd(const std::vector<int>& arr);

int main() {

        int a = 0;
        int p = 0;

        std::cin >> a >> p;
        std::cout << (a * 3 + p) / 2 << std::endl;
        return 0;
}

int gcd(int a, int b) {
        if (a > b) {
                std::swap(a, b);
        }

        for (int r = b % a; r != 0; b = a, a = r, r = b % a)
                ;

        return a;
}

int gcd(const std::vector<int>& arr) {
        const int size = arr.size();
        if (size == 0) {
                return 0;
        }
        else if (size == 1) {
                return arr[0];
        }

        int ret = gcd(arr[0], arr[1]);

        for (std::size_t i = 2; i < size && ret != 1; ++i) {
                ret = gcd(arr[i], ret);
        }

        return ret;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void run() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
}
const int N = 2e5+5;

char g[6][6];
int h,w,k,black;

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    run();
    cin >> h >> w >> k;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >> g[i][j];
        }
    }
    ll ans = 0;
    for (int i = 0; i < (1 << h); ++i) {
        for (int j = 0; j < (1 << w); ++j) {
            black = 0;
            for (int r = 0; r < h; ++r)
                for (int c = 0; c < w; ++c)
                    black += (((1 << r) & i) == 0 && ((1 << c) & j) == 0 && g[r][c] == '#');

            ans += black == k;
        }
    }
    cout << ans;

    return 0;
}


Measured memory_bytes: 3612
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdlib>
#define LL long long
#define LD long double
using namespace std;
const int NN=1000000 +117;
const int MM=1000000 +117;
int read(){
	int fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}


int m,n;
int a[NN]={};
bool eq[NN]={};
bool ok(int l,int r){
	if(l==r)return true;
	if((r-l)&1)return false;
	int now=0;
	for(int i=l;i<=r;++i){
		if(eq[i]!=now)return false;
		now^=1;
	}
	int pre1=0,pre2=0;
	for(int i=l;i<=r;i+=2){
		if(i<a[i]){
			if(pre1<a[i])pre1=a[i];
			else return false;
		}
		else{
			if(pre2<a[i])pre2=a[i];
			else return false;
		}
	}
	return true;
}
bool solve(){
	int pre=0;
	int til=0;
	for(int i=1;i<=n;++i){
		til=max(til,a[i]);
		if(til==i){
			if(!ok(pre+1,i))return false;
			pre=i;
			til=0;
		}
	}
	return true;
}
int main(){
	//open();
	n=read();
	for(int i=1;i<=n;++i){
		a[i]=read();
		eq[i]=(a[i]==i);
	}
	if(solve())printf("Yes\n");
	else printf("No\n");
	close();
	return 0;
}

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

using ll = long long;
// #define int long long

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
/***** MAIN *****/
signed main() {
  int n;
  cin >> n;
  int cards[n+1];
  cards[n] = 0;
  REP(i,n) {
    cin >> cards[i];
  }
  ll ans = 0;
  REP(i,n) {
    if(cards[i]%2 && cards[i+1] > 0) {
      --cards[i+1];
      ans++;
    }
    ans += cards[i]/2;
  }
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int ans=0;
    if(n>=105){ans++;}
    if(n>=135){ans++;}
    if(n>=165){ans++;}
    if(n>=189){ans++;}
    if(n>=195){ans++;}
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(2005);

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

    mint ans = 0;

    int count = s / 3;
    for(int i=1; i<=count; i++){
        int c = s - 3*i;
        ans += comb(c+i-1,i-1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        String[] x = null;
        Scanner sc = new Scanner(System.in);
		String ip = sc.nextLine();
		x = ip.split(" ", 0);
		int a = Integer.parseInt(x[0]);
		int b = Integer.parseInt(x[1]);
		if(a<b){
		    System.out.println("a < b");
		}else if(a>b){
		    System.out.println("a > b");
		}else{
		    System.out.println("a == b");
		}
    }
}


Measured memory_bytes: 26144
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    s = str(readline().rstrip().decode('utf-8'))
    ls1 = [0] * 1000
    ls2 = [0] * 1000
    ls3 = [0] * 1000
    for i in range(n):
        t = [s[i]]
        if not ls1[int("".join(t))]:
            ls1[int("".join(t))] = True
            for j in range(i + 1, n):
                t = [s[i], s[j]]
                if not ls2[int("".join(t))]:
                    ls2[int("".join(t))] = True
                    for k in range(j + 1, n):
                        t = [s[i], s[j], s[k]]
                        ls3[int("".join(t))] = True
    print(ls3.count(True))


if __name__ == '__main__':
    solve()


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;

int main(){

	int k;
	int ans = 0;
	cin >> k;
	
	ans = (k % 2 == 0)? k*k / 4 : ans;
	ans = (k % 2 == 1)? (k - 1) * (k + 1) / 4: ans;

	cout << ans << endl;
}

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

using namespace std;

int main() {
    int h, w;
    cin >> h >> w;
    int a, b;
    cin >> a >> b;
    swap(a, b);
    vector<vector<int>> v(h, vector<int>(w, 1));
    for (int i = 0; i < a; ++i) {
        for (int j = 0; j < b; ++j) {
            v[i][j] = 0;
        }
    }
    for (int i = a; i < h; ++i) {
        for (int j = b; j < w; ++j) {
            v[i][j] = 0;
        }
    }
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cout << v[i][j];
        }
        cout << endl;
    }
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pii pair<int, int>
#define fr(n) for (int i = 0; i < n; i++)
#define fr1(n) for (int i = 1; i <= n; i++)
#define debug(x) cerr << #x << " = " << x << "\n";
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    if (a > b) cout << a - 1;
    else cout << a;
}


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

int main() {
  bool exist[1000];
  memset(exist, 0, sizeof exist);
  int X, N;
  cin >> X >> N;
  for (int i = 0; i < N; ++i) {
    int tmp;
    cin >> tmp;
    exist[tmp] = true;
  }
  pair<int,int> ans = {INT_MAX, INT_MAX};
  for (int i = 0; i < 1000; ++i) {
    if (!exist[i]) {
	    ans = min(ans, (pair<int,int>){abs(X-i), i});
    }
  }
  cout << ans.second << '\n';
  return 0;
}


Measured memory_bytes: 3628
/**
 *      purpose : Tenka1 Programmer Beginner Contest A
 *      author  : kyomukyomupurin
 *      created : 2018-12-14 16:41:19
**/

#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define fi first
#define se second

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(__null);
    
    string s; cin >> s;
    int cnt = 0;
    for (int i = 0; i < (int) s.size(); ++i){
        if (s[i] == '1') ++cnt;
    }
    print(cnt);
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;


public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		char[][] button = {{'.',',','!','?',' '},
				{'a','b','c'},
				{'d','e','f'},
				{'g','h','i'},
				{'j','k','l'},
				{'m','n','o'},
				{'p','q','r','s'},
				{'t','u','v'},
				{'w','x','y','z'}
		};

		for(int i=0;i<N;i++){
			StringBuffer sb = new StringBuffer();
			String input = sc.next();
			for(int j=0;j<input.length();j++){
				//System.out.print("\n"+input.charAt(j));
				int now = Integer.parseInt(""+input.charAt(j));
				if(now!=0){
					int count = 0;
					for(;;){
						j++;
						if(Integer.parseInt(""+input.charAt(j))==0){
							break;
						}else{
							count++;
						}
					}
				sb.append(button[now-1][count % button[now-1].length]);
				}
			}
			System.out.println(sb);
		}
	}
}

Measured memory_bytes: 31804
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;
  vector<pair<int,int>> site(N);
  for(int i=0;i<N;i++)
    cin>>site.at(i).first>>site.at(i).second;
  
  vector<vector<pair<int,int>>> point(N,vector<pair<int,int>>(N));
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      point.at(i).at(j).first=site.at(i).first-site.at(j).first;
      point.at(i).at(j).second=site.at(i).second-site.at(j).second;
    }
  }
  
  vector<pair<int,int>> key(N*N-N);
  for(int i=0,k=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(i==j)continue;
      else{
        key.at(k).first=point.at(i).at(j).first;
        key.at(k).second=point.at(i).at(j).second;
        k++;
      }
    }
  }
  
  sort(key.begin(),key.end());

  int count=0,ans=0;
  for(int i=0;i<N*N-N-1;i++){
    if(key.at(i).first==key.at(i+1).first &&
      key.at(i).second==key.at(i+1).second)count++;
    else{
      ans=max(ans,count);
      count=0;
    }
  }
  ans=max(ans,count);
  if(N==1)cout<<1<<endl;
  else cout<<N-ans-1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for(int i=0;i<N;i++)
using namespace std;
long long  INF=1000000000000000000;
long long mod=1000000007;
using namespace std;


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

vector<long long>A(N);
rep(i,N){
    cin>>A[i];
}
sort(A.begin(),A.end());

vector<long long>f(N);
rep(i,N){
    cin>>f[i];
}
sort(f.begin(),f.end());
reverse(f.begin(),f.end());

long long right=1e12;
long long left=-1;
long long mid;
while(left+1<right){
    long long sum=0;
    mid=(right+left)/2;
    rep(i,N){
        if(A[i]*f[i]>mid){
        sum+=A[i]-(int)((double)mid/f[i]);
        }
    }
    if(sum>K){
        left=mid;
    }
    else{
        right=mid;
    }
}
cout<<right<<endl;

 return 0;
}
/*
3 5
4 2 1
2 3 1

2

3 8
4 2 1
2 3 1

0



11 14
3 1 4 1 5 9 2 6 5 3 5
8 9 7 9 3 2 3 8 4 6 2

12
*/

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);

int n;
ll a[MAX_N];

multiset<ll> mst;

int main(void) {
  // Here your code !
  scanf("%d", &n);

  for (int i = 0; i < n; ++i) {
    scanf("%lld", &(a[i]));
  }

  mst.insert(INF);

  for (int i = 0; i < n; ++i) {
    // printf("mst: ");
    // for (auto &e : mst) {
    //   printf("%lld ", e);
    // }
    // printf("\n");

    if (*mst.begin() >= a[i] || mst.empty()) {
      mst.insert(a[i]);
      continue;
    }

    auto ptr = mst.upper_bound(a[i] - 1);
    auto prv = prev(ptr);

    if (prv == mst.end()) {
      mst.insert(a[i]);
      continue;
    }

    mst.erase(prv);
    mst.insert(a[i]);
  }

  printf("%d\n", mst.size() - 1);

  return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define endl '\n'

int main() {
	int n;
	string s;
	cin >> n >> s;
	int w, r;
	w = r = 0;
	for (char c : s) {
		if (c == 'W') w++;
		else r++;
	}
	if (w == 0 || r == 0) {
		cout << 0 << endl;
		return 0;
	}
	else {
		int a, b;
		a = b = 0;
		for (size_t i = 0; i < n; i++) {
			if (i < r && s[i] == 'W') {
				a++;
			}
			else if (i >= r && s[i] == 'R') {
				b++;
			}
		}
		cout << max(a, b) << endl;
		return 0;
	}
}


Measured memory_bytes: 3724
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n; cin >> n;
  ++n;
  vector<int> a(n, 0); FOR(i, 1, n) cin >> a[i];
  vector<int> idx(n);
  iota(ALL(idx), 0);
  sort(ALL(idx), [&](int l, int r) { return a[l] == a[r] ? l < r : a[l] < a[r]; });
  vector<ll> ans(n, 0);
  int mn = n;
  for (int i = n - 1; i > 0; --i) {
    chmin(mn, idx[i]);
    while (a[idx[i - 1]] == a[idx[i]]) chmin(mn, idx[--i]);
    // cout << idx[i] << ' ' << mn << '\n';
    ans[mn] += 1LL * (a[idx[i]] - a[idx[i - 1]]) * (n - i);
  }
  FOR(i, 1, n) cout << ans[i] << '\n';
  return 0;
}


Measured memory_bytes: 2688
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

int main() {
    int N,M;
    cin>>N>>M;
    set<int> food,likefood[N];
    int A[N][M],K[N];
    for(int i=0;i<N;i++){
        cin>>K[i];
        for(int k=0;k<K[i];k++){
            cin>>A[i][k];
            likefood[i].insert(A[i][k]);
        }
    }
    for(int i=1;i<=M;i++)food.insert(i);
    for(int i=0;i<N;i++){
        for(int f=1;f<=M;f++){
            if(likefood[i].count(f)==0) food.erase(f);
        }
    }
    cout<<food.size()<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
	ll ans=1;
	rep(i,n){
		ans*=2;
	}
	return ans;
}
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

    int a,b,c;
    cin >>a>>b>>c;
    int N=100*a +b*10 +c;

    if(N%4==0)cout<<"YES\n";
    else cout<<"NO\n";
    
  
}

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

using namespace std;
typedef long long ll;
#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 repf(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define repr(i,a,b) for(ll i=(ll)a-1;i>=(ll)b;i--)
#define Fi first
#define Se second
typedef pair<ll, ll> pll;
const ll MAX = 1005;
const char END = '\n';
ll N, M, sub, Ans = 0;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> N >> M;
	multiset <ll> A;
	rep(i, N) {
		cin >> sub;
		A.insert(sub);
		Ans += sub;
	}

	rep(i, M) {
		auto a = A.end();
		a--;
		sub = *a / 2;
		Ans -= *a - sub;
		A.erase(a);
		A.insert(sub);
	}

	cout << Ans << END;
	return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  long long int k;
  int d,i;
  cin>>s>>k;
  d=s.size();
  int icount=0;
  for(i=0;i<d;i++){
    if((s.at(i) =='1')){
      icount++;
    }else{
      break;
    }
  }
  if(icount>=k){cout<<1<<endl;}else{cout<<s.at(i)<<endl;}
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a, b, c, s = 0;
    scanf("%d %d %d", &a, &b, &c);
    for(int i = a; i <= b; i ++){
        if(c % i == 0){
            s++;
        }
    }
    printf("%d\n", s);
    return 0;
}


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

using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define mod 1000000007
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define prec(n) fixed << setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int>>
#define PI 3.1415926535897932384626
#define bits(n) __builtin_popcount(n)


void solve()
{
    string s;
    cin>>s;
    ll res=0;
    for(int i=0;i<s.length();i++)
    {
        res+=(int)s[i]-'0';
    }
    if(res%9==0)
    cout<<"Yes";
    else
    {
        cout<<"No";
    }
    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input1.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output1.txt", "w", stdout);
#endif

    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1e9+7;
ll dp[2002];
ll find(ll s){
    if(s<3)
    return 0;
    if(s<6)
    return 1;
    if(dp[s]!=-1)
    return dp[s];
    ll ans=1;
    for(int i=3;i<=s-3;i++){
        ans=(ans+find(i))%mod;
    }
    dp[s]=ans;
    return ans;
}

int main() {
	ll s;
    cin>>s;
    for(int i=0;i<2002;i++){
        dp[i]=-1;
    }
    ll ans=find(s);
    cout<<ans;
	return 0;
}


Measured memory_bytes: 3636
const fi='abc065_b.inp';
        fo='abc065_b.out';
var n,i:longint;
        a:array[1..100000] of longint;
        d:array[1..100000] of boolean;
function conan:longint;
        var i,kq:longint;
        begin
                i:=1;
                kq:=0;
                while i<n+1 do
                        begin
                                if d[i] then exit(-1);
                                if i=2 then exit(kq);
                                d[i]:=true;
                                i:=a[i];
                                inc(kq);
                        end;
        end;
begin

        readln(n);
        for i:=1 to n do readln(a[i]);
        writeln(conan);
end.


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

int main()
{
    int n;
    scanf("%d", &n);
    int* a = new int[n];
    int mx1 = 0, cnt = 0, mx2 = 0;
    for (int i = 0; i < n; ++i)
    {
        scanf("%d", a + i);
        if (a[i] > mx1)
        {
            cnt = 1;
            mx2 = mx1;
            mx1 = a[i];
        }
        else if (a[i] == mx1)
            ++cnt;
        else if (a[i] > mx2)
            mx2 = a[i];
    }

    if (cnt > 1)
        for (int i = 0; i < n; ++i)
            printf("%d\n", mx1);
    else
        for (int i = 0; i < n; ++i)
            if (a[i] == mx1) printf("%d\n", mx2);
            else printf("%d\n", mx1);
}


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

int main () {
    string s;
    cin >> s;
    int ans = 0;
    if (s[0] == '1') {
        ans++;
    }
    if (s[1] == '1') {
        ans++;
    }
    if (s[2] == '1') {
        ans++;
    }
    cout << ans << endl;
}

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

int D[110];

int main(){
	int N,Q,M,a,ans,maxd;
	while(1){
		cin>>N>>Q;
		for(int i=0;i<110;i++) D[i]=0;
		if(N==0&&Q==0) break;
		maxd=ans=0;
		for(int i=0;i<N;i++){
			cin>>M;
			for(int j=0;j<M;j++){
				cin>>a;
				D[a-1]++;
			}
		}
		for(int i=0;i<100;i++){
			if(maxd<D[i]&&D[i]>=Q){
				ans=i+1;
				maxd=D[i];
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}



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

int main() {
  int N;
  double ans , b = 0;
  cin >> N;
  for (int i = 0;i < N; i ++) {
    int c;
    
    c = (i + 1) % 2;
    
    if (c == 1) {
      b = b + 1;
    }
  }
  
  ans = b / N ;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {

	int a[3];
	cin >> a[0] >> a[1] >> a[2];

	sort(a,a+3);

	if (a[0] == 5 && a[1] == 5 && a[2] == 7) {
		COUT("YES");
	}
	else {
		COUT("NO");
	}



	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int a,x[1000],s[1000],w[1000],i,X[1000],flg,flg1,flg2,j;
    scanf("%d",&a);
    for(i=0;i<a;i++){
        scanf("%d%d%d",&x[i],&s[i],&w[i]);
		X[i]=0;
    }
    for(i=0;i<a;i++){
        flg=0; flg1=0; flg2=0;
        for(j=0;j<a;j++){
            if(i!=j){
                if(x[i]==x[j]){
                    flg=1;
                }
                if(s[i]==s[j]){
                    flg1=1;
                }
                if(w[i]==w[j]){
                    flg2=1;
                }
            }
        }
        if(flg==0){
            X[i]+=x[i];
        }
        if(flg1==0){
            X[i]+=s[i];
        }
        if(flg2==0){
            X[i]+=w[i];
        }
    }
    for(i=0;i<a;i++){
        printf("%d\n",X[i]);
    }
    return 0;
}

Measured memory_bytes: 1040
#include<bits/stdc++.h>
using namespace std;
int main()
{

long long a,b,c,d,ct=0,e,f=0,g=0,h;
vector<long long>vc;
cin>>a;
while(a--)
{

cin>>b;
vc.push_back(b);

}

sort(vc.begin(),vc.end());
for(long long i=vc.size()-1;i>=0;i--)
{
    ct++;
if(ct%2==1)
f=f+vc[i];
else
g=g+vc[i];


}

cout<<f-g;

}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
#define fast_io ios::sync_with_stdio(false)

const int maxn = 1e6 + 7;
const LL INF = 1e12;
const LL mod = 1e9 + 7;

int prime[maxn+1];

void getPrime() {
    prime[0] = 0;
    for(int i = 2 ; i <= maxn ; i++) {
        if(!prime[i]) prime[++prime[0]] = i;
        for(int j = 1 ; j <= prime[0] && prime[j] <= maxn / i ; j++) {
            prime[prime[j]*i] = 1;
            if(i%prime[j] == 0) break;
        }
    }
}

int main() {
    getPrime();
    int n,k,s;
    while(~scanf("%d%d%d",&n,&k,&s)) {
        for(int i = 1 ; i <= k ; i++) {
            if(i != 1) printf(" ");
            printf("%d",s);
        }
        int res = 1;
        for(int i = 1 ; i <= prime[0] ; i++) {
            if(s % prime[i] != 0) {
                res = prime[i];
                break;
            }
        }
        for(int i = k + 1 ; i <= n ; i++) {
            if(i != 1) printf(" ");
            printf("%d",res);
        }
        printf("\n");
    }
    return 0;
}


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

int main()
{
    int A,B;
    cin >> A >> B;
    int count = 0;

    if(A >= B)
    {
        count += A;
        A -= 1;
    }
    else
    {
        count += B;
        B -= 1;
    }

    if(A >= B)
    {
        count += A;
        A -= 1;
    }
    else
    {
        count += B;
        B -= 1;
    }
    cout << count << endl;
}

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

vector<int> a(100010);

int main()
{
	string s;
	int count1=0;
	int count2=0;

	cin >> s;

	for (long long i = 0; i<s.size(); ++i)
	{
		if (s[i] == '0')
		{
			count1++;
		}
		else
		{
			count2++;
		}

	}

	if (count1 > count2)
	{
		cout << count2 * 2;
	}
	else
	{
		cout << count1 * 2;
	}


}


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

int main(){
	long long N,M;
	cin >> N >> M;
	vector<pair<long long,long long>> D;
	for(auto i=0;i<N;i++){
		long long A,B;
		cin >> A >> B;
		pair<long long,long long> p;
		p.first=A;
		p.second=B;
		D.push_back(p);
	}
	sort(D.begin(),D.end());
	long long ans=0;
	for(auto i=0;i<N;i++){
		ans+=D[i].first*min(M,D[i].second);
		M-=min(M,D[i].second);
		if(M==0)break;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2420
N = int(input())
A = [int(i) for i in input().split()]
S = []
e = 0
for i in A:
    e += i
    S.append(e)
    
ans = 0
for i in range(N-1):
    ans += A[i]%(10**9+7)*((S[N-1] - S[i])%(10**9+7))
    
print(ans%(10**9+7))

Measured memory_bytes: 31492
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;
 
#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7
 
typedef long long ll;
typedef long long int lli;
 
int main() {
    string N, res;
	cin >> N;
    res = "No";
    for (int i = 0; i < N.size() - 2; i++) {
        if (N[i] == N[i+1] && N[i] == N[i+2])
        {
            res = "Yes";
        }
    }
    cout << res << endl;   
	return 0;
}

Measured memory_bytes: 256
import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N,M = map(int, input().split())
    RAMPS = [0]*M
    for i in range(M):
        tmp = list(map(int, input().split()))
        RAMPS[i] = [x-1 for x in tmp[1:]]
    PS = list(map(int, input().split()))
    ans = 0
    for bit in range(2**N):
        for i in range(M):
            cnt = 0
            for j in RAMPS[i]:
                if 1<<j & bit != 0: cnt += 1
            if cnt%2 != PS[i]:
                break
        else:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3828
#include<stdio.h>

int main(){
	long long a,b,x;
	scanf("%lld%lld%lld",&a,&b,&x);
	long long z,c;
	if(a%x==0){
		z=a/x;
	}
	else{
		z=a/x+1;
	}
	c=b/x;
	printf("%lld",c-z+1);
}

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

using namespace std; 


int main(){
	
	
	int a , b; 
	
	
	cin >> a >> b ; 
	
	
	int ans  = b%a==0?(a+b):(b-a); 
	
	cout << ans << endl;
		
    return 0;
}


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

using namespace std;

//mem(a, b) memset(a, (b), sizeof(a))

typedef long long ll;

#define f(i,a,b) for (ll i=a ; i<b ; i++)

#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define faster ios::sync_with_stdio(0);cin.tie(0);
typedef pair<int, int> p;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<p> vii;
typedef vector<vi> vvi;
typedef map<int,int> mp;
typedef set<int> se;
typedef multiset<int> MSETI;


// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal

// traversal function to avoid long template definition. Now with C++11 auto alleviates the pain.
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)

// find if a given value is present in a container. Container version. Runs in log(n) for set and map
#define present(c,x) ((c).find(x) != (c).end())

//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())

// Avoiding wrap around of size()-1 where size is a unsigned int.
#define sz(a) int((a).size())


struct duo{
    ll x,y;
};

bool mycomp(duo a,duo b) { return a.x < b.x ;}

bool comp(int a,int b){
	return a<b;
}


int main()
{
	faster


	ll t,n,a=0,b=0,d,i,j,k,c,sum;
    cin>>n;
  if(n>=30)
    cout<<"Yes";
  else
    cout<<"No";
    
    
	
	
}


Measured memory_bytes: 3644
#include <iostream>

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

int main()
{
    ios_base::sync_with_stdio(0);
    ll n, k;
    cin >> n >> k;
    ll odp = 0;
    for (ll i = k; i <= n + 1; ++i)
        odp = (odp + (n - i + 1) * i + 1) % MOD;
    cout << odp;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)

using namespace std;
class CompareFirst
{
public:
  bool operator()(pair<int,int> n1,pair<int,int> n2) {
    return n1.first>n2.first; //>:desc <:asc
  }
};


int main(){

  string s;
  int a,b,c,i,j,k,l,n,m,y,ans;
  long sum;
  vector<string> vs;
  vector<int> vi;
  pair<int,int> pr;
  //unordered_map<string,int> mp;
  //priority_queue<int> pq; // default ‘å‚«‚¢‡
  //priority_queue<pair<int,int>,vector<pair<int,int>>,CompareFirst> pq;

  cin >> n >> y;

  rep(a,0,n)rep(b,0,n){
    c = n - a-b;
    if(c >=0 && (a*10000+b*5000+c*1000) == y){
      cout << a << " " << b << " " << c << endl;
      return 0;
    }
  }

cout << -1 << " " <<  -1 << " " << -1 << endl;
  return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os, const map<T,U>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int,int>;
using vi = std::vector<int>;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    ll N, K; cin >> N >> K;
    vector<ll> a(N);
    rep(i,N){
        cin >> a[i];
        a[i]--;
    }

    int start;
    vector<bool> used(N,false);
    vector<int> dist(N,0);

    int now = 0;
    ll cnt = 0;
    while(!used[now]){
        used[now] = true;
        dist[now] = cnt++;

        now = a[now];
        if(cnt == K){
            cout << now+1 << endl;
            return 0;
        }
    }
    start = now;
    //debug2(start,cnt);
    //debug(dist[start]);

    ll loop = cnt - dist[start];

    ll rem = (K-cnt) % loop;

    now = start;
    rep(i, rem){
        now = a[now];
    }
    cout << now + 1 << endl;
}


Measured memory_bytes: 5636